nostr-tools
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -77,3 +77,2 @@ "use strict"; | ||
NostrConnect: () => NostrConnect, | ||
NostrConnectAdmin: () => NostrConnectAdmin, | ||
OpenTimestamps: () => OpenTimestamps, | ||
@@ -177,3 +176,2 @@ Pinlist: () => Pinlist, | ||
var NostrConnect = 24133; | ||
var NostrConnectAdmin = 24134; | ||
var HTTPAuth = 27235; | ||
@@ -180,0 +178,0 @@ var Followsets = 3e4; |
@@ -226,3 +226,2 @@ "use strict"; | ||
var NostrConnect = 24133; | ||
var NostrConnectAdmin = 24134; | ||
var Handlerinformation = 31990; | ||
@@ -805,2 +804,3 @@ | ||
listeners; | ||
waitingForAuth; | ||
secretKey; | ||
@@ -819,10 +819,13 @@ bp; | ||
this.listeners = {}; | ||
this.waitingForAuth = {}; | ||
const listeners = this.listeners; | ||
const waitingForAuth = this.waitingForAuth; | ||
this.subCloser = this.pool.subscribeMany( | ||
this.bp.relays, | ||
[{ kinds: [NostrConnect, NostrConnectAdmin], "#p": [getPublicKey(this.secretKey)] }], | ||
[{ kinds: [NostrConnect], "#p": [getPublicKey(this.secretKey)] }], | ||
{ | ||
async onevent(event) { | ||
const { id, result, error } = JSON.parse(await decrypt(clientSecretKey, event.pubkey, event.content)); | ||
if (result === "auth_url") { | ||
if (result === "auth_url" && waitingForAuth[id]) { | ||
delete listeners[id]; | ||
if (params.onauth) { | ||
@@ -864,3 +867,3 @@ params.onauth(error); | ||
{ | ||
kind: method === "create_account" ? NostrConnectAdmin : NostrConnect, | ||
kind: NostrConnect, | ||
tags: [["p", this.bp.pubkey]], | ||
@@ -873,2 +876,3 @@ content: encryptedContent, | ||
this.listeners[id] = { resolve, reject }; | ||
this.waitingForAuth[id] = true; | ||
await Promise.any(this.pool.publish(this.bp.relays, verifiedEvent)); | ||
@@ -875,0 +879,0 @@ } catch (err) { |
@@ -266,3 +266,2 @@ var __defProp = Object.defineProperty; | ||
NostrConnect: () => NostrConnect, | ||
NostrConnectAdmin: () => NostrConnectAdmin, | ||
OpenTimestamps: () => OpenTimestamps, | ||
@@ -365,3 +364,2 @@ Pinlist: () => Pinlist, | ||
var NostrConnect = 24133; | ||
var NostrConnectAdmin = 24134; | ||
var HTTPAuth = 27235; | ||
@@ -368,0 +366,0 @@ var Followsets = 3e4; |
@@ -73,3 +73,2 @@ // kinds.ts | ||
var NostrConnect = 24133; | ||
var NostrConnectAdmin = 24134; | ||
var HTTPAuth = 27235; | ||
@@ -156,3 +155,2 @@ var Followsets = 3e4; | ||
NostrConnect, | ||
NostrConnectAdmin, | ||
OpenTimestamps, | ||
@@ -159,0 +157,0 @@ Pinlist, |
@@ -195,3 +195,2 @@ // pure.ts | ||
var NostrConnect = 24133; | ||
var NostrConnectAdmin = 24134; | ||
var Handlerinformation = 31990; | ||
@@ -774,2 +773,3 @@ | ||
listeners; | ||
waitingForAuth; | ||
secretKey; | ||
@@ -788,10 +788,13 @@ bp; | ||
this.listeners = {}; | ||
this.waitingForAuth = {}; | ||
const listeners = this.listeners; | ||
const waitingForAuth = this.waitingForAuth; | ||
this.subCloser = this.pool.subscribeMany( | ||
this.bp.relays, | ||
[{ kinds: [NostrConnect, NostrConnectAdmin], "#p": [getPublicKey(this.secretKey)] }], | ||
[{ kinds: [NostrConnect], "#p": [getPublicKey(this.secretKey)] }], | ||
{ | ||
async onevent(event) { | ||
const { id, result, error } = JSON.parse(await decrypt(clientSecretKey, event.pubkey, event.content)); | ||
if (result === "auth_url") { | ||
if (result === "auth_url" && waitingForAuth[id]) { | ||
delete listeners[id]; | ||
if (params.onauth) { | ||
@@ -833,3 +836,3 @@ params.onauth(error); | ||
{ | ||
kind: method === "create_account" ? NostrConnectAdmin : NostrConnect, | ||
kind: NostrConnect, | ||
tags: [["p", this.bp.pubkey]], | ||
@@ -842,2 +845,3 @@ content: encryptedContent, | ||
this.listeners[id] = { resolve, reject }; | ||
this.waitingForAuth[id] = true; | ||
await Promise.any(this.pool.publish(this.bp.relays, verifiedEvent)); | ||
@@ -844,0 +848,0 @@ } catch (err) { |
@@ -61,3 +61,2 @@ /** Events are **regular**, which means they're all expected to be stored by relays. */ | ||
export declare const NostrConnect = 24133; | ||
export declare const NostrConnectAdmin = 24134; | ||
export declare const HTTPAuth = 27235; | ||
@@ -64,0 +63,0 @@ export declare const Followsets = 30000; |
@@ -24,2 +24,3 @@ import { UnsignedEvent, VerifiedEvent } from './core.ts'; | ||
private listeners; | ||
private waitingForAuth; | ||
private secretKey; | ||
@@ -26,0 +27,0 @@ bp: BunkerPointer; |
{ | ||
"type": "module", | ||
"name": "nostr-tools", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "Tools for making a Nostr client.", | ||
@@ -6,0 +6,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2668919
25704