fix: curve verification return boolean

This commit is contained in:
Adhiraj Singh
2022-04-23 17:46:59 +05:30
parent b3e8b38917
commit 40abd71d2e
2 changed files with 9 additions and 4 deletions

View File

@@ -27,9 +27,14 @@ export const Curve = {
sign: (privateKey: Uint8Array, buf: Uint8Array) => (
libsignal.curve.calculateSignature(privateKey, buf)
),
verify: (pubKey: Uint8Array, message: Uint8Array, signature: Uint8Array) => (
libsignal.curve.verifySignature(generateSignalPubKey(pubKey), message, signature)
)
verify: (pubKey: Uint8Array, message: Uint8Array, signature: Uint8Array) => {
try {
libsignal.curve.verifySignature(generateSignalPubKey(pubKey), message, signature)
return true
} catch(error) {
return false
}
}
}
export const signedKeyPair = (identityKeyPair: KeyPair, keyId: number) => {