mirror of
https://github.com/kind-0/nsecbunkerd.git
synced 2026-05-03 07:00:11 +00:00
allow using nip05 to sign from the client too
This commit is contained in:
parent
d9c07c0115
commit
bfcb0992d4
@ -41,7 +41,7 @@ In the background, the bunker will have configured the requested NIP-05 mapping
|
||||
```
|
||||
|
||||
## NIP-89
|
||||
Bunkers supporting user registration can announce themselves using NIP-89's `kind:31990`. Clients SHOULD validate that the 31990 is from a pubkey that owns the root NIP-05 of the domain.
|
||||
Bunkers supporting user registration can announce themselves using NIP-89's `kind:31990`. Clients MUST validate that the 31990 is from a pubkey that owns the root NIP-05 of the domain.
|
||||
|
||||
```json
|
||||
{
|
||||
|
||||
@ -85,7 +85,18 @@ function loadPrivateKey(): string | undefined {
|
||||
remoteUser = u;
|
||||
remotePubkey = remoteUser.pubkey;
|
||||
} else {
|
||||
remoteUser = new NDKUser({npub: remotePubkey});
|
||||
// check if we have a @ so we try to get the npub from nip05
|
||||
if (remotePubkey.includes('@')) {
|
||||
const u = await NDKUser.fromNip05(remotePubkey);
|
||||
if (!u) {
|
||||
console.log(`Invalid nip05 ${remotePubkey}`);
|
||||
process.exit(1);
|
||||
}
|
||||
remoteUser = u;
|
||||
remotePubkey = remoteUser.pubkey;
|
||||
} else {
|
||||
remoteUser = new NDKUser({npub: remotePubkey});
|
||||
}
|
||||
}
|
||||
|
||||
ndk = await createNDK();
|
||||
|
||||
@ -19,7 +19,7 @@ export async function validateRegistration(request, record) {
|
||||
if (!email.includes("@")) throw new Error("Invalid email address");
|
||||
|
||||
// validate email uniqueness (if one was provided)
|
||||
const emailRecord = await prisma.user.findUnique({ where: { email } });
|
||||
const emailRecord = await prisma.user.findFirst({ where: { email } });
|
||||
if (emailRecord) throw new Error("Email already exists");
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user