aboutsummaryrefslogtreecommitdiffstats
path: root/lib/utils.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-09-16 15:59:34 -0700
committerAdam Soltys <[email protected]>2024-09-16 15:59:56 -0700
commite4444d467ddd38ff204b17e862649d6a047bfea0 (patch)
tree585fdbe90f48bd513c1b58111233779964b1e92a /lib/utils.ts
parentc89d85b4bdebe1b3a096a880b624654e11431ad9 (diff)
downloadcoinos-server-e4444d467ddd38ff204b17e862649d6a047bfea0.tar.gz
coinos-server-e4444d467ddd38ff204b17e862649d6a047bfea0.zip
nwc
Diffstat (limited to 'lib/utils.ts')
-rw-r--r--lib/utils.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/utils.ts b/lib/utils.ts
index b0875873..2eab7f67 100644
--- a/lib/utils.ts
+++ b/lib/utils.ts
@@ -2,6 +2,7 @@ import { randomBytes, bytesToHex } from "@noble/hashes/utils";
import migrate from "$lib/migrate";
import { g, s } from "$lib/db";
import config from "$config";
+import { getPublicKey } from "nostr";
export let fail = (msg) => {
throw new Error(msg);
@@ -71,7 +72,8 @@ export let getUser = async (username) => {
let user = await migrate(username);
if (user && !user.nwc) {
user.nwc = bytesToHex(randomBytes(32));
- s(`user:${user.id}`, user);
+ await s(getPublicKey(user.nwc), user.id);
+ await s(`user:${user.id}`, user);
}
return user;