diff --git a/src/extension/background-script/CryptoService.ts b/src/extension/background-script/CryptoService.ts index 86435ba83cc7..0edccf883fc1 100644 --- a/src/extension/background-script/CryptoService.ts +++ b/src/extension/background-script/CryptoService.ts @@ -207,9 +207,9 @@ export async function getMyProveBio(whoami: PersonIdentifier): Promise { const [_, compressedX, _2] = bio.split('🔒') - if (!compressedX) return null + if (!compressedX) return false const { x, y } = unCompressSecp256k1Point(decodeArrayBuffer(compressedX)) const key: JsonWebKey = { crv: 'K-256', @@ -235,7 +235,7 @@ export async function verifyOthersProve(bio: string, others: PersonIdentifier) { // TODO: Add relation verify at caller, then change to new Date() relationLastCheckTime: new Date('Jan 1 2019'), }) - return publicKey + return true } //#endregion diff --git a/src/key-management/people-gun.ts b/src/key-management/people-gun.ts index 8a4f9be31a61..b08d2d94c09b 100644 --- a/src/key-management/people-gun.ts +++ b/src/key-management/people-gun.ts @@ -17,13 +17,13 @@ export async function queryPersonFromGun(username: string) { export async function addPersonPublicKey(user: PersonIdentifier): Promise { const fromBio = async () => { const bio = await tasks(getProfilePageUrlAtFacebook(user)).getBioContent() - if ((await verifyOthersProve(bio, user)) === null) throw new Error('Not in bio!') + if ((await verifyOthersProve(bio, user)) === false) throw new Error('Not in bio!') } const fromPost = async () => { const person = await queryPersonFromGun(user.userId) if (!person || !person.provePostId) throw new Error('Not in gun!') const post = await tasks(getPostUrlAtFacebook(new PostIdentifier(user, person.provePostId))).getPostContent() - if ((await verifyOthersProve(post, user)) === null) throw new Error('Not in prove post!') + if ((await verifyOthersProve(post, user)) === false) throw new Error('Not in prove post!') } let bioRejected = false let proveRejected = false diff --git a/src/key-management/posts-gun.ts b/src/key-management/posts-gun.ts index 8f4fdcfa6d4a..907b7374bbd8 100644 --- a/src/key-management/posts-gun.ts +++ b/src/key-management/posts-gun.ts @@ -13,7 +13,7 @@ export async function queryPostAESKey(salt: string, myUsername: string) { .get(salt) .get(myUsername) .once().then!() - if (result.encryptedKey && result.salt) return result + if (result && result.encryptedKey && result.salt) return result return undefined }