@metalabel/dfos-protocol 0.10.0 → 0.12.0
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 +7 -7
- package/dist/chain/index.d.ts +28 -31
- package/dist/chain/index.js +29 -9
- package/dist/{chunk-GQOZJKKO.js → chunk-4QQ5HK5M.js} +7 -3
- package/dist/{chunk-LQFOBE6X.js → chunk-J3XXF6F5.js} +18 -15
- package/dist/{chunk-GZ7ZAIRD.js → chunk-J5C4OXL4.js} +154 -103
- package/dist/credentials/index.d.ts +17 -6
- package/dist/credentials/index.js +4 -2
- package/dist/crypto/index.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +31 -9
- package/dist/schemas-Bb_9P8_s.d.ts +213 -0
- package/examples/identity-services.json +38 -0
- package/package.json +2 -2
- package/dist/schemas-BhikXSf_.d.ts +0 -146
- package/examples/beacon.json +0 -14
- package/schemas/manifest.v1.json +0 -29
package/dist/index.js
CHANGED
|
@@ -1,30 +1,40 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ARTIFACT_CID_ANCHOR_RE,
|
|
2
3
|
ArtifactPayload,
|
|
3
|
-
|
|
4
|
+
CONTENT_ID_ANCHOR_RE,
|
|
4
5
|
ContentOperation,
|
|
5
6
|
CountersignPayload,
|
|
6
7
|
IdentityOperation,
|
|
7
8
|
MAX_ARTIFACT_PAYLOAD_SIZE,
|
|
9
|
+
MAX_OPERATION_SIZE,
|
|
10
|
+
MAX_SERVICES_ENTRIES,
|
|
11
|
+
MAX_SERVICES_PAYLOAD_SIZE,
|
|
8
12
|
MultikeyPublicKey,
|
|
13
|
+
RECOGNIZED_SERVICE_TYPES,
|
|
9
14
|
RevocationPayload,
|
|
15
|
+
ServiceEntry,
|
|
16
|
+
ServicesArray,
|
|
10
17
|
VerifiedIdentity,
|
|
18
|
+
anchorsByLabel,
|
|
19
|
+
assertServicesWithinCap,
|
|
20
|
+
classifyAnchor,
|
|
11
21
|
deriveChainIdentifier,
|
|
12
22
|
deriveContentId,
|
|
23
|
+
isRecognizedServiceType,
|
|
24
|
+
relayEndpoints,
|
|
13
25
|
signArtifact,
|
|
14
|
-
signBeacon,
|
|
15
26
|
signContentOperation,
|
|
16
27
|
signCountersignature,
|
|
17
28
|
signIdentityOperation,
|
|
18
29
|
signRevocation,
|
|
19
30
|
verifyArtifact,
|
|
20
|
-
verifyBeacon,
|
|
21
31
|
verifyContentChain,
|
|
22
32
|
verifyContentExtensionFromTrustedState,
|
|
23
33
|
verifyCountersignature,
|
|
24
34
|
verifyIdentityChain,
|
|
25
35
|
verifyIdentityExtensionFromTrustedState,
|
|
26
36
|
verifyRevocation
|
|
27
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-J5C4OXL4.js";
|
|
28
38
|
import {
|
|
29
39
|
Attenuation,
|
|
30
40
|
AuthTokenClaims,
|
|
@@ -33,6 +43,7 @@ import {
|
|
|
33
43
|
DFOSCredentialPayload,
|
|
34
44
|
ED25519_PRIV_MULTICODEC,
|
|
35
45
|
ED25519_PUB_MULTICODEC,
|
|
46
|
+
MAX_CREDENTIAL_SIZE,
|
|
36
47
|
createAuthToken,
|
|
37
48
|
createDFOSCredential,
|
|
38
49
|
decodeDFOSCredentialUnsafe,
|
|
@@ -43,7 +54,7 @@ import {
|
|
|
43
54
|
verifyAuthToken,
|
|
44
55
|
verifyDFOSCredential,
|
|
45
56
|
verifyDelegationChain
|
|
46
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-J3XXF6F5.js";
|
|
47
58
|
import {
|
|
48
59
|
JwsVerificationError,
|
|
49
60
|
JwtVerificationError,
|
|
@@ -67,13 +78,14 @@ import {
|
|
|
67
78
|
signPayloadEd25519,
|
|
68
79
|
verifyJws,
|
|
69
80
|
verifyJwt
|
|
70
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-4QQ5HK5M.js";
|
|
71
82
|
export {
|
|
83
|
+
ARTIFACT_CID_ANCHOR_RE,
|
|
72
84
|
ArtifactPayload,
|
|
73
85
|
Attenuation,
|
|
74
86
|
AuthTokenClaims,
|
|
75
87
|
AuthTokenVerificationError,
|
|
76
|
-
|
|
88
|
+
CONTENT_ID_ANCHOR_RE,
|
|
77
89
|
ContentOperation,
|
|
78
90
|
CountersignPayload,
|
|
79
91
|
CredentialVerificationError,
|
|
@@ -84,12 +96,22 @@ export {
|
|
|
84
96
|
JwsVerificationError,
|
|
85
97
|
JwtVerificationError,
|
|
86
98
|
MAX_ARTIFACT_PAYLOAD_SIZE,
|
|
99
|
+
MAX_CREDENTIAL_SIZE,
|
|
100
|
+
MAX_OPERATION_SIZE,
|
|
101
|
+
MAX_SERVICES_ENTRIES,
|
|
102
|
+
MAX_SERVICES_PAYLOAD_SIZE,
|
|
87
103
|
MultikeyPublicKey,
|
|
104
|
+
RECOGNIZED_SERVICE_TYPES,
|
|
88
105
|
RevocationPayload,
|
|
106
|
+
ServiceEntry,
|
|
107
|
+
ServicesArray,
|
|
89
108
|
VerifiedIdentity,
|
|
109
|
+
anchorsByLabel,
|
|
90
110
|
assertJwsProfile,
|
|
111
|
+
assertServicesWithinCap,
|
|
91
112
|
base64urlDecode,
|
|
92
113
|
base64urlEncode,
|
|
114
|
+
classifyAnchor,
|
|
93
115
|
createAuthToken,
|
|
94
116
|
createDFOSCredential,
|
|
95
117
|
createJws,
|
|
@@ -108,13 +130,14 @@ export {
|
|
|
108
130
|
importEd25519Keypair,
|
|
109
131
|
isAttenuated,
|
|
110
132
|
isCanonicallyEqual,
|
|
133
|
+
isRecognizedServiceType,
|
|
111
134
|
isValidEd25519Signature,
|
|
112
135
|
isValidId,
|
|
113
136
|
matchesResource,
|
|
114
137
|
normalizedId,
|
|
115
138
|
parseDagCborCID,
|
|
139
|
+
relayEndpoints,
|
|
116
140
|
signArtifact,
|
|
117
|
-
signBeacon,
|
|
118
141
|
signContentOperation,
|
|
119
142
|
signCountersignature,
|
|
120
143
|
signIdentityOperation,
|
|
@@ -122,7 +145,6 @@ export {
|
|
|
122
145
|
signRevocation,
|
|
123
146
|
verifyArtifact,
|
|
124
147
|
verifyAuthToken,
|
|
125
|
-
verifyBeacon,
|
|
126
148
|
verifyContentChain,
|
|
127
149
|
verifyContentExtensionFromTrustedState,
|
|
128
150
|
verifyCountersignature,
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/** Function that signs a byte array and returns a signature */
|
|
4
|
+
type Signer = (message: Uint8Array) => Promise<Uint8Array>;
|
|
5
|
+
/**
|
|
6
|
+
* Max number of service entries in an identity's services state — a generous
|
|
7
|
+
* cardinality ceiling on resolution fan-out. Individual entry fields are NOT
|
|
8
|
+
* separately length-capped (no per-field length zoo): the aggregate byte cap
|
|
9
|
+
* below, plus the operation-size cap, bound entry size. The op-size cap is the
|
|
10
|
+
* real arbiter when services and keys are both large.
|
|
11
|
+
*/
|
|
12
|
+
declare const MAX_SERVICES_ENTRIES = 256;
|
|
13
|
+
/**
|
|
14
|
+
* Max CBOR-encoded size of the services array (bytes) — the SINGLE aggregate that
|
|
15
|
+
* bounds the services manifest, replacing the former per-field length caps (the
|
|
16
|
+
* same collapse the op-size cap applied at the operation level). Sized so the
|
|
17
|
+
* 256-entry ceiling is genuinely reachable with realistic entries.
|
|
18
|
+
*/
|
|
19
|
+
declare const MAX_SERVICES_PAYLOAD_SIZE = 32768;
|
|
20
|
+
/**
|
|
21
|
+
* Max dag-cbor-encoded size of a single protocol operation payload (bytes) — the
|
|
22
|
+
* one aggregate validity bound on operation size, measured over the exact bytes
|
|
23
|
+
* the CID commits to. Generously set (64 KiB) so it never binds a legitimate
|
|
24
|
+
* proof-layer operation while bounding decode/verify cost (a DoS + determinism
|
|
25
|
+
* invariant). This is a VALIDITY-determining cap: it MUST be identical across
|
|
26
|
+
* implementations. Large binary media does NOT travel in operation payloads —
|
|
27
|
+
* it is referenced, not inlined — so this bound is about proof-layer ops only.
|
|
28
|
+
*/
|
|
29
|
+
declare const MAX_OPERATION_SIZE = 65536;
|
|
30
|
+
declare const MultikeyPublicKey: z.ZodObject<{
|
|
31
|
+
id: z.ZodString;
|
|
32
|
+
type: z.ZodLiteral<"Multikey">;
|
|
33
|
+
publicKeyMultibase: z.ZodString;
|
|
34
|
+
}, z.core.$loose>;
|
|
35
|
+
type MultikeyPublicKey = z.infer<typeof MultikeyPublicKey>;
|
|
36
|
+
/**
|
|
37
|
+
* Anchor target shapes — a ContentAnchor references a STABLE content
|
|
38
|
+
* identifier, dispatched by structural form:
|
|
39
|
+
* - 31-char contentId (content chain) → mutable, gateable
|
|
40
|
+
* - CIDv1 base32 (artifact) → immutable, public
|
|
41
|
+
* Both are stable; a chain HEAD CID (also base32 but resolves to a non-artifact
|
|
42
|
+
* op) is rejected by the shape-dispatch + resolution type check, never anchored.
|
|
43
|
+
*/
|
|
44
|
+
declare const CONTENT_ID_ANCHOR_RE: RegExp;
|
|
45
|
+
declare const ARTIFACT_CID_ANCHOR_RE: RegExp;
|
|
46
|
+
/**
|
|
47
|
+
* Service entry — discovery vocabulary in identity-chain state.
|
|
48
|
+
*
|
|
49
|
+
* Open namespace: `type` is an arbitrary bounded string. Recognized types
|
|
50
|
+
* (`DfosRelay`, `ContentAnchor`) are structurally validated; UNRECOGNIZED types
|
|
51
|
+
* are preserved verbatim and ignored (MUST-ignore-unknown) — only the common
|
|
52
|
+
* envelope (id + type) and the byte cap apply. New service types therefore
|
|
53
|
+
* never require a protocol/cross-language change.
|
|
54
|
+
*/
|
|
55
|
+
declare const ServiceEntry: z.ZodObject<{
|
|
56
|
+
id: z.ZodString;
|
|
57
|
+
type: z.ZodString;
|
|
58
|
+
}, z.core.$catchall<z.ZodUnknown>>;
|
|
59
|
+
type ServiceEntry = z.infer<typeof ServiceEntry>;
|
|
60
|
+
/** Identity services state — full-state, bounded, unique entry ids */
|
|
61
|
+
declare const ServicesArray: z.ZodArray<z.ZodObject<{
|
|
62
|
+
id: z.ZodString;
|
|
63
|
+
type: z.ZodString;
|
|
64
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
65
|
+
type ServicesArray = z.infer<typeof ServicesArray>;
|
|
66
|
+
declare const IdentityOperation: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
67
|
+
version: z.ZodLiteral<1>;
|
|
68
|
+
type: z.ZodLiteral<"create">;
|
|
69
|
+
authKeys: z.ZodArray<z.ZodObject<{
|
|
70
|
+
id: z.ZodString;
|
|
71
|
+
type: z.ZodLiteral<"Multikey">;
|
|
72
|
+
publicKeyMultibase: z.ZodString;
|
|
73
|
+
}, z.core.$loose>>;
|
|
74
|
+
assertKeys: z.ZodArray<z.ZodObject<{
|
|
75
|
+
id: z.ZodString;
|
|
76
|
+
type: z.ZodLiteral<"Multikey">;
|
|
77
|
+
publicKeyMultibase: z.ZodString;
|
|
78
|
+
}, z.core.$loose>>;
|
|
79
|
+
controllerKeys: z.ZodArray<z.ZodObject<{
|
|
80
|
+
id: z.ZodString;
|
|
81
|
+
type: z.ZodLiteral<"Multikey">;
|
|
82
|
+
publicKeyMultibase: z.ZodString;
|
|
83
|
+
}, z.core.$loose>>;
|
|
84
|
+
services: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
85
|
+
id: z.ZodString;
|
|
86
|
+
type: z.ZodString;
|
|
87
|
+
}, z.core.$catchall<z.ZodUnknown>>>>;
|
|
88
|
+
createdAt: z.ZodISODateTime;
|
|
89
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
90
|
+
version: z.ZodLiteral<1>;
|
|
91
|
+
type: z.ZodLiteral<"update">;
|
|
92
|
+
previousOperationCID: z.ZodString;
|
|
93
|
+
authKeys: z.ZodArray<z.ZodObject<{
|
|
94
|
+
id: z.ZodString;
|
|
95
|
+
type: z.ZodLiteral<"Multikey">;
|
|
96
|
+
publicKeyMultibase: z.ZodString;
|
|
97
|
+
}, z.core.$loose>>;
|
|
98
|
+
assertKeys: z.ZodArray<z.ZodObject<{
|
|
99
|
+
id: z.ZodString;
|
|
100
|
+
type: z.ZodLiteral<"Multikey">;
|
|
101
|
+
publicKeyMultibase: z.ZodString;
|
|
102
|
+
}, z.core.$loose>>;
|
|
103
|
+
controllerKeys: z.ZodArray<z.ZodObject<{
|
|
104
|
+
id: z.ZodString;
|
|
105
|
+
type: z.ZodLiteral<"Multikey">;
|
|
106
|
+
publicKeyMultibase: z.ZodString;
|
|
107
|
+
}, z.core.$loose>>;
|
|
108
|
+
services: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
109
|
+
id: z.ZodString;
|
|
110
|
+
type: z.ZodString;
|
|
111
|
+
}, z.core.$catchall<z.ZodUnknown>>>>;
|
|
112
|
+
createdAt: z.ZodISODateTime;
|
|
113
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
114
|
+
version: z.ZodLiteral<1>;
|
|
115
|
+
type: z.ZodLiteral<"delete">;
|
|
116
|
+
previousOperationCID: z.ZodString;
|
|
117
|
+
createdAt: z.ZodISODateTime;
|
|
118
|
+
}, z.core.$loose>], "type">;
|
|
119
|
+
type IdentityOperation = z.infer<typeof IdentityOperation>;
|
|
120
|
+
declare const VerifiedIdentity: z.ZodObject<{
|
|
121
|
+
did: z.ZodString;
|
|
122
|
+
isDeleted: z.ZodBoolean;
|
|
123
|
+
authKeys: z.ZodArray<z.ZodObject<{
|
|
124
|
+
id: z.ZodString;
|
|
125
|
+
type: z.ZodLiteral<"Multikey">;
|
|
126
|
+
publicKeyMultibase: z.ZodString;
|
|
127
|
+
}, z.core.$loose>>;
|
|
128
|
+
assertKeys: z.ZodArray<z.ZodObject<{
|
|
129
|
+
id: z.ZodString;
|
|
130
|
+
type: z.ZodLiteral<"Multikey">;
|
|
131
|
+
publicKeyMultibase: z.ZodString;
|
|
132
|
+
}, z.core.$loose>>;
|
|
133
|
+
controllerKeys: z.ZodArray<z.ZodObject<{
|
|
134
|
+
id: z.ZodString;
|
|
135
|
+
type: z.ZodLiteral<"Multikey">;
|
|
136
|
+
publicKeyMultibase: z.ZodString;
|
|
137
|
+
}, z.core.$loose>>;
|
|
138
|
+
services: z.ZodArray<z.ZodObject<{
|
|
139
|
+
id: z.ZodString;
|
|
140
|
+
type: z.ZodString;
|
|
141
|
+
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
142
|
+
}, z.core.$strict>;
|
|
143
|
+
type VerifiedIdentity = z.infer<typeof VerifiedIdentity>;
|
|
144
|
+
declare const ContentOperation: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
145
|
+
version: z.ZodLiteral<1>;
|
|
146
|
+
type: z.ZodLiteral<"create">;
|
|
147
|
+
did: z.ZodString;
|
|
148
|
+
documentCID: z.ZodString;
|
|
149
|
+
baseDocumentCID: z.ZodNullable<z.ZodString>;
|
|
150
|
+
createdAt: z.ZodISODateTime;
|
|
151
|
+
note: z.ZodNullable<z.ZodString>;
|
|
152
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
153
|
+
version: z.ZodLiteral<1>;
|
|
154
|
+
type: z.ZodLiteral<"update">;
|
|
155
|
+
did: z.ZodString;
|
|
156
|
+
previousOperationCID: z.ZodString;
|
|
157
|
+
documentCID: z.ZodNullable<z.ZodString>;
|
|
158
|
+
baseDocumentCID: z.ZodNullable<z.ZodString>;
|
|
159
|
+
createdAt: z.ZodISODateTime;
|
|
160
|
+
note: z.ZodNullable<z.ZodString>;
|
|
161
|
+
authorization: z.ZodOptional<z.ZodString>;
|
|
162
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
163
|
+
version: z.ZodLiteral<1>;
|
|
164
|
+
type: z.ZodLiteral<"delete">;
|
|
165
|
+
did: z.ZodString;
|
|
166
|
+
previousOperationCID: z.ZodString;
|
|
167
|
+
createdAt: z.ZodISODateTime;
|
|
168
|
+
note: z.ZodNullable<z.ZodString>;
|
|
169
|
+
authorization: z.ZodOptional<z.ZodString>;
|
|
170
|
+
}, z.core.$loose>], "type">;
|
|
171
|
+
type ContentOperation = z.infer<typeof ContentOperation>;
|
|
172
|
+
/** Max CBOR-encoded payload size for artifacts (bytes) — protocol constant */
|
|
173
|
+
declare const MAX_ARTIFACT_PAYLOAD_SIZE = 16384;
|
|
174
|
+
/** Artifact: standalone signed inline document, immutable, CID-addressable */
|
|
175
|
+
declare const ArtifactPayload: z.ZodObject<{
|
|
176
|
+
version: z.ZodLiteral<1>;
|
|
177
|
+
type: z.ZodLiteral<"artifact">;
|
|
178
|
+
did: z.ZodString;
|
|
179
|
+
content: z.ZodObject<{
|
|
180
|
+
$schema: z.ZodString;
|
|
181
|
+
}, z.core.$catchall<z.ZodUnknown>>;
|
|
182
|
+
createdAt: z.ZodISODateTime;
|
|
183
|
+
}, z.core.$loose>;
|
|
184
|
+
type ArtifactPayload = z.infer<typeof ArtifactPayload>;
|
|
185
|
+
/**
|
|
186
|
+
* Countersign: standalone witness attestation referencing a target operation by CID.
|
|
187
|
+
*
|
|
188
|
+
* `relation` is an OPEN-namespace tag naming the nature of the attestation
|
|
189
|
+
* (e.g. `coauthors`, `endorses`, `witnessed`, `holds`, `received`). It is an
|
|
190
|
+
* arbitrary bounded string — recognized values carry social meaning to clients,
|
|
191
|
+
* unrecognized values MUST be preserved and ignored. Optional, so a bare witness
|
|
192
|
+
* attestation (no relation) encodes identically (CID-neutral).
|
|
193
|
+
*/
|
|
194
|
+
declare const CountersignPayload: z.ZodObject<{
|
|
195
|
+
version: z.ZodLiteral<1>;
|
|
196
|
+
type: z.ZodLiteral<"countersign">;
|
|
197
|
+
did: z.ZodString;
|
|
198
|
+
targetCID: z.ZodString;
|
|
199
|
+
relation: z.ZodOptional<z.ZodString>;
|
|
200
|
+
createdAt: z.ZodISODateTime;
|
|
201
|
+
}, z.core.$loose>;
|
|
202
|
+
type CountersignPayload = z.infer<typeof CountersignPayload>;
|
|
203
|
+
/** Revocation: signed credential revocation artifact, gossiped on the proof plane */
|
|
204
|
+
declare const RevocationPayload: z.ZodObject<{
|
|
205
|
+
version: z.ZodLiteral<1>;
|
|
206
|
+
type: z.ZodLiteral<"revocation">;
|
|
207
|
+
did: z.ZodString;
|
|
208
|
+
credentialCID: z.ZodString;
|
|
209
|
+
createdAt: z.ZodISODateTime;
|
|
210
|
+
}, z.core.$loose>;
|
|
211
|
+
type RevocationPayload = z.infer<typeof RevocationPayload>;
|
|
212
|
+
|
|
213
|
+
export { ARTIFACT_CID_ANCHOR_RE as A, CONTENT_ID_ANCHOR_RE as C, IdentityOperation as I, MAX_ARTIFACT_PAYLOAD_SIZE as M, RevocationPayload as R, ServiceEntry as S, VerifiedIdentity as V, ArtifactPayload as a, ContentOperation as b, CountersignPayload as c, MAX_OPERATION_SIZE as d, MAX_SERVICES_ENTRIES as e, MAX_SERVICES_PAYLOAD_SIZE as f, MultikeyPublicKey as g, ServicesArray as h, type Signer as i };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Identity chain: genesis publishing a services set (relay locator + content/artifact anchors)",
|
|
3
|
+
"type": "identity",
|
|
4
|
+
"chain": [
|
|
5
|
+
"eyJhbGciOiJFZERTQSIsInR5cCI6ImRpZDpkZm9zOmlkZW50aXR5LW9wIiwia2lkIjoia2V5X3I5ZXYzNGZ2YzIzejk5OXZlYWFmdDgzbm4yOXp2aGUiLCJjaWQiOiJiYWZ5cmVpZGkzcXBzM3F0dHFwMjJtM3kzM2JkYmYyaXlrYnE1cjQ1ampod2EzN21nZXNvdjdzZGd6ZSJ9.eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiY3JlYXRlIiwiYXV0aEtleXMiOlt7ImlkIjoia2V5X3I5ZXYzNGZ2YzIzejk5OXZlYWFmdDgzbm4yOXp2aGUiLCJ0eXBlIjoiTXVsdGlrZXkiLCJwdWJsaWNLZXlNdWx0aWJhc2UiOiJ6Nk1rcnpMTU53b0pTVjRQM1ljY1djYnRrOHZkOUx0Z01LbkxlYURMVXFMdUFTamIifV0sImFzc2VydEtleXMiOlt7ImlkIjoia2V5X3I5ZXYzNGZ2YzIzejk5OXZlYWFmdDgzbm4yOXp2aGUiLCJ0eXBlIjoiTXVsdGlrZXkiLCJwdWJsaWNLZXlNdWx0aWJhc2UiOiJ6Nk1rcnpMTU53b0pTVjRQM1ljY1djYnRrOHZkOUx0Z01LbkxlYURMVXFMdUFTamIifV0sImNvbnRyb2xsZXJLZXlzIjpbeyJpZCI6ImtleV9yOWV2MzRmdmMyM3o5OTl2ZWFhZnQ4M25uMjl6dmhlIiwidHlwZSI6Ik11bHRpa2V5IiwicHVibGljS2V5TXVsdGliYXNlIjoiejZNa3J6TE1Od29KU1Y0UDNZY2NXY2J0azh2ZDlMdGdNS25MZWFETFVxTHVBU2piIn1dLCJzZXJ2aWNlcyI6W3siaWQiOiJyZWxheSIsInR5cGUiOiJEZm9zUmVsYXkiLCJlbmRwb2ludCI6Imh0dHBzOi8vcmVsYXkuZGZvcy5jb20ifSx7ImlkIjoicHJvZmlsZSIsInR5cGUiOiJDb250ZW50QW5jaG9yIiwibGFiZWwiOiJwcm9maWxlIiwiYW5jaG9yIjoiY3Y3bjh2a3ZyNjRjY3RmMzI5NGg5azRlYW5oZmY4eiJ9LHsiaWQiOiJhdmF0YXIiLCJ0eXBlIjoiQ29udGVudEFuY2hvciIsImxhYmVsIjoiYXZhdGFyIiwiYW5jaG9yIjoiYmFmeXJlaWV2Y3FybXZ0ejJwaXM1dGRpenQ3c2pvdG9xcW9nbDZ2cnJxZ2E2NHcydG53a3Eycm51ZHkifV0sImNyZWF0ZWRBdCI6IjIwMjYtMDMtMDdUMDA6MDU6MDAuMDAwWiJ9.HCzVJXcUzL62lxtC8omBlit1JNSWk4b4kQKjjjWT00honzZ9-k3dKusIRuhTV6gjT1M74bLVZYUxPb8kJvhHAw"
|
|
6
|
+
],
|
|
7
|
+
"controllerPublicKey": "z6MkrzLMNwoJSV4P3YccWcbtk8vd9LtgMKnLeaDLUqLuASjb",
|
|
8
|
+
"expected": {
|
|
9
|
+
"did": "did:dfos:zhkrrzrd7z623ha8tt7dt699de8r3ar",
|
|
10
|
+
"isDeleted": false,
|
|
11
|
+
"controllerKeys": [
|
|
12
|
+
{
|
|
13
|
+
"id": "key_r9ev34fvc23z999veaaft83nn29zvhe",
|
|
14
|
+
"type": "Multikey",
|
|
15
|
+
"publicKeyMultibase": "z6MkrzLMNwoJSV4P3YccWcbtk8vd9LtgMKnLeaDLUqLuASjb"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"services": [
|
|
19
|
+
{
|
|
20
|
+
"id": "relay",
|
|
21
|
+
"type": "DfosRelay",
|
|
22
|
+
"endpoint": "https://relay.dfos.com"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"id": "profile",
|
|
26
|
+
"type": "ContentAnchor",
|
|
27
|
+
"label": "profile",
|
|
28
|
+
"anchor": "cv7n8vkvr64cctf3294h9k4eanhff8z"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"id": "avatar",
|
|
32
|
+
"type": "ContentAnchor",
|
|
33
|
+
"label": "avatar",
|
|
34
|
+
"anchor": "bafyreievcqrmvtz2pis5tdizt7sjotoqqogl6vrrqga64w2tnwkq2rnudy"
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metalabel/dfos-protocol",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "DFOS Protocol — Ed25519 signed chain primitives,
|
|
5
|
+
"description": "DFOS Protocol — Ed25519 signed chain primitives, services, credentials, and verification",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Metalabel <hello@metalabel.com> (https://metalabel.com)",
|
|
8
8
|
"repository": {
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
/** Function that signs a byte array and returns a signature */
|
|
4
|
-
type Signer = (message: Uint8Array) => Promise<Uint8Array>;
|
|
5
|
-
declare const MultikeyPublicKey: z.ZodObject<{
|
|
6
|
-
id: z.ZodString;
|
|
7
|
-
type: z.ZodLiteral<"Multikey">;
|
|
8
|
-
publicKeyMultibase: z.ZodString;
|
|
9
|
-
}, z.core.$strict>;
|
|
10
|
-
type MultikeyPublicKey = z.infer<typeof MultikeyPublicKey>;
|
|
11
|
-
declare const IdentityOperation: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
12
|
-
version: z.ZodLiteral<1>;
|
|
13
|
-
type: z.ZodLiteral<"create">;
|
|
14
|
-
authKeys: z.ZodArray<z.ZodObject<{
|
|
15
|
-
id: z.ZodString;
|
|
16
|
-
type: z.ZodLiteral<"Multikey">;
|
|
17
|
-
publicKeyMultibase: z.ZodString;
|
|
18
|
-
}, z.core.$strict>>;
|
|
19
|
-
assertKeys: z.ZodArray<z.ZodObject<{
|
|
20
|
-
id: z.ZodString;
|
|
21
|
-
type: z.ZodLiteral<"Multikey">;
|
|
22
|
-
publicKeyMultibase: z.ZodString;
|
|
23
|
-
}, z.core.$strict>>;
|
|
24
|
-
controllerKeys: z.ZodArray<z.ZodObject<{
|
|
25
|
-
id: z.ZodString;
|
|
26
|
-
type: z.ZodLiteral<"Multikey">;
|
|
27
|
-
publicKeyMultibase: z.ZodString;
|
|
28
|
-
}, z.core.$strict>>;
|
|
29
|
-
createdAt: z.ZodISODateTime;
|
|
30
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
31
|
-
version: z.ZodLiteral<1>;
|
|
32
|
-
type: z.ZodLiteral<"update">;
|
|
33
|
-
previousOperationCID: z.ZodString;
|
|
34
|
-
authKeys: z.ZodArray<z.ZodObject<{
|
|
35
|
-
id: z.ZodString;
|
|
36
|
-
type: z.ZodLiteral<"Multikey">;
|
|
37
|
-
publicKeyMultibase: z.ZodString;
|
|
38
|
-
}, z.core.$strict>>;
|
|
39
|
-
assertKeys: z.ZodArray<z.ZodObject<{
|
|
40
|
-
id: z.ZodString;
|
|
41
|
-
type: z.ZodLiteral<"Multikey">;
|
|
42
|
-
publicKeyMultibase: z.ZodString;
|
|
43
|
-
}, z.core.$strict>>;
|
|
44
|
-
controllerKeys: z.ZodArray<z.ZodObject<{
|
|
45
|
-
id: z.ZodString;
|
|
46
|
-
type: z.ZodLiteral<"Multikey">;
|
|
47
|
-
publicKeyMultibase: z.ZodString;
|
|
48
|
-
}, z.core.$strict>>;
|
|
49
|
-
createdAt: z.ZodISODateTime;
|
|
50
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
51
|
-
version: z.ZodLiteral<1>;
|
|
52
|
-
type: z.ZodLiteral<"delete">;
|
|
53
|
-
previousOperationCID: z.ZodString;
|
|
54
|
-
createdAt: z.ZodISODateTime;
|
|
55
|
-
}, z.core.$strict>], "type">;
|
|
56
|
-
type IdentityOperation = z.infer<typeof IdentityOperation>;
|
|
57
|
-
declare const VerifiedIdentity: z.ZodObject<{
|
|
58
|
-
did: z.ZodString;
|
|
59
|
-
isDeleted: z.ZodBoolean;
|
|
60
|
-
authKeys: z.ZodArray<z.ZodObject<{
|
|
61
|
-
id: z.ZodString;
|
|
62
|
-
type: z.ZodLiteral<"Multikey">;
|
|
63
|
-
publicKeyMultibase: z.ZodString;
|
|
64
|
-
}, z.core.$strict>>;
|
|
65
|
-
assertKeys: z.ZodArray<z.ZodObject<{
|
|
66
|
-
id: z.ZodString;
|
|
67
|
-
type: z.ZodLiteral<"Multikey">;
|
|
68
|
-
publicKeyMultibase: z.ZodString;
|
|
69
|
-
}, z.core.$strict>>;
|
|
70
|
-
controllerKeys: z.ZodArray<z.ZodObject<{
|
|
71
|
-
id: z.ZodString;
|
|
72
|
-
type: z.ZodLiteral<"Multikey">;
|
|
73
|
-
publicKeyMultibase: z.ZodString;
|
|
74
|
-
}, z.core.$strict>>;
|
|
75
|
-
}, z.core.$strict>;
|
|
76
|
-
type VerifiedIdentity = z.infer<typeof VerifiedIdentity>;
|
|
77
|
-
declare const ContentOperation: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
78
|
-
version: z.ZodLiteral<1>;
|
|
79
|
-
type: z.ZodLiteral<"create">;
|
|
80
|
-
did: z.ZodString;
|
|
81
|
-
documentCID: z.ZodString;
|
|
82
|
-
baseDocumentCID: z.ZodNullable<z.ZodString>;
|
|
83
|
-
createdAt: z.ZodISODateTime;
|
|
84
|
-
note: z.ZodNullable<z.ZodString>;
|
|
85
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
86
|
-
version: z.ZodLiteral<1>;
|
|
87
|
-
type: z.ZodLiteral<"update">;
|
|
88
|
-
did: z.ZodString;
|
|
89
|
-
previousOperationCID: z.ZodString;
|
|
90
|
-
documentCID: z.ZodNullable<z.ZodString>;
|
|
91
|
-
baseDocumentCID: z.ZodNullable<z.ZodString>;
|
|
92
|
-
createdAt: z.ZodISODateTime;
|
|
93
|
-
note: z.ZodNullable<z.ZodString>;
|
|
94
|
-
authorization: z.ZodOptional<z.ZodString>;
|
|
95
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
96
|
-
version: z.ZodLiteral<1>;
|
|
97
|
-
type: z.ZodLiteral<"delete">;
|
|
98
|
-
did: z.ZodString;
|
|
99
|
-
previousOperationCID: z.ZodString;
|
|
100
|
-
createdAt: z.ZodISODateTime;
|
|
101
|
-
note: z.ZodNullable<z.ZodString>;
|
|
102
|
-
authorization: z.ZodOptional<z.ZodString>;
|
|
103
|
-
}, z.core.$strict>], "type">;
|
|
104
|
-
type ContentOperation = z.infer<typeof ContentOperation>;
|
|
105
|
-
/** Beacon: floating signed manifest pointer announcement */
|
|
106
|
-
declare const BeaconPayload: z.ZodObject<{
|
|
107
|
-
version: z.ZodLiteral<1>;
|
|
108
|
-
type: z.ZodLiteral<"beacon">;
|
|
109
|
-
did: z.ZodString;
|
|
110
|
-
manifestContentId: z.ZodString;
|
|
111
|
-
createdAt: z.ZodISODateTime;
|
|
112
|
-
}, z.core.$strict>;
|
|
113
|
-
type BeaconPayload = z.infer<typeof BeaconPayload>;
|
|
114
|
-
/** Max CBOR-encoded payload size for artifacts (bytes) — protocol constant */
|
|
115
|
-
declare const MAX_ARTIFACT_PAYLOAD_SIZE = 16384;
|
|
116
|
-
/** Artifact: standalone signed inline document, immutable, CID-addressable */
|
|
117
|
-
declare const ArtifactPayload: z.ZodObject<{
|
|
118
|
-
version: z.ZodLiteral<1>;
|
|
119
|
-
type: z.ZodLiteral<"artifact">;
|
|
120
|
-
did: z.ZodString;
|
|
121
|
-
content: z.ZodObject<{
|
|
122
|
-
$schema: z.ZodString;
|
|
123
|
-
}, z.core.$catchall<z.ZodUnknown>>;
|
|
124
|
-
createdAt: z.ZodISODateTime;
|
|
125
|
-
}, z.core.$strict>;
|
|
126
|
-
type ArtifactPayload = z.infer<typeof ArtifactPayload>;
|
|
127
|
-
/** Countersign: standalone witness attestation referencing a target operation by CID */
|
|
128
|
-
declare const CountersignPayload: z.ZodObject<{
|
|
129
|
-
version: z.ZodLiteral<1>;
|
|
130
|
-
type: z.ZodLiteral<"countersign">;
|
|
131
|
-
did: z.ZodString;
|
|
132
|
-
targetCID: z.ZodString;
|
|
133
|
-
createdAt: z.ZodISODateTime;
|
|
134
|
-
}, z.core.$strict>;
|
|
135
|
-
type CountersignPayload = z.infer<typeof CountersignPayload>;
|
|
136
|
-
/** Revocation: signed credential revocation artifact, gossiped like beacons */
|
|
137
|
-
declare const RevocationPayload: z.ZodObject<{
|
|
138
|
-
version: z.ZodLiteral<1>;
|
|
139
|
-
type: z.ZodLiteral<"revocation">;
|
|
140
|
-
did: z.ZodString;
|
|
141
|
-
credentialCID: z.ZodString;
|
|
142
|
-
createdAt: z.ZodISODateTime;
|
|
143
|
-
}, z.core.$strict>;
|
|
144
|
-
type RevocationPayload = z.infer<typeof RevocationPayload>;
|
|
145
|
-
|
|
146
|
-
export { ArtifactPayload as A, BeaconPayload as B, ContentOperation as C, IdentityOperation as I, MAX_ARTIFACT_PAYLOAD_SIZE as M, RevocationPayload as R, type Signer as S, VerifiedIdentity as V, CountersignPayload as a, MultikeyPublicKey as b };
|
package/examples/beacon.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"description": "Beacon: signed manifest content ID announcement with witness countersignature",
|
|
3
|
-
"type": "beacon",
|
|
4
|
-
"controllerJws": "eyJhbGciOiJFZERTQSIsInR5cCI6ImRpZDpkZm9zOmJlYWNvbiIsImtpZCI6ImRpZDpkZm9zOmNubm5mdDlmOGEycm45MzhkNm5rejM4cjg0N3Yya3Ija2V5X3I5ZXYzNGZ2YzIzejk5OXZlYWFmdDgzbm4yOXp2aGUiLCJjaWQiOiJiYWZ5cmVpYjR3MnAydTZ0bHc3N3NidGtwdnc3ZnF2d3ZrNnJ3MzdweWFtM29zb2JvNXhwM29vZWt1cSJ9.eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiYmVhY29uIiwiZGlkIjoiZGlkOmRmb3M6Y25ubmZ0OWY4YTJybjkzOGQ2bmt6MzhyODQ3djJrciIsIm1hbmlmZXN0Q29udGVudElkIjoiY3Y3bjh2a3ZyNjRjY3RmMzI5NGg5azRlYW5oZmY4eiIsImNyZWF0ZWRBdCI6IjIwMjYtMDMtMDdUMDA6MDU6MDAuMDAwWiJ9.exr0Dfb_asVXeMpnUOaql9ppeO2pifzEdId8ocXHQ6-v_XUwccQdJaL4MhKzJGUbRAa0hfRVSFRndhjJ4NN1DA",
|
|
5
|
-
"witnessJws": "eyJhbGciOiJFZERTQSIsInR5cCI6ImRpZDpkZm9zOmJlYWNvbiIsImtpZCI6ImRpZDpkZm9zOmNubm5mdDlmOGEycm45MzhkNm5rejM4cjg0N3Yya3Ija2V5X2V6OWE4NzR0Y2tyM2R2OTMzZDNja2RuN3o2enJjdDgiLCJjaWQiOiJiYWZ5cmVpYjR3MnAydTZ0bHc3N3NidGtwdnc3ZnF2d3ZrNnJ3MzdweWFtM29zb2JvNXhwM29vZWt1cSJ9.eyJ2ZXJzaW9uIjoxLCJ0eXBlIjoiYmVhY29uIiwiZGlkIjoiZGlkOmRmb3M6Y25ubmZ0OWY4YTJybjkzOGQ2bmt6MzhyODQ3djJrciIsIm1hbmlmZXN0Q29udGVudElkIjoiY3Y3bjh2a3ZyNjRjY3RmMzI5NGg5azRlYW5oZmY4eiIsImNyZWF0ZWRBdCI6IjIwMjYtMDMtMDdUMDA6MDU6MDAuMDAwWiJ9.-49R4npkmKMJtnK4sVS_x7MFOgB1RhjkZAzwycLp80g_o6y0gV0JjnUAj12as8NglccBXEk_5DdZTFs17ygKCA",
|
|
6
|
-
"controllerPublicKey": "z6MkrzLMNwoJSV4P3YccWcbtk8vd9LtgMKnLeaDLUqLuASjb",
|
|
7
|
-
"witnessPublicKey": "z6MkfUd65JrAhfdgFuMCccU9ThQvjB2fJAMUHkuuajF992gK",
|
|
8
|
-
"expected": {
|
|
9
|
-
"beaconCID": "bafyreib4w2p2u6tlw77sbtkpvw7fqvwvk6rw37pyam3osobo5xp3ooekuq",
|
|
10
|
-
"did": "did:dfos:cnnnft9f8a2rn938d6nkz38r847v2kr",
|
|
11
|
-
"manifestContentId": "cv7n8vkvr64cctf3294h9k4eanhff8z",
|
|
12
|
-
"createdAt": "2026-03-07T00:05:00.000Z"
|
|
13
|
-
}
|
|
14
|
-
}
|
package/schemas/manifest.v1.json
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://schemas.dfos.com/manifest/v1",
|
|
4
|
-
"title": "Manifest",
|
|
5
|
-
"description": "A manifest — a named map of protocol object references for semantic navigation. Keys are path-like labels. Values are protocol references: content chain identifiers (31-char bare hash), DIDs (did:dfos:...), or CIDs (bafyrei...). The document layer of the dark forest. Discovery is social or out-of-band.",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"required": ["$schema", "entries"],
|
|
8
|
-
"properties": {
|
|
9
|
-
"$schema": {
|
|
10
|
-
"const": "https://schemas.dfos.com/manifest/v1"
|
|
11
|
-
},
|
|
12
|
-
"entries": {
|
|
13
|
-
"type": "object",
|
|
14
|
-
"propertyNames": {
|
|
15
|
-
"pattern": "^[a-z0-9][a-z0-9._/-]*[a-z0-9]$",
|
|
16
|
-
"minLength": 2,
|
|
17
|
-
"maxLength": 128
|
|
18
|
-
},
|
|
19
|
-
"additionalProperties": {
|
|
20
|
-
"type": "string",
|
|
21
|
-
"pattern": "^[a-z0-9][a-z0-9:._/-]*$",
|
|
22
|
-
"minLength": 1,
|
|
23
|
-
"maxLength": 512
|
|
24
|
-
},
|
|
25
|
-
"description": "Named entries mapping path-like keys to protocol object references (contentId, DID, or CID)."
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"additionalProperties": false
|
|
29
|
-
}
|