forked from quic-issues/427e7578-d7bf-49c8-aee9-2dd999e25316
Fix type error
This commit is contained in:
@@ -46,10 +46,10 @@ export async function sign(data: string): Promise<string> {
|
||||
|
||||
export async function verify(data: string, signature: string, publicKeyRaw: Uint8Array): Promise<boolean> {
|
||||
try {
|
||||
const key = await crypto.subtle.importKey('raw', publicKeyRaw as unknown as ArrayBuffer, ALGO, false, ['verify']);
|
||||
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 unknown as ArrayBuffer, encoded as unknown as ArrayBuffer);
|
||||
return crypto.subtle.verify(ALGO, key, sig as BufferSource, encoded as BufferSource);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user