twin3-sdk 0.2.12-pre-alpha → 0.2.15-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 +20 -7
- package/index.d.ts +306 -39
- package/js/comm/counterparty.js +9 -1
- package/js/comm.d.ts +66 -0
- package/js/comm.js +53 -0
- package/js/comm.mjs +50 -0
- package/js/discovery-evidence.js +329 -0
- package/js/discovery.d.ts +93 -0
- package/js/discovery.js +67 -0
- package/js/discovery.mjs +64 -0
- package/js/governance.d.ts +37 -0
- package/js/governance.js +27 -0
- package/js/governance.mjs +24 -0
- package/js/id-format.js +15 -0
- package/js/index.js +266 -6718
- package/js/index.mjs +260 -0
- package/js/internal/comm.js +2682 -0
- package/js/internal/core.js +481 -0
- package/js/internal/discovery.js +1361 -0
- package/js/internal/governance.js +434 -0
- package/js/internal/matrix.js +462 -0
- package/js/internal/settlement.js +471 -0
- package/js/internal/shield.js +930 -0
- package/js/internal/trust.js +1059 -0
- package/js/local-memory.js +19 -6
- package/js/matrix.d.ts +27 -0
- package/js/matrix.js +21 -0
- package/js/matrix.mjs +18 -0
- package/js/memory-guard.js +173 -0
- package/js/settlement.d.ts +29 -0
- package/js/settlement.js +22 -0
- package/js/settlement.mjs +19 -0
- package/js/shield.d.ts +61 -0
- package/js/shield.js +39 -0
- package/js/shield.mjs +35 -0
- package/js/trust/didweb.js +262 -0
- package/js/trust/external-signer.js +209 -0
- package/js/trust/passkey-registration.js +228 -0
- package/js/trust.d.ts +80 -0
- package/js/trust.js +76 -0
- package/js/trust.mjs +59 -0
- package/local-memory.d.ts +1 -0
- package/package.json +84 -3
- package/twin3/discovery/evidence-i18n.json +21 -0
- package/twin3/discovery/id-format.v1.json +13 -0
package/README.md
CHANGED
|
@@ -60,7 +60,15 @@ Twin3 SDK organizes all distributed primitives into seven clean, composable laye
|
|
|
60
60
|
| **L4 Shield** | `twin3.shield` | Differential tampering defense, prompt injection filtering, and authorization guardrails. | `scan_text` / `scan_envelope` (T0–T3), `IntelEngine` (T1), `Ensemble` (T4), `diff_plans` / `authorize_execution` (T5), `MemoryGuard` |
|
|
61
61
|
| **L5 Matrix** | `twin3.matrix` | High-density vector space topological mapping and semantic cosine matching. | `DenseVector256`, `feature_distance`, `HumanMatrixSchema`, `EnterpriseMatrixSchema` |
|
|
62
62
|
| **L6 Settlement** | `twin3.settlement` | Signed-receipt verification for HTTP 402 gates, with externally supplied chain-finality and replay controls. | `PaymentDemand`, `PaymentReceipt`, `X402SettlementEngine` |
|
|
63
|
-
| **L7 Governance** | `twin3.governance` | Immutable evidence trail, appeals, advisory reputation federation, provisional arbitration helper. | `EvidenceTrail
|
|
63
|
+
| **L7 Governance** | `twin3.governance` | Immutable evidence trail, appeals, advisory reputation federation, provisional arbitration helper. | `EvidenceTrail` (experimental), `open_appeal` / `resolve_appeal`, `export_reputation` / `import_reputation`, `ArbitrationEngine` (experimental), `DisputeCase` (experimental) |
|
|
64
|
+
|
|
65
|
+
L1 also exposes a candidate discovery evidence API for xAgent ID and xHuman ID. It normalizes owner-supplied CDN/server visits and Google Search Console generative AI search exports, then returns separate visit and impression summaries and a display-ready view model. See [the L1 evidence contract and interface presentation guidance](docs/architecture/L1-DISCOVERY-VISIT-EVIDENCE.md). These APIs do not collect private logs or establish visitor identity on their own.
|
|
66
|
+
|
|
67
|
+
Python and Node support [explicit Matrix comparison profiles](docs/matrix-runtime-profiles.md),
|
|
68
|
+
including weighted/masked cosine and structured coverage results. Node constructor
|
|
69
|
+
coercions still differ. Node TaskInbox admits owner-policy receipts with
|
|
70
|
+
applyPayment and injected-verifier receipts with applyX402Payment. Evidence
|
|
71
|
+
trail is experimental until an actual consumer supplies durable integration evidence.
|
|
64
72
|
|
|
65
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).
|
|
66
74
|
|
|
@@ -70,12 +78,17 @@ Twin3 SDK organizes all distributed primitives into seven clean, composable laye
|
|
|
70
78
|
|
|
71
79
|
The primitives in `twin3-sdk` are extracted from the `twin3-team/agent-id` Inbox line (PRs #615–#642, merged 2026-09-03 → 2026-09-05; spec: `docs/architecture/inbox-module-spec.md` in that repo). What each layer inherited:
|
|
72
80
|
|
|
81
|
+
The paths below describe historical source in the
|
|
82
|
+
[Agent ID repository](https://github.com/twin3-team/agent-id/tree/main/agent_id/inbox),
|
|
83
|
+
not the current SDK directory layout. See the [generated Node API reference](docs/node-api.md)
|
|
84
|
+
for the installed package's public declarations.
|
|
85
|
+
|
|
73
86
|
* **Envelope, KYA handshake, counterparty ladder** — `agent_id/inbox/{envelope,kya,counterparty}.py`: canonical-JSON signed envelopes with `authority:"none"`, the mutual Ed25519 challenge that binds a declared identity to a key, and the G0→G3 attention ladder keyed on the counterparty rather than the request.
|
|
74
87
|
* **Task inbox and state machine** — `agent_id/inbox/state.py`: intake gate, review gate, rate limits, stale expiry, hash-chained audit.
|
|
75
88
|
* **Shield T0–T5** — `agent_id/inbox/{shield,intel,classifier,plandiff,corpus}.py`: deterministic layers, URL/domain/hash intelligence, the T4 ensemble, plan diffing, and the corpus that publishes error rates.
|
|
76
89
|
* **Settlement policy** — `agent_id/inbox/payments.py`: owner policy, signed quotes and receipts behind HTTP 402.
|
|
77
90
|
* **Governance** — `agent_id/inbox/governance.py`: appeals, pardons, advisory reputation federation.
|
|
78
|
-
* **Canonical Matrix Core**:
|
|
91
|
+
* **Canonical Matrix Core**: 256-dimensional single-pair vector arithmetic and tolerance comparison. The SDK does not supply population clustering, a similarity index or a batch ranking engine.
|
|
79
92
|
|
|
80
93
|
The 2026-09-05 sync also adds the **AI-era hardening** (mandatory T5, identity-cost tier caps, provenance-gated memory, rotation demotes, paid ≠ authorized). See `CHANGELOG.md`.
|
|
81
94
|
|
|
@@ -103,22 +116,22 @@ pip install -e /path/to/twin3-sdk
|
|
|
103
116
|
* Any protocol or algorithm improvement in `twin3-sdk` is reflected in both applications in **0 milliseconds**.
|
|
104
117
|
|
|
105
118
|
#### 2. Production Distribution
|
|
106
|
-
`v0.2.
|
|
119
|
+
`v0.2.15-pre-alpha` is the current release candidate: `0.2.15-pre-alpha` for npm and `0.2.15a0` for PyPI. Publication is pending. 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`.
|
|
107
120
|
|
|
108
121
|
`package.json` `engines` sets Node.js to `>=18` and does not set an npm engine. Any npm that can install a tarball can consume the package. Packing this repository was checked with npm 10 or newer; the stricter npm version in the release runbook applies only to Trusted Publishing.
|
|
109
122
|
|
|
110
123
|
After publication, install the exact released version from the registry:
|
|
111
124
|
|
|
112
125
|
```bash
|
|
113
|
-
npm install twin3-sdk@0.2.
|
|
114
|
-
pip install twin3-sdk==0.2.
|
|
126
|
+
npm install twin3-sdk@0.2.15-pre-alpha
|
|
127
|
+
pip install twin3-sdk==0.2.15a0
|
|
115
128
|
```
|
|
116
129
|
|
|
117
130
|
For local evaluation, you can also use the packed npm tarball. Do not install from a git URL or a version range:
|
|
118
131
|
|
|
119
132
|
```bash
|
|
120
133
|
npm pack --ignore-scripts
|
|
121
|
-
npm install ./twin3-sdk-0.2.
|
|
134
|
+
npm install ./twin3-sdk-0.2.15-pre-alpha.tgz
|
|
122
135
|
```
|
|
123
136
|
|
|
124
137
|
---
|
|
@@ -135,7 +148,7 @@ Agent ID consumes Twin3 SDK to execute the **5-Stage A2A Autonomous Commercial L
|
|
|
135
148
|
|
|
136
149
|
### 👤 Human ID (Personal Sovereignty Projection)
|
|
137
150
|
Human ID consumes Twin3 SDK to empower natural individuals:
|
|
138
|
-
1. **
|
|
151
|
+
1. **Personality Assets**: Uses `twin3.matrix` for single-pair vector comparisons. Population indexing, ranking throughput and storage remain product responsibilities.
|
|
139
152
|
2. **Passkey WebAuthn Login**: Binds biometric secure enclaves to decentralized keys via `twin3.trust`.
|
|
140
153
|
3. **Paid Inbox**: Protects individual inboxes against spam using `twin3.comm` and the signed-receipt adapter ($5 paywall threshold); the application supplies chain verification and shared replay state.
|
|
141
154
|
4. **Sovereign Card**: Renders non-custodial credentials using `twin3.discovery`.
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
export type JsonPrimitive = string | number | boolean | null;
|
|
2
|
+
export type JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };
|
|
3
|
+
export interface JsonObject { [key: string]: JsonValue; }
|
|
4
|
+
export type CryptoKeyInput = string | Buffer | import("node:crypto").KeyObject;
|
|
5
|
+
|
|
1
6
|
export declare const AGENT_CARD_SCHEMA: "twin3-discovery-agent-card-v1";
|
|
2
7
|
export declare const SOVEREIGN_CARD_SCHEMA: "twin3-discovery-sovereign-card-v1";
|
|
3
8
|
|
|
@@ -10,7 +15,7 @@ export interface Twin3AgentCard {
|
|
|
10
15
|
public_key: string | null;
|
|
11
16
|
capabilities: string[];
|
|
12
17
|
endpoints: Record<string, string>;
|
|
13
|
-
pricing:
|
|
18
|
+
pricing: JsonObject;
|
|
14
19
|
created_at: number;
|
|
15
20
|
digest: string;
|
|
16
21
|
}
|
|
@@ -59,7 +64,7 @@ export interface Twin3AgentCardInput {
|
|
|
59
64
|
publicKey?: string | null;
|
|
60
65
|
capabilities?: string[];
|
|
61
66
|
endpoints?: Record<string, string>;
|
|
62
|
-
pricing?:
|
|
67
|
+
pricing?: JsonObject;
|
|
63
68
|
createdAt?: number;
|
|
64
69
|
}
|
|
65
70
|
|
|
@@ -72,15 +77,92 @@ export declare function createTwin3AgentCard(input: Twin3AgentCardInput): Twin3A
|
|
|
72
77
|
export declare const createAgentCard: typeof createTwin3AgentCard;
|
|
73
78
|
export declare function parseTwin3AgentCard(data: unknown, options?: { verify?: boolean }): Twin3AgentCard;
|
|
74
79
|
export declare function parseSovereignCard(data: unknown, options?: { verify?: boolean }): SovereignCard;
|
|
75
|
-
export declare function cardDigest(card: SovereignCard | Twin3AgentCard |
|
|
76
|
-
export declare function verifyCardDigest(card: SovereignCard | Twin3AgentCard |
|
|
77
|
-
export declare function inspectCardWire(card: SovereignCard | Twin3AgentCard |
|
|
78
|
-
export declare function migrateCardToEmit(card: SovereignCard | Twin3AgentCard |
|
|
80
|
+
export declare function cardDigest(card: SovereignCard | Twin3AgentCard | JsonObject): string;
|
|
81
|
+
export declare function verifyCardDigest(card: SovereignCard | Twin3AgentCard | JsonObject): string;
|
|
82
|
+
export declare function inspectCardWire(card: SovereignCard | Twin3AgentCard | JsonObject, options?: { allowLegacy?: boolean }): CardWireInspection;
|
|
83
|
+
export declare function migrateCardToEmit(card: SovereignCard | Twin3AgentCard | JsonObject): SovereignCard | Twin3AgentCard;
|
|
84
|
+
|
|
85
|
+
export declare const VISIT_EVIDENCE_SCHEMA: "twin3-discovery-visit-evidence-v1";
|
|
86
|
+
export declare const AI_EXPOSURE_SCHEMA: "twin3-discovery-ai-exposure-v1";
|
|
87
|
+
export declare const DISCOVERY_SUMMARY_SCHEMA: "twin3-discovery-evidence-summary-v1";
|
|
88
|
+
export declare const DISCOVERY_VIEW_SCHEMA: "twin3-discovery-evidence-view-v1";
|
|
89
|
+
export declare class DiscoveryEvidenceError extends Error { code: string; }
|
|
90
|
+
export interface DiscoveryVisitInput {
|
|
91
|
+
source: "cdn_log" | "server_log";
|
|
92
|
+
record_id: string;
|
|
93
|
+
source_digest: string;
|
|
94
|
+
observed_at: number;
|
|
95
|
+
path: string;
|
|
96
|
+
status: number;
|
|
97
|
+
method?: "GET" | "HEAD";
|
|
98
|
+
request_count?: number;
|
|
99
|
+
user_agent?: string;
|
|
100
|
+
host?: string;
|
|
101
|
+
}
|
|
102
|
+
export interface DiscoveryVisitEvidence {
|
|
103
|
+
schema: typeof VISIT_EVIDENCE_SCHEMA;
|
|
104
|
+
host: string;
|
|
105
|
+
path: string;
|
|
106
|
+
surface: "agent_card" | "website";
|
|
107
|
+
source: "cdn_log" | "server_log";
|
|
108
|
+
record_id: string;
|
|
109
|
+
source_digest: string;
|
|
110
|
+
observed_at: number;
|
|
111
|
+
request_count: number;
|
|
112
|
+
method: "GET" | "HEAD";
|
|
113
|
+
status: number;
|
|
114
|
+
provider: string | null;
|
|
115
|
+
bot: string | null;
|
|
116
|
+
evidence_level: "ua_claim" | "unclassified";
|
|
117
|
+
user_agent_digest: string;
|
|
118
|
+
digest: string;
|
|
119
|
+
}
|
|
120
|
+
export interface AiExposureInput {
|
|
121
|
+
source: "google_search_console_generative_ai_search";
|
|
122
|
+
report_digest: string;
|
|
123
|
+
date: string;
|
|
124
|
+
page: string;
|
|
125
|
+
impressions: number;
|
|
126
|
+
}
|
|
127
|
+
export interface AiExposureEvidence extends AiExposureInput {
|
|
128
|
+
schema: typeof AI_EXPOSURE_SCHEMA;
|
|
129
|
+
host: string;
|
|
130
|
+
/** SHA-256 of the complete canonical page URL, including query and fragment. */
|
|
131
|
+
page_digest: string;
|
|
132
|
+
evidence_level: "owner_supplied_platform_export";
|
|
133
|
+
digest: string;
|
|
134
|
+
}
|
|
135
|
+
export interface DiscoveryEvidenceSummary {
|
|
136
|
+
schema: typeof DISCOVERY_SUMMARY_SCHEMA;
|
|
137
|
+
host: string;
|
|
138
|
+
visits: { records: number; requests: number; successful: number; failed: number; agent_card_successful: number; agent_card_bot_claim_successful: number; by_bot_claim: Record<string, number>; by_path: Record<string, number>; by_day_utc: Record<string, number> };
|
|
139
|
+
google_ai_search: { records: number; impressions: number; by_date: Record<string, number> };
|
|
140
|
+
visit_digests: string[];
|
|
141
|
+
exposure_digests: string[];
|
|
142
|
+
digest: string;
|
|
143
|
+
}
|
|
144
|
+
export declare function normalizeDiscoveryVisit(row: DiscoveryVisitInput, options: { host: string }): DiscoveryVisitEvidence;
|
|
145
|
+
export declare function normalizeAiExposure(row: AiExposureInput, options: { host: string }): AiExposureEvidence;
|
|
146
|
+
export declare function summarizeDiscoveryEvidence(visits: DiscoveryVisitEvidence[], exposures: AiExposureEvidence[], options: { host: string }): DiscoveryEvidenceSummary;
|
|
147
|
+
export interface DiscoveryEvidenceView {
|
|
148
|
+
schema: typeof DISCOVERY_VIEW_SCHEMA;
|
|
149
|
+
host: string;
|
|
150
|
+
summary_digest: string;
|
|
151
|
+
cards: Array<{ id: string; label_zh_tw: string; value: number | null; unit: "requests" | "impressions"; state: "ready" | "not_connected" | "no_imported_records"; evidence_level: "http_log" | "ua_claim" | "owner_supplied_platform_export" }>;
|
|
152
|
+
trends: Array<{ id: string; unit: "requests" | "impressions"; date_basis: "utc" | "report_date"; state: "ready" | "not_connected" | "no_imported_records"; points: Array<{ date: string; value: number }> }>;
|
|
153
|
+
bot_claims: Array<{ bot: string; requests: number }>;
|
|
154
|
+
paths: Array<{ path: string; requests: number }>;
|
|
155
|
+
evidence_labels_zh_tw: Record<string, string>;
|
|
156
|
+
state_labels_zh_tw: Record<"no_imported_records" | "not_connected", string>;
|
|
157
|
+
notice_zh_tw: string;
|
|
158
|
+
digest: string;
|
|
159
|
+
}
|
|
160
|
+
export declare function buildDiscoveryEvidenceView(summary: DiscoveryEvidenceSummary, options: { visitSourceStatus: "connected" | "not_connected"; googleAiSearchSourceStatus: "connected" | "not_connected" }): DiscoveryEvidenceView;
|
|
79
161
|
|
|
80
162
|
export declare const DESCRIPTOR_CANONICALIZATION: "rfc8785";
|
|
81
163
|
export declare const DESCRIPTOR_SIGNATURE_FIELDS: readonly ["signatures", "signatureStatus"];
|
|
82
164
|
export interface DescriptorSignature { protected: string; signature: string; }
|
|
83
|
-
export interface SignedDescriptor extends Record<string,
|
|
165
|
+
export interface SignedDescriptor extends Record<string, unknown> { signatures: DescriptorSignature[]; signatureStatus: string; }
|
|
84
166
|
export interface DescriptorVerification {
|
|
85
167
|
status: "signed" | "unsigned";
|
|
86
168
|
digest: string;
|
|
@@ -88,13 +170,13 @@ export interface DescriptorVerification {
|
|
|
88
170
|
jku: string | null;
|
|
89
171
|
protected: { alg: "EdDSA"; typ: string; kid: string; jku?: string } | null;
|
|
90
172
|
}
|
|
91
|
-
export declare function descriptorBody(document: Record<string,
|
|
92
|
-
export declare function descriptorBytes(document: Record<string,
|
|
93
|
-
export declare function descriptorDigest(document: Record<string,
|
|
94
|
-
export declare function descriptorEtag(document: Record<string,
|
|
95
|
-
export declare function signDescriptor(document: Record<string,
|
|
96
|
-
export declare function unsignedDescriptor(document: Record<string,
|
|
97
|
-
export declare function verifyDescriptor(document: Record<string,
|
|
173
|
+
export declare function descriptorBody(document: Record<string, unknown>): Record<string, unknown>;
|
|
174
|
+
export declare function descriptorBytes(document: Record<string, unknown>): Buffer;
|
|
175
|
+
export declare function descriptorDigest(document: Record<string, unknown>): string;
|
|
176
|
+
export declare function descriptorEtag(document: Record<string, unknown>): string;
|
|
177
|
+
export declare function signDescriptor(document: Record<string, unknown>, privateKey: string | Buffer | import("node:crypto").KeyObject, options?: { kid?: string; jku?: string | null; typ?: string }): SignedDescriptor;
|
|
178
|
+
export declare function unsignedDescriptor(document: Record<string, unknown>, reason?: string): SignedDescriptor;
|
|
179
|
+
export declare function verifyDescriptor(document: Record<string, unknown>, publicKey: string | Buffer | import("node:crypto").KeyObject | null | undefined, options?: { expectedKid?: string | null; expectedJku?: string | null; allowUnsigned?: boolean }): DescriptorVerification;
|
|
98
180
|
|
|
99
181
|
export declare const WELL_KNOWN_DOCUMENT_SCHEMA: "twin3-discovery-well-known-v1";
|
|
100
182
|
export interface WellKnownProtocol {
|
|
@@ -104,7 +186,7 @@ export interface WellKnownProtocol {
|
|
|
104
186
|
required?: string[];
|
|
105
187
|
implementation_specific?: string[];
|
|
106
188
|
}
|
|
107
|
-
export interface WellKnownDocument extends Record<string,
|
|
189
|
+
export interface WellKnownDocument extends Record<string, unknown> {
|
|
108
190
|
schema: string;
|
|
109
191
|
host: string;
|
|
110
192
|
did?: string;
|
|
@@ -112,8 +194,8 @@ export interface WellKnownDocument extends Record<string, any> {
|
|
|
112
194
|
digest: string;
|
|
113
195
|
}
|
|
114
196
|
export declare function buildWellKnownDocument(host: string, protocol: WellKnownProtocol, fields: Record<string, any>, options?: { did?: boolean | string; schema?: string }): WellKnownDocument;
|
|
115
|
-
export declare function validateWellKnownDocument(document: Record<string,
|
|
116
|
-
export declare function resolveDocumentPath(document: Record<string,
|
|
197
|
+
export declare function validateWellKnownDocument(document: Record<string, unknown>): Required<WellKnownProtocol>;
|
|
198
|
+
export declare function resolveDocumentPath(document: Record<string, unknown>, dotted: string): [boolean, unknown];
|
|
117
199
|
|
|
118
200
|
export interface OwnerPolicyInput extends Record<string, any> {
|
|
119
201
|
stranger_requires_payment?: unknown;
|
|
@@ -240,7 +322,7 @@ export interface CounterpartyTable {
|
|
|
240
322
|
freeze(identity: CounterpartyIdentity, actor: string, reason: string, options?: { now?: number }): CounterpartyRow;
|
|
241
323
|
unfreeze(identity: CounterpartyIdentity, actor: string, reason: string, options?: { now?: number }): CounterpartyRow;
|
|
242
324
|
bindKey(identity: CounterpartyIdentity, binding: Record<string, any>, actor: string, reason: string,
|
|
243
|
-
options?: { ownerPublicKey?:
|
|
325
|
+
options?: { ownerPublicKey?: CryptoKeyInput; now?: number }): CounterpartyRow;
|
|
244
326
|
boundKey(identity: CounterpartyIdentity): [string, string] | null;
|
|
245
327
|
bindWallet(identity: CounterpartyIdentity, walletAddress: string,
|
|
246
328
|
options?: { actor?: string; reason?: string; now?: number }): CounterpartyRow;
|
|
@@ -294,10 +376,10 @@ export declare function openAppeal(table: CounterpartyTable, identity: Counterpa
|
|
|
294
376
|
export declare function resolveAppeal(table: CounterpartyTable, appealId: string,
|
|
295
377
|
decision: "uphold" | "overturn", actor: string, reason: string, options?: { now?: number }): Appeal;
|
|
296
378
|
export declare function listAppeals(table: CounterpartyTable, options?: { status?: string }): Appeal[];
|
|
297
|
-
export declare function exportReputation(table: CounterpartyTable, owner: string, ownerPrivateKey:
|
|
379
|
+
export declare function exportReputation(table: CounterpartyTable, owner: string, ownerPrivateKey: CryptoKeyInput,
|
|
298
380
|
options?: { now?: number; minStrikes?: number }): ReputationBundle;
|
|
299
381
|
export declare function importReputation(table: CounterpartyTable, bundle: Record<string, any>,
|
|
300
|
-
peerPublicKey:
|
|
382
|
+
peerPublicKey: CryptoKeyInput, actor: string, options?: { now?: number; weight?: number }): ReputationImport;
|
|
301
383
|
|
|
302
384
|
export declare const TIERS: string[];
|
|
303
385
|
export declare const TIER_RANK: Record<string, number>;
|
|
@@ -311,7 +393,7 @@ export declare function createCounterpartyTable(params: {
|
|
|
311
393
|
store: Record<string, any>;
|
|
312
394
|
owner: string;
|
|
313
395
|
now?: number | (() => number);
|
|
314
|
-
ownerPublicKey?:
|
|
396
|
+
ownerPublicKey?: CryptoKeyInput;
|
|
315
397
|
legacyTierResolver?: (owner: string, key: string, snapshot: Record<string, any>) => string;
|
|
316
398
|
}): CounterpartyTable;
|
|
317
399
|
export declare function emptyCounterpartyStore(): { schema: string; owners: Record<string, any> };
|
|
@@ -330,13 +412,13 @@ export declare function issueOwnerAccessGrant(params: {
|
|
|
330
412
|
grantEpoch: number;
|
|
331
413
|
actor: string;
|
|
332
414
|
reason: string;
|
|
333
|
-
ownerPrivateKey:
|
|
415
|
+
ownerPrivateKey: CryptoKeyInput;
|
|
334
416
|
now?: number;
|
|
335
417
|
grantId?: string;
|
|
336
418
|
}): OwnerAccessGrant;
|
|
337
419
|
export declare function verifyOwnerAccessGrant(params: {
|
|
338
420
|
grant: Record<string, any>;
|
|
339
|
-
ownerPublicKey:
|
|
421
|
+
ownerPublicKey: CryptoKeyInput;
|
|
340
422
|
owner: string;
|
|
341
423
|
identity: CounterpartyIdentity;
|
|
342
424
|
binding: Record<string, any>;
|
|
@@ -381,7 +463,7 @@ export interface A2AAgentCardSignature {
|
|
|
381
463
|
header?: Record<string, unknown>;
|
|
382
464
|
}
|
|
383
465
|
export interface A2AJwks { keys: import("node:crypto").JsonWebKey[]; }
|
|
384
|
-
export interface A2AAgentCard extends Record<string,
|
|
466
|
+
export interface A2AAgentCard extends Record<string, unknown> {
|
|
385
467
|
name: string;
|
|
386
468
|
description: string;
|
|
387
469
|
version: string;
|
|
@@ -486,7 +568,62 @@ export declare class DenseVector256 {
|
|
|
486
568
|
cosineDistance(other: DenseVector256): number;
|
|
487
569
|
compositeToleranceDistance(other: DenseVector256): number;
|
|
488
570
|
matchTolerance(other: DenseVector256, maxDistance?: number): boolean;
|
|
489
|
-
|
|
571
|
+
compare(other: DenseVector256, options?: MatrixComparisonOptions): MatrixComparisonResult;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
export declare const COMPARISON_SCHEMA: "twin3-matrix-comparison-v1";
|
|
575
|
+
export declare const COMPARISON_PROFILE_SCHEMA: "twin3-matrix-comparison-profile-v1";
|
|
576
|
+
export type MatrixFeaturePolicy = "numeric" | "bitmask_jaccard" | "exact_bucket" | "split_nibble";
|
|
577
|
+
export interface MatrixComparisonOptions {
|
|
578
|
+
metric?: "cosine" | "composite_rms";
|
|
579
|
+
dimensionPolicies?: Record<number, MatrixFeaturePolicy>;
|
|
580
|
+
missingByte?: number | null;
|
|
581
|
+
weights?: number[] | null;
|
|
582
|
+
maxDistance?: number | null;
|
|
583
|
+
minCoverage?: number | null;
|
|
584
|
+
sourceDigest?: string | null;
|
|
585
|
+
projectionDigest?: string | null;
|
|
586
|
+
mappingReference?: string | null;
|
|
587
|
+
}
|
|
588
|
+
export interface MatrixComparisonProfileWire {
|
|
589
|
+
schema: typeof COMPARISON_PROFILE_SCHEMA;
|
|
590
|
+
layout: string;
|
|
591
|
+
registry_reference: string;
|
|
592
|
+
excluded_dimensions: number[];
|
|
593
|
+
unresolved_dimensions: number[];
|
|
594
|
+
}
|
|
595
|
+
export interface MatrixComparisonResult {
|
|
596
|
+
schema: typeof COMPARISON_SCHEMA;
|
|
597
|
+
status: "comparable" | "not_comparable" | "insufficient_coverage" | "metric_undefined";
|
|
598
|
+
reason: string | null;
|
|
599
|
+
distance: number | null;
|
|
600
|
+
match: boolean | null;
|
|
601
|
+
comparable_dimensions: number;
|
|
602
|
+
eligible_weight: number;
|
|
603
|
+
requested_weight: number;
|
|
604
|
+
coverage: number | null;
|
|
605
|
+
metric: "cosine" | "composite_rms";
|
|
606
|
+
policy_version: "l5-rms-v1";
|
|
607
|
+
source_digest: string | null;
|
|
608
|
+
projection_digest: string | null;
|
|
609
|
+
mapping_reference: string | null;
|
|
610
|
+
profile?: MatrixComparisonProfileWire;
|
|
611
|
+
}
|
|
612
|
+
export declare class ComparisonProfile {
|
|
613
|
+
readonly layout: string;
|
|
614
|
+
readonly registryReference: string;
|
|
615
|
+
readonly excluded: readonly number[];
|
|
616
|
+
readonly unresolved: readonly number[];
|
|
617
|
+
constructor(options: { layout: string; registryReference: string; excluded?: number[]; unresolved?: number[] });
|
|
618
|
+
comparableDimensions(): number[];
|
|
619
|
+
defaultWeights(): number[];
|
|
620
|
+
resolveWeights(weights?: number[] | null): number[];
|
|
621
|
+
assertLayout(aLayout: string, bLayout: string): void;
|
|
622
|
+
compare(a: DenseVector256, b: DenseVector256, options: MatrixComparisonOptions & { aLayout: string; bLayout: string }): MatrixComparisonResult;
|
|
623
|
+
toDict(): MatrixComparisonProfileWire;
|
|
624
|
+
}
|
|
625
|
+
export declare function humanComparisonProfile(registryReference: string, unresolved?: number[]): ComparisonProfile;
|
|
626
|
+
export declare function featureDistance(a: number, b: number, policy?: MatrixFeaturePolicy, missing?: number | null): number;
|
|
490
627
|
|
|
491
628
|
export interface HumanMatrixQuadrantMap {
|
|
492
629
|
physical: [number, number];
|
|
@@ -572,6 +709,41 @@ export declare function issuePasskeyChallenge(params: {
|
|
|
572
709
|
expires_at: number;
|
|
573
710
|
}>;
|
|
574
711
|
|
|
712
|
+
export interface PasskeyRegistrationInput {
|
|
713
|
+
challenge: string;
|
|
714
|
+
credentialId: string;
|
|
715
|
+
clientDataJson: string;
|
|
716
|
+
attestationObject: string;
|
|
717
|
+
expectedOrigin: string;
|
|
718
|
+
expectedRpId: string;
|
|
719
|
+
requireUserVerification?: boolean;
|
|
720
|
+
}
|
|
721
|
+
export interface PasskeyRegistrationResult {
|
|
722
|
+
readonly valid: true;
|
|
723
|
+
readonly credential_id: string;
|
|
724
|
+
readonly public_key_pem: string;
|
|
725
|
+
readonly algorithm: -7;
|
|
726
|
+
readonly rp_id: string;
|
|
727
|
+
readonly origin: string;
|
|
728
|
+
readonly sign_count: number;
|
|
729
|
+
readonly user_present: true;
|
|
730
|
+
readonly user_verified: boolean;
|
|
731
|
+
readonly backup_eligible: boolean;
|
|
732
|
+
readonly backup_state: boolean;
|
|
733
|
+
readonly attestation_format: "none";
|
|
734
|
+
}
|
|
735
|
+
export type PasskeyRegistrationErrorCode =
|
|
736
|
+
| "registration_input_invalid" | "registration_context_invalid"
|
|
737
|
+
| "registration_client_data_invalid" | "registration_challenge_mismatch"
|
|
738
|
+
| "registration_origin_mismatch" | "registration_attestation_invalid"
|
|
739
|
+
| "registration_rp_mismatch" | "registration_flags_invalid"
|
|
740
|
+
| "registration_credential_mismatch" | "registration_key_invalid";
|
|
741
|
+
export declare class PasskeyRegistrationError extends Error {
|
|
742
|
+
constructor(code?: PasskeyRegistrationErrorCode);
|
|
743
|
+
readonly code: PasskeyRegistrationErrorCode;
|
|
744
|
+
}
|
|
745
|
+
export declare function verifyPasskeyRegistration(input: PasskeyRegistrationInput): Readonly<PasskeyRegistrationResult>;
|
|
746
|
+
|
|
575
747
|
export declare function verifyPasskeyAssertion(params: {
|
|
576
748
|
challenge: string;
|
|
577
749
|
clientDataJson: string;
|
|
@@ -640,7 +812,7 @@ export declare function verifyPasskeyAssertionWithStores(params: {
|
|
|
640
812
|
challengeStore: ChallengeStore;
|
|
641
813
|
}): Promise<ReturnType<typeof verifyPasskeyAssertion> & { user_id: string }>;
|
|
642
814
|
|
|
643
|
-
export declare function keyId(publicKey:
|
|
815
|
+
export declare function keyId(publicKey: CryptoKeyInput): string;
|
|
644
816
|
|
|
645
817
|
export interface KyaIdentity {
|
|
646
818
|
kind: string;
|
|
@@ -676,6 +848,12 @@ export interface KyaBinding {
|
|
|
676
848
|
receipt: string;
|
|
677
849
|
}
|
|
678
850
|
|
|
851
|
+
export declare class DidResolutionError extends Error { readonly code: string; }
|
|
852
|
+
export declare function didWebForHost(host: string): string;
|
|
853
|
+
export declare function didWebUrl(did: string): string;
|
|
854
|
+
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; };
|
|
855
|
+
export declare function multibaseEd25519(raw: Uint8Array, multicodec?: boolean): string;
|
|
856
|
+
export declare const AuthorityAnchor: { readonly SUPPORTED_KINDS: readonly string[]; isValidKind(kind: string): boolean; };
|
|
679
857
|
export declare function createKyaChallenge(params: {
|
|
680
858
|
owner: string;
|
|
681
859
|
identity: KyaIdentity;
|
|
@@ -684,7 +862,7 @@ export declare function createKyaChallenge(params: {
|
|
|
684
862
|
now?: number;
|
|
685
863
|
ttlSeconds?: number;
|
|
686
864
|
}): KyaChallenge;
|
|
687
|
-
export declare function verifyOwnerSignature(challenge: KyaChallenge, ownerPublicKey:
|
|
865
|
+
export declare function verifyOwnerSignature(challenge: KyaChallenge, ownerPublicKey: CryptoKeyInput): true;
|
|
688
866
|
export declare function challengeSignaturePayload(challenge: KyaChallenge): Uint8Array;
|
|
689
867
|
export declare function exportEd25519PublicKey(publicKey: string | object): string;
|
|
690
868
|
export declare function verifyKyaChallenge(params: {
|
|
@@ -855,11 +1033,59 @@ export declare function buildEnvelope(params: {
|
|
|
855
1033
|
ttlSeconds?: number;
|
|
856
1034
|
}): Envelope;
|
|
857
1035
|
|
|
858
|
-
export declare function signEnvelope(envelope: Envelope, privateKey:
|
|
859
|
-
export declare function verifyEnvelopeSignature(envelope: Envelope, publicKey:
|
|
1036
|
+
export declare function signEnvelope(envelope: Envelope, privateKey: CryptoKeyInput): Envelope;
|
|
1037
|
+
export declare function verifyEnvelopeSignature(envelope: Envelope, publicKey: CryptoKeyInput, expectedKeyId?: string): true;
|
|
860
1038
|
|
|
861
1039
|
export declare function scanText(text: string, options?: { source?: string; now?: number }): ShieldVerdict;
|
|
862
1040
|
|
|
1041
|
+
export declare const MEMORY_SCHEMA: string;
|
|
1042
|
+
export declare const REVOCATION_SCHEMA: string;
|
|
1043
|
+
|
|
1044
|
+
export declare class MemoryRejected extends Error {
|
|
1045
|
+
readonly code: string;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
export interface MemoryShieldStamp {
|
|
1049
|
+
verdict: string;
|
|
1050
|
+
reason_codes: string[];
|
|
1051
|
+
receipt: unknown;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
export interface MemoryEntry {
|
|
1055
|
+
schema: string;
|
|
1056
|
+
id: string;
|
|
1057
|
+
text: string;
|
|
1058
|
+
origin: string;
|
|
1059
|
+
kind: "data" | "instruction";
|
|
1060
|
+
treat_as: "data" | "instruction";
|
|
1061
|
+
actor: string;
|
|
1062
|
+
source: string;
|
|
1063
|
+
source_epoch: number;
|
|
1064
|
+
at: number;
|
|
1065
|
+
shield: MemoryShieldStamp | null;
|
|
1066
|
+
flagged: boolean;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
export interface MemoryRevocation {
|
|
1070
|
+
schema: string;
|
|
1071
|
+
source: string;
|
|
1072
|
+
epoch: number;
|
|
1073
|
+
actor: string;
|
|
1074
|
+
reason: string;
|
|
1075
|
+
at: number;
|
|
1076
|
+
removed: number;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
export declare class MemoryGuard {
|
|
1080
|
+
constructor(store: { entries?: MemoryEntry[]; revocations?: Record<string, MemoryRevocation>; purges?: unknown[] }, ensemble?: unknown, intel?: unknown);
|
|
1081
|
+
revokedEpoch(source: string): number | null;
|
|
1082
|
+
purgeSource(source: string, actor: string, reason: string, now?: number, epoch?: number): MemoryRevocation;
|
|
1083
|
+
write(text: string, origin: string, actor: string, kind?: "data" | "instruction", source?: string, sourceEpoch?: number, now?: number): MemoryEntry;
|
|
1084
|
+
recall(kinds?: Array<"data" | "instruction">, origins?: string[] | null, includeFlagged?: boolean): MemoryEntry[];
|
|
1085
|
+
instructions(): MemoryEntry[];
|
|
1086
|
+
purgeOrigin(origin: string, actor: string, reason: string): number;
|
|
1087
|
+
}
|
|
1088
|
+
|
|
863
1089
|
export declare const TASK_EXPORT_SCHEMA: string;
|
|
864
1090
|
|
|
865
1091
|
export declare function taskTrustLine(task: Record<string, unknown>, row: Record<string, unknown> | null): string;
|
|
@@ -1126,13 +1352,13 @@ export declare function issueReceipt(params: {
|
|
|
1126
1352
|
identity: { kind: string; value: string };
|
|
1127
1353
|
quote: Record<string, any>;
|
|
1128
1354
|
reference: string;
|
|
1129
|
-
ownerPrivateKey:
|
|
1355
|
+
ownerPrivateKey: CryptoKeyInput;
|
|
1130
1356
|
now?: number;
|
|
1131
1357
|
receiptId?: string;
|
|
1132
1358
|
}): SettlementReceipt;
|
|
1133
1359
|
export declare function verifyReceipt(params: {
|
|
1134
1360
|
receipt: Record<string, any>;
|
|
1135
|
-
ownerPublicKey:
|
|
1361
|
+
ownerPublicKey: CryptoKeyInput;
|
|
1136
1362
|
owner: string;
|
|
1137
1363
|
identity: { kind: string; value: string };
|
|
1138
1364
|
quote?: Record<string, any> | null;
|
|
@@ -1292,7 +1518,7 @@ export interface CounterpartyAgent {
|
|
|
1292
1518
|
keyId: string;
|
|
1293
1519
|
routes: Record<"challenge" | "complete" | "submit" | "quote" | "declaration", string>;
|
|
1294
1520
|
publicKey(format?: "compact" | "pem" | "multibase"): string;
|
|
1295
|
-
answerChallenge(challenge: KyaChallenge, options?: { ownerPublicKey?:
|
|
1521
|
+
answerChallenge(challenge: KyaChallenge, options?: { ownerPublicKey?: CryptoKeyInput; signPayload?: string }): ChallengeAnswer;
|
|
1296
1522
|
buildEnvelope(kind: Envelope["kind"], payload: Record<string, any>, options?: { ttlSeconds?: number; now?: number }): Envelope;
|
|
1297
1523
|
signEnvelope(envelope: Envelope): Envelope;
|
|
1298
1524
|
envelope(kind: Envelope["kind"], payload: Record<string, any>, options?: { ttlSeconds?: number; now?: number }): Envelope;
|
|
@@ -1305,7 +1531,7 @@ export declare function createCounterpartyAgent(params: {
|
|
|
1305
1531
|
identity: Identity;
|
|
1306
1532
|
keyPath?: string;
|
|
1307
1533
|
privateKeyPem?: string;
|
|
1308
|
-
privateKey?:
|
|
1534
|
+
privateKey?: import("node:crypto").KeyObject;
|
|
1309
1535
|
now?: () => number;
|
|
1310
1536
|
legacySchemas?: boolean;
|
|
1311
1537
|
routes?: Partial<CounterpartyAgent["routes"]>;
|
|
@@ -1320,8 +1546,8 @@ export declare function createRelayTransport(params: {
|
|
|
1320
1546
|
export declare function createChallenge(params: {
|
|
1321
1547
|
owner: string;
|
|
1322
1548
|
identity: Identity;
|
|
1323
|
-
counterpartyPublicKey:
|
|
1324
|
-
ownerPrivateKey:
|
|
1549
|
+
counterpartyPublicKey: CryptoKeyInput;
|
|
1550
|
+
ownerPrivateKey: CryptoKeyInput;
|
|
1325
1551
|
now?: number;
|
|
1326
1552
|
ttlSeconds?: number;
|
|
1327
1553
|
legacySchemas?: boolean;
|
|
@@ -1329,8 +1555,8 @@ export declare function createChallenge(params: {
|
|
|
1329
1555
|
|
|
1330
1556
|
export declare function verifyChallengeAnswer(challenge: KyaChallenge, signature: string, options?: { now?: number }): true;
|
|
1331
1557
|
export declare function envelopeDigest(envelope: Envelope): string;
|
|
1332
|
-
export declare function loadPublicKey(value:
|
|
1333
|
-
export declare function exportPublicKey(publicKey:
|
|
1558
|
+
export declare function loadPublicKey(value: CryptoKeyInput): import("node:crypto").KeyObject;
|
|
1559
|
+
export declare function exportPublicKey(publicKey: CryptoKeyInput, format?: "compact" | "pem" | "multibase"): string;
|
|
1334
1560
|
export declare const INBOX_ROUTES: CounterpartyAgent["routes"];
|
|
1335
1561
|
|
|
1336
1562
|
export declare const TASK_STORE_SCHEMA: "twin3-comm-task-store-v1";
|
|
@@ -1380,8 +1606,8 @@ export interface TaskInboxOptions {
|
|
|
1380
1606
|
ensemble?: null | undefined;
|
|
1381
1607
|
intel?: null | undefined;
|
|
1382
1608
|
requirePlanDiff?: true;
|
|
1383
|
-
replayStore?:
|
|
1384
|
-
replay_store?:
|
|
1609
|
+
replayStore?: { consume(key: string, expiresAt: number, now?: number): boolean | Promise<boolean> } | null;
|
|
1610
|
+
replay_store?: { consume(key: string, expiresAt: number, now?: number): boolean | Promise<boolean> } | null;
|
|
1385
1611
|
}
|
|
1386
1612
|
|
|
1387
1613
|
export declare class IntakeRejected extends Error {
|
|
@@ -1442,6 +1668,10 @@ export declare class TaskInbox {
|
|
|
1442
1668
|
}): TaskInboxTask;
|
|
1443
1669
|
clearReview(taskId: string, actor: string, reason: string, now?: number): TaskInboxTask;
|
|
1444
1670
|
clearReview(input: { taskId: string; actor: string; reason: string; now?: number }): TaskInboxTask;
|
|
1671
|
+
getPolicy(): Record<string, any> | null;
|
|
1672
|
+
setPolicy(policy: Record<string, any>): Record<string, any>;
|
|
1673
|
+
quoteFor(identity: { kind: string; value: string }, now?: number): Record<string, any> | null;
|
|
1674
|
+
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>>;
|
|
1445
1675
|
recordPlanDiff(taskId: string, before: any[], after: any[], actor: string,
|
|
1446
1676
|
authorized?: string[], now?: number): Record<string, any>;
|
|
1447
1677
|
recordPlanDiff(input: {
|
|
@@ -1452,6 +1682,19 @@ export declare class TaskInbox {
|
|
|
1452
1682
|
authorized?: string[];
|
|
1453
1683
|
now?: number;
|
|
1454
1684
|
}): Record<string, any>;
|
|
1685
|
+
getPolicy(): Record<string, any> | null;
|
|
1686
|
+
setPolicy(policy: Record<string, any>): Record<string, any>;
|
|
1687
|
+
applyX402Payment(
|
|
1688
|
+
identity: { kind: string; value: string },
|
|
1689
|
+
demand: Record<string, any>,
|
|
1690
|
+
receipt: Record<string, any>,
|
|
1691
|
+
publicKey: CryptoKeyInput,
|
|
1692
|
+
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>),
|
|
1693
|
+
replayStore?: { reserve: Function; commit: Function; release: Function } | null,
|
|
1694
|
+
minimumConfirmations?: number,
|
|
1695
|
+
actor?: string,
|
|
1696
|
+
now?: number,
|
|
1697
|
+
): Promise<Record<string, any>>;
|
|
1455
1698
|
expireStale(now?: number): string[];
|
|
1456
1699
|
verifyAuditChain(taskId: string): boolean;
|
|
1457
1700
|
}
|
|
@@ -1523,3 +1766,27 @@ export declare namespace experimentalTaskInbox {
|
|
|
1523
1766
|
expire(input: { principal: unknown; taskId: string; expectedVersion: number; operationId: string; reason: string }): Promise<InboxTask>;
|
|
1524
1767
|
}
|
|
1525
1768
|
}
|
|
1769
|
+
|
|
1770
|
+
export interface ExternalEd25519Signer {
|
|
1771
|
+
publicKey: string;
|
|
1772
|
+
sign(bytes: Uint8Array, signal: AbortSignal): Promise<string> | string;
|
|
1773
|
+
}
|
|
1774
|
+
export interface ExternalSignerOptions {
|
|
1775
|
+
now?: number;
|
|
1776
|
+
signal?: AbortSignal;
|
|
1777
|
+
timeoutMs?: number;
|
|
1778
|
+
}
|
|
1779
|
+
export type ExternalSignerErrorCode = "external_signer_input_invalid" | "external_signer_unavailable"
|
|
1780
|
+
| "external_signer_aborted" | "external_signer_timeout" | "external_signer_signature_invalid" | "external_signer_expired";
|
|
1781
|
+
export declare class ExternalSignerError extends Error {
|
|
1782
|
+
readonly code: ExternalSignerErrorCode;
|
|
1783
|
+
constructor(code: ExternalSignerErrorCode);
|
|
1784
|
+
}
|
|
1785
|
+
export declare function createKyaChallengeWithSigner(params: ExternalSignerOptions & {
|
|
1786
|
+
owner: string; identity: KyaIdentity; counterpartyPublicKey: string; signer: ExternalEd25519Signer;
|
|
1787
|
+
ttlSeconds?: number;
|
|
1788
|
+
}): Promise<Readonly<KyaChallenge>>;
|
|
1789
|
+
export declare function signDelegationWithSigner(delegation: Record<string, unknown>, signer: ExternalEd25519Signer,
|
|
1790
|
+
options?: ExternalSignerOptions): Promise<Readonly<Record<string, unknown>>>;
|
|
1791
|
+
export declare function signEnvelopeWithSigner(envelope: Envelope, signer: ExternalEd25519Signer,
|
|
1792
|
+
options?: ExternalSignerOptions): Promise<Readonly<Envelope>>;
|
package/js/comm/counterparty.js
CHANGED
|
@@ -345,7 +345,15 @@ function createRelayTransport({ serviceOrigin, accessToken, fetch: fetcher = glo
|
|
|
345
345
|
const token = typeof accessToken === "function" ? await accessToken() : accessToken;
|
|
346
346
|
const headers = { "content-type": "application/json" };
|
|
347
347
|
if (token) headers.authorization = "Bearer " + token;
|
|
348
|
-
const response = await fetcher(origin + pathname, {
|
|
348
|
+
const response = await fetcher(origin + pathname, {
|
|
349
|
+
method,
|
|
350
|
+
headers,
|
|
351
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
352
|
+
redirect: "manual",
|
|
353
|
+
});
|
|
354
|
+
if (response.type === "opaqueredirect" || (response.status >= 300 && response.status < 400)) {
|
|
355
|
+
throw sdkError("inbox_redirect_forbidden");
|
|
356
|
+
}
|
|
349
357
|
const payload = await response.json();
|
|
350
358
|
if (!response.ok || payload.ok === false) {
|
|
351
359
|
const error = sdkError(payload && payload.error ? payload.error : `inbox_http_${response.status}`);
|