@konemono/nostr-login 1.7.55 → 1.7.56
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
|
@@ -119,16 +119,27 @@ export class AmberDirectSigner implements Signer {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
private generateUrl(content: string, type: string, id: string, recipient?: string): string {
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
const url = new URL(window.location.href);
|
|
123
|
+
const searchParams = url.searchParams;
|
|
124
|
+
searchParams.delete('amberType');
|
|
125
|
+
searchParams.delete('amberId');
|
|
126
|
+
searchParams.delete('signature');
|
|
127
|
+
searchParams.delete('result');
|
|
128
|
+
url.hash = ''; // Amber/Android may not handle hash in callbackUrl well
|
|
129
|
+
|
|
130
|
+
url.searchParams.set('amberType', type);
|
|
131
|
+
url.searchParams.set('amberId', id);
|
|
125
132
|
|
|
126
133
|
const params = new URLSearchParams();
|
|
127
134
|
params.set('type', type);
|
|
128
135
|
params.set('id', id);
|
|
129
|
-
params.set('callbackUrl',
|
|
130
|
-
|
|
131
|
-
if (recipient)
|
|
136
|
+
params.set('callbackUrl', url.toString());
|
|
137
|
+
params.set('name', document.location.host);
|
|
138
|
+
if (recipient) {
|
|
139
|
+
params.set('pubkey', recipient);
|
|
140
|
+
} else if (this._pubkey) {
|
|
141
|
+
params.set('pubkey', this._pubkey);
|
|
142
|
+
}
|
|
132
143
|
|
|
133
144
|
return `nostrsigner:${encodeURIComponent(content)}?${params.toString()}`;
|
|
134
145
|
}
|