Migrated n_signer verb names to nostr_ prefix (sign_event→nostr_sign_event, get_public_key→nostr_get_public_key, nip04_*→nostr_nip04_*, nip44_*→nostr_nip44_*)

This commit is contained in:
Laan Tungir
2026-07-20 18:04:15 -04:00
parent 2ca4baad63
commit 2221e81c9b
4 changed files with 19 additions and 19 deletions

View File

@@ -8,7 +8,7 @@
* Two-file architecture: * Two-file architecture:
* 1. Load nostr.bundle.js (official nostr-tools bundle) * 1. Load nostr.bundle.js (official nostr-tools bundle)
* 2. Load nostr-lite.js (this file - NOSTR_LOGIN_LITE library with CSS-only themes) * 2. Load nostr-lite.js (this file - NOSTR_LOGIN_LITE library with CSS-only themes)
* Generated on: 2026-06-09T19:25:39.199Z * Generated on: 2026-07-20T22:03:53.007Z
*/ */
// Verify dependencies are loaded // Verify dependencies are loaded

View File

@@ -11146,12 +11146,12 @@ zoo`.split("\n");
} }
async getPublicKey() { async getPublicKey() {
if (!this.cachedPubKey) { if (!this.cachedPubKey) {
this.cachedPubKey = await this.sendRequest("get_public_key", []); this.cachedPubKey = await this.sendRequest("nostr_get_public_key", []);
} }
return this.cachedPubKey; return this.cachedPubKey;
} }
async signEvent(event) { async signEvent(event) {
let resp = await this.sendRequest("sign_event", [JSON.stringify(event)]); let resp = await this.sendRequest("nostr_sign_event", [JSON.stringify(event)]);
let signed = JSON.parse(resp); let signed = JSON.parse(resp);
if (verifyEvent(signed)) { if (verifyEvent(signed)) {
return signed; return signed;
@@ -11160,16 +11160,16 @@ zoo`.split("\n");
} }
} }
async nip04Encrypt(thirdPartyPubkey, plaintext) { async nip04Encrypt(thirdPartyPubkey, plaintext) {
return await this.sendRequest("nip04_encrypt", [thirdPartyPubkey, plaintext]); return await this.sendRequest("nostr_nip04_encrypt", [thirdPartyPubkey, plaintext]);
} }
async nip04Decrypt(thirdPartyPubkey, ciphertext) { async nip04Decrypt(thirdPartyPubkey, ciphertext) {
return await this.sendRequest("nip04_decrypt", [thirdPartyPubkey, ciphertext]); return await this.sendRequest("nostr_nip04_decrypt", [thirdPartyPubkey, ciphertext]);
} }
async nip44Encrypt(thirdPartyPubkey, plaintext) { async nip44Encrypt(thirdPartyPubkey, plaintext) {
return await this.sendRequest("nip44_encrypt", [thirdPartyPubkey, plaintext]); return await this.sendRequest("nostr_nip44_encrypt", [thirdPartyPubkey, plaintext]);
} }
async nip44Decrypt(thirdPartyPubkey, ciphertext) { async nip44Decrypt(thirdPartyPubkey, ciphertext) {
return await this.sendRequest("nip44_decrypt", [thirdPartyPubkey, ciphertext]); return await this.sendRequest("nostr_nip44_decrypt", [thirdPartyPubkey, ciphertext]);
} }
}; };
async function createAccount(bunker, params, username, domain, email, localSecretKey = generateSecretKey()) { async function createAccount(bunker, params, username, domain, email, localSecretKey = generateSecretKey()) {

View File

@@ -611,7 +611,7 @@
// ── Pubkey helper ───────────────────────────────────────────────────────── // ── Pubkey helper ─────────────────────────────────────────────────────────
async function fetchOwnPubkeyAndFillPeers() { async function fetchOwnPubkeyAndFillPeers() {
const params = [getIndexOptions()]; const params = [getIndexOptions()];
const resp = await rpcCall("get_public_key", params); const resp = await rpcCall("nostr_get_public_key", params);
if (resp && typeof resp.result === "string") { if (resp && typeof resp.result === "string") {
ownPubkey = resp.result.trim().toLowerCase(); ownPubkey = resp.result.trim().toLowerCase();
pubkeyOutEl.textContent = pretty(resp); pubkeyOutEl.textContent = pretty(resp);
@@ -668,7 +668,7 @@
}; };
const params = [unsignedEvent, getIndexOptions()]; const params = [unsignedEvent, getIndexOptions()];
const resp = await rpcCall("sign_event", params); const resp = await rpcCall("nostr_sign_event", params);
signOutEl.textContent = pretty(resp?.result ?? resp); signOutEl.textContent = pretty(resp?.result ?? resp);
} catch (e) { } catch (e) {
signOutEl.textContent = String(e); signOutEl.textContent = String(e);
@@ -680,7 +680,7 @@
const peer = requirePeerHex(nip04PeerEl.value); const peer = requirePeerHex(nip04PeerEl.value);
const msg = String(nip04MsgEl.value || ""); const msg = String(nip04MsgEl.value || "");
const params = [peer, msg, getIndexOptions()]; const params = [peer, msg, getIndexOptions()];
const resp = await rpcCall("nip04_encrypt", params); const resp = await rpcCall("nostr_nip04_encrypt", params);
nip04OutEl.textContent = pretty(resp?.result ?? resp); nip04OutEl.textContent = pretty(resp?.result ?? resp);
if (resp && typeof resp.result === "string") { if (resp && typeof resp.result === "string") {
nip04DecPeerEl.value = peer; nip04DecPeerEl.value = peer;
@@ -696,7 +696,7 @@
const peer = requirePeerHex(nip04DecPeerEl.value); const peer = requirePeerHex(nip04DecPeerEl.value);
const ciphertext = String(nip04CipherEl.value || ""); const ciphertext = String(nip04CipherEl.value || "");
const params = [peer, ciphertext, getIndexOptions()]; const params = [peer, ciphertext, getIndexOptions()];
const resp = await rpcCall("nip04_decrypt", params); const resp = await rpcCall("nostr_nip04_decrypt", params);
nip04DecOutEl.textContent = requireStringResult(resp, "NIP-04 decrypt"); nip04DecOutEl.textContent = requireStringResult(resp, "NIP-04 decrypt");
} catch (e) { } catch (e) {
nip04DecOutEl.textContent = String(e); nip04DecOutEl.textContent = String(e);
@@ -708,7 +708,7 @@
const peer = requirePeerHex(nip44PeerEl.value); const peer = requirePeerHex(nip44PeerEl.value);
const msg = String(nip44MsgEl.value || ""); const msg = String(nip44MsgEl.value || "");
const params = [peer, msg, getIndexOptions()]; const params = [peer, msg, getIndexOptions()];
const resp = await rpcCall("nip44_encrypt", params); const resp = await rpcCall("nostr_nip44_encrypt", params);
nip44OutEl.textContent = pretty(resp?.result ?? resp); nip44OutEl.textContent = pretty(resp?.result ?? resp);
if (resp && typeof resp.result === "string") { if (resp && typeof resp.result === "string") {
nip44DecPeerEl.value = peer; nip44DecPeerEl.value = peer;
@@ -724,7 +724,7 @@
const peer = requirePeerHex(nip44DecPeerEl.value); const peer = requirePeerHex(nip44DecPeerEl.value);
const ciphertext = String(nip44CipherEl.value || ""); const ciphertext = String(nip44CipherEl.value || "");
const params = [peer, ciphertext, getIndexOptions()]; const params = [peer, ciphertext, getIndexOptions()];
const resp = await rpcCall("nip44_decrypt", params); const resp = await rpcCall("nostr_nip44_decrypt", params);
nip44DecOutEl.textContent = requireStringResult(resp, "NIP-44 decrypt"); nip44DecOutEl.textContent = requireStringResult(resp, "NIP-44 decrypt");
} catch (e) { } catch (e) {
nip44DecOutEl.textContent = String(e); nip44DecOutEl.textContent = String(e);

View File

@@ -369,7 +369,7 @@
async function fetchOwnPubkeyAndFillPeers() { async function fetchOwnPubkeyAndFillPeers() {
const params = [getIndexOptions()]; const params = [getIndexOptions()];
const resp = await rpcCall("get_public_key", params, "web-own-pubkey"); const resp = await rpcCall("nostr_get_public_key", params, "web-own-pubkey");
if (resp && typeof resp.result === "string") { if (resp && typeof resp.result === "string") {
ownPubkey = resp.result.trim().toLowerCase(); ownPubkey = resp.result.trim().toLowerCase();
pubkeyOutEl.textContent = pretty(resp); pubkeyOutEl.textContent = pretty(resp);
@@ -460,7 +460,7 @@
}; };
const params = [unsignedEvent, getIndexOptions()]; const params = [unsignedEvent, getIndexOptions()];
const resp = await rpcCall("sign_event", params, "web-sign-kind1"); const resp = await rpcCall("nostr_sign_event", params, "web-sign-kind1");
signOutEl.textContent = pretty(resp?.result ?? resp); signOutEl.textContent = pretty(resp?.result ?? resp);
} catch (e) { } catch (e) {
signOutEl.textContent = String(e); signOutEl.textContent = String(e);
@@ -472,7 +472,7 @@
const peer = requirePeerHex(nip04PeerEl.value); const peer = requirePeerHex(nip04PeerEl.value);
const msg = String(nip04MsgEl.value || ""); const msg = String(nip04MsgEl.value || "");
const params = [peer, msg, getIndexOptions()]; const params = [peer, msg, getIndexOptions()];
const resp = await rpcCall("nip04_encrypt", params, "web-nip04-enc"); const resp = await rpcCall("nostr_nip04_encrypt", params, "web-nip04-enc");
nip04OutEl.textContent = pretty(resp?.result ?? resp); nip04OutEl.textContent = pretty(resp?.result ?? resp);
if (resp && typeof resp.result === "string") { if (resp && typeof resp.result === "string") {
nip04DecPeerEl.value = peer; nip04DecPeerEl.value = peer;
@@ -488,7 +488,7 @@
const peer = requirePeerHex(nip04DecPeerEl.value); const peer = requirePeerHex(nip04DecPeerEl.value);
const ciphertext = String(nip04CipherEl.value || ""); const ciphertext = String(nip04CipherEl.value || "");
const params = [peer, ciphertext, getIndexOptions()]; const params = [peer, ciphertext, getIndexOptions()];
const resp = await rpcCall("nip04_decrypt", params, "web-nip04-dec"); const resp = await rpcCall("nostr_nip04_decrypt", params, "web-nip04-dec");
nip04DecOutEl.textContent = requireStringResult(resp, "NIP-04 decrypt"); nip04DecOutEl.textContent = requireStringResult(resp, "NIP-04 decrypt");
} catch (e) { } catch (e) {
nip04DecOutEl.textContent = String(e); nip04DecOutEl.textContent = String(e);
@@ -500,7 +500,7 @@
const peer = requirePeerHex(nip44PeerEl.value); const peer = requirePeerHex(nip44PeerEl.value);
const msg = String(nip44MsgEl.value || ""); const msg = String(nip44MsgEl.value || "");
const params = [peer, msg, getIndexOptions()]; const params = [peer, msg, getIndexOptions()];
const resp = await rpcCall("nip44_encrypt", params, "web-nip44-enc"); const resp = await rpcCall("nostr_nip44_encrypt", params, "web-nip44-enc");
nip44OutEl.textContent = pretty(resp?.result ?? resp); nip44OutEl.textContent = pretty(resp?.result ?? resp);
if (resp && typeof resp.result === "string") { if (resp && typeof resp.result === "string") {
nip44DecPeerEl.value = peer; nip44DecPeerEl.value = peer;
@@ -516,7 +516,7 @@
const peer = requirePeerHex(nip44DecPeerEl.value); const peer = requirePeerHex(nip44DecPeerEl.value);
const ciphertext = String(nip44CipherEl.value || ""); const ciphertext = String(nip44CipherEl.value || "");
const params = [peer, ciphertext, getIndexOptions()]; const params = [peer, ciphertext, getIndexOptions()];
const resp = await rpcCall("nip44_decrypt", params, "web-nip44-dec"); const resp = await rpcCall("nostr_nip44_decrypt", params, "web-nip44-dec");
nip44DecOutEl.textContent = requireStringResult(resp, "NIP-44 decrypt"); nip44DecOutEl.textContent = requireStringResult(resp, "NIP-44 decrypt");
} catch (e) { } catch (e) {
nip44DecOutEl.textContent = String(e); nip44DecOutEl.textContent = String(e);