twin3-sdk 0.2.14-pre-alpha → 0.2.17-pre-alpha
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 -6
- package/index.d.ts +233 -2
- package/js/comm/counterparty.js +2 -1
- package/js/discovery.d.ts +9 -0
- package/js/discovery.js +5 -0
- package/js/discovery.mjs +5 -0
- package/js/engine-observation.js +261 -0
- package/js/human-score.mjs +13 -0
- package/js/index.js +25 -0
- package/js/index.mjs +25 -0
- package/js/internal/comm.js +391 -21
- package/js/internal/discovery.js +9 -0
- package/js/internal/matrix.js +1 -1
- package/js/internal/shield.js +55 -17
- package/js/memory-guard.js +173 -0
- package/js/shield.d.ts +5 -0
- package/js/shield.js +5 -0
- package/js/shield.mjs +4 -0
- package/js/trust/consumer-registration.js +259 -0
- package/js/trust/didweb.js +407 -0
- package/js/trust.d.ts +27 -0
- package/js/trust.js +31 -0
- package/js/trust.mjs +16 -0
- package/package.json +9 -3
package/README.md
CHANGED
|
@@ -66,7 +66,8 @@ L1 also exposes a candidate discovery evidence API for xAgent ID and xHuman ID.
|
|
|
66
66
|
|
|
67
67
|
Python and Node support [explicit Matrix comparison profiles](docs/matrix-runtime-profiles.md),
|
|
68
68
|
including weighted/masked cosine and structured coverage results. Node constructor
|
|
69
|
-
coercions still differ
|
|
69
|
+
coercions still differ. Node TaskInbox admits owner-policy receipts with
|
|
70
|
+
applyPayment and injected-verifier receipts with applyX402Payment. Evidence
|
|
70
71
|
trail is experimental until an actual consumer supplies durable integration evidence.
|
|
71
72
|
|
|
72
73
|
`(experimental)` marks a capability whose row in [`tests/capability-inventory.json`](tests/capability-inventory.json) is not yet `available`: it is importable today and its surface may still change. Everything unmarked is `available`. A name written `Class.method` is a method, not a module export. Every name in this table is checked against a real public export by [`tests/test_readme_capability_claims.py`](tests/test_readme_capability_claims.py).
|
|
@@ -115,22 +116,22 @@ pip install -e /path/to/twin3-sdk
|
|
|
115
116
|
* Any protocol or algorithm improvement in `twin3-sdk` is reflected in both applications in **0 milliseconds**.
|
|
116
117
|
|
|
117
118
|
#### 2. Production Distribution
|
|
118
|
-
`v0.2.
|
|
119
|
+
`v0.2.17-pre-alpha` is the current release candidate: `0.2.17-pre-alpha` for npm and `0.2.17a0` for PyPI. It is published from main through the Cloud Build tag trigger; the previous version number was never published. Consumers must pin the exact released version and lock its registry integrity; never use a mutable range for a cryptographic protocol dependency. This release stays pre-alpha. Marketplace or sales copy may offer it for evaluation; it is not a stable release, and the npm dist-tag is `next`, not `latest`.
|
|
119
120
|
|
|
120
|
-
`package.json` `engines`
|
|
121
|
+
`package.json` `engines` requires Node.js `>=22.23.4` and does not set an npm engine. CI covers patched Node 22, 24 and 26; Node 18 and 20 are outside the supported baseline. Packing this repository was checked with npm 10 or newer; the stricter npm version in the release runbook applies only to Trusted Publishing.
|
|
121
122
|
|
|
122
123
|
After publication, install the exact released version from the registry:
|
|
123
124
|
|
|
124
125
|
```bash
|
|
125
|
-
npm install twin3-sdk@0.2.
|
|
126
|
-
pip install twin3-sdk==0.2.
|
|
126
|
+
npm install twin3-sdk@0.2.17-pre-alpha
|
|
127
|
+
pip install twin3-sdk==0.2.17a0
|
|
127
128
|
```
|
|
128
129
|
|
|
129
130
|
For local evaluation, you can also use the packed npm tarball. Do not install from a git URL or a version range:
|
|
130
131
|
|
|
131
132
|
```bash
|
|
132
133
|
npm pack --ignore-scripts
|
|
133
|
-
npm install ./twin3-sdk-0.2.
|
|
134
|
+
npm install ./twin3-sdk-0.2.17-pre-alpha.tgz
|
|
134
135
|
```
|
|
135
136
|
|
|
136
137
|
---
|
package/index.d.ts
CHANGED
|
@@ -158,6 +158,71 @@ export interface DiscoveryEvidenceView {
|
|
|
158
158
|
digest: string;
|
|
159
159
|
}
|
|
160
160
|
export declare function buildDiscoveryEvidenceView(summary: DiscoveryEvidenceSummary, options: { visitSourceStatus: "connected" | "not_connected"; googleAiSearchSourceStatus: "connected" | "not_connected" }): DiscoveryEvidenceView;
|
|
161
|
+
export declare const ENGINE_OBSERVATION_SCHEMA: "twin3-discovery-engine-observation-v1";
|
|
162
|
+
export declare const ENGINE_READING_SCHEMA: "twin3-discovery-engine-reading-v1";
|
|
163
|
+
export declare class EngineObservationError extends Error { code: string; }
|
|
164
|
+
export type EngineObservationEvidenceLevel = "server_observed_engine_answer" | "replay_api" | "owner_supplied_platform_export";
|
|
165
|
+
export interface EngineObservationInput {
|
|
166
|
+
engine: string;
|
|
167
|
+
prompt_id: string;
|
|
168
|
+
observed_at: number;
|
|
169
|
+
status: "answered" | "error";
|
|
170
|
+
model?: string | null;
|
|
171
|
+
need_id?: string | null;
|
|
172
|
+
paraphrase_of?: string | null;
|
|
173
|
+
run_id?: string | null;
|
|
174
|
+
host?: string | null;
|
|
175
|
+
retrieved?: boolean | null;
|
|
176
|
+
mentioned?: boolean | null;
|
|
177
|
+
cited?: boolean | null;
|
|
178
|
+
evidence_level?: EngineObservationEvidenceLevel;
|
|
179
|
+
evidence_strength?: EngineObservationEvidenceLevel;
|
|
180
|
+
answer?: string | null;
|
|
181
|
+
answer_digest?: string | null;
|
|
182
|
+
[extra: string]: unknown;
|
|
183
|
+
}
|
|
184
|
+
export interface EngineObservation {
|
|
185
|
+
schema: "twin3-discovery-engine-observation-v1";
|
|
186
|
+
host: string;
|
|
187
|
+
engine: string;
|
|
188
|
+
model: string | null;
|
|
189
|
+
prompt_id: string;
|
|
190
|
+
need_id: string | null;
|
|
191
|
+
run_id: string | null;
|
|
192
|
+
observed_at: number;
|
|
193
|
+
status: "answered" | "error";
|
|
194
|
+
retrieved: boolean | null;
|
|
195
|
+
mentioned: boolean | null;
|
|
196
|
+
cited: boolean | null;
|
|
197
|
+
evidence_level: EngineObservationEvidenceLevel;
|
|
198
|
+
answer_digest: string | null;
|
|
199
|
+
digest: string;
|
|
200
|
+
}
|
|
201
|
+
export interface EngineObservationSignalReading {
|
|
202
|
+
state: "measured" | "withheld" | "unknown";
|
|
203
|
+
observed: number;
|
|
204
|
+
positive: number;
|
|
205
|
+
rate_bp: number | null;
|
|
206
|
+
interval_bp: [number, number] | null;
|
|
207
|
+
}
|
|
208
|
+
export interface EngineObservationReading {
|
|
209
|
+
schema: "twin3-discovery-engine-reading-v1";
|
|
210
|
+
host: string;
|
|
211
|
+
valid: boolean;
|
|
212
|
+
source_level: boolean;
|
|
213
|
+
blockers: Array<"no_answered_observations" | "insufficient_repetitions" | "insufficient_paraphrases">;
|
|
214
|
+
caveats: Array<"window_shorter_than_21_days">;
|
|
215
|
+
window_utc: { first: string; last: string; span_days: number; observed_days: number } | null;
|
|
216
|
+
engines: string[];
|
|
217
|
+
by_engine: Record<string, { answered: number; errors: number; prompts: number; signals: Record<"retrieved" | "mentioned" | "cited", EngineObservationSignalReading> }>;
|
|
218
|
+
evidence_levels: EngineObservationEvidenceLevel[];
|
|
219
|
+
protocol: { min_runs_per_prompt: number; min_runs_for_source_coverage: number; min_paraphrases_per_need: number; window_days: number; interval: string; source: string };
|
|
220
|
+
non_claims: string[];
|
|
221
|
+
observation_digests: string[];
|
|
222
|
+
digest: string;
|
|
223
|
+
}
|
|
224
|
+
export declare function normalizeEngineObservation(row: EngineObservationInput, options: { host: string }): EngineObservation;
|
|
225
|
+
export declare function summarizeEngineObservations(observations: EngineObservation[], options: { host: string; sourceLevel?: boolean }): EngineObservationReading;
|
|
161
226
|
|
|
162
227
|
export declare const DESCRIPTOR_CANONICALIZATION: "rfc8785";
|
|
163
228
|
export declare const DESCRIPTOR_SIGNATURE_FIELDS: readonly ["signatures", "signatureStatus"];
|
|
@@ -848,6 +913,21 @@ export interface KyaBinding {
|
|
|
848
913
|
receipt: string;
|
|
849
914
|
}
|
|
850
915
|
|
|
916
|
+
export declare class DidResolutionError extends Error { readonly code: string; }
|
|
917
|
+
export declare function didWebForHost(host: string): string;
|
|
918
|
+
export declare function didWebUrl(did: string): string;
|
|
919
|
+
export declare function resolveDidWeb(did: string, fetch: (method: string, url: string, headers: Record<string, string>, body: null) => [number, string | Uint8Array | null], maxBytes?: number): { did: string; url: string; method_id: string; key_id: string; public_key: string; };
|
|
920
|
+
export declare function multibaseEd25519(raw: Uint8Array, multicodec?: boolean): string;
|
|
921
|
+
export type DidFetch = (method: string, url: string, headers: Record<string, string>, body: null) => [number, string | Uint8Array | null];
|
|
922
|
+
export type DidKeyPurpose = "assertionMethod" | "authentication" | "keyAgreement" | "capabilityInvocation" | "capabilityDelegation";
|
|
923
|
+
export interface DidDocumentKey { did: string; method_id: string; key_id: string; public_key: string; purpose: DidKeyPurpose | null; }
|
|
924
|
+
/** Ed25519 verification methods of a did:web document, restricted to the requested verification relationship (default `assertionMethod`). */
|
|
925
|
+
export declare function didWebDocumentKeys(doc: Record<string, unknown>, did: string, options?: { purpose?: DidKeyPurpose | null }): DidDocumentKey[];
|
|
926
|
+
/** Resolve one did:web key through the injected fetch; `kid` must select exactly one method (`did_kid_not_found` / `did_kid_ambiguous`). */
|
|
927
|
+
export declare function resolveDidWebKey(did: string, fetch: DidFetch, options?: { kid?: string | null; purpose?: DidKeyPurpose | null; maxBytes?: number }): DidDocumentKey & { url: string };
|
|
928
|
+
/** Select one Ed25519 (`OKP`/`Ed25519`, `alg` EdDSA if present) key from a JWKS by `kid`. */
|
|
929
|
+
export declare function jwksKey(jwks: Record<string, unknown>, kid: string): { kid: string; key_id: string; public_key: string };
|
|
930
|
+
export declare const AuthorityAnchor: { readonly SUPPORTED_KINDS: readonly string[]; isValidKind(kind: string): boolean; };
|
|
851
931
|
export declare function createKyaChallenge(params: {
|
|
852
932
|
owner: string;
|
|
853
933
|
identity: KyaIdentity;
|
|
@@ -900,6 +980,9 @@ export interface TrustDelegation {
|
|
|
900
980
|
export interface AuthorizationLease {
|
|
901
981
|
bindings: KyaBinding[];
|
|
902
982
|
delegations: TrustDelegation[];
|
|
983
|
+
/** Optional copy of the consumer registration the bindings were issued under; it is compared
|
|
984
|
+
* against `LeaseAuthority.consumer_registration` and is never authority on its own. */
|
|
985
|
+
registration?: ConsumerRegistrationStatement | null;
|
|
903
986
|
}
|
|
904
987
|
export interface BindingWindow { not_before: number; not_after: number; epoch: number; }
|
|
905
988
|
export interface LeaseAuthority {
|
|
@@ -910,6 +993,10 @@ export interface LeaseAuthority {
|
|
|
910
993
|
policy_revision: string;
|
|
911
994
|
binding_windows: Record<string, BindingWindow>;
|
|
912
995
|
reanchored_at: number;
|
|
996
|
+
/** A `twin3-trust-consumer-registration-v1` statement signed by `owner_public_key` (the vertical's
|
|
997
|
+
* root R). When present, a binding whose challenge was signed by the statement's `kya_owner` key
|
|
998
|
+
* verifies; bindings signed by R itself verify unchanged. `null` means no registration. */
|
|
999
|
+
consumer_registration?: ConsumerRegistrationStatement | null;
|
|
913
1000
|
}
|
|
914
1001
|
export interface LeaseAuthorityPort {
|
|
915
1002
|
currentAuthority(tenant: string, owner: string): LeaseAuthority | Promise<LeaseAuthority>;
|
|
@@ -929,6 +1016,8 @@ export interface VerifiedLeaseRequest {
|
|
|
929
1016
|
policy_revision: string;
|
|
930
1017
|
binding_receipts: string[];
|
|
931
1018
|
delegation_receipts: string[];
|
|
1019
|
+
/** Receipt of the verified consumer registration, or `null` when the authority carries none. */
|
|
1020
|
+
registration_receipt: string | null;
|
|
932
1021
|
}
|
|
933
1022
|
export declare class AuthorizationLeaseError extends ProtocolError {
|
|
934
1023
|
constructor(code: string);
|
|
@@ -958,6 +1047,8 @@ export interface LeaseClearanceContext {
|
|
|
958
1047
|
actor_key_id: string; purpose: string; occurrence_index: number;
|
|
959
1048
|
binding_receipts: string[]; delegation_receipts: string[];
|
|
960
1049
|
binding_windows: Array<BindingWindow | null>; usage: Record<string, number>;
|
|
1050
|
+
/** Present only when the authority carries a consumer registration. */
|
|
1051
|
+
registration_receipt?: string;
|
|
961
1052
|
};
|
|
962
1053
|
}
|
|
963
1054
|
export type DetectorState = "allow" | "flag" | "block" | "unavailable" | "not_configured";
|
|
@@ -1032,6 +1123,54 @@ export declare function verifyEnvelopeSignature(envelope: Envelope, publicKey: C
|
|
|
1032
1123
|
|
|
1033
1124
|
export declare function scanText(text: string, options?: { source?: string; now?: number }): ShieldVerdict;
|
|
1034
1125
|
|
|
1126
|
+
export declare const MEMORY_SCHEMA: string;
|
|
1127
|
+
export declare const REVOCATION_SCHEMA: string;
|
|
1128
|
+
|
|
1129
|
+
export declare class MemoryRejected extends Error {
|
|
1130
|
+
readonly code: string;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
export interface MemoryShieldStamp {
|
|
1134
|
+
verdict: string;
|
|
1135
|
+
reason_codes: string[];
|
|
1136
|
+
receipt: unknown;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
export interface MemoryEntry {
|
|
1140
|
+
schema: string;
|
|
1141
|
+
id: string;
|
|
1142
|
+
text: string;
|
|
1143
|
+
origin: string;
|
|
1144
|
+
kind: "data" | "instruction";
|
|
1145
|
+
treat_as: "data" | "instruction";
|
|
1146
|
+
actor: string;
|
|
1147
|
+
source: string;
|
|
1148
|
+
source_epoch: number;
|
|
1149
|
+
at: number;
|
|
1150
|
+
shield: MemoryShieldStamp | null;
|
|
1151
|
+
flagged: boolean;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
export interface MemoryRevocation {
|
|
1155
|
+
schema: string;
|
|
1156
|
+
source: string;
|
|
1157
|
+
epoch: number;
|
|
1158
|
+
actor: string;
|
|
1159
|
+
reason: string;
|
|
1160
|
+
at: number;
|
|
1161
|
+
removed: number;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
export declare class MemoryGuard {
|
|
1165
|
+
constructor(store: { entries?: MemoryEntry[]; revocations?: Record<string, MemoryRevocation>; purges?: unknown[] }, ensemble?: unknown, intel?: unknown);
|
|
1166
|
+
revokedEpoch(source: string): number | null;
|
|
1167
|
+
purgeSource(source: string, actor: string, reason: string, now?: number, epoch?: number): MemoryRevocation;
|
|
1168
|
+
write(text: string, origin: string, actor: string, kind?: "data" | "instruction", source?: string, sourceEpoch?: number, now?: number): MemoryEntry;
|
|
1169
|
+
recall(kinds?: Array<"data" | "instruction">, origins?: string[] | null, includeFlagged?: boolean): MemoryEntry[];
|
|
1170
|
+
instructions(): MemoryEntry[];
|
|
1171
|
+
purgeOrigin(origin: string, actor: string, reason: string): number;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1035
1174
|
export declare const TASK_EXPORT_SCHEMA: string;
|
|
1036
1175
|
|
|
1037
1176
|
export declare function taskTrustLine(task: Record<string, unknown>, row: Record<string, unknown> | null): string;
|
|
@@ -1552,8 +1691,8 @@ export interface TaskInboxOptions {
|
|
|
1552
1691
|
ensemble?: null | undefined;
|
|
1553
1692
|
intel?: null | undefined;
|
|
1554
1693
|
requirePlanDiff?: true;
|
|
1555
|
-
replayStore?:
|
|
1556
|
-
replay_store?:
|
|
1694
|
+
replayStore?: { consume(key: string, expiresAt: number, now?: number): boolean | Promise<boolean> } | null;
|
|
1695
|
+
replay_store?: { consume(key: string, expiresAt: number, now?: number): boolean | Promise<boolean> } | null;
|
|
1557
1696
|
}
|
|
1558
1697
|
|
|
1559
1698
|
export declare class IntakeRejected extends Error {
|
|
@@ -1614,6 +1753,10 @@ export declare class TaskInbox {
|
|
|
1614
1753
|
}): TaskInboxTask;
|
|
1615
1754
|
clearReview(taskId: string, actor: string, reason: string, now?: number): TaskInboxTask;
|
|
1616
1755
|
clearReview(input: { taskId: string; actor: string; reason: string; now?: number }): TaskInboxTask;
|
|
1756
|
+
getPolicy(): Record<string, any> | null;
|
|
1757
|
+
setPolicy(policy: Record<string, any>): Record<string, any>;
|
|
1758
|
+
quoteFor(identity: { kind: string; value: string }, now?: number): Record<string, any> | null;
|
|
1759
|
+
applyPayment(identity: { kind: string; value: string }, receipt: Record<string, any>, ownerPublicKey: CryptoKeyInput, quoteBody?: Record<string, any> | null, actor?: string, now?: number): Promise<Record<string, any>>;
|
|
1617
1760
|
recordPlanDiff(taskId: string, before: any[], after: any[], actor: string,
|
|
1618
1761
|
authorized?: string[], now?: number): Record<string, any>;
|
|
1619
1762
|
recordPlanDiff(input: {
|
|
@@ -1624,6 +1767,19 @@ export declare class TaskInbox {
|
|
|
1624
1767
|
authorized?: string[];
|
|
1625
1768
|
now?: number;
|
|
1626
1769
|
}): Record<string, any>;
|
|
1770
|
+
getPolicy(): Record<string, any> | null;
|
|
1771
|
+
setPolicy(policy: Record<string, any>): Record<string, any>;
|
|
1772
|
+
applyX402Payment(
|
|
1773
|
+
identity: { kind: string; value: string },
|
|
1774
|
+
demand: Record<string, any>,
|
|
1775
|
+
receipt: Record<string, any>,
|
|
1776
|
+
publicKey: CryptoKeyInput,
|
|
1777
|
+
chainVerifier: { verifyPayment?: (demand: Record<string, any>, receipt: Record<string, any>) => Promise<Record<string, any>> | Record<string, any>; verify_payment?: (demand: Record<string, any>, receipt: Record<string, any>) => Promise<Record<string, any>> | Record<string, any> } | ((demand: Record<string, any>, receipt: Record<string, any>) => Promise<Record<string, any>> | Record<string, any>),
|
|
1778
|
+
replayStore?: { reserve: Function; commit: Function; release: Function } | null,
|
|
1779
|
+
minimumConfirmations?: number,
|
|
1780
|
+
actor?: string,
|
|
1781
|
+
now?: number,
|
|
1782
|
+
): Promise<Record<string, any>>;
|
|
1627
1783
|
expireStale(now?: number): string[];
|
|
1628
1784
|
verifyAuditChain(taskId: string): boolean;
|
|
1629
1785
|
}
|
|
@@ -1719,3 +1875,78 @@ export declare function signDelegationWithSigner(delegation: Record<string, unkn
|
|
|
1719
1875
|
options?: ExternalSignerOptions): Promise<Readonly<Record<string, unknown>>>;
|
|
1720
1876
|
export declare function signEnvelopeWithSigner(envelope: Envelope, signer: ExternalEd25519Signer,
|
|
1721
1877
|
options?: ExternalSignerOptions): Promise<Readonly<Envelope>>;
|
|
1878
|
+
|
|
1879
|
+
export declare const CONSUMER_REGISTRATION_SCHEMA: "twin3-trust-consumer-registration-v1";
|
|
1880
|
+
export type ConsumerRegistrationEnvironment = "sandbox" | "staging" | "production";
|
|
1881
|
+
export type ConsumerRegistrationKeyRole = "kya_owner" | "evidence";
|
|
1882
|
+
export interface ConsumerRegistrationKey {
|
|
1883
|
+
role: ConsumerRegistrationKeyRole;
|
|
1884
|
+
key_id: string;
|
|
1885
|
+
public_key: string;
|
|
1886
|
+
label?: string;
|
|
1887
|
+
}
|
|
1888
|
+
export interface ConsumerRegistrationSubject {
|
|
1889
|
+
consumer_id: string;
|
|
1890
|
+
namespace: string;
|
|
1891
|
+
environment: ConsumerRegistrationEnvironment;
|
|
1892
|
+
identity_kinds: Array<"lei" | "duns" | "human_id">;
|
|
1893
|
+
epoch: number;
|
|
1894
|
+
policy_revision: string;
|
|
1895
|
+
endpoints?: Record<string, string>;
|
|
1896
|
+
sdk_contract_digest?: string;
|
|
1897
|
+
}
|
|
1898
|
+
/** `twin3-trust-consumer-registration-v1`: the vertical's root R signs which consumer keys it authorizes.
|
|
1899
|
+
* Exactly one `kya_owner` key; `issuer.key_id` and the JWS `kid` are descriptive and are compared against
|
|
1900
|
+
* the injected root, never fetched. */
|
|
1901
|
+
export interface ConsumerRegistrationStatement {
|
|
1902
|
+
schema: "twin3-trust-consumer-registration-v1";
|
|
1903
|
+
issuer: { key_id: string; did?: string };
|
|
1904
|
+
subject: ConsumerRegistrationSubject;
|
|
1905
|
+
authorized_keys: ConsumerRegistrationKey[];
|
|
1906
|
+
not_before: number;
|
|
1907
|
+
not_after: number;
|
|
1908
|
+
signatures?: DescriptorSignature[];
|
|
1909
|
+
signatureStatus?: string;
|
|
1910
|
+
}
|
|
1911
|
+
export interface ConsumerRegistrationExpectation {
|
|
1912
|
+
consumer_id?: string;
|
|
1913
|
+
namespace?: string;
|
|
1914
|
+
environment?: ConsumerRegistrationEnvironment;
|
|
1915
|
+
epoch?: number;
|
|
1916
|
+
policy_revision?: string;
|
|
1917
|
+
identity_kind?: "lei" | "duns" | "human_id";
|
|
1918
|
+
}
|
|
1919
|
+
export interface VerifiedConsumerRegistration {
|
|
1920
|
+
receipt: string;
|
|
1921
|
+
issuer_key_id: string;
|
|
1922
|
+
subject: ConsumerRegistrationSubject;
|
|
1923
|
+
kya_owner_key: ConsumerRegistrationKey;
|
|
1924
|
+
evidence_keys: ConsumerRegistrationKey[];
|
|
1925
|
+
not_before: number;
|
|
1926
|
+
not_after: number;
|
|
1927
|
+
kid: string;
|
|
1928
|
+
jku: string | null;
|
|
1929
|
+
}
|
|
1930
|
+
export type ConsumerRegistrationErrorCode = "registration_schema_mismatch" | "registration_unknown_field"
|
|
1931
|
+
| "registration_field_required" | "registration_signature_invalid" | "registration_root_required"
|
|
1932
|
+
| "registration_root_mismatch" | "registration_kid_mismatch" | "registration_time_invalid"
|
|
1933
|
+
| "registration_not_yet_valid" | "registration_expired" | "registration_subject_mismatch"
|
|
1934
|
+
| "registration_key_unauthorized" | "registration_key_role_invalid" | "registration_required"
|
|
1935
|
+
| "registration_mismatch";
|
|
1936
|
+
export declare class ConsumerRegistrationError extends ProtocolError {
|
|
1937
|
+
readonly code: ConsumerRegistrationErrorCode;
|
|
1938
|
+
constructor(code: ConsumerRegistrationErrorCode);
|
|
1939
|
+
}
|
|
1940
|
+
/** Shape rules only (no signature); returns the canonical body. With `now`, also checks the validity window. */
|
|
1941
|
+
export declare function validateConsumerRegistration(statement: ConsumerRegistrationStatement, options?: { now?: number | null }): Omit<ConsumerRegistrationStatement, "signatures" | "signatureStatus">;
|
|
1942
|
+
/** SHA-256 hex of the RFC 8785 body without signature fields; the revocation reference for the statement. */
|
|
1943
|
+
export declare function registrationReceipt(statement: ConsumerRegistrationStatement): string;
|
|
1944
|
+
export declare function signConsumerRegistration(statement: ConsumerRegistrationStatement, privateKey: string | Buffer | import("node:crypto").KeyObject,
|
|
1945
|
+
options?: { kid?: string; jku?: string | null }): ConsumerRegistrationStatement & SignedDescriptor;
|
|
1946
|
+
export declare function signConsumerRegistrationWithSigner(statement: ConsumerRegistrationStatement, signer: ExternalEd25519Signer,
|
|
1947
|
+
options?: { kid?: string; jku?: string | null; timeoutMs?: number; signal?: AbortSignal }): Promise<ConsumerRegistrationStatement & SignedDescriptor>;
|
|
1948
|
+
/** Verify shape, root signature (`rootPublicKey` is injected, never fetched), optional `kid`, window at `now` and the expected subject. No network. */
|
|
1949
|
+
export declare function verifyConsumerRegistration(statement: ConsumerRegistrationStatement, options: {
|
|
1950
|
+
rootPublicKey: string | Buffer | import("node:crypto").KeyObject; expectedKid?: string | null; now: number;
|
|
1951
|
+
expected?: ConsumerRegistrationExpectation | null;
|
|
1952
|
+
}): VerifiedConsumerRegistration;
|
package/js/comm/counterparty.js
CHANGED
|
@@ -316,7 +316,8 @@ function createCounterpartyAgent({ identity, keyPath, privateKeyPem, privateKey,
|
|
|
316
316
|
if (id.kind !== self.identity.kind || id.value !== self.identity.value) throw sdkError("challenge_identity_mismatch");
|
|
317
317
|
if (!(now() <= Number(challenge.expires_at))) throw sdkError("challenge_expired");
|
|
318
318
|
verifyOwnerSignature(challenge, ownerPublicKey || challenge.owner_public_key);
|
|
319
|
-
const payload =
|
|
319
|
+
const payload = challengeSignaturePayload(challenge);
|
|
320
|
+
if (signPayload && !b64urlDecode(signPayload).equals(payload)) throw sdkError("challenge_payload_mismatch");
|
|
320
321
|
return { handshake_id: challenge.handshake_id, signature: b64url(crypto.sign(null, payload, key)) };
|
|
321
322
|
};
|
|
322
323
|
|
package/js/discovery.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ export {
|
|
|
24
24
|
DESCRIPTOR_CANONICALIZATION,
|
|
25
25
|
DESCRIPTOR_SIGNATURE_FIELDS,
|
|
26
26
|
DISCOVERY_SUMMARY_SCHEMA,
|
|
27
|
+
ENGINE_OBSERVATION_SCHEMA,
|
|
28
|
+
ENGINE_READING_SCHEMA,
|
|
27
29
|
DISCOVERY_VIEW_SCHEMA,
|
|
28
30
|
DeclarationEndpoints,
|
|
29
31
|
DescriptorSignature,
|
|
@@ -31,6 +33,11 @@ export {
|
|
|
31
33
|
DiscoveryEvidenceError,
|
|
32
34
|
DiscoveryEvidenceSummary,
|
|
33
35
|
DiscoveryEvidenceView,
|
|
36
|
+
EngineObservation,
|
|
37
|
+
EngineObservationError,
|
|
38
|
+
EngineObservationInput,
|
|
39
|
+
EngineObservationReading,
|
|
40
|
+
EngineObservationSignalReading,
|
|
34
41
|
DiscoveryVisitEvidence,
|
|
35
42
|
DiscoveryVisitInput,
|
|
36
43
|
InboxDeclaration,
|
|
@@ -73,6 +80,7 @@ export {
|
|
|
73
80
|
inspectCardWire,
|
|
74
81
|
migrateCardToEmit,
|
|
75
82
|
normalizeAiExposure,
|
|
83
|
+
normalizeEngineObservation,
|
|
76
84
|
normalizeDiscoveryVisit,
|
|
77
85
|
parseSovereignCard,
|
|
78
86
|
parseTwin3AgentCard,
|
|
@@ -82,6 +90,7 @@ export {
|
|
|
82
90
|
signA2AAgentCard,
|
|
83
91
|
signDescriptor,
|
|
84
92
|
summarizeDiscoveryEvidence,
|
|
93
|
+
summarizeEngineObservations,
|
|
85
94
|
unsignedDescriptor,
|
|
86
95
|
validateAgentCardV1,
|
|
87
96
|
validateWellKnownDocument,
|
package/js/discovery.js
CHANGED
|
@@ -11,6 +11,11 @@ module.exports = {
|
|
|
11
11
|
normalizeAiExposure: impl.discoveryEvidenceApi.normalizeAiExposure,
|
|
12
12
|
summarizeDiscoveryEvidence: impl.discoveryEvidenceApi.summarizeDiscoveryEvidence,
|
|
13
13
|
buildDiscoveryEvidenceView: impl.discoveryEvidenceApi.buildDiscoveryEvidenceView,
|
|
14
|
+
ENGINE_OBSERVATION_SCHEMA: impl.engineObservation.ENGINE_OBSERVATION_SCHEMA,
|
|
15
|
+
ENGINE_READING_SCHEMA: impl.engineObservation.ENGINE_READING_SCHEMA,
|
|
16
|
+
EngineObservationError: impl.engineObservation.EngineObservationError,
|
|
17
|
+
normalizeEngineObservation: impl.engineObservationApi.normalizeEngineObservation,
|
|
18
|
+
summarizeEngineObservations: impl.engineObservationApi.summarizeEngineObservations,
|
|
14
19
|
createSovereignCard: impl.createSovereignCard,
|
|
15
20
|
createTwin3AgentCard: impl.createTwin3AgentCard,
|
|
16
21
|
createAgentCard: impl.createAgentCard,
|
package/js/discovery.mjs
CHANGED
|
@@ -8,6 +8,11 @@ export const normalizeDiscoveryVisit = api.normalizeDiscoveryVisit;
|
|
|
8
8
|
export const normalizeAiExposure = api.normalizeAiExposure;
|
|
9
9
|
export const summarizeDiscoveryEvidence = api.summarizeDiscoveryEvidence;
|
|
10
10
|
export const buildDiscoveryEvidenceView = api.buildDiscoveryEvidenceView;
|
|
11
|
+
export const ENGINE_OBSERVATION_SCHEMA = api.ENGINE_OBSERVATION_SCHEMA;
|
|
12
|
+
export const ENGINE_READING_SCHEMA = api.ENGINE_READING_SCHEMA;
|
|
13
|
+
export const EngineObservationError = api.EngineObservationError;
|
|
14
|
+
export const normalizeEngineObservation = api.normalizeEngineObservation;
|
|
15
|
+
export const summarizeEngineObservations = api.summarizeEngineObservations;
|
|
11
16
|
export const createSovereignCard = api.createSovereignCard;
|
|
12
17
|
export const createTwin3AgentCard = api.createTwin3AgentCard;
|
|
13
18
|
export const createAgentCard = api.createAgentCard;
|