tenzro-sdk 0.2.0 → 0.3.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 +1 -1
- package/dist/adaptive-burn.js +4 -4
- package/dist/adaptive-burn.js.map +1 -1
- package/dist/agent.d.ts +119 -11
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +162 -13
- package/dist/agent.js.map +1 -1
- package/dist/app.js +1 -1
- package/dist/app.js.map +1 -1
- package/dist/auth.d.ts +37 -0
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +11 -0
- package/dist/auth.js.map +1 -1
- package/dist/client.d.ts +81 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +99 -0
- package/dist/client.js.map +1 -1
- package/dist/eip7702.d.ts +110 -0
- package/dist/eip7702.d.ts.map +1 -0
- package/dist/eip7702.js +73 -0
- package/dist/eip7702.js.map +1 -0
- package/dist/erc7683.d.ts +79 -0
- package/dist/erc7683.d.ts.map +1 -0
- package/dist/erc7683.js +82 -0
- package/dist/erc7683.js.map +1 -0
- package/dist/events.d.ts +45 -15
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +38 -8
- package/dist/events.js.map +1 -1
- package/dist/identity.d.ts +1 -1
- package/dist/identity.js +1 -1
- package/dist/index.d.ts +25 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -2
- package/dist/index.js.map +1 -1
- package/dist/iroh.d.ts +104 -0
- package/dist/iroh.d.ts.map +1 -0
- package/dist/iroh.js +102 -0
- package/dist/iroh.js.map +1 -0
- package/dist/marketplace.d.ts +2 -2
- package/dist/marketplace.js +2 -2
- package/dist/memory.d.ts +78 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +60 -0
- package/dist/memory.js.map +1 -0
- package/dist/multimodal.d.ts +294 -0
- package/dist/multimodal.d.ts.map +1 -0
- package/dist/multimodal.js +160 -0
- package/dist/multimodal.js.map +1 -0
- package/dist/passkey.d.ts +193 -0
- package/dist/passkey.d.ts.map +1 -0
- package/dist/passkey.js +481 -0
- package/dist/passkey.js.map +1 -0
- package/dist/provider.d.ts +5 -4
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +8 -5
- package/dist/provider.js.map +1 -1
- package/dist/seed-agent.js +7 -7
- package/dist/seed-agent.js.map +1 -1
- package/dist/settlement.d.ts +23 -6
- package/dist/settlement.d.ts.map +1 -1
- package/dist/settlement.js +30 -7
- package/dist/settlement.js.map +1 -1
- package/dist/signer.d.ts +181 -0
- package/dist/signer.d.ts.map +1 -0
- package/dist/signer.js +69 -0
- package/dist/signer.js.map +1 -0
- package/dist/sla.d.ts +95 -0
- package/dist/sla.d.ts.map +1 -0
- package/dist/sla.js +70 -0
- package/dist/sla.js.map +1 -0
- package/dist/snapshot.d.ts +122 -0
- package/dist/snapshot.d.ts.map +1 -0
- package/dist/snapshot.js +80 -0
- package/dist/snapshot.js.map +1 -0
- package/dist/staking.d.ts +5 -5
- package/dist/staking.d.ts.map +1 -1
- package/dist/staking.js +8 -6
- package/dist/staking.js.map +1 -1
- package/dist/task.d.ts +56 -22
- package/dist/task.d.ts.map +1 -1
- package/dist/task.js +65 -31
- package/dist/task.js.map +1 -1
- package/dist/token.d.ts +41 -11
- package/dist/token.d.ts.map +1 -1
- package/dist/token.js.map +1 -1
- package/dist/training.d.ts +108 -0
- package/dist/training.d.ts.map +1 -0
- package/dist/training.js +53 -0
- package/dist/training.js.map +1 -0
- package/dist/types.d.ts +72 -11
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/validator.d.ts +76 -0
- package/dist/validator.d.ts.map +1 -0
- package/dist/validator.js +47 -0
- package/dist/validator.js.map +1 -0
- package/package.json +2 -1
package/dist/seed-agent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seed-agent.js","sourceRoot":"","sources":["../src/seed-agent.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;GAaG;AAC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,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC;QACjF,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,2BAA2B,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9D,CAAC;CACF;AAnDD,0CAmDC"}
|
package/dist/settlement.d.ts
CHANGED
|
@@ -64,17 +64,34 @@ export declare class SettlementClient {
|
|
|
64
64
|
/** Inspect an escrow record by its 32-byte id. */
|
|
65
65
|
getEscrow(escrowId: string): Promise<any>;
|
|
66
66
|
/**
|
|
67
|
-
* List every escrow
|
|
67
|
+
* List every escrow funded by `payer`. Returns
|
|
68
|
+
* `{payer, count, escrows: [...]}`. Backed by the `escrow_payer:`
|
|
69
|
+
* secondary index in `CF_SETTLEMENTS`.
|
|
70
|
+
*
|
|
68
71
|
* @param payer - Payer address (the wallet that created the escrow)
|
|
69
|
-
* @returns Array of escrow records (empty if payer has none)
|
|
70
72
|
*/
|
|
71
|
-
listEscrowsByPayer(payer: string): Promise<any
|
|
73
|
+
listEscrowsByPayer(payer: string): Promise<any>;
|
|
72
74
|
/**
|
|
73
|
-
* List every escrow
|
|
75
|
+
* List every escrow held for `payee`. Returns
|
|
76
|
+
* `{payee, count, escrows: [...]}`. Backed by the `escrow_payee:`
|
|
77
|
+
* secondary index in `CF_SETTLEMENTS`.
|
|
78
|
+
*
|
|
74
79
|
* @param payee - Payee address (the recipient on successful release)
|
|
75
|
-
* @returns Array of escrow records (empty if payee has none)
|
|
76
80
|
*/
|
|
77
|
-
listEscrowsByPayee(payee: string): Promise<any
|
|
81
|
+
listEscrowsByPayee(payee: string): Promise<any>;
|
|
82
|
+
/**
|
|
83
|
+
* Fetch a single channel dispute by id. Returns the full
|
|
84
|
+
* `ChannelDispute` record (challenger, evidence blobs, status,
|
|
85
|
+
* opened_at / timeout_at / resolved_at, resolution). Returns
|
|
86
|
+
* JSON-RPC `-32004` if no dispute with that id exists.
|
|
87
|
+
*/
|
|
88
|
+
getDispute(disputeId: string): Promise<any>;
|
|
89
|
+
/**
|
|
90
|
+
* List every dispute (open or historical) attached to a channel.
|
|
91
|
+
* Returns `{channel_id, count, disputes: [...]}`. Empty list is not
|
|
92
|
+
* an error — a channel with no disputes returns `count: 0`.
|
|
93
|
+
*/
|
|
94
|
+
listDisputesByChannel(channelId: string): Promise<any>;
|
|
78
95
|
/** Internal helper: fetch nonce + chain_id with safe defaults. */
|
|
79
96
|
private fetchNonceAndChainId;
|
|
80
97
|
/**
|
package/dist/settlement.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settlement.d.ts","sourceRoot":"","sources":["../src/settlement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE9D;;;GAGG;AACH,qBAAa,gBAAgB;IACf,OAAO,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAElC;;;;OAIG;IACG,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAInE;;;;OAIG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAMzE;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACG,YAAY,CAChB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,MAAM,GACxB,OAAO,CAAC,MAAM,CAAC;IAwDlB;;;;;;;;;OASG;IACG,aAAa,CACjB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC;IAqClB;;;;;OAKG;IACG,YAAY,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AM,GAAG,OAAO,CAAC,GAAG,CAAC;IAIrD;;;;;;OAMG;IACG,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAIrD;;;;;OAKG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAIjD;;;;OAIG;IACG,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAM5D,kEAAkE;YACpD,oBAAoB;IAuBlC;;;;;OAKG;IACG,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IASzE;;;;OAIG;IACG,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAK3D"}
|
package/dist/settlement.js
CHANGED
|
@@ -177,23 +177,46 @@ class SettlementClient {
|
|
|
177
177
|
async getEscrow(escrowId) {
|
|
178
178
|
const escrowIdBytes = parseEscrowId(escrowId);
|
|
179
179
|
const escrowIdHex = "0x" + bytesToHex(escrowIdBytes);
|
|
180
|
-
return this.rpc.call("tenzro_getEscrow",
|
|
180
|
+
return this.rpc.call("tenzro_getEscrow", { escrow_id: escrowIdHex });
|
|
181
181
|
}
|
|
182
182
|
/**
|
|
183
|
-
* List every escrow
|
|
183
|
+
* List every escrow funded by `payer`. Returns
|
|
184
|
+
* `{payer, count, escrows: [...]}`. Backed by the `escrow_payer:`
|
|
185
|
+
* secondary index in `CF_SETTLEMENTS`.
|
|
186
|
+
*
|
|
184
187
|
* @param payer - Payer address (the wallet that created the escrow)
|
|
185
|
-
* @returns Array of escrow records (empty if payer has none)
|
|
186
188
|
*/
|
|
187
189
|
async listEscrowsByPayer(payer) {
|
|
188
|
-
return this.rpc.call("tenzro_listEscrowsByPayer",
|
|
190
|
+
return this.rpc.call("tenzro_listEscrowsByPayer", { payer });
|
|
189
191
|
}
|
|
190
192
|
/**
|
|
191
|
-
* List every escrow
|
|
193
|
+
* List every escrow held for `payee`. Returns
|
|
194
|
+
* `{payee, count, escrows: [...]}`. Backed by the `escrow_payee:`
|
|
195
|
+
* secondary index in `CF_SETTLEMENTS`.
|
|
196
|
+
*
|
|
192
197
|
* @param payee - Payee address (the recipient on successful release)
|
|
193
|
-
* @returns Array of escrow records (empty if payee has none)
|
|
194
198
|
*/
|
|
195
199
|
async listEscrowsByPayee(payee) {
|
|
196
|
-
return this.rpc.call("tenzro_listEscrowsByPayee",
|
|
200
|
+
return this.rpc.call("tenzro_listEscrowsByPayee", { payee });
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Fetch a single channel dispute by id. Returns the full
|
|
204
|
+
* `ChannelDispute` record (challenger, evidence blobs, status,
|
|
205
|
+
* opened_at / timeout_at / resolved_at, resolution). Returns
|
|
206
|
+
* JSON-RPC `-32004` if no dispute with that id exists.
|
|
207
|
+
*/
|
|
208
|
+
async getDispute(disputeId) {
|
|
209
|
+
return this.rpc.call("tenzro_getDispute", { dispute_id: disputeId });
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* List every dispute (open or historical) attached to a channel.
|
|
213
|
+
* Returns `{channel_id, count, disputes: [...]}`. Empty list is not
|
|
214
|
+
* an error — a channel with no disputes returns `count: 0`.
|
|
215
|
+
*/
|
|
216
|
+
async listDisputesByChannel(channelId) {
|
|
217
|
+
return this.rpc.call("tenzro_listDisputesByChannel", {
|
|
218
|
+
channel_id: channelId,
|
|
219
|
+
});
|
|
197
220
|
}
|
|
198
221
|
/** Internal helper: fetch nonce + chain_id with safe defaults. */
|
|
199
222
|
async fetchNonceAndChainId(address) {
|
package/dist/settlement.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settlement.js","sourceRoot":"","sources":["../src/settlement.ts"],"names":[],"mappings":";;;AAGA;;;GAGG;AACH,MAAa,gBAAgB;IACP;IAApB,YAAoB,GAAc;QAAd,QAAG,GAAH,GAAG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EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;SAC3C,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED,SAAS,aAAa,CAAC,CAAS;IAC9B,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IAC5B,IAAI,KAAK,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,mCAAmC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/signer.d.ts
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pluggable signing surface for custom wallet developers — the
|
|
3
|
+
* TypeScript mirror of `tenzro-sdk::signer` (Rust). See
|
|
4
|
+
* `docs/SPECIFICATION.md` §15.10.2 for the full contract.
|
|
5
|
+
*
|
|
6
|
+
* The high-level surface (`createPasskeyWallet` / `signWithPasskey`)
|
|
7
|
+
* is built on these interfaces; there is no internal-only API.
|
|
8
|
+
*
|
|
9
|
+
* Why interfaces, not classes:
|
|
10
|
+
* - Custom MPC topologies, custom HSM integrations, air-gapped flows,
|
|
11
|
+
* and social-recovery topologies need to extend the surface without
|
|
12
|
+
* forking the SDK.
|
|
13
|
+
* - The SDK's defaults consume the same surface, so any feature that
|
|
14
|
+
* works for the SDK's `PasskeyWallet` works for a third-party
|
|
15
|
+
* wallet.
|
|
16
|
+
*
|
|
17
|
+
* Why this lives in the SDK and not in `tenzro-vm`:
|
|
18
|
+
* - `tenzro-vm` owns the on-chain validator modules; the SDK owns
|
|
19
|
+
* how an off-chain wallet produces the signature and the
|
|
20
|
+
* `validatorData` blob the user op carries.
|
|
21
|
+
*/
|
|
22
|
+
import type { Address } from "./types";
|
|
23
|
+
/** What the {@link Signer} is. Callers use this to pick a {@link Validator}. */
|
|
24
|
+
export type SignerKind = {
|
|
25
|
+
kind: "webauthn";
|
|
26
|
+
credentialId: Uint8Array;
|
|
27
|
+
} | {
|
|
28
|
+
kind: "ed25519";
|
|
29
|
+
} | {
|
|
30
|
+
kind: "frost";
|
|
31
|
+
threshold: number;
|
|
32
|
+
total: number;
|
|
33
|
+
} | {
|
|
34
|
+
kind: "tee";
|
|
35
|
+
backend: TeeBackend;
|
|
36
|
+
} | {
|
|
37
|
+
kind: "hsm";
|
|
38
|
+
vendor: string;
|
|
39
|
+
} | {
|
|
40
|
+
kind: "custom";
|
|
41
|
+
name: string;
|
|
42
|
+
};
|
|
43
|
+
/** Which TEE attests a `tee` signer. */
|
|
44
|
+
export type TeeBackend = "intel-tdx" | "amd-sev-snp" | "aws-nitro" | "nvidia-cc" | "apple-secure-enclave" | "android-strongbox" | "windows-tpm" | "linux-tpm";
|
|
45
|
+
/** ERC-7579 module type. Numeric values match the on-chain enum. */
|
|
46
|
+
export declare enum Erc7579ModuleType {
|
|
47
|
+
Validator = 1,
|
|
48
|
+
Executor = 2,
|
|
49
|
+
Fallback = 3,
|
|
50
|
+
Hook = 4
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Bundle of the EIP-712 user-op hash + raw bytes. Mirrors
|
|
54
|
+
* `tenzro_sdk::signer::PackedUserOperation`.
|
|
55
|
+
*/
|
|
56
|
+
export interface PackedUserOperation {
|
|
57
|
+
/** 32-byte EIP-712 hash of the user op — what {@link Signer.sign} signs. */
|
|
58
|
+
opHash: Uint8Array;
|
|
59
|
+
/** Raw EntryPoint bytes for validators that need to inspect the op. */
|
|
60
|
+
rawOp: Uint8Array;
|
|
61
|
+
}
|
|
62
|
+
/** Per-call signing context. */
|
|
63
|
+
export interface SignContext {
|
|
64
|
+
/** User-facing reason shown in the biometric prompt. */
|
|
65
|
+
promptReason?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Domain tag the signer scopes the hash with. Implementations MUST
|
|
68
|
+
* refuse to sign when this is set and the tag does not match.
|
|
69
|
+
*/
|
|
70
|
+
domainTag?: Uint8Array;
|
|
71
|
+
/** Wall-clock deadline (ms since epoch). */
|
|
72
|
+
deadlineMs?: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Opaque signature. Format is signer-specific — the matching
|
|
76
|
+
* {@link Validator} unpacks it.
|
|
77
|
+
*/
|
|
78
|
+
export interface SignerSignature {
|
|
79
|
+
/** Raw signature bytes. */
|
|
80
|
+
bytes: Uint8Array;
|
|
81
|
+
/**
|
|
82
|
+
* Ancillary data the validator needs alongside `bytes`. WebAuthn:
|
|
83
|
+
* `clientDataJSON || authenticatorData`. TEE-bound: attestation report.
|
|
84
|
+
*/
|
|
85
|
+
aux: Uint8Array;
|
|
86
|
+
}
|
|
87
|
+
export declare class SignerError extends Error {
|
|
88
|
+
readonly kind: SignerErrorKind;
|
|
89
|
+
constructor(kind: SignerErrorKind, message: string);
|
|
90
|
+
}
|
|
91
|
+
export type SignerErrorKind = "user-cancelled" | "authentication-failed" | "timeout" | "domain-tag-mismatch" | "backend-unavailable" | "transport";
|
|
92
|
+
export declare class ValidatorError extends Error {
|
|
93
|
+
readonly kind: ValidatorErrorKind;
|
|
94
|
+
constructor(kind: ValidatorErrorKind, message: string);
|
|
95
|
+
}
|
|
96
|
+
export type ValidatorErrorKind = "unsupported" | "assembly-failed";
|
|
97
|
+
/** Stable identifier for a key inside {@link KeyStorage}. */
|
|
98
|
+
export interface KeyId {
|
|
99
|
+
value: string;
|
|
100
|
+
}
|
|
101
|
+
/** What a storage backend promises about its keys. */
|
|
102
|
+
export interface StorageCapabilities {
|
|
103
|
+
/** Secret material never leaves dedicated hardware. */
|
|
104
|
+
hardwareBacked: boolean;
|
|
105
|
+
/** Every signing op forces a biometric / user-presence check. */
|
|
106
|
+
biometricGated: boolean;
|
|
107
|
+
/** Key can be exported as raw bytes. Hardware-backed keys MUST be false. */
|
|
108
|
+
exportable: boolean;
|
|
109
|
+
/** Key survives a device reboot. */
|
|
110
|
+
persistent: boolean;
|
|
111
|
+
}
|
|
112
|
+
/** Per-key policy attached at store time. */
|
|
113
|
+
export interface StoragePolicy {
|
|
114
|
+
biometricRequired?: boolean;
|
|
115
|
+
noCloudBackup?: boolean;
|
|
116
|
+
deviceBound?: boolean;
|
|
117
|
+
}
|
|
118
|
+
export declare class StorageError extends Error {
|
|
119
|
+
readonly kind: StorageErrorKind;
|
|
120
|
+
constructor(kind: StorageErrorKind, message: string);
|
|
121
|
+
}
|
|
122
|
+
export type StorageErrorKind = "not-found" | "rejected" | "unavailable";
|
|
123
|
+
/**
|
|
124
|
+
* Produces a {@link SignerSignature} over a 32-byte hash. Implementations
|
|
125
|
+
* are stateless wrt the hash — per-call state lives in
|
|
126
|
+
* {@link SignContext}.
|
|
127
|
+
*/
|
|
128
|
+
export interface Signer {
|
|
129
|
+
/** Self-describes the signer kind so callers can pick a {@link Validator}. */
|
|
130
|
+
describe(): SignerKind;
|
|
131
|
+
/** Signs `hash`. */
|
|
132
|
+
sign(hash: Uint8Array, context: SignContext): Promise<SignerSignature>;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Builds the `validatorData` blob that an ERC-7579 validator module
|
|
136
|
+
* expects in `UserOperation.signature`. Off-chain mirror of the
|
|
137
|
+
* on-chain validator the wallet has installed.
|
|
138
|
+
*/
|
|
139
|
+
export interface Validator {
|
|
140
|
+
/** Address of the on-chain ERC-7579 module. */
|
|
141
|
+
moduleAddress(): Address;
|
|
142
|
+
/** Module type — Validator/Executor/Fallback/Hook. */
|
|
143
|
+
moduleType(): Erc7579ModuleType;
|
|
144
|
+
/** Assembles the `validatorData` blob for `userOp`. */
|
|
145
|
+
buildValidatorData(userOp: PackedUserOperation): Promise<Uint8Array>;
|
|
146
|
+
}
|
|
147
|
+
/** Where secret material actually lives. */
|
|
148
|
+
export interface KeyStorage {
|
|
149
|
+
store(keyId: KeyId, blob: Uint8Array, policy: StoragePolicy): Promise<void>;
|
|
150
|
+
load(keyId: KeyId): Promise<Uint8Array>;
|
|
151
|
+
capabilities(): StorageCapabilities;
|
|
152
|
+
}
|
|
153
|
+
/** Recovery proposal carried by the social-recovery flow. */
|
|
154
|
+
export interface RecoveryProposal {
|
|
155
|
+
account: Address;
|
|
156
|
+
/** 33- or 65-byte public key for the new owner. */
|
|
157
|
+
newOwner: Uint8Array;
|
|
158
|
+
/** Opaque proposal ID — implementations choose the format. */
|
|
159
|
+
proposalId: Uint8Array;
|
|
160
|
+
}
|
|
161
|
+
/** Per-guardian signature on a {@link RecoveryProposal}. */
|
|
162
|
+
export interface GuardianSignature {
|
|
163
|
+
guardianAddress: Address;
|
|
164
|
+
signature: Uint8Array;
|
|
165
|
+
}
|
|
166
|
+
/** Hex-encoded transaction hash returned after `executeRecovery`. */
|
|
167
|
+
export interface TxHash {
|
|
168
|
+
value: string;
|
|
169
|
+
}
|
|
170
|
+
export declare class RecoveryError extends Error {
|
|
171
|
+
readonly kind: RecoveryErrorKind;
|
|
172
|
+
constructor(kind: RecoveryErrorKind, message: string);
|
|
173
|
+
}
|
|
174
|
+
export type RecoveryErrorKind = "threshold" | "invalid-signature" | "not-found" | "transport";
|
|
175
|
+
/** Social-recovery surface for the `SocialRecoveryValidator` module. */
|
|
176
|
+
export interface RecoveryGuardian {
|
|
177
|
+
proposeRecovery(account: Address, newOwner: Uint8Array): Promise<RecoveryProposal>;
|
|
178
|
+
approveRecovery(proposal: RecoveryProposal): Promise<GuardianSignature>;
|
|
179
|
+
executeRecovery(proposal: RecoveryProposal, sigs: GuardianSignature[]): Promise<TxHash>;
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=signer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,gFAAgF;AAChF,MAAM,MAAM,UA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AE,gBAAgB,EAC1B,IAAI,EAAE,iBAAiB,EAAE,GACxB,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB"}
|
package/dist/signer.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Pluggable signing surface for custom wallet developers — the
|
|
4
|
+
* TypeScript mirror of `tenzro-sdk::signer` (Rust). See
|
|
5
|
+
* `docs/SPECIFICATION.md` §15.10.2 for the full contract.
|
|
6
|
+
*
|
|
7
|
+
* The high-level surface (`createPasskeyWallet` / `signWithPasskey`)
|
|
8
|
+
* is built on these interfaces; there is no internal-only API.
|
|
9
|
+
*
|
|
10
|
+
* Why interfaces, not classes:
|
|
11
|
+
* - Custom MPC topologies, custom HSM integrations, air-gapped flows,
|
|
12
|
+
* and social-recovery topologies need to extend the surface without
|
|
13
|
+
* forking the SDK.
|
|
14
|
+
* - The SDK's defaults consume the same surface, so any feature that
|
|
15
|
+
* works for the SDK's `PasskeyWallet` works for a third-party
|
|
16
|
+
* wallet.
|
|
17
|
+
*
|
|
18
|
+
* Why this lives in the SDK and not in `tenzro-vm`:
|
|
19
|
+
* - `tenzro-vm` owns the on-chain validator modules; the SDK owns
|
|
20
|
+
* how an off-chain wallet produces the signature and the
|
|
21
|
+
* `validatorData` blob the user op carries.
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.RecoveryError = exports.StorageError = exports.ValidatorError = exports.SignerError = exports.Erc7579ModuleType = void 0;
|
|
25
|
+
/** ERC-7579 module type. Numeric values match the on-chain enum. */
|
|
26
|
+
var Erc7579ModuleType;
|
|
27
|
+
(function (Erc7579ModuleType) {
|
|
28
|
+
Erc7579ModuleType[Erc7579ModuleType["Validator"] = 1] = "Validator";
|
|
29
|
+
Erc7579ModuleType[Erc7579ModuleType["Executor"] = 2] = "Executor";
|
|
30
|
+
Erc7579ModuleType[Erc7579ModuleType["Fallback"] = 3] = "Fallback";
|
|
31
|
+
Erc7579ModuleType[Erc7579ModuleType["Hook"] = 4] = "Hook";
|
|
32
|
+
})(Erc7579ModuleType || (exports.Erc7579ModuleType = Erc7579ModuleType = {}));
|
|
33
|
+
class SignerError extends Error {
|
|
34
|
+
kind;
|
|
35
|
+
constructor(kind, message) {
|
|
36
|
+
super(message);
|
|
37
|
+
this.kind = kind;
|
|
38
|
+
this.name = "SignerError";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.SignerError = SignerError;
|
|
42
|
+
class ValidatorError extends Error {
|
|
43
|
+
kind;
|
|
44
|
+
constructor(kind, message) {
|
|
45
|
+
super(message);
|
|
46
|
+
this.kind = kind;
|
|
47
|
+
this.name = "ValidatorError";
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.ValidatorError = ValidatorError;
|
|
51
|
+
class StorageError extends Error {
|
|
52
|
+
kind;
|
|
53
|
+
constructor(kind, message) {
|
|
54
|
+
super(message);
|
|
55
|
+
this.kind = kind;
|
|
56
|
+
this.name = "StorageError";
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.StorageError = StorageError;
|
|
60
|
+
class RecoveryError extends Error {
|
|
61
|
+
kind;
|
|
62
|
+
constructor(kind, message) {
|
|
63
|
+
super(message);
|
|
64
|
+
this.kind = kind;
|
|
65
|
+
this.name = "RecoveryError";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.RecoveryError = RecoveryError;
|
|
69
|
+
//# sourceMappingURL=signer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.js","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAwBH,oEAAoE;AACpE,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B,mEAAa,CAAA;IACb,iEAAY,CAAA;IACZ,iEAAY,CAAA;IACZ,yDAAQ,CAAA;AACV,CAAC,EALW,iBAAiB,iCAAjB,iBAAiB,QAK5B;AAwCD,MAAa,WAAY,SAAQ,KAAK;IACR;IAA5B,YAA4B,IAAqB,EAAE,OAAe;QAChE,KAAK,CAAC,OAAO,CAAC,CAAC;QADW,SAAI,GAAJ,IAAI,CAAiB;QAE/C,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF;AALD,kCAKC;AAUD,MAAa,cAAe,SAAQ,KAAK;IACX;IAA5B,YAA4B,IAAwB,EAAE,OAAe;QACnE,KAAK,CAAC,OAAO,CAAC,CAAC;QADW,SAAI,GAAJ,IAAI,CAAoB;QAElD,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AALD,wCAKC;AA4BD,MAAa,YAAa,SAAQ,KAAK;IACT;IAA5B,YAA4B,IAAsB,EAAE,OAAe;QACjE,KAAK,CAAC,OAAO,CAAC,CAAC;QADW,SAAI,GAAJ,IAAI,CAAkB;QAEhD,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AALD,oCAKC;AAyDD,MAAa,aAAc,SAAQ,KAAK;IACV;IAA5B,YAA4B,IAAuB,EAAE,OAAe;QAClE,KAAK,CAAC,OAAO,CAAC,CAAC;QADW,SAAI,GAAJ,IAAI,CAAmB;QAEjD,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AALD,sCAKC"}
|
package/dist/sla.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { RpcClient } from './rpc';
|
|
2
|
+
/**
|
|
3
|
+
* Probe issued by `tenzro_slaIssueProbe`. The `challenge_nonce` is the
|
|
4
|
+
* 32-byte VRF output used to address the probe through its lifecycle.
|
|
5
|
+
*/
|
|
6
|
+
export interface SlaProbeIssued {
|
|
7
|
+
/** 0x-prefixed hex of the issuing validator's address (32 bytes). */
|
|
8
|
+
issuer: string;
|
|
9
|
+
/** DID of the provider being probed. */
|
|
10
|
+
provider_did: string;
|
|
11
|
+
/** Validator epoch the probe was issued in. */
|
|
12
|
+
epoch: number;
|
|
13
|
+
/** Probe round within the epoch. */
|
|
14
|
+
round: number;
|
|
15
|
+
/** 0x-prefixed hex of the 32-byte VRF output addressing this probe. */
|
|
16
|
+
challenge_nonce: string;
|
|
17
|
+
/** Unix-millisecond deadline by which the provider must respond. */
|
|
18
|
+
deadline_ms: number;
|
|
19
|
+
/** 0x-prefixed hex of the issuing validator's VRF public key. */
|
|
20
|
+
vrf_pubkey: string;
|
|
21
|
+
}
|
|
22
|
+
/** A single entry in the outstanding-probes reflector. */
|
|
23
|
+
export interface SlaOutstandingProbe {
|
|
24
|
+
challenge_nonce: string;
|
|
25
|
+
provider_did: string;
|
|
26
|
+
epoch: number;
|
|
27
|
+
round: number;
|
|
28
|
+
deadline_ms: number;
|
|
29
|
+
/** 0x-prefixed hex of the issuing validator's address. */
|
|
30
|
+
issuer: string;
|
|
31
|
+
}
|
|
32
|
+
/** Result of `tenzro_slaListOutstandingProbes`. */
|
|
33
|
+
export interface SlaOutstandingProbes {
|
|
34
|
+
count: number;
|
|
35
|
+
probes: SlaOutstandingProbe[];
|
|
36
|
+
}
|
|
37
|
+
/** Result of `tenzro_slaGetParams`. */
|
|
38
|
+
export interface SlaParams {
|
|
39
|
+
/** Number of missed probes before slashing fires for a provider. */
|
|
40
|
+
slash_threshold: number;
|
|
41
|
+
/** Per-crossing slash amount in wei, as a decimal string. */
|
|
42
|
+
slash_amount_wei: string;
|
|
43
|
+
/** 0x-prefixed hex of this validator's VRF public key. */
|
|
44
|
+
vrf_pubkey: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Validator-side SLA fault-detector inspection client.
|
|
48
|
+
*
|
|
49
|
+
* Wraps:
|
|
50
|
+
* - `tenzro_slaIssueProbe` — issue a VRF-bound liveness probe to a
|
|
51
|
+
* ModelProvider / TeeProvider DID and broadcast it on the
|
|
52
|
+
* `tenzro/sla` gossipsub topic. **Validator-only** — non-validator
|
|
53
|
+
* nodes return `-32000 SlaManager not initialized`.
|
|
54
|
+
* - `tenzro_slaListOutstandingProbes` — list every in-flight probe
|
|
55
|
+
* awaiting a response, regardless of who issued it. Used by
|
|
56
|
+
* operators to spot stuck probes whose deadline has already
|
|
57
|
+
* elapsed without a response.
|
|
58
|
+
* - `tenzro_slaGetParams` — read-only surface for the fault-detector
|
|
59
|
+
* parameters (`slash_threshold`, `slash_amount_wei`, this
|
|
60
|
+
* validator's VRF public key).
|
|
61
|
+
*/
|
|
62
|
+
export declare class SlaClient {
|
|
63
|
+
private readonly rpc;
|
|
64
|
+
constructor(rpc: RpcClient);
|
|
65
|
+
/**
|
|
66
|
+
* Issue a VRF-bound liveness probe to `providerDid`. Validator-only.
|
|
67
|
+
*
|
|
68
|
+
* The issuing node computes the VRF output over
|
|
69
|
+
* `(provider_did, epoch, round)`, registers the probe in its
|
|
70
|
+
* in-memory outstanding-probe map (so a fast response cannot race
|
|
71
|
+
* the insertion), and broadcasts it on the `tenzro/sla` gossipsub
|
|
72
|
+
* topic.
|
|
73
|
+
*
|
|
74
|
+
* @param providerDid - DID of the provider being probed
|
|
75
|
+
* @param epoch - Validator epoch the probe is issued in
|
|
76
|
+
* @param round - Probe round within the epoch
|
|
77
|
+
* @param deadlineMs - Unix-millisecond timestamp by which the
|
|
78
|
+
* provider must respond before the probe is considered missed
|
|
79
|
+
*/
|
|
80
|
+
issueProbe(providerDid: string, epoch: number, round: number, deadlineMs: number): Promise<SlaProbeIssued>;
|
|
81
|
+
/**
|
|
82
|
+
* List every in-flight probe awaiting a response from any provider,
|
|
83
|
+
* regardless of issuer. Used by operators to spot probes whose
|
|
84
|
+
* `deadline_ms` has already elapsed without a matching response.
|
|
85
|
+
*/
|
|
86
|
+
listOutstandingProbes(): Promise<SlaOutstandingProbes>;
|
|
87
|
+
/**
|
|
88
|
+
* Read the fault-detector parameters this validator is using.
|
|
89
|
+
* Returns the slash threshold (missed probes before slashing
|
|
90
|
+
* fires), the per-crossing slash amount in wei, and this
|
|
91
|
+
* validator's VRF public key.
|
|
92
|
+
*/
|
|
93
|
+
getParams(): Promise<SlaParams>;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=sla.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sla.d.ts","sourceRoot":"","sources":["../src/sla.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,eAAe,EAAE,MAAM,CAAC;IACxB,oEAAoE;IACpE,WAAW,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,0DAA0D;AAC1D,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,mDAAmD;AACnD,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,mBAAmB,EAAE,CAAC;CAC/B;AAED,uCAAuC;AACvC,MAAM,WAAW,SAAS;IACxB,oEAAoE;IACpE,eAAe,EAAE,MAAM,CAAC;IACxB,6DAA6D;IAC7D,gBAAgB,EAAE,MAAM,CAAC;IACzB,0DAA0D;IAC1D,UAAU,EAAE,MAAM,CAAC;CACpB;AAID;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,SAAS;IACR,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAE3C;;;;;;;;;;;;;;OAcG;IACG,UAAU,CACd,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,CAAC;IAW1B;;;;OAIG;IACG,qBAAqB,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAO5D;;;;;OAKG;IACG,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC;CAGtC"}
|
package/dist/sla.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SlaClient = void 0;
|
|
4
|
+
// ── Client ──
|
|
5
|
+
/**
|
|
6
|
+
* Validator-side SLA fault-detector inspection client.
|
|
7
|
+
*
|
|
8
|
+
* Wraps:
|
|
9
|
+
* - `tenzro_slaIssueProbe` — issue a VRF-bound liveness probe to a
|
|
10
|
+
* ModelProvider / TeeProvider DID and broadcast it on the
|
|
11
|
+
* `tenzro/sla` gossipsub topic. **Validator-only** — non-validator
|
|
12
|
+
* nodes return `-32000 SlaManager not initialized`.
|
|
13
|
+
* - `tenzro_slaListOutstandingProbes` — list every in-flight probe
|
|
14
|
+
* awaiting a response, regardless of who issued it. Used by
|
|
15
|
+
* operators to spot stuck probes whose deadline has already
|
|
16
|
+
* elapsed without a response.
|
|
17
|
+
* - `tenzro_slaGetParams` — read-only surface for the fault-detector
|
|
18
|
+
* parameters (`slash_threshold`, `slash_amount_wei`, this
|
|
19
|
+
* validator's VRF public key).
|
|
20
|
+
*/
|
|
21
|
+
class SlaClient {
|
|
22
|
+
rpc;
|
|
23
|
+
constructor(rpc) {
|
|
24
|
+
this.rpc = rpc;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Issue a VRF-bound liveness probe to `providerDid`. Validator-only.
|
|
28
|
+
*
|
|
29
|
+
* The issuing node computes the VRF output over
|
|
30
|
+
* `(provider_did, epoch, round)`, registers the probe in its
|
|
31
|
+
* in-memory outstanding-probe map (so a fast response cannot race
|
|
32
|
+
* the insertion), and broadcasts it on the `tenzro/sla` gossipsub
|
|
33
|
+
* topic.
|
|
34
|
+
*
|
|
35
|
+
* @param providerDid - DID of the provider being probed
|
|
36
|
+
* @param epoch - Validator epoch the probe is issued in
|
|
37
|
+
* @param round - Probe round within the epoch
|
|
38
|
+
* @param deadlineMs - Unix-millisecond timestamp by which the
|
|
39
|
+
* provider must respond before the probe is considered missed
|
|
40
|
+
*/
|
|
41
|
+
async issueProbe(providerDid, epoch, round, deadlineMs) {
|
|
42
|
+
return this.rpc.call('tenzro_slaIssueProbe', [
|
|
43
|
+
{
|
|
44
|
+
provider_did: providerDid,
|
|
45
|
+
epoch,
|
|
46
|
+
round,
|
|
47
|
+
deadline_ms: deadlineMs,
|
|
48
|
+
},
|
|
49
|
+
]);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* List every in-flight probe awaiting a response from any provider,
|
|
53
|
+
* regardless of issuer. Used by operators to spot probes whose
|
|
54
|
+
* `deadline_ms` has already elapsed without a matching response.
|
|
55
|
+
*/
|
|
56
|
+
async listOutstandingProbes() {
|
|
57
|
+
return this.rpc.call('tenzro_slaListOutstandingProbes', []);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Read the fault-detector parameters this validator is using.
|
|
61
|
+
* Returns the slash threshold (missed probes before slashing
|
|
62
|
+
* fires), the per-crossing slash amount in wei, and this
|
|
63
|
+
* validator's VRF public key.
|
|
64
|
+
*/
|
|
65
|
+
async getParams() {
|
|
66
|
+
return this.rpc.call('tenzro_slaGetParams', []);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.SlaClient = SlaClient;
|
|
70
|
+
//# sourceMappingURL=sla.js.map
|
package/dist/sla.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sla.js","sourceRoot":"","sources":["../src/sla.ts"],"names":[],"mappings":";;;AAoDA,eAAe;AAEf;;;;;;;;;;;;;;;GAeG;AACH,MAAa,SAAS;IACS;IAA7B,YAA6B,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAE/C;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,UAAU,CACd,WAAmB,EACnB,KAAa,EACb,KAAa,EACb,UAAkB;QAElB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAiB,sBAAsB,EAAE;YAC3D;gBACE,YAAY,EAAE,WAAW;gBACzB,KAAK;gBACL,KAAK;gBACL,WAAW,EAAE,UAAU;aACxB;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,qBAAqB;QACzB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAClB,iCAAiC,EACjC,EAAE,CACH,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,SAAS;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAY,qBAAqB,EAAE,EAAE,CAAC,CAAC;IAC7D,CAAC;CACF;AAvDD,8BAuDC"}
|