From 81bda05cf07311bebec810025a4d4dc650086202 Mon Sep 17 00:00:00 2001 From: MO Thibault <103271673+MO-Thibault@users.noreply.github.com> Date: Thu, 24 Oct 2024 11:47:22 -0400 Subject: [PATCH] add a helper function to hash any string to sha256 --- lib/sdk.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/sdk.ts b/lib/sdk.ts index d7da74b..bcbb1f3 100644 --- a/lib/sdk.ts +++ b/lib/sdk.ts @@ -108,6 +108,10 @@ class OptableSDK { return email ? "e:" + sha256.hex(email.toLowerCase().trim()) : ""; } + static sha256(string: string): string { + return string ? sha256.hex(string) : ""; + } + static cid(ppid: string, variant: number = 0): string { let prefix = "c:";