From 13576425752a72d33e58ddee2f26bc4f3028667e Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sat, 16 Dec 2023 13:08:37 -0300 Subject: [PATCH] adjust packages exported. --- README.md | 37 ------------------------------------- index.ts | 3 ++- package.json | 15 ++++++++++----- 3 files changed, 12 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 64782ea6..a452c3b3 100644 --- a/README.md +++ b/README.md @@ -221,43 +221,6 @@ assert(data.pubkey === pk) assert(data.relays.length === 2) ``` -### Encrypting and decrypting direct messages - -```js -import {nip44, getPublicKey, generatePrivateKey} from 'nostr-tools' - -// sender -let sk1 = generatePrivateKey() -let pk1 = getPublicKey(sk1) - -// receiver -let sk2 = generatePrivateKey() -let pk2 = getPublicKey(sk2) - -// on the sender side -let message = 'hello' -let key = nip44.getSharedSecret(sk1, pk2) -let ciphertext = nip44.encrypt(key, message) - -let event = { - kind: 4, - pubkey: pk1, - tags: [['p', pk2]], - content: ciphertext, - ...otherProperties, -} - -sendEvent(event) - -// on the receiver side -sub.on('event', async event => { - let sender = event.pubkey - // pk1 === sender - let _key = nip44.getSharedSecret(sk2, pk1) - let plaintext = nip44.decrypt(_key, event.content) -}) -``` - ### Using from the browser (if you don't want to use a bundler) ```html diff --git a/index.ts b/index.ts index 73c1c40d..ae85ccb8 100644 --- a/index.ts +++ b/index.ts @@ -8,6 +8,7 @@ export * from './references.ts' export * as nip04 from './nip04.ts' export * as nip05 from './nip05.ts' export * as nip10 from './nip10.ts' +export * as nip11 from './nip11.ts' export * as nip13 from './nip13.ts' export * as nip18 from './nip18.ts' export * as nip19 from './nip19.ts' @@ -15,9 +16,9 @@ export * as nip21 from './nip21.ts' export * as nip25 from './nip25.ts' export * as nip27 from './nip27.ts' export * as nip28 from './nip28.ts' +export * as nip30 from './nip30.ts' export * as nip39 from './nip39.ts' export * as nip42 from './nip42.ts' -export * as nip44 from './nip44.ts' export * as nip47 from './nip47.ts' export * as nip57 from './nip57.ts' export * as nip98 from './nip98.ts' diff --git a/package.json b/package.json index 64655ada..e306bd01 100644 --- a/package.json +++ b/package.json @@ -69,6 +69,11 @@ "require": "./lib/cjs/nip10.js", "types": "./lib/types/nip10.d.ts" }, + "./nip11": { + "import": "./lib/esm/nip11.js", + "require": "./lib/cjs/nip11.js", + "types": "./lib/types/nip11.d.ts" + }, "./nip13": { "import": "./lib/esm/nip13.js", "require": "./lib/cjs/nip13.js", @@ -104,6 +109,11 @@ "require": "./lib/cjs/nip28.js", "types": "./lib/types/nip28.d.ts" }, + "./nip30": { + "import": "./lib/esm/nip30.js", + "require": "./lib/cjs/nip30.js", + "types": "./lib/types/nip30.d.ts" + }, "./nip39": { "import": "./lib/esm/nip39.js", "require": "./lib/cjs/nip39.js", @@ -114,11 +124,6 @@ "require": "./lib/cjs/nip42.js", "types": "./lib/types/nip42.d.ts" }, - "./nip44": { - "import": "./lib/esm/nip44.js", - "require": "./lib/cjs/nip44.js", - "types": "./lib/types/nip44.d.ts" - }, "./nip57": { "import": "./lib/esm/nip57.js", "require": "./lib/cjs/nip57.js",