@konemono/nostr-login 1.9.2 → 1.9.4

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.9.2",
3
+ "version": "1.9.4",
4
4
  "description": "",
5
5
  "main": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",
@@ -123,9 +123,12 @@ export class AmberDirectSigner implements Signer {
123
123
  }
124
124
 
125
125
  public generateUrl(content: string, type: string, id: string, pubkey?: string): string {
126
- const callbackUrl = window.location.href.split('#')[0].split('?')[0];
126
+ const baseUrl = window.location.href.split('#')[0].split('?')[0];
127
127
  const encodedContent = encodeURIComponent(content || '');
128
- const encodedCallback = encodeURIComponent(callbackUrl);
128
+
129
+ // callbackUrl にはベースURLだけを渡す
130
+ // Amberが自動的に ?event=<result> を追加する (NIP-55)
131
+ const callbackUrl = baseUrl;
129
132
 
130
133
  localStorage.setItem('amber_last_type', type);
131
134
  localStorage.setItem('amber_last_id', id);
@@ -167,6 +170,13 @@ export class AmberDirectSigner implements Signer {
167
170
  // パターン1: NIP-55標準 (?event=...)
168
171
  let result = url.searchParams.get('event');
169
172
 
173
+ // Amberが壊れた{result}プレースホルダーを返した場合のクリーンアップ
174
+ // 例: ?event=result}5650178... → 5650178...
175
+ if (result && result.includes('result}')) {
176
+ result = result.replace(/^result\}/, '');
177
+ console.log('[AmberDirectSigner] Cleaned up malformed result:', result);
178
+ }
179
+
170
180
  // パターン2: パス末尾にhexId (/<hexId>)
171
181
  if (!result) {
172
182
  const pathParts = url.pathname.split('/').filter(Boolean);