@metalabel/dfos-protocol 0.24.0 → 0.26.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/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { JwsHeader, JwsVerificationError, JwtClaims, JwtCreateOptions, JwtHeader, JwtVerificationError, JwtVerifyOptions, PrefixedID, assertJwsProfile, base64urlDecode, base64urlEncode, createJws, createJwt, createNewEd25519Keypair, dagCborCanonicalEncode, decodeJwsUnsafe, decodeJwtUnsafe, generateId, generateIdNoPrefix, importEd25519Keypair, isCanonicallyEqual, isValidEd25519Signature, isValidId, normalizedId, parseDagCborCID, signPayloadEd25519, verifyJws, verifyJwt } from './crypto/index.js';
2
- export { A as ARTIFACT_CID_ANCHOR_RE, a as ArtifactPayload, C as CONTENT_ID_ANCHOR_RE, b as ContentOperation, c as CountersignPayload, I as IdentityOperation, M as MAX_ARTIFACT_PAYLOAD_SIZE, d as MAX_OPERATION_SIZE, e as MAX_SERVICES_ENTRIES, f as MAX_SERVICES_PAYLOAD_SIZE, g as MultikeyPublicKey, R as RevocationPayload, S as ServiceEntry, h as ServicesArray, i as Signer, V as VerifiedIdentity } from './schemas-BXye25k7.js';
3
- export { AnchorKind, ED25519_PRIV_MULTICODEC, ED25519_PUB_MULTICODEC, RECOGNIZED_SERVICE_TYPES, VerifiedArtifact, VerifiedContentChain, VerifiedCountersignature, VerifiedRevocation, anchorsByLabel, assertServicesWithinCap, classifyAnchor, decodeMultikey, deriveChainIdentifier, deriveContentId, encodeEd25519Multikey, isRecognizedServiceType, relayEndpoints, signArtifact, signContentOperation, signCountersignature, signIdentityOperation, signRevocation, verifyArtifact, verifyContentChain, verifyContentExtensionFromTrustedState, verifyCountersignature, verifyIdentityChain, verifyIdentityExtensionFromTrustedState, verifyRevocation } from './chain/index.js';
4
- export { Attenuation, AuthTokenClaims, AuthTokenCreateOptions, AuthTokenVerificationError, AuthTokenVerifyOptions, CredentialVerificationError, DFOSCredentialPayload, MAX_CREDENTIAL_SIZE, VerifiedAuthToken, VerifiedDFOSCredential, VerifiedDelegationChain, createAuthToken, createDFOSCredential, decodeDFOSCredentialUnsafe, isAttenuated, matchesResource, verifyAuthToken, verifyDFOSCredential, verifyDelegationChain } from './credentials/index.js';
2
+ export { A as ARTIFACT_CID_ANCHOR_RE, a as ArtifactPayload, b as Attenuation, c as AuthTokenClaims, C as CONTENT_ID_ANCHOR_RE, d as ContentOperation, e as CountersignPayload, f as CredentialVerificationError, g as CreditClaimPayload, D as DFOSCredentialPayload, I as IdentityOperation, h as Iso8601, M as MAX_ARTIFACT_PAYLOAD_SIZE, i as MAX_CREDENTIAL_SIZE, j as MAX_CREDIT_CLAIM_SIZE, k as MAX_OPERATION_SIZE, l as MAX_SERVICES_ENTRIES, m as MAX_SERVICES_PAYLOAD_SIZE, n as MultikeyPublicKey, R as RevocationChecker, o as RevocationPayload, S as ServiceEntry, p as ServicesArray, q as Signer, V as VerifiedDFOSCredential, r as VerifiedDelegationChain, s as VerifiedIdentity, t as createDFOSCredential, u as decodeDFOSCredentialUnsafe, v as isAttenuated, w as matchesResource, x as parseProtocolTimestampUnix, y as verifyDFOSCredential, z as verifyDelegationChain } from './dfos-credential-CAYCqUCP.js';
3
+ export { AnchorKind, CreditClaimFailureReason, CreditClaimVerifyError, CreditEntry, CreditEntryState, ED25519_PRIV_MULTICODEC, ED25519_PUB_MULTICODEC, RECOGNIZED_SERVICE_TYPES, VerifiedArtifact, VerifiedContentChain, VerifiedCountersignature, VerifiedCreditClaim, VerifiedCreditEntry, VerifiedRevocation, anchorsByLabel, assertServicesWithinCap, classifyAnchor, decodeMultikey, deriveChainIdentifier, deriveContentId, encodeEd25519Multikey, isRecognizedServiceType, relayEndpoints, signArtifact, signContentOperation, signCountersignature, signCreditClaim, signIdentityOperation, signRevocation, verifyArtifact, verifyContentChain, verifyContentExtensionFromTrustedState, verifyCountersignature, verifyCreditClaim, verifyCreditEntry, verifyIdentityChain, verifyIdentityExtensionFromTrustedState, verifyRevocation } from './chain/index.js';
4
+ export { AuthTokenCreateOptions, AuthTokenVerificationError, AuthTokenVerifyOptions, VerifiedAuthToken, createAuthToken, verifyAuthToken } from './credentials/index.js';
5
5
  export { FoldOperation, INDEX_V1_SCHEMA, IndexDelta, IndexDocument, IndexEntry, LwwDelta, OrderKey, byteCompare, compareHeadPreference, compareLinear, foldIndexV1, foldLwwMap, linearize } from './fold/index.js';
