@konemono/nostr-login 1.7.66 → 1.7.67

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.66",
3
+ "version": "1.7.67",
4
4
  "description": "",
5
5
  "main": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",
package/src/index.ts CHANGED
@@ -173,6 +173,8 @@ export class NostrLoginInitializer {
173
173
  await this.extensionService.trySetExtensionForPubkey(info.pubkey);
174
174
  } else if (info.authMethod === 'connect' && info.sk && info.relays && info.relays[0]) {
175
175
  this.authNostrService.setConnect(info);
176
+ } else if (info.authMethod === ('amber' as any)) {
177
+ this.authNostrService.setAmber(info);
176
178
  } else {
177
179
  throw new Error('Bad auth info');
178
180
  }
@@ -307,7 +309,7 @@ export class NostrLoginInitializer {
307
309
  public setAuth = async (o: NostrLoginAuthOptions) => {
308
310
  if (!o.type) throw new Error('Invalid auth event');
309
311
  if (o.type !== 'login' && o.type !== 'logout' && o.type !== 'signup') throw new Error('Invalid auth event');
310
- if (o.method && o.method !== 'connect' && o.method !== 'extension' && o.method !== 'local' && o.method !== 'otp' && o.method !== 'readOnly')
312
+ if (o.method && o.method !== 'connect' && o.method !== 'extension' && o.method !== 'local' && o.method !== 'otp' && o.method !== 'readOnly' && o.method !== ('amber' as any))
311
313
  throw new Error('Invalid auth event');
312
314
 
313
315
  if (o.type === 'logout') return this.logout();
@@ -132,13 +132,15 @@ export class AmberDirectSigner implements Signer {
132
132
  }
133
133
  }
134
134
 
135
- console.log('Amber response detection:', {
136
- href: window.location.href,
137
- eventParam: url.searchParams.get('event'),
138
- pathResult: result,
139
- sessionId: localStorage.getItem('amber_last_id'),
140
- sessionType: localStorage.getItem('amber_last_type')
141
- });
135
+ if (result) {
136
+ console.log('Amber response detection:', {
137
+ href: window.location.href,
138
+ eventParam: url.searchParams.get('event'),
139
+ pathResult: result,
140
+ sessionId: localStorage.getItem('amber_last_id'),
141
+ sessionType: localStorage.getItem('amber_last_type')
142
+ });
143
+ }
142
144
 
143
145
  if (!result) return null;
144
146