utils: remove unused sha256 text function

This commit is contained in:
Alex Gleason 2024-10-02 13:35:34 -05:00
parent c5bcf1d4a3
commit 23bedd82a0
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -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<string> {
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';