ncc-02-js 0.2.3 → 0.2.5

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 CHANGED
@@ -26,12 +26,13 @@ npm install ncc-02-js
26
26
  import { NCC02Resolver } from 'ncc-02-js';
27
27
 
28
28
  // Initialize with relay URLs and optional trusted CA pubkeys
29
- const resolver = new NCC02Resolver(['wss://relay.damus.io'], {
30
- trustedCAPubkeys: ['ca_pubkey_hex']
29
+ const resolver = new NCC02Resolver(['wss://192.0.2.1:443'], {
30
+ trustedCAPubkeys: ['npub1...'] // Trusted third-party certifiers
31
31
  });
32
32
 
33
33
  try {
34
- const service = await resolver.resolve(ownerPubkey, 'api', {
34
+ // ownerPubkey can be hex or npub
35
+ const service = await resolver.resolve(ownerPubkey, 'media', {
35
36
  requireAttestation: true,
36
37
  minLevel: 'verified' // 'self', 'verified', 'hardened'
37
38
  });
@@ -46,6 +47,7 @@ try {
46
47
  ```javascript
47
48
  import { NCC02Builder } from 'ncc-02-js';
48
49
 
50
+ // Initialize with private key (hex)
49
51
  const builder = new NCC02Builder(privateKey);
50
52
 
51
53
  // Example 1: IP-based Service
@@ -71,8 +73,8 @@ const onionEvent = builder.createServiceRecord({
71
73
  ```javascript
72
74
  const caBuilder = new NCC02Builder(caPrivateKey);
73
75
  const attestation = caBuilder.createAttestation({
74
- subjectPubkey: ownerPubkey,
75
- serviceId: 'api',
76
+ subjectPubkey: 'npub1...', // The service owner being certified
77
+ serviceId: 'media',
76
78
  serviceEventId: serviceRecordEventId,
77
79
  level: 'verified',
78
80
  validDays: 30
package/dist/index.cjs CHANGED
@@ -7679,7 +7679,10 @@ var NCC02Resolver = class {
7679
7679
  * @param {string[]} relays - List of relay URLs.
7680
7680
  * @param {Object} [options={}]
7681
7681
  * @param {SimplePool} [options.pool] - Shared SimplePool instance.
7682
- * @param {string[]} [options.trustedCAPubkeys=[]] - List of trusted CA pubkeys.
7682
+ * @param {string[]} [options.trustedCAPubkeys=[]] - List of trusted CA pubkeys (hex or npub).
7683
+ * These are the ONLY pubkeys whose attestation signatures (Kind 30060) will be accepted
7684
+ * by the resolver. This allows you to define your own web of trust or rely on specific
7685
+ * community auditors. If empty, all attestations are ignored (effectively disabling attestation checks).
7683
7686
  */
7684
7687
  constructor(relays, options = {}) {
7685
7688
  if (!Array.isArray(relays)) {
package/dist/index.mjs CHANGED
@@ -7645,7 +7645,10 @@ var NCC02Resolver = class {
7645
7645
  * @param {string[]} relays - List of relay URLs.
7646
7646
  * @param {Object} [options={}]
7647
7647
  * @param {SimplePool} [options.pool] - Shared SimplePool instance.
7648
- * @param {string[]} [options.trustedCAPubkeys=[]] - List of trusted CA pubkeys.
7648
+ * @param {string[]} [options.trustedCAPubkeys=[]] - List of trusted CA pubkeys (hex or npub).
7649
+ * These are the ONLY pubkeys whose attestation signatures (Kind 30060) will be accepted
7650
+ * by the resolver. This allows you to define your own web of trust or rely on specific
7651
+ * community auditors. If empty, all attestations are ignored (effectively disabling attestation checks).
7649
7652
  */
7650
7653
  constructor(relays, options = {}) {
7651
7654
  if (!Array.isArray(relays)) {
@@ -29,7 +29,10 @@ export class NCC02Resolver {
29
29
  * @param {string[]} relays - List of relay URLs.
30
30
  * @param {Object} [options={}]
31
31
  * @param {SimplePool} [options.pool] - Shared SimplePool instance.
32
- * @param {string[]} [options.trustedCAPubkeys=[]] - List of trusted CA pubkeys.
32
+ * @param {string[]} [options.trustedCAPubkeys=[]] - List of trusted CA pubkeys (hex or npub).
33
+ * These are the ONLY pubkeys whose attestation signatures (Kind 30060) will be accepted
34
+ * by the resolver. This allows you to define your own web of trust or rely on specific
35
+ * community auditors. If empty, all attestations are ignored (effectively disabling attestation checks).
33
36
  */
34
37
  constructor(relays: string[], options?: {
35
38
  pool?: SimplePool;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ncc-02-js",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Nostr-native service discovery and trust implementation (NCC-02)",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
package/src/resolver.js CHANGED
@@ -36,7 +36,10 @@ export class NCC02Resolver {
36
36
  * @param {string[]} relays - List of relay URLs.
37
37
  * @param {Object} [options={}]
38
38
  * @param {SimplePool} [options.pool] - Shared SimplePool instance.
39
- * @param {string[]} [options.trustedCAPubkeys=[]] - List of trusted CA pubkeys.
39
+ * @param {string[]} [options.trustedCAPubkeys=[]] - List of trusted CA pubkeys (hex or npub).
40
+ * These are the ONLY pubkeys whose attestation signatures (Kind 30060) will be accepted
41
+ * by the resolver. This allows you to define your own web of trust or rely on specific
42
+ * community auditors. If empty, all attestations are ignored (effectively disabling attestation checks).
40
43
  */
41
44
  constructor(relays, options = {}) {
42
45
  if (!Array.isArray(relays)) {