@konemono/nostr-login 1.9.3 → 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.3",
3
+ "version": "1.9.4",
4
4
  "description": "",
5
5
  "main": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",
@@ -126,10 +126,9 @@ export class AmberDirectSigner implements Signer {
126
126
  const baseUrl = window.location.href.split('#')[0].split('?')[0];
127
127
  const encodedContent = encodeURIComponent(content || '');
128
128
 
129
- // callbackUrl にはベースURLに結果パラメータのプレースホルダーを含める
130
- // Amberが戻ってくる時に ?event=<result> が追加される
131
- const callbackUrl = `${baseUrl}?event={result}`;
132
- const encodedCallback = encodeURIComponent(callbackUrl);
129
+ // callbackUrl にはベースURLだけを渡す
130
+ // Amberが自動的に ?event=<result> を追加する (NIP-55)
131
+ const callbackUrl = baseUrl;
133
132
 
134
133
  localStorage.setItem('amber_last_type', type);
135
134
  localStorage.setItem('amber_last_id', id);
@@ -171,6 +170,13 @@ export class AmberDirectSigner implements Signer {
171
170
  // パターン1: NIP-55標準 (?event=...)
172
171
  let result = url.searchParams.get('event');
173
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
+
174
180
  // パターン2: パス末尾にhexId (/<hexId>)
175
181
  if (!result) {
176
182
  const pathParts = url.pathname.split('/').filter(Boolean);