@konemono/nostr-login 1.7.21 → 1.7.22
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
|
@@ -708,20 +708,33 @@ class AuthNostrService extends EventEmitter implements Signer {
|
|
|
708
708
|
}
|
|
709
709
|
|
|
710
710
|
public async signEvent(event: any) {
|
|
711
|
+
console.log('AuthNostrService.signEvent called', {
|
|
712
|
+
hasLocalSigner: !!this.localSigner,
|
|
713
|
+
hasSigner: !!this.signer,
|
|
714
|
+
signerRemotePubkey: this.signer?.remotePubkey,
|
|
715
|
+
eventBefore: JSON.parse(JSON.stringify(event))
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
// Create a copy to avoid mutating the original event on timeout
|
|
719
|
+
const eventToSign = { ...event };
|
|
720
|
+
|
|
711
721
|
if (this.localSigner) {
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
722
|
+
eventToSign.pubkey = getPublicKey(this.localSigner.privateKey!);
|
|
723
|
+
eventToSign.id = getEventHash(eventToSign);
|
|
724
|
+
eventToSign.sig = await this.localSigner.sign(eventToSign);
|
|
715
725
|
} else {
|
|
716
726
|
if (!this.signer) {
|
|
727
|
+
console.error('No signer available!');
|
|
717
728
|
throw new Error('No signer available');
|
|
718
729
|
}
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
730
|
+
eventToSign.pubkey = this.signer.remotePubkey;
|
|
731
|
+
eventToSign.id = getEventHash(eventToSign);
|
|
732
|
+
console.log('Calling signer.sign with event:', eventToSign);
|
|
733
|
+
eventToSign.sig = await this.signer.sign(eventToSign);
|
|
734
|
+
console.log('Received signature:', eventToSign.sig);
|
|
722
735
|
}
|
|
723
|
-
console.log('signed', { event });
|
|
724
|
-
return
|
|
736
|
+
console.log('signed event:', { event: eventToSign });
|
|
737
|
+
return eventToSign;
|
|
725
738
|
}
|
|
726
739
|
|
|
727
740
|
private async codec_call(method: string, pubkey: string, param: string) {
|