aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-02-09 22:56:17 -0800
committerAdam Soltys <[email protected]>2024-02-09 22:56:17 -0800
commitfa78755b4357a09c61107405580c36c9cc2e2fbb (patch)
treea7b9493ed86b672653be010ba53273654b217ff8
parenta85fc8e2c57dc4b6f04b1b7e462eafdbc1cfc2a5 (diff)
downloadcoinos-server-fa78755b4357a09c61107405580c36c9cc2e2fbb.tar.gz
coinos-server-fa78755b4357a09c61107405580c36c9cc2e2fbb.zip
whitelist nsec
-rw-r--r--lib/nostr.js1
-rw-r--r--lib/whitelist.js1
-rw-r--r--routes/users.js9
3 files changed, 10 insertions, 1 deletions
diff --git a/lib/nostr.js b/lib/nostr.js
index 64009168..09059542 100644
--- a/lib/nostr.js
+++ b/lib/nostr.js
@@ -68,7 +68,6 @@ export let fillPool = () => {
};
await s(`user:${pubkey}`, JSON.stringify(user));
- coinos.send(ev);
} else if (sub.includes("messages")) {
let pubkey = sub.split(":")[0];
await db.sAdd(`${pubkey}:messages`, ev.id);
diff --git a/lib/whitelist.js b/lib/whitelist.js
index fffe779d..97caf221 100644
--- a/lib/whitelist.js
+++ b/lib/whitelist.js
@@ -24,6 +24,7 @@ export default [
"locktime",
"nip5",
"notify",
+ "nsec",
"payments",
"profile",
"prompt",
diff --git a/routes/users.js b/routes/users.js
index 8e2a0d14..97a0c9a7 100644
--- a/routes/users.js
+++ b/routes/users.js
@@ -195,6 +195,7 @@ export default {
password,
pin,
newpin,
+ pubkey,
username,
shopifyToken,
shopifyStore,
@@ -220,6 +221,13 @@ export default {
user.username = username;
}
+ if (pubkey) exists = await getUser(pubkey);
+ if (username !== exists.username) {
+ warn("key in use", pubkey, exists.username);
+ if (exists.anon) await db.del(`user:${pubkey}`);
+ else fail("Key in use by another account");
+ }
+
let attributes = [
"address",
"autowithdraw",
@@ -235,6 +243,7 @@ export default {
"locktime",
"nip5",
"notify",
+ "nsec",
"prompt",
"profile",
"pubkey",