@konemono/nostr-login 1.7.68 → 1.7.70

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konemono/nostr-login",
3
- "version": "1.7.68",
3
+ "version": "1.7.70",
4
4
  "description": "",
5
5
  "main": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",
@@ -106,7 +106,21 @@ export class AmberDirectSigner implements Signer {
106
106
  params.append('returnType', 'signature');
107
107
  params.append('type', type);
108
108
  params.append('callbackUrl', callbackUrl);
109
- params.append('name', window.location.hostname);
109
+
110
+ // 三重の冗長性でアプリ名を渡す
111
+ const appName = document.title || window.location.hostname;
112
+ params.append('name', appName);
113
+ params.append('appName', appName);
114
+ params.append('app', appName);
115
+
116
+ // NIP-46互換のmetadata形式も追加
117
+ const metadata = {
118
+ name: appName,
119
+ url: window.location.origin,
120
+ description: 'Nostr Login provided by nostr-login library'
121
+ };
122
+ params.append('metadata', JSON.stringify(metadata));
123
+
110
124
  if (pubkey) params.append('pubkey', pubkey);
111
125
  if (this._pubkey) params.append('current_user', this._pubkey);
112
126
 
@@ -123,6 +123,8 @@ class AuthNostrService extends EventEmitter implements Signer {
123
123
  pubkey: response.result,
124
124
  name: nip19.npubEncode(response.result),
125
125
  authMethod: 'amber' as any,
126
+ relays: [],
127
+ signerPubkey: '',
126
128
  };
127
129
  console.log('Amber login success', info);
128
130
  this.onAuth('login', info);
@@ -222,6 +224,8 @@ class AuthNostrService extends EventEmitter implements Signer {
222
224
  pubkey,
223
225
  name: nip19.npubEncode(pubkey),
224
226
  authMethod: 'amber' as any,
227
+ relays: [],
228
+ signerPubkey: '',
225
229
  };
226
230
 
227
231
  this.onAuth('login', info);
@@ -19,7 +19,7 @@ export const localStorageGetItem = (key: string) => {
19
19
  if (value) {
20
20
  try {
21
21
  return JSON.parse(value);
22
- } catch {}
22
+ } catch { }
23
23
  }
24
24
 
25
25
  return null;
@@ -113,7 +113,7 @@ export const getBunkerUrl = async (value: string, optionsModal: NostrLoginOption
113
113
  const origin = optionsModal.devOverrideBunkerOrigin || `https://${domain}`;
114
114
 
115
115
  const bunkerUrl = `${origin}/.well-known/nostr.json?name=_`;
116
- const userUrl = `${origin}/.well-known/nostr.json?name=${name}`;
116
+ const userUrl = `${origin}/.well-known/nostr.json?name=${name}`;
117
117
 
118
118
  const bunkerRes = await fetch(bunkerUrl);
119
119
  const bunkerData = await bunkerRes.json();
@@ -167,7 +167,7 @@ export const checkNip05 = async (nip05: string) => {
167
167
  pubkey = d.names[name];
168
168
  return;
169
169
  }
170
- } catch {}
170
+ } catch { }
171
171
 
172
172
  available = true;
173
173
  })();
@@ -197,6 +197,11 @@ const upgradeInfo = (info: Info | RecentType) => {
197
197
  if (info.authMethod === 'connect' && !info.signerPubkey) {
198
198
  info.signerPubkey = info.pubkey;
199
199
  }
200
+
201
+ if (info.authMethod === ('amber' as any)) {
202
+ if (!info.signerPubkey) info.signerPubkey = '';
203
+ if (!(info as any).relays) (info as any).relays = [];
204
+ }
200
205
  };
201
206
 
202
207
  export const localStorageAddAccount = (info: Info) => {