update ndk
This commit is contained in:
parent
032b67632e
commit
919beb941c
4 changed files with 25 additions and 15 deletions
|
|
@ -39,7 +39,7 @@
|
||||||
"@fastify/view": "^8.2.0",
|
"@fastify/view": "^8.2.0",
|
||||||
"@inquirer/password": "^1.1.2",
|
"@inquirer/password": "^1.1.2",
|
||||||
"@inquirer/prompts": "^1.2.3",
|
"@inquirer/prompts": "^1.2.3",
|
||||||
"@nostr-dev-kit/ndk": "^2.5.1",
|
"@nostr-dev-kit/ndk": "^2.8.1",
|
||||||
"@prisma/client": "^5.4.1",
|
"@prisma/client": "^5.4.1",
|
||||||
"@scure/base": "^1.1.1",
|
"@scure/base": "^1.1.1",
|
||||||
"@types/yargs": "^17.0.24",
|
"@types/yargs": "^17.0.24",
|
||||||
|
|
|
||||||
27
pnpm-lock.yaml
generated
27
pnpm-lock.yaml
generated
|
|
@ -18,8 +18,8 @@ dependencies:
|
||||||
specifier: ^1.2.3
|
specifier: ^1.2.3
|
||||||
version: 1.2.3
|
version: 1.2.3
|
||||||
'@nostr-dev-kit/ndk':
|
'@nostr-dev-kit/ndk':
|
||||||
specifier: ^2.5.1
|
specifier: ^2.8.1
|
||||||
version: 2.5.1(typescript@5.1.3)
|
version: 2.8.1(typescript@5.1.3)
|
||||||
'@prisma/client':
|
'@prisma/client':
|
||||||
specifier: ^5.4.1
|
specifier: ^5.4.1
|
||||||
version: 5.4.1(prisma@5.4.1)
|
version: 5.4.1(prisma@5.4.1)
|
||||||
|
|
@ -393,7 +393,7 @@ packages:
|
||||||
resolution: {integrity: sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==}
|
resolution: {integrity: sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==}
|
||||||
engines: {node: '>=10.10.0'}
|
engines: {node: '>=10.10.0'}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@humanwhocodes/object-schema': 2.0.2
|
'@humanwhocodes/object-schema': 2.0.3
|
||||||
debug: 4.3.4
|
debug: 4.3.4
|
||||||
minimatch: 3.1.2
|
minimatch: 3.1.2
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
|
|
@ -405,8 +405,8 @@ packages:
|
||||||
engines: {node: '>=12.22'}
|
engines: {node: '>=12.22'}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@humanwhocodes/object-schema@2.0.2:
|
/@humanwhocodes/object-schema@2.0.3:
|
||||||
resolution: {integrity: sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==}
|
resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@inquirer/checkbox@1.3.2:
|
/@inquirer/checkbox@1.3.2:
|
||||||
|
|
@ -599,6 +599,12 @@ packages:
|
||||||
'@noble/hashes': 1.3.1
|
'@noble/hashes': 1.3.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@noble/curves@1.4.0:
|
||||||
|
resolution: {integrity: sha512-p+4cb332SFCrReJkCYe8Xzm0OWi4Jji5jVdIZRL/PmacmDkFNw6MrrV+gGpiPxLHbV+zKFRywUWbaseT+tZRXg==}
|
||||||
|
dependencies:
|
||||||
|
'@noble/hashes': 1.4.0
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@noble/hashes@1.3.1:
|
/@noble/hashes@1.3.1:
|
||||||
resolution: {integrity: sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==}
|
resolution: {integrity: sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==}
|
||||||
engines: {node: '>= 16'}
|
engines: {node: '>= 16'}
|
||||||
|
|
@ -614,8 +620,8 @@ packages:
|
||||||
engines: {node: '>= 16'}
|
engines: {node: '>= 16'}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@noble/secp256k1@2.0.0:
|
/@noble/secp256k1@2.1.0:
|
||||||
resolution: {integrity: sha512-rUGBd95e2a45rlmFTqQJYEFA4/gdIARFfuTuTqLglz0PZ6AKyzyXsEZZq7UZn8hZsvaBgpCzKKBJizT2cJERXw==}
|
resolution: {integrity: sha512-XLEQQNdablO0XZOIniFQimiXsZDNwaYgL96dZwC54Q30imSbAOFf3NKtepc+cXyuZf5Q1HCgbqgZ2UFFuHVcEw==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@nodelib/fs.scandir@2.1.5:
|
/@nodelib/fs.scandir@2.1.5:
|
||||||
|
|
@ -636,11 +642,12 @@ packages:
|
||||||
'@nodelib/fs.scandir': 2.1.5
|
'@nodelib/fs.scandir': 2.1.5
|
||||||
fastq: 1.15.0
|
fastq: 1.15.0
|
||||||
|
|
||||||
/@nostr-dev-kit/ndk@2.5.1(typescript@5.1.3):
|
/@nostr-dev-kit/ndk@2.8.1(typescript@5.1.3):
|
||||||
resolution: {integrity: sha512-uJTs3DLBzQS27WbHS6haFGYdnXd3GVzrcDHcrJqoXPu4DQOcMdsIrvNXcX0O+J4YkgGSSWXDspKd8iWFjduVJg==}
|
resolution: {integrity: sha512-2WPN1FVhxcLxFYwva2Ti6XKQUjqU0jfdoHHhqDF+0Mxp8f/uDyLflsUQCXsZym5rOIHY85eCYhAXi6V6q6gpRg==}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@noble/curves': 1.4.0
|
||||||
'@noble/hashes': 1.4.0
|
'@noble/hashes': 1.4.0
|
||||||
'@noble/secp256k1': 2.0.0
|
'@noble/secp256k1': 2.1.0
|
||||||
'@scure/base': 1.1.1
|
'@scure/base': 1.1.1
|
||||||
debug: 4.3.4
|
debug: 4.3.4
|
||||||
light-bolt11-decoder: 3.1.1
|
light-bolt11-decoder: 3.1.1
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,8 @@ function loadPrivateKey(): string | undefined {
|
||||||
(async () => {
|
(async () => {
|
||||||
let remoteUser: NDKUser;
|
let remoteUser: NDKUser;
|
||||||
|
|
||||||
|
ndk = await createNDK();
|
||||||
|
|
||||||
// if this is the create_account command and we have something that doesn't look like an npub as the remotePubkey, use NDKUser.fromNip05 to get the npub
|
// if this is the create_account command and we have something that doesn't look like an npub as the remotePubkey, use NDKUser.fromNip05 to get the npub
|
||||||
if (command === 'create_account' && !remotePubkey.startsWith("npub")) {
|
if (command === 'create_account' && !remotePubkey.startsWith("npub")) {
|
||||||
// see if we have a username@domain
|
// see if we have a username@domain
|
||||||
|
|
@ -88,7 +90,7 @@ function loadPrivateKey(): string | undefined {
|
||||||
|
|
||||||
content = `${username},${domain}`
|
content = `${username},${domain}`
|
||||||
|
|
||||||
const u = await NDKUser.fromNip05(domain);
|
const u = await NDKUser.fromNip05(domain, ndk);
|
||||||
if (!u) {
|
if (!u) {
|
||||||
console.log(`Invalid nip05 ${remotePubkey}`);
|
console.log(`Invalid nip05 ${remotePubkey}`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|
@ -110,7 +112,7 @@ function loadPrivateKey(): string | undefined {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ndk = await createNDK();
|
|
||||||
let localSigner: NDKPrivateKeySigner;
|
let localSigner: NDKPrivateKeySigner;
|
||||||
|
|
||||||
const pk = loadPrivateKey();
|
const pk = loadPrivateKey();
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,10 @@ async function nip89announcement(configData: IConfig) {
|
||||||
const relays = config.nip89!.relays;
|
const relays = config.nip89!.relays;
|
||||||
const nip05 = `_@${domain}`;
|
const nip05 = `_@${domain}`;
|
||||||
|
|
||||||
|
const ndk = new NDK({explicitRelayUrls: relays});
|
||||||
|
|
||||||
// make sure the nip05 correctly points to this pubkey
|
// make sure the nip05 correctly points to this pubkey
|
||||||
const uservianip05 = await NDKUser.fromNip05(nip05);
|
const uservianip05 = await NDKUser.fromNip05(nip05, ndk);
|
||||||
if (!uservianip05 || uservianip05.pubkey !== signerUser.pubkey) {
|
if (!uservianip05 || uservianip05.pubkey !== signerUser.pubkey) {
|
||||||
console.log(`❌ ${nip05} does not point to this nsecbunker's key`);
|
console.log(`❌ ${nip05} does not point to this nsecbunker's key`);
|
||||||
if (uservianip05) {
|
if (uservianip05) {
|
||||||
|
|
@ -53,7 +55,6 @@ async function nip89announcement(configData: IConfig) {
|
||||||
const hasWallet = !!config.wallet;
|
const hasWallet = !!config.wallet;
|
||||||
const hasNostrdress = !!config.wallet?.lnbits?.nostdressUrl;
|
const hasNostrdress = !!config.wallet?.lnbits?.nostdressUrl;
|
||||||
|
|
||||||
const ndk = new NDK({explicitRelayUrls: relays});
|
|
||||||
ndk.signer = signer;
|
ndk.signer = signer;
|
||||||
ndk.connect(5000).then(async () => {
|
ndk.connect(5000).then(async () => {
|
||||||
const event = new NDKAppHandlerEvent(ndk, {
|
const event = new NDKAppHandlerEvent(ndk, {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue