aboutsummaryrefslogtreecommitdiffstats
path: root/lib/register.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-01-10 22:19:01 -0800
committerAdam Soltys <[email protected]>2025-01-10 22:19:01 -0800
commit6560cc552aa8fecff14292bfa31e8369c42c2c73 (patch)
tree05fbc13baa69f1dd1d87856870c5e6d5ce8d5fd3 /lib/register.ts
parente2ba4a77a77daa29869533f6e500b6a6ec3e9708 (diff)
downloadcoinos-server-6560cc552aa8fecff14292bfa31e8369c42c2c73.tar.gz
coinos-server-6560cc552aa8fecff14292bfa31e8369c42c2c73.zip
send nsec on registration
Diffstat (limited to 'lib/register.ts')
-rw-r--r--lib/register.ts4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/register.ts b/lib/register.ts
index a35781fe..6bd9df9f 100644
--- a/lib/register.ts
+++ b/lib/register.ts
@@ -54,8 +54,9 @@ export default async (user, ip) => {
user.migrated = true;
user.locktime = 300;
+ let sk;
if (!pubkey) {
- const sk = randomBytes(32);
+ sk = randomBytes(32);
pubkey = getPublicKey(sk);
user.pubkey = pubkey;
user.nsec = nip49encrypt(sk, password);
@@ -84,6 +85,7 @@ export default async (user, ip) => {
.exec();
l("new user", username);
+ if (sk) user.sk = bytesToHex(sk);
return user;
};