6
6
  import 'multiformats';
7
7
  import 'multiformats/cid';
package/dist/index.js CHANGED
@@ -4,8 +4,12 @@ import {
4
4
  CONTENT_ID_ANCHOR_RE,
5
5
  ContentOperation,
6
6
  CountersignPayload,
7
+ CreditClaimPayload,
8
+ CreditClaimVerifyError,
7
9
  IdentityOperation,
10
+ Iso8601,
8
11
  MAX_ARTIFACT_PAYLOAD_SIZE,
12
+ MAX_CREDIT_CLAIM_SIZE,
9
13
  MAX_OPERATION_SIZE,
10
14
  MAX_SERVICES_ENTRIES,
11
15
  MAX_SERVICES_PAYLOAD_SIZE,
@@ -21,20 +25,24 @@ import {
21
25
  deriveChainIdentifier,
22
26
  deriveContentId,
23
27
  isRecognizedServiceType,
28
+ parseProtocolTimestampUnix,
24
29
  relayEndpoints,
25
30
  signArtifact,
26
31
  signContentOperation,
27
32
  signCountersignature,
33
+ signCreditClaim,
28
34
  signIdentityOperation,
29
35
  signRevocation,
30
36
  verifyArtifact,
31
37
  verifyContentChain,
32
38
  verifyContentExtensionFromTrustedState,
33
39
  verifyCountersignature,
40
+ verifyCreditClaim,
41
+ verifyCreditEntry,
34
42
  verifyIdentityChain,
35
43
  verifyIdentityExtensionFromTrustedState,
36
44
  verifyRevocation
37
- } from "./chunk-4EJCATUC.js";
45
+ } from "./chunk-3USIENKC.js";
38
46
  import {
39
47
  Attenuation,
40
48
  AuthTokenClaims,
@@ -54,7 +62,7 @@ import {
54
62
  verifyAuthToken,
55
63
  verifyDFOSCredential,
56
64
  verifyDelegationChain
57
- } from "./chunk-FMHROCFH.js";
65
+ } from "./chunk-PGFHCBGH.js";
58
66
  import {
59
67
  JwsVerificationError,
60
68
  JwtVerificationError,
@@ -98,15 +106,19 @@ export {
98
106
  ContentOperation,
99
107
  CountersignPayload,
100
108
  CredentialVerificationError,
109
+ CreditClaimPayload,
110
+ CreditClaimVerifyError,
101
111
  DFOSCredentialPayload,
102
112
  ED25519_PRIV_MULTICODEC,
103
113
  ED25519_PUB_MULTICODEC,
104
114
  INDEX_V1_SCHEMA,
105
115
  IdentityOperation,
116
+ Iso8601,
106
117
  JwsVerificationError,
107
118
  JwtVerificationError,
108
119
  MAX_ARTIFACT_PAYLOAD_SIZE,
109
120
  MAX_CREDENTIAL_SIZE,
121
+ MAX_CREDIT_CLAIM_SIZE,
110
122
  MAX_OPERATION_SIZE,
111
123
  MAX_SERVICES_ENTRIES,
112
124
  MAX_SERVICES_PAYLOAD_SIZE,
@@ -152,10 +164,12 @@ export {
152
164
  matchesResource,
153
165
  normalizedId,
154
166
  parseDagCborCID,
167
+ parseProtocolTimestampUnix,
155
168
  relayEndpoints,
156
169
  signArtifact,
157
170
  signContentOperation,
158
171
  signCountersignature,
172
+ signCreditClaim,
159
173
  signIdentityOperation,
160
174
  signPayloadEd25519,
161
175
  signRevocation,
@@ -164,6 +178,8 @@ export {
164
178
  verifyContentChain,
165
179
  verifyContentExtensionFromTrustedState,
166
180
  verifyCountersignature,
181
+ verifyCreditClaim,
182
+ verifyCreditEntry,
167
183
  verifyDFOSCredential,
168
184
  verifyDelegationChain,
169
185
  verifyIdentityChain,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metalabel/dfos-protocol",
3
- "version": "0.24.0",
3
+ "version": "0.26.0",
4
4
  "type": "module",
5
5
  "description": "DFOS Protocol — Ed25519 signed chain primitives, services, credentials, and verification",
6
6
  "license": "MIT",
@@ -57,7 +57,9 @@
57
57
  "@ipld/dag-cbor": "^10.0.1",
58
58
  "@noble/curves": "^2.2.0",
59
59
  "@noble/hashes": "^2.2.0",
60
- "multiformats": "^14.0.0",
60
+ "multiformats": "^14.0.0"
61
+ },
62
+ "peerDependencies": {
61
63
  "zod": "^4.4.3"
62
64
  },
63
65
  "devDependencies": {
@@ -66,7 +68,8 @@
66
68
  "ajv-formats": "^3.0.1",
67
69
  "tsup": "^8.5.1",
68
70
  "tsx": "^4.22.4",
69
- "vitest": "^4.1.8"
71
+ "vitest": "^4.1.8",
72
+ "zod": "^4.4.3"
70
73
  },
71
74
  "scripts": {
72
75
  "build": "tsup",
@@ -0,0 +1,75 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.dfos.com/credit-claim/v1",
4
+ "title": "Credit Claim",
5
+ "description": "The payload of a did:dfos:credit-claim JWS — a claimant's own signed assertion that it holds a named role on a content chain. Unlike post/v1, profile/v1, and index/v1, this is NOT a document committed to a chain by CID: it is an envelope payload carried inside document bytes, in the claim field of a credits entry (see $defs/creditEntry). Attribution, not authorization — a credit claim grants nothing. Unknown top-level fields are deliberately NOT rejected here (no additionalProperties: false, unlike the document schemas): this is a wire payload under the protocol's MUST-ignore-unknown rule, and the CID commits to the exact bytes, so a verifier that stripped unknown keys would fail its own CID check. Full semantics, the two-way bind, and the four verification states: https://protocol.dfos.com/credits",
6
+ "type": "object",
7
+ "required": ["version", "type", "contentId", "did", "role", "createdAt"],
8
+ "properties": {
9
+ "version": {
10
+ "const": 1,
11
+ "description": "Schema version."
12
+ },
13
+ "type": {
14
+ "const": "credit-claim",
15
+ "description": "Literal discriminator."
16
+ },
17
+ "contentId": {
18
+ "type": "string",
19
+ "pattern": "^[2346789acdefhknrtvz]{31}$",
20
+ "description": "The content chain this claim binds to — the binder. A 31-char content chain id, never a documentCID and never a chain head CID: binding the chain is what lets a claim survive edits verbatim and avoids circularity with the document that embeds it. Naming the chain in the signed bytes is also what makes a claim anti-replay — it cannot be lifted into another chain's document."
21
+ },
22
+ "did": {
23
+ "type": "string",
24
+ "pattern": "^did:",
25
+ "description": "The claimant DID. MUST equal the DID portion of the JWS header's kid — only the claimant can claim its own credit."
26
+ },
27
+ "role": {
28
+ "type": "string",
29
+ "minLength": 1,
30
+ "description": "The claimed role — open vocabulary, compared by exact, case-sensitive byte equality with no normalization of any kind (not case folding, not Unicode normalization, not whitespace trimming). One component of the bind, so any normalization would let implementations disagree about whether an entry is claimed."
31
+ },
32
+ "createdAt": {
33
+ "type": "string",
34
+ "format": "date-time",
35
+ "description": "When the claimant signed (ISO 8601, millisecond precision, UTC). Provenance metadata only — unlike an operation's createdAt it orders nothing and gates nothing, and a claim has no expiry."
36
+ },
37
+ "asOfDocumentCID": {
38
+ "type": "string",
39
+ "description": "Optional content-strength flavor — the document state the claimant pins its credit to. When the key IS present it MUST be a non-empty string: an empty string is a distinct, CID-changing encoding from an absent field, so accepting it would mean two claim CIDs for the same statement. NOT part of the bind; consumers that ignore it are conformant. Omission is the default and is CID-neutral.",
40
+ "minLength": 1
41
+ }
42
+ },
43
+ "$defs": {
44
+ "creditEntry": {
45
+ "title": "Credit Entry",
46
+ "description": "The canonical credits[] entry shape — the document-plane site that hosts a credit claim. Schemas carrying credits inline this shape (post/v1 does). Array order is display order; the first entry is the primary author.",
47
+ "type": "object",
48
+ "required": ["did"],
49
+ "dependentRequired": {
50
+ "claim": ["role"]
51
+ },
52
+ "properties": {
53
+ "did": {
54
+ "type": "string",
55
+ "pattern": "^did:",
56
+ "description": "DID of the credited identity."
57
+ },
58
+ "role": {
59
+ "type": "string",
60
+ "description": "Free-text role — open vocabulary, not an enum (e.g. \"author\", \"editor\", \"photography\"). Compared byte-exact against the claim payload's role, so it is REQUIRED whenever claim is present: an entry with a claim but no role — or an empty role, which can never equal the payload's non-empty one — has nothing to bind to and is invalid, not unclaimed.",
61
+ "minLength": 1
62
+ },
63
+ "name": {
64
+ "type": "string",
65
+ "description": "Credited party's display name at time of publication — a rendering convenience so a document reads without resolving every credited DID. Never authoritative (the credited DID's profile is) and never compared during verification."
66
+ },
67
+ "claim": {
68
+ "type": "string",
69
+ "description": "A did:dfos:credit-claim JWS asserting this same credit, bound to the entry by exact match of (contentId, did, role). Absent is the ordinary \"unclaimed\" state, not a defect — the credited party may hold no keys. A claim present but failing verification or the bind is \"invalid\" and MUST NOT be rendered as unclaimed."
70
+ }
71
+ },
72
+ "additionalProperties": false
73
+ }
74
+ }
75
+ }
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://schemas.dfos.com/post/v1",
4
4
  "title": "Post",
5
- "description": "A post \u2014 the primary content type in DFOS. Covers short posts and long-form posts via the format discriminator.",
5
+ "description": "A post the primary content type in DFOS. Covers short posts and long-form posts via the format discriminator.",
6
6
  "type": "object",
7
7
  "required": ["$schema", "format"],
8
8
  "properties": {
@@ -12,12 +12,12 @@
12
12
  "format": {
13
13
  "type": "string",
14
14
  "enum": ["short-post", "long-post"],
15
- "description": "Immutable content format \u2014 set at creation, never changes. Determines rendering and interaction semantics. Comments and replies are deliberately NOT post/v1 surface \u2014 threaded content arrives as its own schema (with signed target linkage), not as additional format values."
15
+ "description": "Immutable content format set at creation, never changes. Determines rendering and interaction semantics. Comments and replies are deliberately NOT post/v1 surface threaded content arrives as its own schema (with signed target linkage), not as additional format values."
16
16
  },
17
17
  "publishedAt": {
18
18
  "type": "string",
19
19
  "format": "date-time",
20
- "description": "Asserted original publication time of the content (ISO 8601). Distinct from the operation's createdAt, which records when the operation was signed: a chain anchored after the fact carries the original publication time here while its genesis operation truthfully records the later anchoring time. Assertion-tier like credits \u2014 the operation signer asserts it; the protocol verifies the signer, not the claim. Author-revisable: a later revision may change it (deliberate back-dating or correction) \u2014 the operation log preserves every previously committed value, so re-dating is always auditable."
20
+ "description": "Asserted original publication time of the content (ISO 8601). Distinct from the operation's createdAt, which records when the operation was signed: a chain anchored after the fact carries the original publication time here while its genesis operation truthfully records the later anchoring time. Assertion-tier like credits the operation signer asserts it; the protocol verifies the signer, not the claim. Author-revisable: a later revision may change it (deliberate back-dating or correction) the operation log preserves every previously committed value, so re-dating is always auditable."
21
21
  },
22
22
  "title": {
23
23
  "type": "string",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "body": {
27
27
  "type": "string",
28
- "description": "Post body content \u2014 markdown (CommonMark) text. May embed attachment://<id> refs inline; each should have a corresponding attachments entry carrying the verifiable reference."
28
+ "description": "Post body content markdown (CommonMark) text. May embed attachment://<id> refs inline; each should have a corresponding attachments entry carrying the verifiable reference."
29
29
  },
30
30
  "cover": {
31
31
  "$ref": "#/$defs/media",
@@ -43,7 +43,7 @@
43
43
  "items": {
44
44
  "$ref": "#/$defs/credit"
45
45
  },
46
- "description": "Ordered authorship credits. Array order is display order; the first entry is the primary author. Omit entirely for unattributed content. Credits are the assertion tier of the authorship lattice \u2014 the operation signer asserts them; a credited DID may upgrade its credit to proof via a claim operation."
46
+ "description": "Ordered authorship credits. Array order is display order; the first entry is the primary author. Omit entirely for unattributed content. A bare entry is the assertion tier of the authorship lattice the operation signer asserts it; a credited DID upgrades its credit to proof by adding a credit claim in the entry's claim field (see https://protocol.dfos.com/credits)."
47
47
  }
48
48
  },
49
49
  "additionalProperties": false,
@@ -55,33 +55,47 @@
55
55
  "uri": {
56
56
  "type": "string",
57
57
  "format": "uri",
58
- "description": "Canonical reference to the media \u2014 an attachment://<id> ref (opaque, host-scoped) or any other URI. Always present."
58
+ "description": "Canonical reference to the media an attachment://<id> ref (opaque, host-scoped) or any other URI. Always present."
59
59
  },
60
60
  "cid": {
61
61
  "type": "string",
62
62
  "pattern": "^bafkrei[a-z2-7]{52}$",
63
- "description": "Optional content commitment \u2014 CIDv1, raw codec (0x55), sha2-256, base32 lowercase, computed over the media bytes exactly as stored/served. May be absent when no cid has been computed for the media."
63
+ "description": "Optional content commitment CIDv1, raw codec (0x55), sha2-256, base32 lowercase, computed over the media bytes exactly as stored/served. May be absent when no cid has been computed for the media."
64
64
  },
65
65
  "href": {
66
66
  "type": "string",
67
67
  "format": "uri",
68
- "description": "Optional resolution hint \u2014 a plain URL where the bytes may currently be fetched. Implementation-dependent and non-normative; carries no integrity promise."
68
+ "description": "Optional resolution hint a plain URL where the bytes may currently be fetched. Implementation-dependent and non-normative; carries no integrity promise."
69
69
  }
70
70
  },
71
71
  "additionalProperties": false
72
72
  },
73
73
  "credit": {
74
+ "title": "Credit Entry",
75
+ "description": "The canonical credits[] entry shape — the document-plane site that hosts a credit claim. Schemas carrying credits inline this shape (post/v1 does). Array order is display order; the first entry is the primary author.",
74
76
  "type": "object",
75
77
  "required": ["did"],
78
+ "dependentRequired": {
79
+ "claim": ["role"]
80
+ },
76
81
  "properties": {
77
82
  "did": {
78
83
  "type": "string",
79
84
  "pattern": "^did:",
80
85
  "description": "DID of the credited identity."
81
86
  },
82
- "label": {
87
+ "role": {
88
+ "type": "string",
89
+ "description": "Free-text role — open vocabulary, not an enum (e.g. \"author\", \"editor\", \"photography\"). Compared byte-exact against the claim payload's role, so it is REQUIRED whenever claim is present: an entry with a claim but no role — or an empty role, which can never equal the payload's non-empty one — has nothing to bind to and is invalid, not unclaimed.",
90
+ "minLength": 1
91
+ },
92
+ "name": {
93
+ "type": "string",
94
+ "description": "Credited party's display name at time of publication — a rendering convenience so a document reads without resolving every credited DID. Never authoritative (the credited DID's profile is) and never compared during verification."
95
+ },
96
+ "claim": {
83
97
  "type": "string",
84
- "description": "Free-text role label \u2014 display vocabulary, not an enum (e.g. \"author\", \"editor\", \"photography\")."
98
+ "description": "A did:dfos:credit-claim JWS asserting this same credit, bound to the entry by exact match of (contentId, did, role). Absent is the ordinary \"unclaimed\" state, not a defect — the credited party may hold no keys. A claim present but failing verification or the bind is \"invalid\" and MUST NOT be rendered as unclaimed."
85
99
  }
86
100
  },
87
101
  "additionalProperties": false
@@ -1,220 +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
- /**
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 dag-cbor+sha256 (artifact) → immutable, public
41
- * Both are stable; a chain HEAD CID (also a `bafyrei…` CID but resolves to a
42
- * non-artifact op) is rejected by the shape-dispatch + resolution type check,
43
- * never anchored.
44
- *
45
- * The artifact form is the EXACT 59-char CIDv1(dag-cbor 0x71 + sha256 0x12 0x20)
46
- * base32 string — 36 raw bytes → 58 base32 chars + the `b` multibase prefix,
47
- * fixed `bafyrei` head + 52 base32 chars. Artifact payloads are ALWAYS dag-cbor +
48
- * sha256 (ArtifactPayload below), so every real artifact CID is `bafyrei…`. The
49
- * regex is pinned to that exact length (not a loose `baf…{20,}`) so an anchor of
50
- * any other shape — wrong codec, wrong length — is rejected uniformly across
51
- * implementations. New anchor KINDS arrive via a new service `type`, never a new
52
- * anchor shape.
53
- */
54
- declare const CONTENT_ID_ANCHOR_RE: RegExp;
55
- declare const ARTIFACT_CID_ANCHOR_RE: RegExp;
56
- /**
57
- * Service entry — discovery vocabulary in identity-chain state.
58
- *
59
- * Open namespace: `type` is an arbitrary bounded string. Recognized types
60
- * (`DfosRelay`, `ContentAnchor`) are structurally validated; UNRECOGNIZED types
61
- * are preserved verbatim and ignored (MUST-ignore-unknown) — only the common
62
- * envelope (id + type) and the byte cap apply. New service types therefore
63
- * never require a protocol/cross-language change.
64
- */
65
- declare const ServiceEntry: z.ZodObject<{
66
- id: z.ZodString;
67
- type: z.ZodString;
68
- }, z.core.$catchall<z.ZodUnknown>>;
69
- type ServiceEntry = z.infer<typeof ServiceEntry>;
70
- /** Identity services state — full-state, bounded, unique entry ids */
71
- declare const ServicesArray: z.ZodArray<z.ZodObject<{
72
- id: z.ZodString;
73
- type: z.ZodString;
74
- }, z.core.$catchall<z.ZodUnknown>>>;
75
- type ServicesArray = z.infer<typeof ServicesArray>;
76
- declare const IdentityOperation: z.ZodDiscriminatedUnion<[z.ZodObject<{
77
- version: z.ZodLiteral<1>;
78
- type: z.ZodLiteral<"create">;
79
- authKeys: z.ZodArray<z.ZodObject<{
80
- id: z.ZodString;
81
- type: z.ZodLiteral<"Multikey">;
82
- publicKeyMultibase: z.ZodString;
83
- }, z.core.$loose>>;
84
- assertKeys: z.ZodArray<z.ZodObject<{
85
- id: z.ZodString;
86
- type: z.ZodLiteral<"Multikey">;
87
- publicKeyMultibase: z.ZodString;
88
- }, z.core.$loose>>;
89
- controllerKeys: z.ZodArray<z.ZodObject<{
90
- id: z.ZodString;
91
- type: z.ZodLiteral<"Multikey">;
92
- publicKeyMultibase: z.ZodString;
93
- }, z.core.$loose>>;
94
- services: z.ZodOptional<z.ZodArray<z.ZodObject<{
95
- id: z.ZodString;
96
- type: z.ZodString;
97
- }, z.core.$catchall<z.ZodUnknown>>>>;
98
- createdAt: z.ZodISODateTime;
99
- }, z.core.$loose>, z.ZodObject<{
100
- version: z.ZodLiteral<1>;
101
- type: z.ZodLiteral<"update">;
102
- previousOperationCID: z.ZodString;
103
- authKeys: z.ZodArray<z.ZodObject<{
104
- id: z.ZodString;
105
- type: z.ZodLiteral<"Multikey">;
106
- publicKeyMultibase: z.ZodString;
107
- }, z.core.$loose>>;
108
- assertKeys: z.ZodArray<z.ZodObject<{
109
- id: z.ZodString;
110
- type: z.ZodLiteral<"Multikey">;
111
- publicKeyMultibase: z.ZodString;
112
- }, z.core.$loose>>;
113
- controllerKeys: z.ZodArray<z.ZodObject<{
114
- id: z.ZodString;
115
- type: z.ZodLiteral<"Multikey">;
116
- publicKeyMultibase: z.ZodString;
117
- }, z.core.$loose>>;
118
- services: z.ZodOptional<z.ZodArray<z.ZodObject<{
119
- id: z.ZodString;
120
- type: z.ZodString;
121
- }, z.core.$catchall<z.ZodUnknown>>>>;
122
- createdAt: z.ZodISODateTime;
123
- }, z.core.$loose>, z.ZodObject<{
124
- version: z.ZodLiteral<1>;
125
- type: z.ZodLiteral<"delete">;
126
- previousOperationCID: z.ZodString;
127
- createdAt: z.ZodISODateTime;
128
- }, z.core.$loose>], "type">;
129
- type IdentityOperation = z.infer<typeof IdentityOperation>;
130
- declare const VerifiedIdentity: z.ZodObject<{
131
- did: z.ZodString;
132
- isDeleted: z.ZodBoolean;
133
- authKeys: z.ZodArray<z.ZodObject<{
134
- id: z.ZodString;
135
- type: z.ZodLiteral<"Multikey">;
136
- publicKeyMultibase: z.ZodString;
137
- }, z.core.$loose>>;
138
- assertKeys: z.ZodArray<z.ZodObject<{
139
- id: z.ZodString;
140
- type: z.ZodLiteral<"Multikey">;
141
- publicKeyMultibase: z.ZodString;
142
- }, z.core.$loose>>;
143
- controllerKeys: z.ZodArray<z.ZodObject<{
144
- id: z.ZodString;
145
- type: z.ZodLiteral<"Multikey">;
146
- publicKeyMultibase: z.ZodString;
147
- }, z.core.$loose>>;
148
- services: z.ZodArray<z.ZodObject<{
149
- id: z.ZodString;
150
- type: z.ZodString;
151
- }, z.core.$catchall<z.ZodUnknown>>>;
152
- }, z.core.$strict>;
153
- type VerifiedIdentity = z.infer<typeof VerifiedIdentity>;
154
- declare const ContentOperation: z.ZodDiscriminatedUnion<[z.ZodObject<{
155
- version: z.ZodLiteral<1>;
156
- type: z.ZodLiteral<"create">;
157
- did: z.ZodString;
158
- documentCID: z.ZodString;
159
- baseDocumentCID: z.ZodNullable<z.ZodString>;
160
- createdAt: z.ZodISODateTime;
161
- }, z.core.$loose>, z.ZodObject<{
162
- version: z.ZodLiteral<1>;
163
- type: z.ZodLiteral<"update">;
164
- did: z.ZodString;
165
- previousOperationCID: z.ZodString;
166
- documentCID: z.ZodNullable<z.ZodString>;
167
- baseDocumentCID: z.ZodNullable<z.ZodString>;
168
- createdAt: z.ZodISODateTime;
169
- authorization: z.ZodOptional<z.ZodString>;
170
- }, z.core.$loose>, z.ZodObject<{
171
- version: z.ZodLiteral<1>;
172
- type: z.ZodLiteral<"delete">;
173
- did: z.ZodString;
174
- previousOperationCID: z.ZodString;
175
- createdAt: z.ZodISODateTime;
176
- authorization: z.ZodOptional<z.ZodString>;
177
- }, z.core.$loose>], "type">;
178
- type ContentOperation = z.infer<typeof ContentOperation>;
179
- /** Max CBOR-encoded payload size for artifacts (bytes) — protocol constant */
180
- declare const MAX_ARTIFACT_PAYLOAD_SIZE = 16384;
181
- /** Artifact: standalone signed inline document, immutable, CID-addressable */
182
- declare const ArtifactPayload: z.ZodObject<{
183
- version: z.ZodLiteral<1>;
184
- type: z.ZodLiteral<"artifact">;
185
- did: z.ZodString;
186
- content: z.ZodObject<{
187
- $schema: z.ZodString;
188
- }, z.core.$catchall<z.ZodUnknown>>;
189
- createdAt: z.ZodISODateTime;
190
- }, z.core.$loose>;
191
- type ArtifactPayload = z.infer<typeof ArtifactPayload>;
192
- /**
193
- * Countersign: standalone witness attestation referencing a target operation by CID.
194
- *
195
- * `relation` is an OPEN-namespace tag naming the nature of the attestation
196
- * (e.g. `coauthors`, `endorses`, `witnessed`, `holds`, `received`). It is an
197
- * arbitrary bounded string — recognized values carry social meaning to clients,
198
- * unrecognized values MUST be preserved and ignored. Optional, so a bare witness
199
- * attestation (no relation) encodes identically (CID-neutral).
200
- */
201
- declare const CountersignPayload: z.ZodObject<{
202
- version: z.ZodLiteral<1>;
203
- type: z.ZodLiteral<"countersign">;
204
- did: z.ZodString;
205
- targetCID: z.ZodString;
206
- relation: z.ZodOptional<z.ZodString>;
207
- createdAt: z.ZodISODateTime;
208
- }, z.core.$loose>;
209
- type CountersignPayload = z.infer<typeof CountersignPayload>;
210
- /** Revocation: signed credential revocation artifact, gossiped on the proof plane */
211
- declare const RevocationPayload: z.ZodObject<{
212
- version: z.ZodLiteral<1>;
213
- type: z.ZodLiteral<"revocation">;
214
- did: z.ZodString;
215
- credentialCID: z.ZodString;
216
- createdAt: z.ZodISODateTime;
217
- }, z.core.$loose>;
218
- type RevocationPayload = z.infer<typeof RevocationPayload>;
219
-
220
- 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 };