@agentcontextdistributionprotocol/acdp 0.6.0 → 0.8.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 +29 -4
- package/index.d.ts +84 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -2,16 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
Thin NAPI-rs binding over the [`acdp`](https://crates.io/crates/acdp)
|
|
4
4
|
Rust library. Implements the producer- and consumer-side crypto for the
|
|
5
|
-
Agent Context Distribution Protocol v0.1.0
|
|
6
|
-
|
|
7
|
-
`undici` for transport.
|
|
5
|
+
Agent Context Distribution Protocol — v0.1.0 core plus the v0.2.0 Trust &
|
|
6
|
+
Hardening surface (RFC-ACDP-0001 through 0015). HTTP is intentionally left
|
|
7
|
+
to the caller — pair this with `fetch` / `undici` for transport.
|
|
8
|
+
|
|
9
|
+
Package version tracks the binding release line (currently **0.8.0**).
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @agentcontextdistributionprotocol/acdp
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Prebuilt native binaries are published for macOS (x64/arm64) and Linux
|
|
18
|
+
(x64/arm64-gnu); the loader package selects the right one at install time.
|
|
8
19
|
|
|
9
20
|
## Install (development)
|
|
10
21
|
|
|
11
22
|
```bash
|
|
12
23
|
npm install # installs @napi-rs/cli
|
|
13
24
|
npm run build:debug # produces index.js + acdp.<platform>.node
|
|
14
|
-
node --test tests
|
|
25
|
+
node --test tests/*.mjs # in-process unit tests, no HTTP
|
|
15
26
|
```
|
|
16
27
|
|
|
17
28
|
## Build a release binary
|
|
@@ -46,6 +57,20 @@ AcdpVerifier.verifySignature(
|
|
|
46
57
|
);
|
|
47
58
|
```
|
|
48
59
|
|
|
60
|
+
## Verification surface
|
|
61
|
+
|
|
62
|
+
`AcdpVerifier` covers the full 0.2.0 surface in addition to the basics
|
|
63
|
+
above: offline `did:key` verification (`verifyBodyOffline`,
|
|
64
|
+
`verifyPublishRequestOffline`), registry receipts (`verifyReceipt`,
|
|
65
|
+
`verifyLineageHeadReceipt`), the transparency log (`verifyLogCheckpoint`,
|
|
66
|
+
`verifyLogInclusion`, `verifyLogConsistency`), lifecycle events
|
|
67
|
+
(`verifyLifecycleEvent`), key revocation (`parseKeyRevocation`,
|
|
68
|
+
`classifyUnderRevocation`), and witness cosigning
|
|
69
|
+
(`buildWitnessCosignature`, `verifyWitnessCosignature`,
|
|
70
|
+
`evaluateWitnessQuorum`). `AcdpP256Producer`, `AcdpDid`,
|
|
71
|
+
`AcdpDidDocument`, `AcdpCanonicalizer`, `AcdpMerkle`, and `AcdpSsrfPolicy`
|
|
72
|
+
are also exported.
|
|
73
|
+
|
|
49
74
|
## Design rules
|
|
50
75
|
|
|
51
76
|
* **JSON across the FFI boundary.** Every method accepts and returns
|
package/index.d.ts
CHANGED
|
@@ -857,4 +857,88 @@ export declare class AcdpVerifier {
|
|
|
857
857
|
* steps 3–4).
|
|
858
858
|
*/
|
|
859
859
|
static classifyUnderRevocation(revocationsJson: string, signerFingerprint: string, receiptCreatedAtRfc3339?: string | undefined | null): string
|
|
860
|
+
/**
|
|
861
|
+
* Mint a signed transparency-log witness cosignature
|
|
862
|
+
* (RFC-ACDP-0015 §5) — the MINT surface a host-language witness
|
|
863
|
+
* service uses. The witness observes a checkpoint and cosigns it
|
|
864
|
+
* with its OWN Ed25519 key (a witness key, distinct from the
|
|
865
|
+
* registry receipt key); the returned `log_cosignature` uses the
|
|
866
|
+
* RFC-ACDP-0010 §5 construction verbatim (the witness signs the
|
|
867
|
+
* ASCII bytes of the `"sha256:<hex>"` cosignature-hash string).
|
|
868
|
+
*
|
|
869
|
+
* * `witnessedCheckpointJson` — the identity-bearing subset of the
|
|
870
|
+
* checkpoint the witness observed: `{"log_id", "tree_size",
|
|
871
|
+
* "root_hash", "timestamp"}` (closed schema).
|
|
872
|
+
* * `witnessDid` — the witness's own DID (`did:web` or `did:key`).
|
|
873
|
+
* The signing-key DID URL is derived as
|
|
874
|
+
* `"<witnessDid>#witness-key-1"` (the §5/§9 witness-key
|
|
875
|
+
* convention).
|
|
876
|
+
* * `witnessSeedHex` — the witness Ed25519 signing seed, hex-
|
|
877
|
+
* encoded (64 hex chars → 32 bytes). The same seed produces
|
|
878
|
+
* byte-identical cosignatures across bindings.
|
|
879
|
+
* * `witnessedAtRfc3339` — the witness-clock observation time
|
|
880
|
+
* (canonical millisecond RFC 3339 UTC; truncated to ms).
|
|
881
|
+
*
|
|
882
|
+
* Returns the signed `log_cosignature` as a JSON string. This is
|
|
883
|
+
* the RAW mint (no §7 obligation — the checkpoint's own signature
|
|
884
|
+
* and consistency against a retained head are the host's job).
|
|
885
|
+
* Throws on malformed input (bad seed / timestamp / witness DID /
|
|
886
|
+
* witnessed_checkpoint).
|
|
887
|
+
*/
|
|
888
|
+
static buildWitnessCosignature(witnessedCheckpointJson: string, witnessDid: string, witnessSeedHex: string, witnessedAtRfc3339: string): string
|
|
889
|
+
/**
|
|
890
|
+
* Verify one witness cosignature against a checkpoint the consumer
|
|
891
|
+
* has itself verified, offline per RFC-ACDP-0015 §8 (steps 1–5):
|
|
892
|
+
* closed parse + witness binding, checkpoint binding, the witness
|
|
893
|
+
* signature over the RAW wire preimage against the key resolved
|
|
894
|
+
* from the caller-supplied witness DID document (§9: looked up in
|
|
895
|
+
* `verificationMethod`, retired keys stay verifiable), and the
|
|
896
|
+
* `witnessed_at` well-formedness + forward-skew check.
|
|
897
|
+
*
|
|
898
|
+
* * `cosigJson` — the `log_cosignature` object as received.
|
|
899
|
+
* * `witnessDidDocJson` — the WITNESS's resolved DID document
|
|
900
|
+
* (resolution stays in JS land). Its `id` MUST equal the
|
|
901
|
+
* cosignature's `witness_id`.
|
|
902
|
+
* * `expectedCheckpointJson` — the RFC-ACDP-0012 checkpoint the
|
|
903
|
+
* consumer independently holds and verified; the cosignature's
|
|
904
|
+
* `{log_id, tree_size, root_hash}` MUST match it (§8 step 4).
|
|
905
|
+
* * `nowRfc3339` — the consumer clock (defaults to now).
|
|
906
|
+
* * `maxClockSkewSecs` — §8 step 5 forward allowance (default 120).
|
|
907
|
+
*
|
|
908
|
+
* Returns a JSON verdict: `{"valid": true, "witness_id": ...,
|
|
909
|
+
* "age_secs": int, "stale": bool}` — staleness (§8.1) is policy,
|
|
910
|
+
* not a verification failure — or `{"valid": false, "code":
|
|
911
|
+
* "invalid_witness_cosignature"|..., "error": ...}`. Throws only
|
|
912
|
+
* on malformed host input.
|
|
913
|
+
*/
|
|
914
|
+
static verifyWitnessCosignature(cosigJson: string, witnessDidDocJson: string, expectedCheckpointJson: string, nowRfc3339?: string | undefined | null, maxClockSkewSecs?: number | undefined | null): string
|
|
915
|
+
/**
|
|
916
|
+
* Compute the RFC-ACDP-0015 §8 N-witnessed report over a set of
|
|
917
|
+
* cosignatures for a checkpoint the consumer has itself verified.
|
|
918
|
+
* A cosignature counts toward N iff it names a TRUSTED witness,
|
|
919
|
+
* covers the checkpoint's `(log_id, tree_size, root_hash)` tuple,
|
|
920
|
+
* and passes every §8 step; DISTINCT `witness_id` values are
|
|
921
|
+
* counted. A cosignature that fails a step does not fail the
|
|
922
|
+
* checkpoint — it is recorded in `failures` and simply does not
|
|
923
|
+
* count.
|
|
924
|
+
*
|
|
925
|
+
* * `cosignaturesJson` — a JSON array of `log_cosignature` objects.
|
|
926
|
+
* * `expectedCheckpointJson` — the verified checkpoint the quorum
|
|
927
|
+
* is over.
|
|
928
|
+
* * `trustedWitnessDidsJson` — a JSON array of the witness DIDs the
|
|
929
|
+
* consumer trusts; only these can count.
|
|
930
|
+
* * `witnessDidDocsJson` — a JSON object mapping each `witness_id`
|
|
931
|
+
* to its resolved DID document.
|
|
932
|
+
* * `policyJson` — `{"min_witnesses"?, "max_age_secs"?,
|
|
933
|
+
* "max_clock_skew_secs"?}`. Defaults mirror the Rust
|
|
934
|
+
* `WitnessPolicy`: `min_witnesses=1`, `max_age_secs=300` (an
|
|
935
|
+
* explicit `null` disables the freshness split),
|
|
936
|
+
* `max_clock_skew_secs=120`.
|
|
937
|
+
* * `nowRfc3339` — the consumer clock (defaults to now).
|
|
938
|
+
*
|
|
939
|
+
* Returns a JSON report: `{"witnessed_count", "witnesses",
|
|
940
|
+
* "meets_quorum", "fresh_witnessed_count", "meets_fresh_quorum",
|
|
941
|
+
* "failures"}`. Throws on malformed host input.
|
|
942
|
+
*/
|
|
943
|
+
static evaluateWitnessQuorum(cosignaturesJson: string, expectedCheckpointJson: string, trustedWitnessDidsJson: string, witnessDidDocsJson: string, policyJson: string, nowRfc3339?: string | undefined | null): string
|
|
860
944
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentcontextdistributionprotocol/acdp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Agent Context Distribution Protocol — Node.js SDK",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"registry": "https://registry.npmjs.org/"
|
|
48
48
|
},
|
|
49
49
|
"optionalDependencies": {
|
|
50
|
-
"@agentcontextdistributionprotocol/acdp-darwin-x64": "0.
|
|
51
|
-
"@agentcontextdistributionprotocol/acdp-darwin-arm64": "0.
|
|
52
|
-
"@agentcontextdistributionprotocol/acdp-linux-x64-gnu": "0.
|
|
53
|
-
"@agentcontextdistributionprotocol/acdp-linux-arm64-gnu": "0.
|
|
50
|
+
"@agentcontextdistributionprotocol/acdp-darwin-x64": "0.8.0",
|
|
51
|
+
"@agentcontextdistributionprotocol/acdp-darwin-arm64": "0.8.0",
|
|
52
|
+
"@agentcontextdistributionprotocol/acdp-linux-x64-gnu": "0.8.0",
|
|
53
|
+
"@agentcontextdistributionprotocol/acdp-linux-arm64-gnu": "0.8.0"
|
|
54
54
|
}
|
|
55
55
|
}
|