forked from quic-issues/427e7578-d7bf-49c8-aee9-2dd999e25316
Fix type error
This commit is contained in:
@@ -45,14 +45,14 @@ export async function sign(data: string): Promise<string> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function verify(data: string, signature: string, publicKeyRaw: Uint8Array): Promise<boolean> {
|
export async function verify(data: string, signature: string, publicKeyRaw: Uint8Array): Promise<boolean> {
|
||||||
try {
|
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 sig = base64Decode(signature);
|
||||||
const encoded = new TextEncoder().encode(data);
|
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 {
|
} catch {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Base58 (Bitcoin-style) ---
|
// --- Base58 (Bitcoin-style) ---
|
||||||
|
|||||||
Reference in New Issue
Block a user