@konemono/nostr-login 1.10.1 → 1.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -116,6 +116,8 @@ class AuthNostrService extends EventEmitter implements Signer {
|
|
|
116
116
|
this.signerErrCallback('Cancelled by user');
|
|
117
117
|
this.signerErrCallback = undefined;
|
|
118
118
|
}
|
|
119
|
+
// readyCallbackもクリアする
|
|
120
|
+
this.resetAuth();
|
|
119
121
|
this.emit('signerCancelled');
|
|
120
122
|
}
|
|
121
123
|
|
|
@@ -126,14 +128,17 @@ class AuthNostrService extends EventEmitter implements Signer {
|
|
|
126
128
|
link = '',
|
|
127
129
|
iframeUrl = '',
|
|
128
130
|
importConnect = false,
|
|
131
|
+
customRelays,
|
|
129
132
|
}: {
|
|
130
133
|
domain?: string;
|
|
131
134
|
link?: string;
|
|
132
135
|
importConnect?: boolean;
|
|
133
136
|
iframeUrl?: string;
|
|
137
|
+
customRelays?: string[];
|
|
134
138
|
} = {},
|
|
135
139
|
) {
|
|
136
|
-
|
|
140
|
+
// カスタムリレーが指定されていれば使用、そうでなければ単一リレーまたはデフォルト
|
|
141
|
+
const relays = customRelays && customRelays.length > 0 ? customRelays : [relay || DEFAULT_NOSTRCONNECT_RELAY];
|
|
137
142
|
|
|
138
143
|
const info: Info = {
|
|
139
144
|
authMethod: 'connect',
|
|
@@ -141,7 +146,7 @@ class AuthNostrService extends EventEmitter implements Signer {
|
|
|
141
146
|
signerPubkey: '', // unknown too!
|
|
142
147
|
sk: this.nostrConnectKey,
|
|
143
148
|
domain: domain,
|
|
144
|
-
relays:
|
|
149
|
+
relays: relays,
|
|
145
150
|
iframeUrl,
|
|
146
151
|
};
|
|
147
152
|
|
|
@@ -156,7 +161,9 @@ class AuthNostrService extends EventEmitter implements Signer {
|
|
|
156
161
|
// signer learns the remote pubkey
|
|
157
162
|
if (!info.pubkey || !info.signerPubkey) throw new Error('Bad remote pubkey');
|
|
158
163
|
|
|
159
|
-
|
|
164
|
+
// bunkerUrl\u306b\u5168\u30ea\u30ec\u30fc\u3092\u542b\u3081\u308b
|
|
165
|
+
const relayParams = relays.map(r => `relay=${encodeURIComponent(r)}`).join('&');
|
|
166
|
+
info.bunkerUrl = `bunker://${info.signerPubkey}?${relayParams}`;
|
|
160
167
|
|
|
161
168
|
// callback
|
|
162
169
|
if (!importConnect) this.onAuth('login', info);
|
|
@@ -219,7 +219,7 @@ class ModalManager extends EventEmitter {
|
|
|
219
219
|
if (!cs) this.modal.isLoading = false;
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
await this.authNostrService.nostrConnect(relay, { domain, link, iframeUrl });
|
|
222
|
+
await this.authNostrService.nostrConnect(relay, { domain, link, iframeUrl, customRelays: this.customNip46Relays });
|
|
223
223
|
});
|
|
224
224
|
};
|
|
225
225
|
|