nostr-crypto-utils 0.4.11 → 0.4.12
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/README.md +46 -0
- package/dist/browser/main-43dd7041.nostr-crypto-utils.min.js +1 -1
- package/dist/browser/main-d277ceb9.nostr-crypto-utils.min.js +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +10 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +7 -2
- package/src/index.ts +11 -0
package/README.md
CHANGED
|
@@ -199,6 +199,52 @@ try {
|
|
|
199
199
|
console.error(error); // Error: Invalid hex string
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
+
### Quick Start
|
|
203
|
+
|
|
204
|
+
### Installation
|
|
205
|
+
```bash
|
|
206
|
+
npm install nostr-crypto-utils
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Basic Usage
|
|
210
|
+
|
|
211
|
+
#### NIP-19 Encoding (Human-Readable Formats)
|
|
212
|
+
```typescript
|
|
213
|
+
import { npubEncode, nsecEncode, noteEncode } from 'nostr-crypto-utils';
|
|
214
|
+
|
|
215
|
+
// Convert a hex public key to npub format
|
|
216
|
+
const hexPubkey = '12xyl6w6aacmqa3gmmzwrr9m3u0ldx3dwqhczuascswvew9am9q4sfg99cx';
|
|
217
|
+
const npub = npubEncode(hexPubkey);
|
|
218
|
+
console.log(npub); // npub1...
|
|
219
|
+
|
|
220
|
+
// Convert a hex private key to nsec format
|
|
221
|
+
const hexPrivkey = 'your-hex-private-key';
|
|
222
|
+
const nsec = nsecEncode(hexPrivkey);
|
|
223
|
+
console.log(nsec); // nsec1...
|
|
224
|
+
|
|
225
|
+
// Convert an event ID to note format
|
|
226
|
+
const eventId = 'your-event-id';
|
|
227
|
+
const note = noteEncode(eventId);
|
|
228
|
+
console.log(note); // note1...
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
#### Key Generation and Event Signing
|
|
232
|
+
```typescript
|
|
233
|
+
import { generateKeyPair, createEvent, signEvent } from 'nostr-crypto-utils';
|
|
234
|
+
|
|
235
|
+
// Generate a new key pair
|
|
236
|
+
const keyPair = generateKeyPair();
|
|
237
|
+
console.log(keyPair.publicKey, keyPair.privateKey);
|
|
238
|
+
|
|
239
|
+
// Create and sign an event
|
|
240
|
+
const event = createEvent({
|
|
241
|
+
pubkey: keyPair.publicKey,
|
|
242
|
+
kind: 1,
|
|
243
|
+
content: 'Hello Nostr!'
|
|
244
|
+
});
|
|
245
|
+
const signedEvent = signEvent(event, keyPair.privateKey);
|
|
246
|
+
```
|
|
247
|
+
|
|
202
248
|
### Schnorr Signature Examples
|
|
203
249
|
|
|
204
250
|
The library provides robust support for Schnorr signatures, which are fundamental to Nostr's cryptographic operations. Here are some common use cases:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(this.webpackChunkNostrCryptoUtils=this.webpackChunkNostrCryptoUtils||[]).push([[446],{8300:(t,i,e)=>{"use strict";var n=e(8510),r=e(3039),s=e(1565);new class{constructor(){this.cryptoInstance=null,this.initPromise=this.initialize()}async initialize(){this.cryptoInstance=await(async()=>{if("undefined"!=typeof window)return{};if(void 0!==e.g)return{};try{const t=await Promise.resolve().then(e.t.bind(e,1565,19));if(t.webcrypto)return t.webcrypto}catch{r.vF.debug("Node crypto not available, falling back to crypto-browserify")}return s})()}async ensureInitialized(){if(await this.initPromise,!this.cryptoInstance)throw new Error("Crypto implementation not initialized");return this.cryptoInstance}async getSubtle(){return(await this.ensureInitialized()).subtle}async getRandomValues(t){return(await this.ensureInitialized()).getRandomValues(t)}},n.ko.sign,n.ko.verify},5684:(t,i,e)=>{"use strict";e(3491),e(4710),e(8300),e(3983),e(965),e(8287).Buffer,e(8287).Buffer,e(8287).Buffer,e(1565).default,e(
|
|
1
|
+
(this.webpackChunkNostrCryptoUtils=this.webpackChunkNostrCryptoUtils||[]).push([[446],{8300:(t,i,e)=>{"use strict";var n=e(8510),r=e(3039),s=e(1565);new class{constructor(){this.cryptoInstance=null,this.initPromise=this.initialize()}async initialize(){this.cryptoInstance=await(async()=>{if("undefined"!=typeof window)return{};if(void 0!==e.g)return{};try{const t=await Promise.resolve().then(e.t.bind(e,1565,19));if(t.webcrypto)return t.webcrypto}catch{r.vF.debug("Node crypto not available, falling back to crypto-browserify")}return s})()}async ensureInitialized(){if(await this.initPromise,!this.cryptoInstance)throw new Error("Crypto implementation not initialized");return this.cryptoInstance}async getSubtle(){return(await this.ensureInitialized()).subtle}async getRandomValues(t){return(await this.ensureInitialized()).getRandomValues(t)}},n.ko.sign,n.ko.verify},5684:(t,i,e)=>{"use strict";e(3491),e(4710),e(8300),e(3983),e(965),e(8287).Buffer,e(8287).Buffer,e(8287).Buffer,e(1565).default,e(7916),e(3117)},8982:()=>{},7790:()=>{},1638:()=>{},2668:()=>{},7965:()=>{},6089:()=>{},9368:()=>{},4688:()=>{},1069:()=>{},3779:()=>{},7199:()=>{}}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunkNostrCryptoUtils=this.webpackChunkNostrCryptoUtils||[]).push([[682],{
|
|
1
|
+
"use strict";(this.webpackChunkNostrCryptoUtils=this.webpackChunkNostrCryptoUtils||[]).push([[682],{3117:(t,i,e)=>{e(7916),e(3039),e(4710),e(8300),e(8287).Buffer},4710:(t,i,e)=>{var n=e(3039),r=e(1565);new class{constructor(){this.cryptoInstance=null,this.initPromise=this.initialize()}async initialize(){this.cryptoInstance=await(async()=>{if("undefined"!=typeof window)return{};if(void 0!==e.g)return{};try{const t=await Promise.resolve().then(e.t.bind(e,1565,19));if(t.webcrypto)return t.webcrypto}catch{n.vF.debug("Node crypto not available, falling back to crypto-browserify")}return r})()}async ensureInitialized(){if(await this.initPromise,!this.cryptoInstance)throw new Error("Crypto implementation not initialized");return this.cryptoInstance}async getSubtle(){return(await this.ensureInitialized()).subtle}async getRandomValues(t){return(await this.ensureInitialized()).getRandomValues(t)}}},7916:(t,i,e)=>{e(2343),e(8287)}}]);
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -7,5 +7,6 @@ export { customCrypto, signSchnorr, verifySchnorrSignature, generateKeyPair, get
|
|
|
7
7
|
export { formatEventForRelay, formatSubscriptionForRelay, formatCloseForRelay, formatAuthForRelay, parseMessage as parseEventFromRelay, createMetadataEvent, createTextNoteEvent, createDirectMessageEvent, createChannelMessageEvent, extractReferencedEvents, extractMentionedPubkeys, createKindFilter, createAuthorFilter, createReplyFilter, createFilter as validateEvent } from './protocol/index';
|
|
8
8
|
export { validateEvent as validateRelayMessage, validateResponse as validateRelayResponse } from './validation/index';
|
|
9
9
|
export * from './encoding/index';
|
|
10
|
+
export { npubEncode, nsecEncode, noteEncode, nprofileEncode, neventEncode, naddrEncode, nrelayEncode, decode } from './nips/nip-19';
|
|
10
11
|
export * from './nips/index';
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,eAAe,CAAC;AAG9B,OAAO,EACL,YAAY,EACZ,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,eAAe,EACf,cAAc,EACd,cAAc,EACf,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,IAAI,mBAAmB,EACnC,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,IAAI,aAAa,EAC9B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,aAAa,IAAI,oBAAoB,EACrC,gBAAgB,IAAI,qBAAqB,EAC1C,MAAM,oBAAoB,CAAC;AAG5B,cAAc,kBAAkB,CAAC;AAGjC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,eAAe,CAAC;AAG9B,OAAO,EACL,YAAY,EACZ,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,eAAe,EACf,cAAc,EACd,cAAc,EACf,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,IAAI,mBAAmB,EACnC,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,IAAI,aAAa,EAC9B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,aAAa,IAAI,oBAAoB,EACrC,gBAAgB,IAAI,qBAAqB,EAC1C,MAAM,oBAAoB,CAAC;AAG5B,cAAc,kBAAkB,CAAC;AAGjC,OAAO,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,MAAM,EACP,MAAM,eAAe,CAAC;AAEvB,cAAc,cAAc,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -18,7 +18,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
18
18
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.validateRelayResponse = exports.validateRelayMessage = exports.validateEvent = exports.createReplyFilter = exports.createAuthorFilter = exports.createKindFilter = exports.extractMentionedPubkeys = exports.extractReferencedEvents = exports.createChannelMessageEvent = exports.createDirectMessageEvent = exports.createTextNoteEvent = exports.createMetadataEvent = exports.parseEventFromRelay = exports.formatAuthForRelay = exports.formatCloseForRelay = exports.formatSubscriptionForRelay = exports.formatEventForRelay = exports.decryptMessage = exports.encryptMessage = exports.verifySignature = exports.signEvent = exports.createEvent = exports.getSchnorrPublicKey = exports.getCompressedPublicKey = exports.validateKeyPair = exports.getPublicKey = exports.generateKeyPair = exports.verifySchnorrSignature = exports.signSchnorr = exports.customCrypto = void 0;
|
|
21
|
+
exports.decode = exports.nrelayEncode = exports.naddrEncode = exports.neventEncode = exports.nprofileEncode = exports.noteEncode = exports.nsecEncode = exports.npubEncode = exports.validateRelayResponse = exports.validateRelayMessage = exports.validateEvent = exports.createReplyFilter = exports.createAuthorFilter = exports.createKindFilter = exports.extractMentionedPubkeys = exports.extractReferencedEvents = exports.createChannelMessageEvent = exports.createDirectMessageEvent = exports.createTextNoteEvent = exports.createMetadataEvent = exports.parseEventFromRelay = exports.formatAuthForRelay = exports.formatCloseForRelay = exports.formatSubscriptionForRelay = exports.formatEventForRelay = exports.decryptMessage = exports.encryptMessage = exports.verifySignature = exports.signEvent = exports.createEvent = exports.getSchnorrPublicKey = exports.getCompressedPublicKey = exports.validateKeyPair = exports.getPublicKey = exports.generateKeyPair = exports.verifySchnorrSignature = exports.signSchnorr = exports.customCrypto = void 0;
|
|
22
22
|
// Re-export all types
|
|
23
23
|
__exportStar(require("./types/index"), exports);
|
|
24
24
|
// Re-export crypto utilities
|
|
@@ -60,5 +60,14 @@ Object.defineProperty(exports, "validateRelayResponse", { enumerable: true, get:
|
|
|
60
60
|
// Re-export encoding utilities
|
|
61
61
|
__exportStar(require("./encoding/index"), exports);
|
|
62
62
|
// Re-export NIP implementations
|
|
63
|
+
var nip_19_1 = require("./nips/nip-19");
|
|
64
|
+
Object.defineProperty(exports, "npubEncode", { enumerable: true, get: function () { return nip_19_1.npubEncode; } });
|
|
65
|
+
Object.defineProperty(exports, "nsecEncode", { enumerable: true, get: function () { return nip_19_1.nsecEncode; } });
|
|
66
|
+
Object.defineProperty(exports, "noteEncode", { enumerable: true, get: function () { return nip_19_1.noteEncode; } });
|
|
67
|
+
Object.defineProperty(exports, "nprofileEncode", { enumerable: true, get: function () { return nip_19_1.nprofileEncode; } });
|
|
68
|
+
Object.defineProperty(exports, "neventEncode", { enumerable: true, get: function () { return nip_19_1.neventEncode; } });
|
|
69
|
+
Object.defineProperty(exports, "naddrEncode", { enumerable: true, get: function () { return nip_19_1.naddrEncode; } });
|
|
70
|
+
Object.defineProperty(exports, "nrelayEncode", { enumerable: true, get: function () { return nip_19_1.nrelayEncode; } });
|
|
71
|
+
Object.defineProperty(exports, "decode", { enumerable: true, get: function () { return nip_19_1.decode; } });
|
|
63
72
|
__exportStar(require("./nips/index"), exports);
|
|
64
73
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;AAEH,sBAAsB;AACtB,gDAA8B;AAE9B,6BAA6B;AAC7B,+CAcwB;AAbtB,4GAAA,YAAY,OAAA;AACZ,2GAAA,WAAW,OAAA;AACX,sHAAA,sBAAsB,OAAA;AACtB,+GAAA,eAAe,OAAA;AACf,4GAAA,YAAY,OAAA;AACZ,+GAAA,eAAe,OAAA;AACf,sHAAA,sBAAsB,OAAA;AACtB,mHAAA,mBAAmB,OAAA;AACnB,2GAAA,WAAW,OAAA;AACX,yGAAA,SAAS,OAAA;AACT,+GAAA,eAAe,OAAA;AACf,8GAAA,cAAc,OAAA;AACd,8GAAA,cAAc,OAAA;AAGhB,+BAA+B;AAC/B,0CAgB0B;AAfxB,4GAAA,mBAAmB,OAAA;AACnB,mHAAA,0BAA0B,OAAA;AAC1B,4GAAA,mBAAmB,OAAA;AACnB,2GAAA,kBAAkB,OAAA;AAClB,4GAAA,YAAY,OAAuB;AACnC,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,iHAAA,wBAAwB,OAAA;AACxB,kHAAA,yBAAyB,OAAA;AACzB,gHAAA,uBAAuB,OAAA;AACvB,gHAAA,uBAAuB,OAAA;AACvB,yGAAA,gBAAgB,OAAA;AAChB,2GAAA,kBAAkB,OAAA;AAClB,0GAAA,iBAAiB,OAAA;AACjB,sGAAA,YAAY,OAAiB;AAG/B,iCAAiC;AACjC,4CAG4B;AAF1B,6GAAA,aAAa,OAAwB;AACrC,8GAAA,gBAAgB,OAAyB;AAG3C,+BAA+B;AAC/B,mDAAiC;AAEjC,gCAAgC;AAChC,+CAA6B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;AAEH,sBAAsB;AACtB,gDAA8B;AAE9B,6BAA6B;AAC7B,+CAcwB;AAbtB,4GAAA,YAAY,OAAA;AACZ,2GAAA,WAAW,OAAA;AACX,sHAAA,sBAAsB,OAAA;AACtB,+GAAA,eAAe,OAAA;AACf,4GAAA,YAAY,OAAA;AACZ,+GAAA,eAAe,OAAA;AACf,sHAAA,sBAAsB,OAAA;AACtB,mHAAA,mBAAmB,OAAA;AACnB,2GAAA,WAAW,OAAA;AACX,yGAAA,SAAS,OAAA;AACT,+GAAA,eAAe,OAAA;AACf,8GAAA,cAAc,OAAA;AACd,8GAAA,cAAc,OAAA;AAGhB,+BAA+B;AAC/B,0CAgB0B;AAfxB,4GAAA,mBAAmB,OAAA;AACnB,mHAAA,0BAA0B,OAAA;AAC1B,4GAAA,mBAAmB,OAAA;AACnB,2GAAA,kBAAkB,OAAA;AAClB,4GAAA,YAAY,OAAuB;AACnC,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,iHAAA,wBAAwB,OAAA;AACxB,kHAAA,yBAAyB,OAAA;AACzB,gHAAA,uBAAuB,OAAA;AACvB,gHAAA,uBAAuB,OAAA;AACvB,yGAAA,gBAAgB,OAAA;AAChB,2GAAA,kBAAkB,OAAA;AAClB,0GAAA,iBAAiB,OAAA;AACjB,sGAAA,YAAY,OAAiB;AAG/B,iCAAiC;AACjC,4CAG4B;AAF1B,6GAAA,aAAa,OAAwB;AACrC,8GAAA,gBAAgB,OAAyB;AAG3C,+BAA+B;AAC/B,mDAAiC;AAEjC,gCAAgC;AAChC,wCASuB;AARrB,oGAAA,UAAU,OAAA;AACV,oGAAA,UAAU,OAAA;AACV,oGAAA,UAAU,OAAA;AACV,wGAAA,cAAc,OAAA;AACd,sGAAA,YAAY,OAAA;AACZ,qGAAA,WAAW,OAAA;AACX,sGAAA,YAAY,OAAA;AACZ,gGAAA,MAAM,OAAA;AAGR,+CAA6B"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -7,5 +7,6 @@ export { customCrypto, signSchnorr, verifySchnorrSignature, generateKeyPair, get
|
|
|
7
7
|
export { formatEventForRelay, formatSubscriptionForRelay, formatCloseForRelay, formatAuthForRelay, parseMessage as parseEventFromRelay, createMetadataEvent, createTextNoteEvent, createDirectMessageEvent, createChannelMessageEvent, extractReferencedEvents, extractMentionedPubkeys, createKindFilter, createAuthorFilter, createReplyFilter, createFilter as validateEvent } from './protocol/index';
|
|
8
8
|
export { validateEvent as validateRelayMessage, validateResponse as validateRelayResponse } from './validation/index';
|
|
9
9
|
export * from './encoding/index';
|
|
10
|
+
export { npubEncode, nsecEncode, noteEncode, nprofileEncode, neventEncode, naddrEncode, nrelayEncode, decode } from './nips/nip-19';
|
|
10
11
|
export * from './nips/index';
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,eAAe,CAAC;AAG9B,OAAO,EACL,YAAY,EACZ,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,eAAe,EACf,cAAc,EACd,cAAc,EACf,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,IAAI,mBAAmB,EACnC,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,IAAI,aAAa,EAC9B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,aAAa,IAAI,oBAAoB,EACrC,gBAAgB,IAAI,qBAAqB,EAC1C,MAAM,oBAAoB,CAAC;AAG5B,cAAc,kBAAkB,CAAC;AAGjC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,eAAe,CAAC;AAG9B,OAAO,EACL,YAAY,EACZ,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,eAAe,EACf,cAAc,EACd,cAAc,EACf,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,IAAI,mBAAmB,EACnC,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,IAAI,aAAa,EAC9B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,aAAa,IAAI,oBAAoB,EACrC,gBAAgB,IAAI,qBAAqB,EAC1C,MAAM,oBAAoB,CAAC;AAG5B,cAAc,kBAAkB,CAAC;AAGjC,OAAO,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,MAAM,EACP,MAAM,eAAe,CAAC;AAEvB,cAAc,cAAc,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -13,5 +13,6 @@ export { validateEvent as validateRelayMessage, validateResponse as validateRela
|
|
|
13
13
|
// Re-export encoding utilities
|
|
14
14
|
export * from './encoding/index';
|
|
15
15
|
// Re-export NIP implementations
|
|
16
|
+
export { npubEncode, nsecEncode, noteEncode, nprofileEncode, neventEncode, naddrEncode, nrelayEncode, decode } from './nips/nip-19';
|
|
16
17
|
export * from './nips/index';
|
|
17
18
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sBAAsB;AACtB,cAAc,eAAe,CAAC;AAE9B,6BAA6B;AAC7B,OAAO,EACL,YAAY,EACZ,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,eAAe,EACf,cAAc,EACd,cAAc,EACf,MAAM,gBAAgB,CAAC;AAExB,+BAA+B;AAC/B,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,IAAI,mBAAmB,EACnC,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,IAAI,aAAa,EAC9B,MAAM,kBAAkB,CAAC;AAE1B,iCAAiC;AACjC,OAAO,EACL,aAAa,IAAI,oBAAoB,EACrC,gBAAgB,IAAI,qBAAqB,EAC1C,MAAM,oBAAoB,CAAC;AAE5B,+BAA+B;AAC/B,cAAc,kBAAkB,CAAC;AAEjC,gCAAgC;AAChC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,sBAAsB;AACtB,cAAc,eAAe,CAAC;AAE9B,6BAA6B;AAC7B,OAAO,EACL,YAAY,EACZ,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,WAAW,EACX,SAAS,EACT,eAAe,EACf,cAAc,EACd,cAAc,EACf,MAAM,gBAAgB,CAAC;AAExB,+BAA+B;AAC/B,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,IAAI,mBAAmB,EACnC,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,IAAI,aAAa,EAC9B,MAAM,kBAAkB,CAAC;AAE1B,iCAAiC;AACjC,OAAO,EACL,aAAa,IAAI,oBAAoB,EACrC,gBAAgB,IAAI,qBAAqB,EAC1C,MAAM,oBAAoB,CAAC;AAE5B,+BAA+B;AAC/B,cAAc,kBAAkB,CAAC;AAEjC,gCAAgC;AAChC,OAAO,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,MAAM,EACP,MAAM,eAAe,CAAC;AAEvB,cAAc,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nostr-crypto-utils",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "Cryptographic utilities for Nostr protocol",
|
|
3
|
+
"version": "0.4.12",
|
|
4
|
+
"description": "Cryptographic utilities for Nostr protocol, including key management, event signing, NIP-19 bech32 encoding (npub, nsec, note), and encrypted messaging",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
7
7
|
"module": "./dist/esm/index.js",
|
|
@@ -26,6 +26,11 @@
|
|
|
26
26
|
"import": "./dist/esm/protocol/index.js",
|
|
27
27
|
"require": "./dist/cjs/protocol/index.js",
|
|
28
28
|
"types": "./dist/esm/protocol/index.d.ts"
|
|
29
|
+
},
|
|
30
|
+
"./nips": {
|
|
31
|
+
"import": "./dist/esm/nips/index.js",
|
|
32
|
+
"require": "./dist/cjs/nips/index.js",
|
|
33
|
+
"types": "./dist/esm/nips/index.d.ts"
|
|
29
34
|
}
|
|
30
35
|
},
|
|
31
36
|
"files": [
|
package/src/index.ts
CHANGED
|
@@ -52,4 +52,15 @@ export {
|
|
|
52
52
|
export * from './encoding/index';
|
|
53
53
|
|
|
54
54
|
// Re-export NIP implementations
|
|
55
|
+
export {
|
|
56
|
+
npubEncode,
|
|
57
|
+
nsecEncode,
|
|
58
|
+
noteEncode,
|
|
59
|
+
nprofileEncode,
|
|
60
|
+
neventEncode,
|
|
61
|
+
naddrEncode,
|
|
62
|
+
nrelayEncode,
|
|
63
|
+
decode
|
|
64
|
+
} from './nips/nip-19';
|
|
65
|
+
|
|
55
66
|
export * from './nips/index';
|