@motebit/protocol 2.0.1 → 3.0.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 +6 -1
- package/dist/agent-revocation.d.ts +184 -0
- package/dist/agent-revocation.d.ts.map +1 -0
- package/dist/agent-revocation.js +108 -0
- package/dist/agent-revocation.js.map +1 -0
- package/dist/agent-settlement-anchor.d.ts +12 -0
- package/dist/agent-settlement-anchor.d.ts.map +1 -1
- package/dist/artifact-type.d.ts +25 -7
- package/dist/artifact-type.d.ts.map +1 -1
- package/dist/artifact-type.js +9 -0
- package/dist/artifact-type.js.map +1 -1
- package/dist/base58.d.ts +20 -0
- package/dist/base58.d.ts.map +1 -0
- package/dist/base58.js +47 -0
- package/dist/base58.js.map +1 -0
- package/dist/credential-anchor.d.ts +12 -0
- package/dist/credential-anchor.d.ts.map +1 -1
- package/dist/federation-settlement-anchor.d.ts +140 -0
- package/dist/federation-settlement-anchor.d.ts.map +1 -0
- package/dist/federation-settlement-anchor.js +22 -0
- package/dist/federation-settlement-anchor.js.map +1 -0
- package/dist/index.d.ts +111 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -14
- package/dist/index.js.map +1 -1
- package/dist/memory-events.d.ts +5 -2
- package/dist/memory-events.d.ts.map +1 -1
- package/dist/merkle-tree-hash.d.ts +97 -0
- package/dist/merkle-tree-hash.d.ts.map +1 -0
- package/dist/merkle-tree-hash.js +78 -0
- package/dist/merkle-tree-hash.js.map +1 -0
- package/dist/money.d.ts +45 -0
- package/dist/money.d.ts.map +1 -1
- package/dist/money.js +50 -0
- package/dist/money.js.map +1 -1
- package/dist/retention-policy.d.ts +7 -8
- package/dist/retention-policy.d.ts.map +1 -1
- package/dist/retention-policy.js.map +1 -1
- package/dist/settlement-mode.d.ts +34 -0
- package/dist/settlement-mode.d.ts.map +1 -1
- package/dist/settlement-summary.d.ts +102 -0
- package/dist/settlement-summary.d.ts.map +1 -0
- package/dist/settlement-summary.js +28 -0
- package/dist/settlement-summary.js.map +1 -0
- package/dist/skills.d.ts +1 -2
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js.map +1 -1
- package/dist/transparency.d.ts +2 -3
- package/dist/transparency.d.ts.map +1 -1
- package/dist/transparency.js.map +1 -1
- package/dist/trust-algebra.d.ts +0 -15
- package/dist/trust-algebra.d.ts.map +1 -1
- package/dist/trust-algebra.js +2 -15
- package/dist/trust-algebra.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -37,12 +37,17 @@ const relayFee = PLATFORM_FEE_RATE; // 0.05 — the universal 5% relay fee.
|
|
|
37
37
|
- **Identity** — `MotebitIdentity`, `KeySuccessionRecord`, `DeviceRegistration`
|
|
38
38
|
- **Execution receipts** — `ExecutionReceipt` with nested delegation chains
|
|
39
39
|
- **Credentials** — W3C VC 2.0 types (`ReputationCredentialSubject`, `TrustCredentialSubject`)
|
|
40
|
-
- **Settlement** — `BudgetAllocation`, `SettlementRecord`, `PLATFORM_FEE_RATE`; `SettlementMode` closed union (`"relay" | "p2p"`) with `ALL_SETTLEMENT_MODES` for iteration and `isSettlementMode` for narrowing wire-format payloads pulled from discovery / peer-negotiation responses; `SettlementAsset` closed union (`"USDC"` at sub-phase A) with `ALL_SETTLEMENT_ASSETS` for iteration and `isSettlementAsset` for narrowing — the typed vocabulary of stablecoin assets the protocol clears settlement in; `SovereignRail.asset` is structurally tightened to this union so a peer announcing an unknown asset fails closed. **Guest-rail capability marker interfaces** + type guards — `GuestRail` carries `supportsDeposit` / `supportsWithdraw` / `supportsBatch` discriminants; `DepositableGuestRail` / `WithdrawableGuestRail` / `BatchableGuestRail` add the corresponding methods; `isDepositableRail` / `isWithdrawableRail` / `isBatchableRail` narrow at the call site. The marker on `WithdrawableGuestRail` is the structural enforcement of the off-ramp doctrine: rails that don't opt in (e.g., Bridge, treasury-only) cannot drive user-facing withdrawals because `withdraw` does not exist on the base type
|
|
40
|
+
- **Settlement** — `BudgetAllocation`, `SettlementRecord`, `PLATFORM_FEE_RATE`; `computeP2pFeeMicro(netCostMicro, feeRate)` for the canonical P2P fee-leg amount in micro-units (`gross - net`) — the relay's proof validator and the delegator client building the proof share it so the fee can't drift; `computeFederatedFeeSplit(budgetMicro, feeRate)` for the cross-operator fee-from-budget split (origin-fee / executor-fee / worker-net legs, spec §7.1), shared the same way; `SettlementMode` closed union (`"relay" | "p2p"`) with `ALL_SETTLEMENT_MODES` for iteration and `isSettlementMode` for narrowing wire-format payloads pulled from discovery / peer-negotiation responses; `SettlementAsset` closed union (`"USDC"` at sub-phase A) with `ALL_SETTLEMENT_ASSETS` for iteration and `isSettlementAsset` for narrowing — the typed vocabulary of stablecoin assets the protocol clears settlement in; `SovereignRail.asset` is structurally tightened to this union so a peer announcing an unknown asset fails closed. **Guest-rail capability marker interfaces** + type guards — `GuestRail` carries `supportsDeposit` / `supportsWithdraw` / `supportsBatch` discriminants; `DepositableGuestRail` / `WithdrawableGuestRail` / `BatchableGuestRail` add the corresponding methods; `isDepositableRail` / `isWithdrawableRail` / `isBatchableRail` narrow at the call site. The marker on `WithdrawableGuestRail` is the structural enforcement of the off-ramp doctrine: rails that don't opt in (e.g., Bridge, treasury-only) cannot drive user-facing withdrawals because `withdraw` does not exist on the base type
|
|
41
|
+
- **Sovereign wallet port** — `SovereignWalletRail` (extends `SovereignRail` with `send` / `isAvailable`) + `SovereignSendResult`; the rail interface the interior consumes so a runtime can use a sovereign rail without depending on a settlement-rail provider package
|
|
42
|
+
- **Encoding** — `base58Encode`, a pure chain-agnostic base58btc codec (Bitcoin alphabet; the encoding behind Solana address derivation), sibling to the money converters
|
|
41
43
|
- **Trust algebra** — semiring operations for delegation-chain trust computation
|
|
42
44
|
- **Policy** — `ToolDefinition`, `PolicyDecision`, `RiskLevel`, `SensitivityLevel` (the 5-tier privacy ladder, the most load-bearing closed registry; `ALL_SENSITIVITY_LEVELS` for iteration, `isSensitivityLevel` for narrowing unknown payloads, `rankSensitivity` / `maxSensitivity` / `sensitivityPermits` for the algebra)
|
|
43
45
|
- **Event-log vocabulary** — `EventType` closed enum (59 entries spanning identity / memory / goals / approvals / plans / consolidation / co-browse / agents); `ALL_EVENT_TYPES` for iteration, `isEventType` for narrowing wire-format payloads pulled from sync peers or federation
|
|
46
|
+
- **Agent revocation** — the operator's de-list power, made sovereign-verifiable: `AgentRevocationRecord` / `AgentRevocationFeed` (signed under `AGENT_REVOCATION_SUITE`, spec id `AGENT_REVOCATION_SPEC_ID`) are the wire types for a relay's public, append-only moderation history at `GET /api/v1/agents/revocations`; `AgentRevocationReason` closed registry (`ALL_AGENT_REVOCATION_REASONS` for iteration, `isAgentRevocationReason` for narrowing — `operator_test_cleanup` / `spam` / `abuse` / `malware` / `policy_violation` / `dmca` / `reinstated`) keeps the feed legible. De-list, never de-identify; verify with `@motebit/state-export-client::verifyAgentRevocationFeed`. See [`spec/agent-revocation-v1.md`](../../spec/agent-revocation-v1.md)
|
|
47
|
+
- **Content provenance** — `ContentArtifactType` closed registry of `artifact_type` values for the C2PA-shape `ContentArtifactManifest`; named constants per category, incl. `SETTLEMENT_SUMMARY_ARTIFACT` for the per-peer economic projection a relay emits at `GET /api/v1/agents/:motebitId/settlements` (wire body `SettlementSummaryExport` / `SettlementSummaryPeer` / `SettlementSummaryUnattributed`). The money side of the first-person trust graph — a materialized projection over the signed settlement ledger, never a denormalized balance; verify with `@motebit/state-export-client::verifiedSettlementSummaryFetch`
|
|
44
48
|
- **Storage adapters** — pluggable persistence contracts for any backend
|
|
45
49
|
- **Cryptosuite registry** — `SuiteId` union for crypto-agile wire artifacts
|
|
50
|
+
- **Merkle tree-hash registry** — `MerkleTreeVersion` closed union (RFC 6962 §2.1 leaf/node domain separation as an agility axis) with `MERKLE_TREE_VERSION_REGISTRY` + `ALL_MERKLE_TREE_VERSIONS` for iteration, `isMerkleTreeVersion` / `getMerkleTreeVersionEntry` for narrowing/lookup, and `DEFAULT_MERKLE_TREE_VERSION` — the absent ⇒ v1 downgrade-safety default for a proof's optional `tree_hash_version` field
|
|
46
51
|
- **Auto-router registry** — `TaskShape` closed union (`ALL_TASK_SHAPES`, `isTaskShape`) for the model-selection primitive; named constants `QUICK_TASK_SHAPE`, `CHAT_TASK_SHAPE`, `REASONING_TASK_SHAPE`, `CODE_TASK_SHAPE`, `RESEARCH_TASK_SHAPE`, `CREATIVE_TASK_SHAPE`, `MATH_TASK_SHAPE`. Paired with `ProviderCapability` + `RoutingConstraint` + `RoutingDecision` types consumed by `@motebit/policy::dispatchRouting`
|
|
47
52
|
|
|
48
53
|
Product-level types (state vectors, creature behavior, rendering spec) live in [`@motebit/sdk`](https://www.npmjs.com/package/@motebit/sdk), which re-exports everything here plus the product vocabulary.
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent-revocation — the operator's de-list power, made sovereign-verifiable.
|
|
3
|
+
*
|
|
4
|
+
* A permissionless relay accumulates junk: spam listings, abandoned test
|
|
5
|
+
* agents, abusive capabilities. The only automatic remedy is the 90-day
|
|
6
|
+
* no-heartbeat TTL — too slow for live abuse. The operator therefore needs
|
|
7
|
+
* a hygiene tool: remove an agent from Discover.
|
|
8
|
+
*
|
|
9
|
+
* But an operator who can silently disappear an agent is exactly the trust
|
|
10
|
+
* root the relay is forbidden from being (`services/relay/CLAUDE.md` rule 6:
|
|
11
|
+
* "the relay is a convenience layer, not a trust root"). The move that keeps
|
|
12
|
+
* this on-thesis is the same one motebit makes everywhere else — declared
|
|
13
|
+
* posture → *proven* posture: every revocation is a **signed, reasoned,
|
|
14
|
+
* publicly-fetchable statement**, not a silent DB flip.
|
|
15
|
+
*
|
|
16
|
+
* What revocation is and is not:
|
|
17
|
+
* - It is a **de-list**, not a **de-identify**. It sets the relay's
|
|
18
|
+
* `agent_registry.revoked` flag, which Discover filters
|
|
19
|
+
* (`task-routing.ts` `revokedFilter`). The agent's identity, key,
|
|
20
|
+
* succession chain, and receipts stay served by the
|
|
21
|
+
* identity-transparency endpoint — it remains hireable directly by id.
|
|
22
|
+
* - It is **post-hoc hygiene**, not **editorial curation**. Discovery
|
|
23
|
+
* stays permissionless (no allowlist, no pre-approval); the operator
|
|
24
|
+
* *removes* junk/abuse, it never *picks* winners.
|
|
25
|
+
* - It is **reversible**. An `unrevoke` is itself a signed record; the
|
|
26
|
+
* append-only feed is the operator's complete, auditable moderation
|
|
27
|
+
* history. A third party verifies each record against the relay's
|
|
28
|
+
* pinned public key — the same key the transparency declaration commits.
|
|
29
|
+
*
|
|
30
|
+
* This module exports the wire types only. The producer (signed-record
|
|
31
|
+
* construction, the `agent_revocations` store, the revoke/unrevoke routes,
|
|
32
|
+
* the `GET /api/v1/agents/revocations` feed) lives in `services/relay`.
|
|
33
|
+
*
|
|
34
|
+
* Doctrine: `docs/doctrine/agents-as-first-person-trust-graph.md`,
|
|
35
|
+
* `docs/doctrine/operator-transparency.md`,
|
|
36
|
+
* `docs/doctrine/self-attesting-system.md`.
|
|
37
|
+
*
|
|
38
|
+
* Permissive floor (Apache-2.0), type-only, zero runtime deps.
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* The closed vocabulary of *why* an operator de-listed an agent (or
|
|
42
|
+
* reinstated one). Carried on every `AgentRevocationRecord`, so the public
|
|
43
|
+
* revocations feed is legible — a verifier reading the feed learns not just
|
|
44
|
+
* *that* the operator removed an agent but *under what category*, which is
|
|
45
|
+
* what converts "operator power" into "operator accountability."
|
|
46
|
+
*
|
|
47
|
+
* Registered registry per
|
|
48
|
+
* [`docs/doctrine/registry-pattern-canonical.md`](../../../docs/doctrine/registry-pattern-canonical.md)
|
|
49
|
+
* — the ninth instance after `SuiteId`, `TokenAudience`,
|
|
50
|
+
* `ContentArtifactType`, `TaskShape`, `SensitivityLevel`, `EventType`,
|
|
51
|
+
* `SettlementMode`, and `MerkleTreeVersion`. The four criteria are met:
|
|
52
|
+
* interop law (a verifier reading the signed feed must agree on the reason
|
|
53
|
+
* vocabulary), multi-consumer (relay producer, verifier, Discover UI),
|
|
54
|
+
* wire-format presence (`AgentRevocationRecord.reason`), anticipated drift
|
|
55
|
+
* (the categories will grow — `trademark`, `sanctions`, `court_order` — and
|
|
56
|
+
* silently widening them would break feed consumers without the lock).
|
|
57
|
+
*
|
|
58
|
+
* `reinstated` is the canonical reason on an `unrevoke` (an
|
|
59
|
+
* `AgentRevocationRecord` with `revoked: false`): the record still needs a
|
|
60
|
+
* categorized reason so the append-only feed reads cleanly as a sequence of
|
|
61
|
+
* state changes.
|
|
62
|
+
*/
|
|
63
|
+
export type AgentRevocationReason = "operator_test_cleanup" | "spam" | "abuse" | "malware" | "policy_violation" | "dmca" | "reinstated";
|
|
64
|
+
/**
|
|
65
|
+
* Canonical iteration order over `AgentRevocationReason`, frozen. Single
|
|
66
|
+
* source of truth for "every revocation reason" — exhaustive switches, the
|
|
67
|
+
* relay's reason validation, and the coverage gate
|
|
68
|
+
* (`check-agent-revocation-reason-canonical`) all enumerate through this.
|
|
69
|
+
*
|
|
70
|
+
* Same shape as `ALL_SUITE_IDS`, `ALL_SETTLEMENT_MODES`, `ALL_EVENT_TYPES`.
|
|
71
|
+
* Adding a reason is intentional protocol-level work: new union entry + new
|
|
72
|
+
* entry here + gate reference update.
|
|
73
|
+
*/
|
|
74
|
+
export declare const ALL_AGENT_REVOCATION_REASONS: readonly AgentRevocationReason[];
|
|
75
|
+
/**
|
|
76
|
+
* Type guard — narrows `unknown` to `AgentRevocationReason`. The relay calls
|
|
77
|
+
* this on the operator-supplied `reason` before signing a record so an
|
|
78
|
+
* unrecognized reason fails closed rather than landing an un-typed value in
|
|
79
|
+
* the signed, externally-verified feed.
|
|
80
|
+
*
|
|
81
|
+
* Same shape as `isSuiteId`, `isSettlementMode`, `isEventType`.
|
|
82
|
+
*/
|
|
83
|
+
export declare function isAgentRevocationReason(value: unknown): value is AgentRevocationReason;
|
|
84
|
+
/**
|
|
85
|
+
* The pinned cryptosuite for revocation records. JCS canonicalization
|
|
86
|
+
* (RFC 8785) + Ed25519 + hex signature — the same family as the transparency
|
|
87
|
+
* declaration, identity-file, and content-artifact manifests, so a verifier
|
|
88
|
+
* that already pins the relay key for the transparency declaration verifies
|
|
89
|
+
* revocations with no new machinery. See `SUITE_REGISTRY` in `./crypto-suite.ts`.
|
|
90
|
+
*/
|
|
91
|
+
export declare const AGENT_REVOCATION_SUITE: "motebit-jcs-ed25519-hex-v1";
|
|
92
|
+
/**
|
|
93
|
+
* Current spec identifier for the revocation wire format. Bumps require a
|
|
94
|
+
* new wire-format spec doc; verifiers MUST reject records with an
|
|
95
|
+
* unrecognized `spec`.
|
|
96
|
+
*/
|
|
97
|
+
export declare const AGENT_REVOCATION_SPEC_ID: "motebit-agent-revocation/draft-2026-06-04";
|
|
98
|
+
/**
|
|
99
|
+
* Who performed the state change. `operator` = the relay operator using the
|
|
100
|
+
* hygiene tool (master-token authed). `self` = the agent deregistering
|
|
101
|
+
* itself with its own key. The distinction is part of the record's
|
|
102
|
+
* accountability surface: a verifier can separate operator moderation from
|
|
103
|
+
* voluntary self-removal.
|
|
104
|
+
*/
|
|
105
|
+
export type AgentRevocationActor = "operator" | "self";
|
|
106
|
+
/**
|
|
107
|
+
* A single, signed agent-revocation state change — one entry in the relay's
|
|
108
|
+
* append-only revocations feed.
|
|
109
|
+
*
|
|
110
|
+
* Wire format (foundation law). Field names, types, and the canonical-JSON
|
|
111
|
+
* ordering of the signed payload are protocol law. Each record is an
|
|
112
|
+
* immutable event: a `revoke` (`revoked: true`) or an `unrevoke`
|
|
113
|
+
* (`revoked: false`). Current state for a `motebit_id` is the latest record;
|
|
114
|
+
* the full feed is the operator's auditable moderation history.
|
|
115
|
+
*
|
|
116
|
+
* Hash derivation: `sha256(utf8(canonicalJson(payload)))` where `payload` is
|
|
117
|
+
* the `AgentRevocationSignedPayload` projection — the post-sign fields
|
|
118
|
+
* (`hash`, `suite`, `signature`) are NOT part of the canonical bytes. Two
|
|
119
|
+
* implementations hashing the same payload MUST produce the same hex.
|
|
120
|
+
*/
|
|
121
|
+
export interface AgentRevocationRecord {
|
|
122
|
+
/** Spec identifier — e.g. `"motebit-agent-revocation/draft-2026-06-04"`. */
|
|
123
|
+
readonly spec: string;
|
|
124
|
+
/** The agent whose discoverability changed. Same MotebitId space as agent identities. */
|
|
125
|
+
readonly motebit_id: string;
|
|
126
|
+
/** Resulting state: `true` = de-listed from Discover, `false` = reinstated. */
|
|
127
|
+
readonly revoked: boolean;
|
|
128
|
+
/** Categorized reason. `reinstated` accompanies `revoked: false`. */
|
|
129
|
+
readonly reason: AgentRevocationReason;
|
|
130
|
+
/** Who performed the change. */
|
|
131
|
+
readonly actor: AgentRevocationActor;
|
|
132
|
+
/** Optional free-text operator note (human context; not a substitute for `reason`). */
|
|
133
|
+
readonly note?: string;
|
|
134
|
+
/** Epoch milliseconds when the change took effect. */
|
|
135
|
+
readonly effective_at: number;
|
|
136
|
+
/** Relay's identity — same MotebitId space as agent identities. */
|
|
137
|
+
readonly relay_id: string;
|
|
138
|
+
/** Hex-encoded Ed25519 public key of the relay (32 bytes / 64 chars) — the trust anchor. */
|
|
139
|
+
readonly relay_public_key: string;
|
|
140
|
+
/** Hex-encoded SHA-256 of the canonical-JSON of the signed payload. */
|
|
141
|
+
readonly hash: string;
|
|
142
|
+
/** Cryptosuite identifier — `motebit-jcs-ed25519-hex-v1` today. */
|
|
143
|
+
readonly suite: "motebit-jcs-ed25519-hex-v1";
|
|
144
|
+
/** Hex-encoded Ed25519 signature over the canonical-JSON of the signed payload. */
|
|
145
|
+
readonly signature: string;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The signed payload — exactly what `hash` and `signature` cover. Exposed so
|
|
149
|
+
* producers construct + canonicalize the precise bytes the verifier checks.
|
|
150
|
+
* The post-sign fields (`hash`, `suite`, `signature`) are appended AFTER
|
|
151
|
+
* signing and are NOT part of this payload. `note` is included when present
|
|
152
|
+
* (optional fields participate in JCS only when defined).
|
|
153
|
+
*/
|
|
154
|
+
export type AgentRevocationSignedPayload = Pick<AgentRevocationRecord, "spec" | "motebit_id" | "revoked" | "reason" | "actor" | "note" | "effective_at" | "relay_id" | "relay_public_key">;
|
|
155
|
+
/**
|
|
156
|
+
* The signed feed envelope served at `GET /api/v1/agents/revocations`. The
|
|
157
|
+
* relay signs the list digest so a consumer can fetch the operator's entire
|
|
158
|
+
* moderation history in one verifiable response (in addition to each record
|
|
159
|
+
* being independently signed). Same suite + relay key as the records.
|
|
160
|
+
*/
|
|
161
|
+
export interface AgentRevocationFeed {
|
|
162
|
+
/** Spec identifier — matches the records' `spec`. */
|
|
163
|
+
readonly spec: string;
|
|
164
|
+
/** The relay's identity. */
|
|
165
|
+
readonly relay_id: string;
|
|
166
|
+
/** Hex-encoded Ed25519 public key of the relay. */
|
|
167
|
+
readonly relay_public_key: string;
|
|
168
|
+
/** Epoch milliseconds when the feed snapshot was minted. */
|
|
169
|
+
readonly generated_at: number;
|
|
170
|
+
/** Every revocation state change, oldest-first. */
|
|
171
|
+
readonly records: readonly AgentRevocationRecord[];
|
|
172
|
+
/** Cryptosuite identifier. */
|
|
173
|
+
readonly suite: "motebit-jcs-ed25519-hex-v1";
|
|
174
|
+
/** Ed25519 signature over the canonical-JSON of `{spec, relay_id, relay_public_key, generated_at, records}`. */
|
|
175
|
+
readonly signature: string;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Type guard — narrows `unknown` to `AgentRevocationRecord`. Structural shape
|
|
179
|
+
* only; does NOT verify the signature. Verifiers call this before parsing,
|
|
180
|
+
* then proceed through the verification algorithm (strip post-sign fields,
|
|
181
|
+
* canonicalize, Ed25519-verify against the pinned relay key).
|
|
182
|
+
*/
|
|
183
|
+
export declare function isAgentRevocationRecord(value: unknown): value is AgentRevocationRecord;
|
|
184
|
+
//# sourceMappingURL=agent-revocation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-revocation.d.ts","sourceRoot":"","sources":["../src/agent-revocation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;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;IACnE,QAAQ,CAAC,KAAK,EAAE,4BAA4B,CAAC;IAC7C,mFAAmF;IACnF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,MAAM,MAAM,4BAA4B,GAAG,IAAI,CAC7C,qBAAqB,EACnB,MAAM,GACN,YAAY,GACZ,SAAS,GACT,QAAQ,GACR,OAAO,GACP,MAAM,GACN,cAAc,GACd,UAAU,GACV,kBAAkB,CACrB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4BAA4B;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,mDAAmD;IACnD,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,4DAA4D;IAC5D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,mDAAmD;IACnD,QAAQ,CAAC,OAAO,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACnD,8BAA8B;IAC9B,QAAQ,CAAC,KAAK,EAAE,4BAA4B,CAAC;IAC7C,gHAAgH;IAChH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,qBAAqB,CAiBtF"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent-revocation — the operator's de-list power, made sovereign-verifiable.
|
|
3
|
+
*
|
|
4
|
+
* A permissionless relay accumulates junk: spam listings, abandoned test
|
|
5
|
+
* agents, abusive capabilities. The only automatic remedy is the 90-day
|
|
6
|
+
* no-heartbeat TTL — too slow for live abuse. The operator therefore needs
|
|
7
|
+
* a hygiene tool: remove an agent from Discover.
|
|
8
|
+
*
|
|
9
|
+
* But an operator who can silently disappear an agent is exactly the trust
|
|
10
|
+
* root the relay is forbidden from being (`services/relay/CLAUDE.md` rule 6:
|
|
11
|
+
* "the relay is a convenience layer, not a trust root"). The move that keeps
|
|
12
|
+
* this on-thesis is the same one motebit makes everywhere else — declared
|
|
13
|
+
* posture → *proven* posture: every revocation is a **signed, reasoned,
|
|
14
|
+
* publicly-fetchable statement**, not a silent DB flip.
|
|
15
|
+
*
|
|
16
|
+
* What revocation is and is not:
|
|
17
|
+
* - It is a **de-list**, not a **de-identify**. It sets the relay's
|
|
18
|
+
* `agent_registry.revoked` flag, which Discover filters
|
|
19
|
+
* (`task-routing.ts` `revokedFilter`). The agent's identity, key,
|
|
20
|
+
* succession chain, and receipts stay served by the
|
|
21
|
+
* identity-transparency endpoint — it remains hireable directly by id.
|
|
22
|
+
* - It is **post-hoc hygiene**, not **editorial curation**. Discovery
|
|
23
|
+
* stays permissionless (no allowlist, no pre-approval); the operator
|
|
24
|
+
* *removes* junk/abuse, it never *picks* winners.
|
|
25
|
+
* - It is **reversible**. An `unrevoke` is itself a signed record; the
|
|
26
|
+
* append-only feed is the operator's complete, auditable moderation
|
|
27
|
+
* history. A third party verifies each record against the relay's
|
|
28
|
+
* pinned public key — the same key the transparency declaration commits.
|
|
29
|
+
*
|
|
30
|
+
* This module exports the wire types only. The producer (signed-record
|
|
31
|
+
* construction, the `agent_revocations` store, the revoke/unrevoke routes,
|
|
32
|
+
* the `GET /api/v1/agents/revocations` feed) lives in `services/relay`.
|
|
33
|
+
*
|
|
34
|
+
* Doctrine: `docs/doctrine/agents-as-first-person-trust-graph.md`,
|
|
35
|
+
* `docs/doctrine/operator-transparency.md`,
|
|
36
|
+
* `docs/doctrine/self-attesting-system.md`.
|
|
37
|
+
*
|
|
38
|
+
* Permissive floor (Apache-2.0), type-only, zero runtime deps.
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* Canonical iteration order over `AgentRevocationReason`, frozen. Single
|
|
42
|
+
* source of truth for "every revocation reason" — exhaustive switches, the
|
|
43
|
+
* relay's reason validation, and the coverage gate
|
|
44
|
+
* (`check-agent-revocation-reason-canonical`) all enumerate through this.
|
|
45
|
+
*
|
|
46
|
+
* Same shape as `ALL_SUITE_IDS`, `ALL_SETTLEMENT_MODES`, `ALL_EVENT_TYPES`.
|
|
47
|
+
* Adding a reason is intentional protocol-level work: new union entry + new
|
|
48
|
+
* entry here + gate reference update.
|
|
49
|
+
*/
|
|
50
|
+
export const ALL_AGENT_REVOCATION_REASONS = Object.freeze([
|
|
51
|
+
"operator_test_cleanup",
|
|
52
|
+
"spam",
|
|
53
|
+
"abuse",
|
|
54
|
+
"malware",
|
|
55
|
+
"policy_violation",
|
|
56
|
+
"dmca",
|
|
57
|
+
"reinstated",
|
|
58
|
+
]);
|
|
59
|
+
/**
|
|
60
|
+
* Type guard — narrows `unknown` to `AgentRevocationReason`. The relay calls
|
|
61
|
+
* this on the operator-supplied `reason` before signing a record so an
|
|
62
|
+
* unrecognized reason fails closed rather than landing an un-typed value in
|
|
63
|
+
* the signed, externally-verified feed.
|
|
64
|
+
*
|
|
65
|
+
* Same shape as `isSuiteId`, `isSettlementMode`, `isEventType`.
|
|
66
|
+
*/
|
|
67
|
+
export function isAgentRevocationReason(value) {
|
|
68
|
+
return (typeof value === "string" && ALL_AGENT_REVOCATION_REASONS.includes(value));
|
|
69
|
+
}
|
|
70
|
+
// === Agent Revocation Record (signed envelope) ===
|
|
71
|
+
/**
|
|
72
|
+
* The pinned cryptosuite for revocation records. JCS canonicalization
|
|
73
|
+
* (RFC 8785) + Ed25519 + hex signature — the same family as the transparency
|
|
74
|
+
* declaration, identity-file, and content-artifact manifests, so a verifier
|
|
75
|
+
* that already pins the relay key for the transparency declaration verifies
|
|
76
|
+
* revocations with no new machinery. See `SUITE_REGISTRY` in `./crypto-suite.ts`.
|
|
77
|
+
*/
|
|
78
|
+
export const AGENT_REVOCATION_SUITE = "motebit-jcs-ed25519-hex-v1";
|
|
79
|
+
/**
|
|
80
|
+
* Current spec identifier for the revocation wire format. Bumps require a
|
|
81
|
+
* new wire-format spec doc; verifiers MUST reject records with an
|
|
82
|
+
* unrecognized `spec`.
|
|
83
|
+
*/
|
|
84
|
+
export const AGENT_REVOCATION_SPEC_ID = "motebit-agent-revocation/draft-2026-06-04";
|
|
85
|
+
/**
|
|
86
|
+
* Type guard — narrows `unknown` to `AgentRevocationRecord`. Structural shape
|
|
87
|
+
* only; does NOT verify the signature. Verifiers call this before parsing,
|
|
88
|
+
* then proceed through the verification algorithm (strip post-sign fields,
|
|
89
|
+
* canonicalize, Ed25519-verify against the pinned relay key).
|
|
90
|
+
*/
|
|
91
|
+
export function isAgentRevocationRecord(value) {
|
|
92
|
+
if (typeof value !== "object" || value === null)
|
|
93
|
+
return false;
|
|
94
|
+
const o = value;
|
|
95
|
+
return (typeof o.spec === "string" &&
|
|
96
|
+
typeof o.motebit_id === "string" &&
|
|
97
|
+
typeof o.revoked === "boolean" &&
|
|
98
|
+
isAgentRevocationReason(o.reason) &&
|
|
99
|
+
(o.actor === "operator" || o.actor === "self") &&
|
|
100
|
+
(o.note === undefined || typeof o.note === "string") &&
|
|
101
|
+
typeof o.effective_at === "number" &&
|
|
102
|
+
typeof o.relay_id === "string" &&
|
|
103
|
+
typeof o.relay_public_key === "string" &&
|
|
104
|
+
typeof o.hash === "string" &&
|
|
105
|
+
typeof o.suite === "string" &&
|
|
106
|
+
typeof o.signature === "string");
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=agent-revocation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-revocation.js","sourceRoot":"","sources":["../src/agent-revocation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAoCH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAqC,MAAM,CAAC,MAAM,CAAC;IAC1F,uBAAuB;IACvB,MAAM;IACN,OAAO;IACP,SAAS;IACT,kBAAkB;IAClB,MAAM;IACN,YAAY;CACc,CAAC,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proofs
|
|
15
15
|
* using these types and the shared Merkle library.
|
|
16
16
|
*/
|
|
17
|
+
import type { MerkleTreeVersion } from "./merkle-tree-hash.js";
|
|
17
18
|
/**
|
|
18
19
|
* A batch of per-agent settlement leaf hashes anchored as a Merkle tree.
|
|
19
20
|
*
|
|
@@ -98,5 +99,16 @@ export interface AgentSettlementAnchorProof {
|
|
|
98
99
|
batch_signature: string;
|
|
99
100
|
/** Onchain anchor metadata, or null if not yet submitted. */
|
|
100
101
|
anchor: AgentSettlementChainAnchor | null;
|
|
102
|
+
/**
|
|
103
|
+
* Tree-hash recipe for the Merkle path (leaf-domain / node-domain tags +
|
|
104
|
+
* hash). A `MerkleTreeVersion` from `merkle-tree-hash.ts`. **Absent ⇒
|
|
105
|
+
* `merkle-sha256-plain-v1`** — every proof minted before this axis existed
|
|
106
|
+
* still verifies offline. Verifiers resolve absent to the default and reject
|
|
107
|
+
* an unknown value fail-closed (never silently downgrade); a v2 producer MUST
|
|
108
|
+
* emit it rather than rely on the default. Separate axis from `suite` (the
|
|
109
|
+
* batch-signature recipe). See
|
|
110
|
+
* `docs/doctrine/merkle-tree-hash-versioning.md`.
|
|
111
|
+
*/
|
|
112
|
+
tree_hash_version?: MerkleTreeVersion;
|
|
101
113
|
}
|
|
102
114
|
//# sourceMappingURL=agent-settlement-anchor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-settlement-anchor.d.ts","sourceRoot":"","sources":["../src/agent-settlement-anchor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"agent-settlement-anchor.d.ts","sourceRoot":"","sources":["../src/agent-settlement-anchor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI/D;;;;;;GAMG;AACH,MAAM,WAAW,0BAA0B;IACzC,gCAAgC;IAChC,QAAQ,EAAE,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;;OAKG;IACH,KAAK,EAAE,4BAA4B,CAAC;IACpC,sEAAsE;IACtE,eAAe,EAAE,MAAM,CAAC;IACxB,6DAA6D;IAC7D,MAAM,EAAE,0BAA0B,GAAG,IAAI,CAAC;IAC1C;;;;;;;;;OASG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC"}
|
package/dist/artifact-type.d.ts
CHANGED
|
@@ -31,14 +31,15 @@
|
|
|
31
31
|
*/
|
|
32
32
|
/**
|
|
33
33
|
* The closed set of content-artifact categories motebit currently
|
|
34
|
-
* signs.
|
|
34
|
+
* signs. Thirteen cover the state-export endpoints at
|
|
35
35
|
* `services/relay/src/state-export.ts` (relay-assembled bundles
|
|
36
36
|
* the relay signs as a witness over its database state per the
|
|
37
|
-
* recognition note in `docs/doctrine/nist-alignment.md` §8)
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
37
|
+
* recognition note in `docs/doctrine/nist-alignment.md` §8) — the
|
|
38
|
+
* original twelve plus `settlement-summary` (the per-peer economic
|
|
39
|
+
* projection over `relay_settlements`). `goal-result` is the **first
|
|
40
|
+
* non-relay-state-export consumer**: a motebit-direct, per-fire
|
|
41
|
+
* artifact that the motebit itself signs as the producer (the agent's
|
|
42
|
+
* own work product, not a relay-assembled bundle). The expansion is doctrinally aligned —
|
|
42
43
|
* the registry's stated semantic is "content-artifact category for
|
|
43
44
|
* C2PA-shape provenance," not "relay state-export bundle." Goals
|
|
44
45
|
* is the first arc to prove the registry generalizes; future
|
|
@@ -78,6 +79,15 @@
|
|
|
78
79
|
* categories" — the artifact category's cryptographic
|
|
79
80
|
* provenance envelope. Bound to the fire via `invocation`
|
|
80
81
|
* (goal_id + execution-receipt id when present).
|
|
82
|
+
* - `settlement-summary` — per-peer economic history projected
|
|
83
|
+
* from the relay's signed settlement ledger
|
|
84
|
+
* (`/api/v1/agents/:motebitId/settlements`). Relay-assembled witness
|
|
85
|
+
* over `relay_settlements`: for the calling motebit, what it
|
|
86
|
+
* earned from and paid to each counterparty, in micro-units.
|
|
87
|
+
* The money side of the first-person trust graph — receipts
|
|
88
|
+
* stay source of truth, this is a materialized projection, never
|
|
89
|
+
* a denormalized balance. Doctrine:
|
|
90
|
+
* `docs/doctrine/agents-as-first-person-trust-graph.md` §6.
|
|
81
91
|
*
|
|
82
92
|
* Adding an endpoint is intentional protocol-level work: a new
|
|
83
93
|
* `ContentArtifactType` entry here, a new named constant, a new
|
|
@@ -89,7 +99,7 @@
|
|
|
89
99
|
* not to motebit-direct consumers like `goal-result`, which the
|
|
90
100
|
* runtime signs at fire-time through its own helper.
|
|
91
101
|
*/
|
|
92
|
-
export type ContentArtifactType = "state-snapshot" | "memory-export" | "goal-list" | "conversation-list" | "conversation-messages" | "device-list" | "audit-trail" | "plan-list" | "plan-detail" | "gradient-history" | "sync-pull" | "execution-ledger" | "goal-result";
|
|
102
|
+
export type ContentArtifactType = "state-snapshot" | "memory-export" | "goal-list" | "conversation-list" | "conversation-messages" | "device-list" | "audit-trail" | "plan-list" | "plan-detail" | "gradient-history" | "sync-pull" | "execution-ledger" | "goal-result" | "settlement-summary";
|
|
93
103
|
/** Relay's stored state-vector snapshot for a motebit. */
|
|
94
104
|
export declare const STATE_SNAPSHOT_ARTIFACT: ContentArtifactType;
|
|
95
105
|
/** Relay-assembled memory-graph snapshot (nodes + edges). */
|
|
@@ -128,6 +138,14 @@ export declare const EXECUTION_LEDGER_ARTIFACT: ContentArtifactType;
|
|
|
128
138
|
* artifact category's cryptographic provenance envelope.
|
|
129
139
|
*/
|
|
130
140
|
export declare const GOAL_RESULT_ARTIFACT: ContentArtifactType;
|
|
141
|
+
/**
|
|
142
|
+
* Relay-assembled per-peer economic history for a motebit — what it
|
|
143
|
+
* earned from and paid to each counterparty, projected from the signed
|
|
144
|
+
* `relay_settlements` ledger. The money side of the first-person trust
|
|
145
|
+
* graph; a materialized projection, never a stored balance. Doctrine:
|
|
146
|
+
* `docs/doctrine/agents-as-first-person-trust-graph.md` §6.
|
|
147
|
+
*/
|
|
148
|
+
export declare const SETTLEMENT_SUMMARY_ARTIFACT: ContentArtifactType;
|
|
131
149
|
/**
|
|
132
150
|
* Canonical iteration order, frozen. Consumers that need to iterate
|
|
133
151
|
* (drift gates, tooling, docs) use this so TypeScript sees the narrow
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact-type.d.ts","sourceRoot":"","sources":["../src/artifact-type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH
|
|
1
|
+
{"version":3,"file":"artifact-type.d.ts","sourceRoot":"","sources":["../src/artifact-type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AACH,MAAM,MAAM,mBAAmB,GAC3B,gBAAgB,GAChB,eAAe,GACf,WAAW,GACX,mBAAmB,GACnB,uBAAuB,GACvB,aAAa,GACb,aAAa,GACb,WAAW,GACX,aAAa,GACb,kBAAkB,GAClB,WAAW,GACX,kBAAkB,GAClB,aAAa,GACb,oBAAoB,CAAC;AAUzB,0DAA0D;AAC1D,eAAO,MAAM,uBAAuB,EAAE,mBAAsC,CAAC;AAE7E,6DAA6D;AAC7D,eAAO,MAAM,sBAAsB,EAAE,mBAAqC,CAAC;AAE3E,+CAA+C;AAC/C,eAAO,MAAM,kBAAkB,EAAE,mBAAiC,CAAC;AAEnE,wDAAwD;AACxD,eAAO,MAAM,0BAA0B,EAAE,mBAAyC,CAAC;AAEnF,mEAAmE;AACnE,eAAO,MAAM,8BAA8B,EAAE,mBAA6C,CAAC;AAE3F,+DAA+D;AAC/D,eAAO,MAAM,oBAAoB,EAAE,mBAAmC,CAAC;AAEvE,+CAA+C;AAC/C,eAAO,MAAM,oBAAoB,EAAE,mBAAmC,CAAC;AAEvE,6EAA6E;AAC7E,eAAO,MAAM,kBAAkB,EAAE,mBAAiC,CAAC;AAEnE,yDAAyD;AACzD,eAAO,MAAM,oBAAoB,EAAE,mBAAmC,CAAC;AAEvE,4DAA4D;AAC5D,eAAO,MAAM,yBAAyB,EAAE,mBAAwC,CAAC;AAEjF,sEAAsE;AACtE,eAAO,MAAM,kBAAkB,EAAE,mBAAiC,CAAC;AAEnE;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,EAAE,mBAAwC,CAAC;AAEjF;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,EAAE,mBAAmC,CAAC;AAEvE;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,EAAE,mBAA0C,CAAC;AAIrF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,mBAAmB,EAenE,CAAC;AAEH;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAIlF"}
|
package/dist/artifact-type.js
CHANGED
|
@@ -74,6 +74,14 @@ export const EXECUTION_LEDGER_ARTIFACT = "execution-ledger";
|
|
|
74
74
|
* artifact category's cryptographic provenance envelope.
|
|
75
75
|
*/
|
|
76
76
|
export const GOAL_RESULT_ARTIFACT = "goal-result";
|
|
77
|
+
/**
|
|
78
|
+
* Relay-assembled per-peer economic history for a motebit — what it
|
|
79
|
+
* earned from and paid to each counterparty, projected from the signed
|
|
80
|
+
* `relay_settlements` ledger. The money side of the first-person trust
|
|
81
|
+
* graph; a materialized projection, never a stored balance. Doctrine:
|
|
82
|
+
* `docs/doctrine/agents-as-first-person-trust-graph.md` §6.
|
|
83
|
+
*/
|
|
84
|
+
export const SETTLEMENT_SUMMARY_ARTIFACT = "settlement-summary";
|
|
77
85
|
// === Iteration + type guard =================================================
|
|
78
86
|
/**
|
|
79
87
|
* Canonical iteration order, frozen. Consumers that need to iterate
|
|
@@ -94,6 +102,7 @@ export const ALL_CONTENT_ARTIFACT_TYPES = Object.freeze([
|
|
|
94
102
|
"sync-pull",
|
|
95
103
|
"execution-ledger",
|
|
96
104
|
"goal-result",
|
|
105
|
+
"settlement-summary",
|
|
97
106
|
]);
|
|
98
107
|
/**
|
|
99
108
|
* Type guard — narrows `unknown` to `ContentArtifactType`. Drift-gate-driven
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact-type.js","sourceRoot":"","sources":["../src/artifact-type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;
|
|
1
|
+
{"version":3,"file":"artifact-type.js","sourceRoot":"","sources":["../src/artifact-type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAwFH,+EAA+E;AAC/E,EAAE;AACF,yEAAyE;AACzE,0EAA0E;AAC1E,4EAA4E;AAC5E,6EAA6E;AAC7E,kBAAkB;AAElB,0DAA0D;AAC1D,MAAM,CAAC,MAAM,uBAAuB,GAAwB,gBAAgB,CAAC;AAE7E,6DAA6D;AAC7D,MAAM,CAAC,MAAM,sBAAsB,GAAwB,eAAe,CAAC;AAE3E,+CAA+C;AAC/C,MAAM,CAAC,MAAM,kBAAkB,GAAwB,WAAW,CAAC;AAEnE,wDAAwD;AACxD,MAAM,CAAC,MAAM,0BAA0B,GAAwB,mBAAmB,CAAC;AAEnF,mEAAmE;AACnE,MAAM,CAAC,MAAM,8BAA8B,GAAwB,uBAAuB,CAAC;AAE3F,+DAA+D;AAC/D,MAAM,CAAC,MAAM,oBAAoB,GAAwB,aAAa,CAAC;AAEvE,+CAA+C;AAC/C,MAAM,CAAC,MAAM,oBAAoB,GAAwB,aAAa,CAAC;AAEvE,6EAA6E;AAC7E,MAAM,CAAC,MAAM,kBAAkB,GAAwB,WAAW,CAAC;AAEnE,yDAAyD;AACzD,MAAM,CAAC,MAAM,oBAAoB,GAAwB,aAAa,CAAC;AAEvE,4DAA4D;AAC5D,MAAM,CAAC,MAAM,yBAAyB,GAAwB,kBAAkB,CAAC;AAEjF,sEAAsE;AACtE,MAAM,CAAC,MAAM,kBAAkB,GAAwB,WAAW,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAwB,kBAAkB,CAAC;AAEjF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAwB,aAAa,CAAC;AAEvE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAwB,oBAAoB,CAAC;AAErF,+EAA+E;AAE/E;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAmC,MAAM,CAAC,MAAM,CAAC;IACtF,gBAAgB;IAChB,eAAe;IACf,WAAW;IACX,mBAAmB;IACnB,uBAAuB;IACvB,aAAa;IACb,aAAa;IACb,WAAW;IACX,aAAa;IACb,kBAAkB;IAClB,WAAW;IACX,kBAAkB;IAClB,aAAa;IACb,oBAAoB;CACrB,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAClD,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ,IAAK,0BAAgD,CAAC,QAAQ,CAAC,KAAK,CAAC,CAC/F,CAAC;AACJ,CAAC"}
|
package/dist/base58.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* base58btc encoding (Bitcoin alphabet) — a pure, chain-agnostic codec.
|
|
3
|
+
*
|
|
4
|
+
* This is NOT a Solana primitive: base58btc is the shared encoding used by
|
|
5
|
+
* Bitcoin, IPFS (CIDv0), Solana addresses, and others. It lives in
|
|
6
|
+
* `@motebit/protocol` as a sibling to the money converters (`toMicro` /
|
|
7
|
+
* `fromMicro`) — pure deterministic byte math, no I/O, no chain awareness.
|
|
8
|
+
*
|
|
9
|
+
* The motebit use today: a Solana address is `base58Encode(ed25519_pubkey)` —
|
|
10
|
+
* the sovereign rail's "identity key = address" property. That chain-specific
|
|
11
|
+
* knowledge ("Solana address = base58 of the 32-byte pubkey") stays at the call
|
|
12
|
+
* site; this module only knows bytes → base58 string.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Encode bytes as a base58btc string. Leading zero bytes map to leading `1`s
|
|
16
|
+
* (base58btc convention), so the encoding is length-preserving for zero
|
|
17
|
+
* prefixes — the property addresses and CIDs depend on.
|
|
18
|
+
*/
|
|
19
|
+
export declare function base58Encode(bytes: Uint8Array): string;
|
|
20
|
+
//# sourceMappingURL=base58.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base58.d.ts","sourceRoot":"","sources":["../src/base58.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CA0BtD"}
|
package/dist/base58.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* base58btc encoding (Bitcoin alphabet) — a pure, chain-agnostic codec.
|
|
3
|
+
*
|
|
4
|
+
* This is NOT a Solana primitive: base58btc is the shared encoding used by
|
|
5
|
+
* Bitcoin, IPFS (CIDv0), Solana addresses, and others. It lives in
|
|
6
|
+
* `@motebit/protocol` as a sibling to the money converters (`toMicro` /
|
|
7
|
+
* `fromMicro`) — pure deterministic byte math, no I/O, no chain awareness.
|
|
8
|
+
*
|
|
9
|
+
* The motebit use today: a Solana address is `base58Encode(ed25519_pubkey)` —
|
|
10
|
+
* the sovereign rail's "identity key = address" property. That chain-specific
|
|
11
|
+
* knowledge ("Solana address = base58 of the 32-byte pubkey") stays at the call
|
|
12
|
+
* site; this module only knows bytes → base58 string.
|
|
13
|
+
*/
|
|
14
|
+
const ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
15
|
+
/**
|
|
16
|
+
* Encode bytes as a base58btc string. Leading zero bytes map to leading `1`s
|
|
17
|
+
* (base58btc convention), so the encoding is length-preserving for zero
|
|
18
|
+
* prefixes — the property addresses and CIDs depend on.
|
|
19
|
+
*/
|
|
20
|
+
export function base58Encode(bytes) {
|
|
21
|
+
if (bytes.length === 0)
|
|
22
|
+
return "";
|
|
23
|
+
// Leading zero bytes become leading '1' characters.
|
|
24
|
+
let zeros = 0;
|
|
25
|
+
while (zeros < bytes.length && bytes[zeros] === 0)
|
|
26
|
+
zeros++;
|
|
27
|
+
// Convert the big-endian byte array to a little-endian base-58 digit array
|
|
28
|
+
// by treating it as a base-256 number and repeatedly carrying into base 58.
|
|
29
|
+
const digits = [];
|
|
30
|
+
for (let i = zeros; i < bytes.length; i++) {
|
|
31
|
+
let carry = bytes[i];
|
|
32
|
+
for (let j = 0; j < digits.length; j++) {
|
|
33
|
+
carry += digits[j] << 8;
|
|
34
|
+
digits[j] = carry % 58;
|
|
35
|
+
carry = (carry / 58) | 0;
|
|
36
|
+
}
|
|
37
|
+
while (carry > 0) {
|
|
38
|
+
digits.push(carry % 58);
|
|
39
|
+
carry = (carry / 58) | 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
let out = "1".repeat(zeros);
|
|
43
|
+
for (let k = digits.length - 1; k >= 0; k--)
|
|
44
|
+
out += ALPHABET[digits[k]];
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=base58.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base58.js","sourceRoot":"","sources":["../src/base58.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,QAAQ,GAAG,4DAA4D,CAAC;AAE9E;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAiB;IAC5C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAElC,oDAAoD;IACpD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,OAAO,KAAK,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC;QAAE,KAAK,EAAE,CAAC;IAE3D,2EAA2E;IAC3E,4EAA4E;IAC5E,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1C,IAAI,KAAK,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC;QACtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACvC,KAAK,IAAI,MAAM,CAAC,CAAC,CAAE,IAAI,CAAC,CAAC;YACzB,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;YACvB,KAAK,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,KAAK,GAAG,CAAC,EAAE,CAAC;YACjB,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC;YACxB,KAAK,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,IAAI,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;QAAE,GAAG,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,CAAC;IACzE,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* for credential anchoring. Any implementation can produce and verify anchor
|
|
6
6
|
* proofs using these types.
|
|
7
7
|
*/
|
|
8
|
+
import type { MerkleTreeVersion } from "./merkle-tree-hash.js";
|
|
8
9
|
/** A batch of credential hashes anchored as a Merkle tree. */
|
|
9
10
|
export interface CredentialAnchorBatch {
|
|
10
11
|
/** UUID v4 batch identifier. */
|
|
@@ -79,6 +80,17 @@ export interface CredentialAnchorProof {
|
|
|
79
80
|
batch_signature: string;
|
|
80
81
|
/** Onchain anchor metadata, or null if not yet submitted. */
|
|
81
82
|
anchor: CredentialChainAnchor | null;
|
|
83
|
+
/**
|
|
84
|
+
* Tree-hash recipe for the Merkle path (leaf-domain / node-domain tags +
|
|
85
|
+
* hash). A `MerkleTreeVersion` from `merkle-tree-hash.ts`. **Absent ⇒
|
|
86
|
+
* `merkle-sha256-plain-v1`** — every proof minted before this axis existed
|
|
87
|
+
* still verifies offline. Verifiers resolve absent to the default and reject
|
|
88
|
+
* an unknown value fail-closed (never silently downgrade); a v2 producer MUST
|
|
89
|
+
* emit it rather than rely on the default. Separate axis from `suite` (the
|
|
90
|
+
* batch-signature recipe). See
|
|
91
|
+
* `docs/doctrine/merkle-tree-hash-versioning.md`.
|
|
92
|
+
*/
|
|
93
|
+
tree_hash_version?: MerkleTreeVersion;
|
|
82
94
|
}
|
|
83
95
|
/**
|
|
84
96
|
* Chain-agnostic interface for submitting Merkle roots onchain.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-anchor.d.ts","sourceRoot":"","sources":["../src/credential-anchor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"credential-anchor.d.ts","sourceRoot":"","sources":["../src/credential-anchor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI/D,8DAA8D;AAC9D,MAAM,WAAW,qBAAqB;IACpC,gCAAgC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;IACn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