nostr-tools
Advanced tools
Comparing version 2.1.7 to 2.1.8
@@ -26,3 +26,3 @@ "use strict"; | ||
createAccount: () => createAccount, | ||
fetchCustodialbunkers: () => fetchCustodialbunkers, | ||
fetchCustodialBunkers: () => fetchCustodialBunkers, | ||
parseBunkerInput: () => parseBunkerInput, | ||
@@ -751,2 +751,3 @@ useFetchImplementation: () => useFetchImplementation | ||
// nip46.ts | ||
var import_utils7 = require("@noble/hashes/utils"); | ||
var _fetch2; | ||
@@ -887,2 +888,8 @@ try { | ||
} | ||
async getPublicKey() { | ||
return this.remotePubkey; | ||
} | ||
async getRelays() { | ||
return JSON.parse(await this.sendRequest("get_relays", [])); | ||
} | ||
async signEvent(event) { | ||
@@ -897,2 +904,18 @@ let resp = await this.sendRequest("sign_event", [JSON.stringify(event)]); | ||
} | ||
async nip04Encrypt(thirdPartyPubkey, plaintext) { | ||
return await this.sendRequest("nip04_encrypt", [thirdPartyPubkey, plaintext]); | ||
} | ||
async nip04Decrypt(thirdPartyPubkey, ciphertext) { | ||
return await this.sendRequest("nip04_decrypt", [thirdPartyPubkey, ciphertext]); | ||
} | ||
async nip44GetKey(thirdPartyPubkey) { | ||
let resp = await this.sendRequest("nip44_get_key", [thirdPartyPubkey]); | ||
return (0, import_utils7.hexToBytes)(resp); | ||
} | ||
async nip44Encrypt(thirdPartyPubkey, plaintext) { | ||
return await this.sendRequest("nip44_encrypt", [thirdPartyPubkey, plaintext]); | ||
} | ||
async nip44Decrypt(thirdPartyPubkey, ciphertext) { | ||
return await this.sendRequest("nip44_encrypt", [thirdPartyPubkey, ciphertext]); | ||
} | ||
}; | ||
@@ -909,3 +932,3 @@ async function createAccount(bunker, params, username, domain, email) { | ||
} | ||
async function fetchCustodialbunkers(pool, relays) { | ||
async function fetchCustodialBunkers(pool, relays) { | ||
const events = await pool.querySync(relays, { | ||
@@ -912,0 +935,0 @@ kinds: [Handlerinformation], |
@@ -719,2 +719,3 @@ // pure.ts | ||
// nip46.ts | ||
import { hexToBytes } from "@noble/hashes/utils"; | ||
var _fetch2; | ||
@@ -855,2 +856,8 @@ try { | ||
} | ||
async getPublicKey() { | ||
return this.remotePubkey; | ||
} | ||
async getRelays() { | ||
return JSON.parse(await this.sendRequest("get_relays", [])); | ||
} | ||
async signEvent(event) { | ||
@@ -865,2 +872,18 @@ let resp = await this.sendRequest("sign_event", [JSON.stringify(event)]); | ||
} | ||
async nip04Encrypt(thirdPartyPubkey, plaintext) { | ||
return await this.sendRequest("nip04_encrypt", [thirdPartyPubkey, plaintext]); | ||
} | ||
async nip04Decrypt(thirdPartyPubkey, ciphertext) { | ||
return await this.sendRequest("nip04_decrypt", [thirdPartyPubkey, ciphertext]); | ||
} | ||
async nip44GetKey(thirdPartyPubkey) { | ||
let resp = await this.sendRequest("nip44_get_key", [thirdPartyPubkey]); | ||
return hexToBytes(resp); | ||
} | ||
async nip44Encrypt(thirdPartyPubkey, plaintext) { | ||
return await this.sendRequest("nip44_encrypt", [thirdPartyPubkey, plaintext]); | ||
} | ||
async nip44Decrypt(thirdPartyPubkey, ciphertext) { | ||
return await this.sendRequest("nip44_encrypt", [thirdPartyPubkey, ciphertext]); | ||
} | ||
}; | ||
@@ -877,3 +900,3 @@ async function createAccount(bunker, params, username, domain, email) { | ||
} | ||
async function fetchCustodialbunkers(pool, relays) { | ||
async function fetchCustodialBunkers(pool, relays) { | ||
const events = await pool.querySync(relays, { | ||
@@ -911,5 +934,5 @@ kinds: [Handlerinformation], | ||
createAccount, | ||
fetchCustodialbunkers, | ||
fetchCustodialBunkers, | ||
parseBunkerInput, | ||
useFetchImplementation | ||
}; |
@@ -38,17 +38,25 @@ import { UnsignedEvent, VerifiedEvent } from './core.ts'; | ||
/** | ||
* Sends a ping request to the remote server. | ||
* Requires permission/access rights to bunker. | ||
* @returns "Pong" if successful. The promise will reject if the response is not "pong". | ||
* Calls the "connect" method on the bunker. | ||
* The promise will be rejected if the response is not "pong". | ||
*/ | ||
ping(): Promise<void>; | ||
/** | ||
* Connects to a remote server using the provided keys and remote public key. | ||
* Optionally, a secret can be provided for additional authentication. | ||
* | ||
* @param remotePubkey - Optional the remote public key to connect to. | ||
* @param secret - Optional secret for additional authentication. | ||
* @returns "ack" if successful. The promise will reject if the response is not "ack". | ||
* Calls the "connect" method on the bunker. | ||
*/ | ||
connect(): Promise<void>; | ||
/** | ||
* This was supposed to call the "get_public_key" method on the bunker, | ||
* but instead we just returns the public key we already know. | ||
*/ | ||
getPublicKey(): Promise<string>; | ||
/** | ||
* Calls the "get_relays" method on the bunker. | ||
*/ | ||
getRelays(): Promise<{ | ||
[relay: string]: { | ||
read: boolean; | ||
write: boolean; | ||
}; | ||
}>; | ||
/** | ||
* Signs an event using the remote private key. | ||
@@ -59,2 +67,7 @@ * @param event - The event to sign. | ||
signEvent(event: UnsignedEvent): Promise<VerifiedEvent>; | ||
nip04Encrypt(thirdPartyPubkey: string, plaintext: string): Promise<string>; | ||
nip04Decrypt(thirdPartyPubkey: string, ciphertext: string): Promise<string>; | ||
nip44GetKey(thirdPartyPubkey: string): Promise<Uint8Array>; | ||
nip44Encrypt(thirdPartyPubkey: string, plaintext: string): Promise<string>; | ||
nip44Decrypt(thirdPartyPubkey: string, ciphertext: string): Promise<string>; | ||
} | ||
@@ -75,3 +88,3 @@ /** | ||
*/ | ||
export declare function fetchCustodialbunkers(pool: AbstractSimplePool, relays: string[]): Promise<BunkerProfile[]>; | ||
export declare function fetchCustodialBunkers(pool: AbstractSimplePool, relays: string[]): Promise<BunkerProfile[]>; | ||
export type BunkerProfile = { | ||
@@ -78,0 +91,0 @@ bunkerPointer: BunkerPointer; |
{ | ||
"type": "module", | ||
"name": "nostr-tools", | ||
"version": "2.1.7", | ||
"version": "2.1.8", | ||
"description": "Tools for making a Nostr client.", | ||
@@ -6,0 +6,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2642217
25452