This commit is contained in:
2024-09-09 16:11:18 +02:00
parent a919eabbba
commit 5fa068776c
16 changed files with 55 additions and 47 deletions
+4 -4
View File
@@ -17,9 +17,9 @@ export default class PrivateBox {
log.trace('Extractable :', extractable)
try {
return crypto.subtle.generateKey(consts.ECDH, extractable, ['deriveKey']) as Promise<CryptoKeyPair>
} catch(e) {
log.warn("Failed to generate a key")
log.debug("Error :", e)
} catch (e) {
log.warn('Failed to generate a key')
log.debug('Error :', e)
throw e
}
}
@@ -51,7 +51,7 @@ export default class PrivateBox {
const pubkey = await pubkey_fromString(parts[0], Usage.ecdh)
if (pubkey === null) return null
const box = SecretBox.fromString(parts.slice(1).join("."))
const box = SecretBox.fromString(parts.slice(1).join('.'))
if (box === null) return null
return new PrivateBox(pubkey, box)