fix: use nip44 for nip46 comms
This commit is contained in:
parent
6eafdc1367
commit
892b00810d
@ -69,6 +69,8 @@ export class Nip46Signer extends EventEmitter<Nip46Events> implements EventSigne
|
|||||||
|
|
||||||
if (u.hash.length > 1) {
|
if (u.hash.length > 1) {
|
||||||
this.#token = u.hash.substring(1);
|
this.#token = u.hash.substring(1);
|
||||||
|
} else {
|
||||||
|
this.#token = u.searchParams.get("secret") || undefined;
|
||||||
}
|
}
|
||||||
if (this.#localPubkey.startsWith("npub")) {
|
if (this.#localPubkey.startsWith("npub")) {
|
||||||
this.#localPubkey = bech32ToHex(this.#localPubkey);
|
this.#localPubkey = bech32ToHex(this.#localPubkey);
|
||||||
@ -83,7 +85,7 @@ export class Nip46Signer extends EventEmitter<Nip46Events> implements EventSigne
|
|||||||
}
|
}
|
||||||
|
|
||||||
get supports(): string[] {
|
get supports(): string[] {
|
||||||
return ["nip04"];
|
return ["nip44"];
|
||||||
}
|
}
|
||||||
|
|
||||||
get relays() {
|
get relays() {
|
||||||
@ -222,7 +224,7 @@ export class Nip46Signer extends EventEmitter<Nip46Events> implements EventSigne
|
|||||||
throw new Error("Unknown event kind");
|
throw new Error("Unknown event kind");
|
||||||
}
|
}
|
||||||
|
|
||||||
const decryptedContent = await this.#insideSigner.nip4Decrypt(e.content, e.pubkey);
|
const decryptedContent = await this.#insideSigner.nip44Decrypt(e.content, e.pubkey);
|
||||||
const reply = JSON.parse(decryptedContent) as Nip46Request | Nip46Response;
|
const reply = JSON.parse(decryptedContent) as Nip46Request | Nip46Response;
|
||||||
|
|
||||||
let id = reply.id;
|
let id = reply.id;
|
||||||
@ -286,7 +288,7 @@ export class Nip46Signer extends EventEmitter<Nip46Events> implements EventSigne
|
|||||||
|
|
||||||
const eb = new EventBuilder();
|
const eb = new EventBuilder();
|
||||||
eb.kind(NIP46_KIND as EventKind)
|
eb.kind(NIP46_KIND as EventKind)
|
||||||
.content(await this.#insideSigner.nip4Encrypt(JSON.stringify(payload), target))
|
.content(await this.#insideSigner.nip44Encrypt(JSON.stringify(payload), target))
|
||||||
.tag(["p", target]);
|
.tag(["p", target]);
|
||||||
|
|
||||||
this.#log("Send: %O", payload);
|
this.#log("Send: %O", payload);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user