ncc-02-js 0.2.3 → 0.2.4
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 +6 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,11 +27,12 @@ import { NCC02Resolver } from 'ncc-02-js';
|
|
|
27
27
|
|
|
28
28
|
// Initialize with relay URLs and optional trusted CA pubkeys
|
|
29
29
|
const resolver = new NCC02Resolver(['wss://relay.damus.io'], {
|
|
30
|
-
trustedCAPubkeys: ['
|
|
30
|
+
trustedCAPubkeys: ['npub1...'] // Trusted third-party certifiers
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
try {
|
|
34
|
-
|
|
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:
|
|
75
|
-
serviceId: '
|
|
76
|
+
subjectPubkey: 'npub1...', // The service owner being certified
|
|
77
|
+
serviceId: 'media',
|
|
76
78
|
serviceEventId: serviceRecordEventId,
|
|
77
79
|
level: 'verified',
|
|
78
80
|
validDays: 30
|