diff --git a/app/src/lib/crypto.ts b/app/src/lib/crypto.ts index f76d508..4e57fbe 100644 --- a/app/src/lib/crypto.ts +++ b/app/src/lib/crypto.ts @@ -45,14 +45,14 @@ export async function sign(data: string): Promise { } export async function verify(data: string, signature: string, publicKeyRaw: Uint8Array): Promise { - try { - const key = await crypto.subtle.importKey('raw', publicKeyRaw as unknown as ArrayBuffer, ALGO, false, ['verify']); - const sig = base64Decode(signature); - const encoded = new TextEncoder().encode(data); - return crypto.subtle.verify(ALGO, key, sig as unknown as ArrayBuffer, encoded as unknown as ArrayBuffer); - } catch { - return false; - } + try { + const key = await crypto.subtle.importKey('raw', publicKeyRaw as BufferSource, ALGO, false, ['verify']); + const sig = base64Decode(signature); + const encoded = new TextEncoder().encode(data); + return crypto.subtle.verify(ALGO, key, sig as BufferSource, encoded as BufferSource); + } catch { + return false; + } } // --- Base58 (Bitcoin-style) ---