diff --git a/static-src/utils.js b/static-src/utils.js index a6ffd4d..c7e34c4 100644 --- a/static-src/utils.js +++ b/static-src/utils.js @@ -30,15 +30,13 @@ more information on this, and how to apply and follow the GNU AGPL, see { - return crypto.webcrypto - }) - // import { webcrypto as crypto } from 'crypto' -} // Compute local part of Web Key Directory URL export async function computeWKDLocalPart(localPart) { + if (!_crypto) { + _crypto = (await import('crypto')).webcrypto + } + const localPartEncoded = new TextEncoder().encode(localPart.toLowerCase()); const localPartHashed = new Uint8Array(await _crypto.subtle.digest('SHA-1', localPartEncoded)); return encodeZBase32(localPartHashed);