From 4018ec1c7bc0cf08479b3a1daf7196fb5044986a Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Thu, 23 Jul 2020 10:53:13 +0200 Subject: [PATCH] Improve WKD local part compute --- assets/scripts.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/assets/scripts.js b/assets/scripts.js index d5e5df9..b70bda5 100644 --- a/assets/scripts.js +++ b/assets/scripts.js @@ -776,10 +776,9 @@ function encodeZBase32(data) { } async function computeWKDLocalPart(message) { - const encoder = new TextEncoder(); - const data = encoder.encode(message); - const hash = await crypto.subtle.digest('SHA-1', data); - return encodeZBase32(new Uint8Array(hash)); + const data = openpgp.util.str_to_Uint8Array(message); + const hash = await openpgp.crypto.hash.sha1(data); + return openpgp.util.encodeZBase32(hash); } async function generateProfileURL(data) {