mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-01 08:20:08 +00:00
Merge branch 'main' into do-stuff
This commit is contained in:
@@ -1 +1 @@
|
||||
export { sign } from "https://unpkg.com/@evan/wasm@0.0.50/target/nacl/deno.js";
|
||||
export { verify } from "https://unpkg.com/@evan/wasm@0.0.50/target/ed25519/deno.js";
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { sign } from "./deps.ts";
|
||||
import { verify } from "./deps.ts";
|
||||
|
||||
export function verifySignature(
|
||||
{ publicKey, signature, timestamp, body }: VerifySignatureOptions,
|
||||
): { isValid: boolean; body: string } {
|
||||
const isValid = sign.verify(
|
||||
new TextEncoder().encode(timestamp + body),
|
||||
hexToUint8Array(signature),
|
||||
const isValid = verify(
|
||||
hexToUint8Array(publicKey),
|
||||
hexToUint8Array(signature),
|
||||
new TextEncoder().encode(timestamp + body),
|
||||
);
|
||||
|
||||
return { isValid, body };
|
||||
|
||||
Reference in New Issue
Block a user