From 23bedd82a068dbbfedab4f7dedd40b4d90ccc10a Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 2 Oct 2024 13:35:34 -0500 Subject: [PATCH] utils: remove unused sha256 text function --- src/utils.ts | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index e361109d..ae257374 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -64,20 +64,6 @@ function findTag(tags: string[][], name: string): string[] | undefined { return tags.find((tag) => tag[0] === name); } -/** - * Get sha256 hash (hex) of some text. - * https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest#converting_a_digest_to_a_hex_string - */ -async function sha256(message: string): Promise { - const msgUint8 = new TextEncoder().encode(message); - const hashBuffer = await crypto.subtle.digest('SHA-256', msgUint8); - const hashArray = Array.from(new Uint8Array(hashBuffer)); - const hashHex = hashArray - .map((b) => b.toString(16).padStart(2, '0')) - .join(''); - return hashHex; -} - /** Test whether the value is a Nostr ID. */ function isNostrId(value: unknown): boolean { return n.id().safeParse(value).success; @@ -88,6 +74,6 @@ function isURL(value: unknown): boolean { return z.string().url().safeParse(value).success; } -export { bech32ToPubkey, eventAge, findTag, isNostrId, isURL, type Nip05, nostrDate, nostrNow, parseNip05, sha256 }; +export { bech32ToPubkey, eventAge, findTag, isNostrId, isURL, type Nip05, nostrDate, nostrNow, parseNip05 }; export { Time } from '@/utils/time.ts';