@tinycloud/node-sdk 3.6.0-beta.3 → 3.6.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/{TinyCloudNode-N4mfZI_k.d.cts → TinyCloudNode-B5WCe_ps.d.ts} +3 -250
- package/dist/{TinyCloudNode-N4mfZI_k.d.ts → TinyCloudNode-CIGurdHw.d.cts} +3 -250
- package/dist/{authority-BgZpUFss.d.cts → authority-Beg1WM2U.d.cts} +1 -1
- package/dist/{authority-C670-9su.d.ts → authority-Vh7ike0I.d.ts} +1 -1
- package/dist/core.d.cts +3 -2
- package/dist/core.d.ts +3 -2
- package/dist/credential-pending-store.cjs +401 -0
- package/dist/credential-pending-store.cjs.map +1 -0
- package/dist/credential-pending-store.d.cts +42 -0
- package/dist/credential-pending-store.d.ts +42 -0
- package/dist/credential-pending-store.js +389 -0
- package/dist/credential-pending-store.js.map +1 -0
- package/dist/credentials-core.cjs +309 -0
- package/dist/credentials-core.cjs.map +1 -0
- package/dist/credentials-core.d.cts +337 -0
- package/dist/credentials-core.d.ts +337 -0
- package/dist/credentials-core.js +294 -0
- package/dist/credentials-core.js.map +1 -0
- package/dist/credentials.cjs +746 -0
- package/dist/credentials.cjs.map +1 -0
- package/dist/credentials.d.cts +4 -0
- package/dist/credentials.d.ts +4 -0
- package/dist/credentials.js +732 -0
- package/dist/credentials.js.map +1 -0
- package/dist/delegation-0LKZkmP2.d.cts +251 -0
- package/dist/delegation-0LKZkmP2.d.ts +251 -0
- package/dist/email-proof-Blhdm4ox.d.cts +155 -0
- package/dist/email-proof-Blhdm4ox.d.ts +155 -0
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/replication/authority.d.cts +3 -2
- package/dist/replication/authority.d.ts +3 -2
- package/package.json +18 -2
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { Delegation, DelegatedResource, PermissionEntry } from '@tinycloud/sdk-core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A portable delegation that can be transported between users.
|
|
5
|
+
* Extends the base Delegation type with fields required for transport.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* PortableDelegation adds transport fields to Delegation:
|
|
9
|
+
* - `delegationHeader`: Structured authorization header for API calls
|
|
10
|
+
* - `ownerAddress`: Space owner's address for session creation
|
|
11
|
+
* - `chainId`: Chain ID for session creation
|
|
12
|
+
* - `host`: Optional server URL
|
|
13
|
+
* - `resources`: Multi-resource grant breakdown (present when the
|
|
14
|
+
* delegation was issued via the multi-resource WASM path, i.e. one
|
|
15
|
+
* UCAN covering multiple `(service, path, actions)` entries). The
|
|
16
|
+
* flat `path` + `actions` fields mirror the first entry for
|
|
17
|
+
* single-resource callers; consumers that need the full picture
|
|
18
|
+
* read `resources`.
|
|
19
|
+
*/
|
|
20
|
+
interface PortableDelegation extends Omit<Delegation, "isRevoked"> {
|
|
21
|
+
/** The authorization header for this delegation (structured format) */
|
|
22
|
+
delegationHeader: {
|
|
23
|
+
Authorization: string;
|
|
24
|
+
};
|
|
25
|
+
/** The address of the space owner */
|
|
26
|
+
ownerAddress: string;
|
|
27
|
+
/** The chain ID */
|
|
28
|
+
chainId: number;
|
|
29
|
+
/** TinyCloud server URL where this delegation was created */
|
|
30
|
+
host?: string;
|
|
31
|
+
/** Whether the recipient is prevented from creating sub-delegations */
|
|
32
|
+
disableSubDelegation?: boolean;
|
|
33
|
+
/** Companion delegation for the user's public space (auto-created when includePublicSpace is true) */
|
|
34
|
+
publicDelegation?: PortableDelegation;
|
|
35
|
+
/**
|
|
36
|
+
* Full multi-resource grant breakdown. Present when the delegation
|
|
37
|
+
* was issued via the multi-resource WASM path; each entry describes
|
|
38
|
+
* one `(service, space, path, actions)` grant carried by the single
|
|
39
|
+
* underlying UCAN. When absent, only the flat `path` + `actions`
|
|
40
|
+
* fields are authoritative (legacy single-resource shape).
|
|
41
|
+
*/
|
|
42
|
+
resources?: DelegatedResource[];
|
|
43
|
+
/**
|
|
44
|
+
* The wallet-signed SIWE message and EIP-191 signature behind a
|
|
45
|
+
* `delegationHeader` that is a CACAO session grant (OpenKey `/delegate`,
|
|
46
|
+
* {@link TinyCloudNode.grantRuntimePermissions}) rather than a compact UCAN.
|
|
47
|
+
* Not authority: activation rebuilds the CACAO from them and accepts only
|
|
48
|
+
* byte-identical authorization bytes.
|
|
49
|
+
*/
|
|
50
|
+
siweProof?: {
|
|
51
|
+
siwe: string;
|
|
52
|
+
signature: string;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The transport shape `tc auth request --emit` produces and that an owner
|
|
57
|
+
* grants to its requester. Only the fields the grant logic needs are declared;
|
|
58
|
+
* the CLI artifact carries more (posture, captured command, ...) and remains a
|
|
59
|
+
* structural superset of this interface.
|
|
60
|
+
*/
|
|
61
|
+
interface AuthRequestArtifact {
|
|
62
|
+
kind: "tinycloud.auth.request";
|
|
63
|
+
version: 1;
|
|
64
|
+
requestId: string;
|
|
65
|
+
/** The requester's session DID — the audience the grant is issued to. */
|
|
66
|
+
sessionDid: string;
|
|
67
|
+
/** The capabilities the requester is asking the owner to delegate. */
|
|
68
|
+
requested: PermissionEntry[];
|
|
69
|
+
/** Optional lifetime override carried from the request. */
|
|
70
|
+
requestedExpiry?: string | number;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The transport shape returned by {@link grantAuthRequest} (and written by
|
|
74
|
+
* `tc auth grant`). `tc auth import` accepts this artifact directly.
|
|
75
|
+
*/
|
|
76
|
+
interface AuthDelegationArtifact {
|
|
77
|
+
kind: "tinycloud.auth.delegation";
|
|
78
|
+
version: 1;
|
|
79
|
+
requestId: string;
|
|
80
|
+
delegationCid: string;
|
|
81
|
+
delegation: PortableDelegation;
|
|
82
|
+
permissions: PermissionEntry[];
|
|
83
|
+
expiry: string;
|
|
84
|
+
/** Whether issuing the delegation triggered a wallet prompt. */
|
|
85
|
+
prompted: boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Minimal owner-side capability {@link grantAuthRequest} needs: the signed
|
|
89
|
+
* `delegateTo` primitive. `TinyCloudNode` satisfies this directly; web/SDK
|
|
90
|
+
* contexts can supply any object that exposes the same method.
|
|
91
|
+
*/
|
|
92
|
+
interface DelegationAuthority {
|
|
93
|
+
delegateTo(did: string, permissions: PermissionEntry[], options?: {
|
|
94
|
+
expiry?: string | number;
|
|
95
|
+
forceWalletSign?: boolean;
|
|
96
|
+
}): Promise<{
|
|
97
|
+
delegation: PortableDelegation;
|
|
98
|
+
prompted: boolean;
|
|
99
|
+
}>;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Authority that the validated runtime-delegation activation helper needs.
|
|
103
|
+
* `TinyCloudNode` implements this surface directly; keeping it structural
|
|
104
|
+
* makes the helper usable by a compatible Node wrapper without exposing node
|
|
105
|
+
* internals.
|
|
106
|
+
*/
|
|
107
|
+
interface RuntimeDelegationActivator {
|
|
108
|
+
readonly sessionDid: string;
|
|
109
|
+
readonly did?: string;
|
|
110
|
+
readonly isSessionOnly?: boolean;
|
|
111
|
+
computeDelegationCid(authorization: string): string;
|
|
112
|
+
useRuntimeDelegation(delegation: PortableDelegation): Promise<void>;
|
|
113
|
+
useDelegation?(delegation: PortableDelegation): Promise<unknown>;
|
|
114
|
+
getRuntimePermissionDelegations(): PortableDelegation[];
|
|
115
|
+
/**
|
|
116
|
+
* Verify a wallet-signed session grant issued to this runtime's live session
|
|
117
|
+
* key. Required to activate a CACAO grant; compact UCANs do not use it.
|
|
118
|
+
*/
|
|
119
|
+
verifySessionGrant?(grant: SessionGrantProof): VerifiedSessionGrant;
|
|
120
|
+
}
|
|
121
|
+
/** The installed authority returned by {@link activateValidatedRuntimeDelegation}. */
|
|
122
|
+
interface ValidatedRuntimeDelegation {
|
|
123
|
+
/** CID recomputed from the signed authorization bytes. */
|
|
124
|
+
readonly cid: string;
|
|
125
|
+
/** The authority object installed by the node runtime. */
|
|
126
|
+
readonly delegation: PortableDelegation;
|
|
127
|
+
/** Capabilities read from the signed compact UCAN attenuation or SIWE ReCap. */
|
|
128
|
+
readonly effectivePermissions: readonly PermissionEntry[];
|
|
129
|
+
/** Expiry read from the signed compact UCAN payload or SIWE. */
|
|
130
|
+
readonly expiry: Date;
|
|
131
|
+
/** Audience read from the signed compact UCAN payload or SIWE. */
|
|
132
|
+
readonly audience: string;
|
|
133
|
+
/** Host selected for, and used by, the runtime activation. */
|
|
134
|
+
readonly host: string;
|
|
135
|
+
}
|
|
136
|
+
interface CompactRuntimeDelegationInput {
|
|
137
|
+
readonly authorization: string;
|
|
138
|
+
readonly cid: string;
|
|
139
|
+
readonly host: string;
|
|
140
|
+
readonly ownerAddress: string;
|
|
141
|
+
readonly chainId: number;
|
|
142
|
+
}
|
|
143
|
+
/** A CACAO session grant and the signed SIWE proof it was built from. */
|
|
144
|
+
interface SessionGrantProof {
|
|
145
|
+
readonly delegationHeader: {
|
|
146
|
+
Authorization: string;
|
|
147
|
+
};
|
|
148
|
+
readonly delegationCid: string;
|
|
149
|
+
readonly spaceId: string;
|
|
150
|
+
readonly address: string;
|
|
151
|
+
readonly chainId: number;
|
|
152
|
+
readonly siwe: string;
|
|
153
|
+
readonly signature: string;
|
|
154
|
+
}
|
|
155
|
+
/** Authority read from a verified session grant's signed ReCap. */
|
|
156
|
+
interface VerifiedSessionGrant {
|
|
157
|
+
readonly recap: readonly {
|
|
158
|
+
service: string;
|
|
159
|
+
space: string;
|
|
160
|
+
path: string;
|
|
161
|
+
actions: string[];
|
|
162
|
+
caveats?: Record<string, unknown>[];
|
|
163
|
+
}[];
|
|
164
|
+
readonly expiresAt: Date;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Stable reasons {@link activateValidatedRuntimeDelegation} refuses a
|
|
168
|
+
* delegation for. The error message is for the caller and may quote
|
|
169
|
+
* transport fields or a node's response; the reason is safe to publish.
|
|
170
|
+
*/
|
|
171
|
+
declare const RUNTIME_DELEGATION_REJECTIONS: readonly ["host_mismatch", "expired", "cid_mismatch", "authority_invalid", "proof_missing", "proof_invalid", "owner_mismatch", "audience_mismatch", "resources_mismatch", "unsupported", "activation_rejected", "activation_unavailable", "activation_unauthenticated"];
|
|
172
|
+
type RuntimeDelegationRejection = typeof RUNTIME_DELEGATION_REJECTIONS[number];
|
|
173
|
+
declare class RuntimeDelegationRejectedError extends Error {
|
|
174
|
+
readonly reason: RuntimeDelegationRejection;
|
|
175
|
+
constructor(reason: RuntimeDelegationRejection, message: string);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The expiry a compact UCAN authorization signs: its payload's `exp`. Reads
|
|
179
|
+
* the bytes the issuer's signature covers without verifying that signature,
|
|
180
|
+
* which the node does. `undefined` when `authorization` is not a compact UCAN
|
|
181
|
+
* or its payload has no finite numeric `exp`; then no local expiry decision
|
|
182
|
+
* can be made (activation refuses such a UCAN).
|
|
183
|
+
*/
|
|
184
|
+
declare function signedCompactUcanExpiry(authorization: string): Date | undefined;
|
|
185
|
+
/**
|
|
186
|
+
* CID-bind and activate one runtime delegation.
|
|
187
|
+
*
|
|
188
|
+
* A compact UCAN's audience, expiry and permissions come from its signed
|
|
189
|
+
* payload, and its transport fields must agree with them. A CACAO session
|
|
190
|
+
* grant (OpenKey `/delegate`, `grantRuntimePermissions`) is verified from its
|
|
191
|
+
* `siweProof` against this runtime's live session key; its installed
|
|
192
|
+
* authority is exactly the verified ReCap, and its transport `resources` are
|
|
193
|
+
* display data that is never consulted. Either way the helper then invokes
|
|
194
|
+
* {@link TinyCloudNode.useRuntimeDelegation}; the node activation call remains
|
|
195
|
+
* the authority and delegation-chain validation boundary.
|
|
196
|
+
*
|
|
197
|
+
* `options.authorize`, when given, sees the signed capabilities before
|
|
198
|
+
* anything is activated or installed; returning `false` refuses the
|
|
199
|
+
* delegation.
|
|
200
|
+
*/
|
|
201
|
+
declare function activateValidatedRuntimeDelegation(node: RuntimeDelegationActivator, delegation: PortableDelegation, options: {
|
|
202
|
+
host: string;
|
|
203
|
+
authorize?: (effectivePermissions: readonly PermissionEntry[]) => boolean;
|
|
204
|
+
}): Promise<ValidatedRuntimeDelegation>;
|
|
205
|
+
/**
|
|
206
|
+
* Import compact UCAN bytes returned by an authority ceremony through the
|
|
207
|
+
* ordinary runtime-delegation activation path. All transport projections are
|
|
208
|
+
* derived from signed bytes before `/delegate` is called.
|
|
209
|
+
*/
|
|
210
|
+
declare function activateCompactRuntimeDelegation(node: RuntimeDelegationActivator, input: CompactRuntimeDelegationInput): Promise<ValidatedRuntimeDelegation>;
|
|
211
|
+
/**
|
|
212
|
+
* Project an OpenKey signed-login delegation from the same verified CACAO
|
|
213
|
+
* authority used when the runtime activates and replays it.
|
|
214
|
+
*/
|
|
215
|
+
declare function siweRuntimeDelegation(node: RuntimeDelegationActivator, input: {
|
|
216
|
+
readonly authorization: string;
|
|
217
|
+
readonly cid: string;
|
|
218
|
+
readonly spaceId: string;
|
|
219
|
+
readonly ownerAddress: string;
|
|
220
|
+
readonly chainId: number;
|
|
221
|
+
readonly siwe: string;
|
|
222
|
+
readonly signature: string;
|
|
223
|
+
readonly host: string;
|
|
224
|
+
}): PortableDelegation;
|
|
225
|
+
/**
|
|
226
|
+
* Turn a delegation REQUEST into a signed GRANT.
|
|
227
|
+
*
|
|
228
|
+
* Lifts the body of `tc auth grant` into the SDK so the request→grant
|
|
229
|
+
* handshake is callable programmatically (future SDK/web owner tooling and the
|
|
230
|
+
* KV delegation inbox), with the CLI verb reduced to a thin wrapper. The owner
|
|
231
|
+
* `authority` (a `TinyCloudNode`) signs a delegation scoped to exactly the
|
|
232
|
+
* requested caps, audienced to the requester's `sessionDid`, honoring the
|
|
233
|
+
* request's expiry. The returned artifact round-trips through `tc auth import`.
|
|
234
|
+
*
|
|
235
|
+
* Authorization is enforced cryptographically by `delegateTo`: caps that are
|
|
236
|
+
* not derivable from the owner's own session capability chain are rejected
|
|
237
|
+
* (it throws), so this never widens authority the owner doesn't hold.
|
|
238
|
+
*/
|
|
239
|
+
declare function grantAuthRequest(authority: DelegationAuthority, request: AuthRequestArtifact, options?: {
|
|
240
|
+
expiry?: string | number;
|
|
241
|
+
}): Promise<AuthDelegationArtifact>;
|
|
242
|
+
/**
|
|
243
|
+
* Serialize a PortableDelegation for transport (e.g., over network).
|
|
244
|
+
*/
|
|
245
|
+
declare function serializeDelegation(delegation: PortableDelegation): string;
|
|
246
|
+
/**
|
|
247
|
+
* Deserialize a PortableDelegation from transport.
|
|
248
|
+
*/
|
|
249
|
+
declare function deserializeDelegation(data: string): PortableDelegation;
|
|
250
|
+
|
|
251
|
+
export { type AuthDelegationArtifact as A, type CompactRuntimeDelegationInput as C, type DelegationAuthority as D, type PortableDelegation as P, RUNTIME_DELEGATION_REJECTIONS as R, type SessionGrantProof as S, type ValidatedRuntimeDelegation as V, activateCompactRuntimeDelegation as a, type AuthRequestArtifact as b, type RuntimeDelegationActivator as c, deserializeDelegation as d, RuntimeDelegationRejectedError as e, type RuntimeDelegationRejection as f, type VerifiedSessionGrant as g, activateValidatedRuntimeDelegation as h, grantAuthRequest as i, signedCompactUcanExpiry as j, siweRuntimeDelegation as k, serializeDelegation as s };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { IssuedCredentialEnvelope, VerifiedCredential, CredentialRequirement } from '@tinycloud/sdk-core';
|
|
2
|
+
|
|
3
|
+
declare const EMAIL_PROOF_CREDENTIAL_TYPE: {
|
|
4
|
+
readonly id: "opencredentials.email/v1";
|
|
5
|
+
readonly version: 1;
|
|
6
|
+
};
|
|
7
|
+
/** A pending request is never trusted beyond this window, measured from creation. */
|
|
8
|
+
declare const EMAIL_PROOF_PENDING_MAX_MS: number;
|
|
9
|
+
type EmailProofProfileId = "tinycloud.email-proof/v1";
|
|
10
|
+
declare const DEFAULT_EMAIL_PROOF_PROFILE: EmailProofProfileId;
|
|
11
|
+
/** Which part of the two-step flow failed. */
|
|
12
|
+
type EmailProofStep = "request" | "code" | "credential" | "session";
|
|
13
|
+
/**
|
|
14
|
+
* Stable error codes. `recoverable` = the same pending request may be retried
|
|
15
|
+
* (with another code, or after the network returns) before it expires.
|
|
16
|
+
*
|
|
17
|
+
* | code | recoverable | reason |
|
|
18
|
+
* |-------------------------|-------------|--------|
|
|
19
|
+
* | ADDRESS_INVALID | false | input is malformed; the same address cannot succeed |
|
|
20
|
+
* | HOLDER_INVALID | false | holder key is not an Ed25519 did:key with a matching kid |
|
|
21
|
+
* | CODE_INVALID | true | local format check (8 digits); no network; pending kept |
|
|
22
|
+
* | RATE_LIMITED | witness | witness `recoverable` flag decides (defaults to true); retryAfterMs set |
|
|
23
|
+
* | ISSUER_UNAVAILABLE | true | transient issuer outage (503); witness flag is honoured |
|
|
24
|
+
* | NETWORK | true | transport failure or step timeout; pending kept |
|
|
25
|
+
* | PROFILE_UNAVAILABLE | false | catalog or descriptor does not match the pinned profile |
|
|
26
|
+
* | CODE_REJECTED | true | wrong code; witness flag decides whether another attempt is allowed |
|
|
27
|
+
* | CODE_ATTEMPTS_EXHAUSTED | false | witness proof-attempt budget spent; pending is dead |
|
|
28
|
+
* | SIGNATURE_REJECTED | true | holder binding rejected; same pending may be retried |
|
|
29
|
+
* | CREDENTIAL_INVALID | false | issued credential failed local verification |
|
|
30
|
+
* | SESSION_EXPIRED | false | pending window or server expiry has passed |
|
|
31
|
+
* | SESSION_INVALID | false | pending does not match holder, descriptor, or requirement |
|
|
32
|
+
* | CANCELED | false | caller aborted; pending is deleted |
|
|
33
|
+
* | FAILED | false | unclassified failure; pending is deleted |
|
|
34
|
+
*/
|
|
35
|
+
type EmailProofErrorCode = "ADDRESS_INVALID" | "HOLDER_INVALID" | "CODE_INVALID" | "RATE_LIMITED" | "ISSUER_UNAVAILABLE" | "NETWORK" | "PROFILE_UNAVAILABLE" | "CODE_REJECTED" | "CODE_ATTEMPTS_EXHAUSTED" | "SIGNATURE_REJECTED" | "CREDENTIAL_INVALID" | "SESSION_EXPIRED" | "SESSION_INVALID" | "CANCELED" | "FAILED";
|
|
36
|
+
/** Stable, redaction-safe error. The message never includes the code, verifier, or key material. */
|
|
37
|
+
declare class EmailProofError extends Error {
|
|
38
|
+
readonly name = "EmailProofError";
|
|
39
|
+
readonly step: EmailProofStep;
|
|
40
|
+
readonly code: EmailProofErrorCode;
|
|
41
|
+
readonly retryAfterMs: number | undefined;
|
|
42
|
+
readonly recoverable: boolean;
|
|
43
|
+
constructor(step: EmailProofStep, code: EmailProofErrorCode, retryAfterMs?: number, recoverable?: boolean);
|
|
44
|
+
}
|
|
45
|
+
type HolderAlgorithm = "EdDSA" | "EIP191";
|
|
46
|
+
/**
|
|
47
|
+
* Holder key adapter. `sign` MUST return a raw signature over exactly the bytes it
|
|
48
|
+
* is given: the signer does no hashing, prefixing, or domain separation. `kid` names
|
|
49
|
+
* the key the witness verifies against. `completeEmailProof` rejects with
|
|
50
|
+
* SESSION_INVALID unless `did === pending.holderDid`.
|
|
51
|
+
*/
|
|
52
|
+
interface HolderSigner {
|
|
53
|
+
readonly did: string;
|
|
54
|
+
readonly alg: HolderAlgorithm;
|
|
55
|
+
readonly kid: string;
|
|
56
|
+
readonly sign: (bytes: Uint8Array) => Promise<Uint8Array>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Ed25519 did:key holder. Accepts `did:key:z6Mk…` or `did:key:z6Mk…#<same multibase>`
|
|
60
|
+
* (the session-manager form) and normalises to the bare DID. `kid` is derived from the bare DID.
|
|
61
|
+
*/
|
|
62
|
+
declare function createEd25519HolderSigner(did: string, sign: (bytes: Uint8Array) => Promise<Uint8Array>): HolderSigner;
|
|
63
|
+
/** Options shared by the public steps. Issuer keys are never caller-supplied. */
|
|
64
|
+
interface EmailProofOptions {
|
|
65
|
+
readonly fetch?: typeof fetch;
|
|
66
|
+
readonly signal?: AbortSignal;
|
|
67
|
+
readonly now?: () => Date;
|
|
68
|
+
}
|
|
69
|
+
interface EmailProofRequestInput extends EmailProofOptions {
|
|
70
|
+
readonly address: string;
|
|
71
|
+
readonly holder: HolderSigner;
|
|
72
|
+
readonly profile?: EmailProofProfileId;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Durable state between `requestEmailProofCode` and `completeEmailProof`.
|
|
76
|
+
* `verifier` is a bearer secret. It is a non-enumerable property, so spread
|
|
77
|
+
* omits it; `toJSON` and `util.inspect` redact it. Persist it only with owner-only storage.
|
|
78
|
+
*/
|
|
79
|
+
interface EmailProofPending {
|
|
80
|
+
readonly type: "TinyCloudEmailProofPending";
|
|
81
|
+
readonly version: 1;
|
|
82
|
+
readonly profile: EmailProofProfileId;
|
|
83
|
+
readonly address: string;
|
|
84
|
+
readonly requestId: string;
|
|
85
|
+
readonly verifier: string;
|
|
86
|
+
readonly holderDid: string;
|
|
87
|
+
readonly descriptorDigest: string;
|
|
88
|
+
readonly requirementDigest: string;
|
|
89
|
+
readonly openerOrigin: string;
|
|
90
|
+
readonly createdAt: string;
|
|
91
|
+
readonly expiresAt: string;
|
|
92
|
+
}
|
|
93
|
+
/** Holds pending requests keyed by requestId. Implementations must never return an expired request from `findLive`. */
|
|
94
|
+
interface EmailProofPendingStore {
|
|
95
|
+
/** Newest unexpired request for `address`, or undefined. */
|
|
96
|
+
findLive(address: string, now: Date): Promise<EmailProofPending | undefined>;
|
|
97
|
+
put(pending: EmailProofPending): Promise<void>;
|
|
98
|
+
delete(requestId: string): Promise<void>;
|
|
99
|
+
/** Pending request by id, or undefined if absent or past its deadline. */
|
|
100
|
+
get(requestId: string, now: Date): Promise<EmailProofPending | undefined>;
|
|
101
|
+
}
|
|
102
|
+
/** Process-local pending store for browsers and tests. Nothing survives a reload. */
|
|
103
|
+
declare function createMemoryEmailProofPendingStore(): EmailProofPendingStore;
|
|
104
|
+
interface EmailProofResult {
|
|
105
|
+
readonly envelope: IssuedCredentialEnvelope;
|
|
106
|
+
readonly verified: VerifiedCredential;
|
|
107
|
+
readonly credentialId: string;
|
|
108
|
+
readonly issuedAt: string;
|
|
109
|
+
readonly expiresAt: string;
|
|
110
|
+
}
|
|
111
|
+
interface EmailProofAcquireInput extends EmailProofRequestInput {
|
|
112
|
+
/** Supplies the 8-digit code. Omit to only request one; the pending request is returned for a later call. */
|
|
113
|
+
readonly getCode?: (context: {
|
|
114
|
+
readonly pending: EmailProofPending;
|
|
115
|
+
}) => Promise<string>;
|
|
116
|
+
/** Resumes an unexpired pending request for this address, and keeps one across recoverable failures. */
|
|
117
|
+
readonly pendingStore?: EmailProofPendingStore;
|
|
118
|
+
}
|
|
119
|
+
type EmailProofAcquisition = {
|
|
120
|
+
readonly status: "issued";
|
|
121
|
+
readonly result: EmailProofResult; /** Non-fatal, e.g. the pending record could not be deleted after success. */
|
|
122
|
+
readonly warnings: readonly string[];
|
|
123
|
+
} | {
|
|
124
|
+
readonly status: "code-requested";
|
|
125
|
+
readonly pending: EmailProofPending;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Step 1: start an email-proof request. The witness sends an 8-digit code to
|
|
129
|
+
* `address`. Returns the pending state to persist until the owner supplies the code.
|
|
130
|
+
*/
|
|
131
|
+
declare function requestEmailProofCode(input: EmailProofRequestInput): Promise<EmailProofPending>;
|
|
132
|
+
/**
|
|
133
|
+
* Step 2: submit the owner's 8-digit code, sign the holder binding, issue, and
|
|
134
|
+
* verify. The caller must delete `pending` after this call, success or failure.
|
|
135
|
+
*/
|
|
136
|
+
declare function completeEmailProof(input: EmailProofOptions & {
|
|
137
|
+
readonly pending: EmailProofPending;
|
|
138
|
+
readonly code: string;
|
|
139
|
+
readonly holder: HolderSigner;
|
|
140
|
+
}): Promise<EmailProofResult>;
|
|
141
|
+
/**
|
|
142
|
+
* Request a code and, when `getCode` is given, complete the flow in one call.
|
|
143
|
+
* With a `pendingStore`, an unexpired request for the address is resumed instead of
|
|
144
|
+
* requesting a new code. A non-recoverable failure deletes the pending request.
|
|
145
|
+
*
|
|
146
|
+
* `store.put` throwing after the code was mailed: the code is in the owner's inbox but
|
|
147
|
+
* not persisted, so the error propagates and the owner must request a new code.
|
|
148
|
+
* `store.delete` failing after success: the credential is returned with a warning.
|
|
149
|
+
* `store.delete` failing on a non-recoverable failure: the original error propagates.
|
|
150
|
+
*/
|
|
151
|
+
declare function acquireEmailProof(input: EmailProofAcquireInput): Promise<EmailProofAcquisition>;
|
|
152
|
+
/** Requirement for an email credential issued to `address` under the default profile. Storage and `show` key on its digest. */
|
|
153
|
+
declare function emailProofRequirement(address: string): CredentialRequirement;
|
|
154
|
+
|
|
155
|
+
export { DEFAULT_EMAIL_PROOF_PROFILE as D, EMAIL_PROOF_CREDENTIAL_TYPE as E, type HolderAlgorithm as H, EMAIL_PROOF_PENDING_MAX_MS as a, type EmailProofAcquireInput as b, type EmailProofAcquisition as c, EmailProofError as d, type EmailProofErrorCode as e, type EmailProofOptions as f, type EmailProofPending as g, type EmailProofPendingStore as h, type EmailProofProfileId as i, type EmailProofRequestInput as j, type EmailProofResult as k, type EmailProofStep as l, type HolderSigner as m, acquireEmailProof as n, completeEmailProof as o, createEd25519HolderSigner as p, createMemoryEmailProofPendingStore as q, emailProofRequirement as r, requestEmailProofCode as s };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { IssuedCredentialEnvelope, VerifiedCredential, CredentialRequirement } from '@tinycloud/sdk-core';
|
|
2
|
+
|
|
3
|
+
declare const EMAIL_PROOF_CREDENTIAL_TYPE: {
|
|
4
|
+
readonly id: "opencredentials.email/v1";
|
|
5
|
+
readonly version: 1;
|
|
6
|
+
};
|
|
7
|
+
/** A pending request is never trusted beyond this window, measured from creation. */
|
|
8
|
+
declare const EMAIL_PROOF_PENDING_MAX_MS: number;
|
|
9
|
+
type EmailProofProfileId = "tinycloud.email-proof/v1";
|
|
10
|
+
declare const DEFAULT_EMAIL_PROOF_PROFILE: EmailProofProfileId;
|
|
11
|
+
/** Which part of the two-step flow failed. */
|
|
12
|
+
type EmailProofStep = "request" | "code" | "credential" | "session";
|
|
13
|
+
/**
|
|
14
|
+
* Stable error codes. `recoverable` = the same pending request may be retried
|
|
15
|
+
* (with another code, or after the network returns) before it expires.
|
|
16
|
+
*
|
|
17
|
+
* | code | recoverable | reason |
|
|
18
|
+
* |-------------------------|-------------|--------|
|
|
19
|
+
* | ADDRESS_INVALID | false | input is malformed; the same address cannot succeed |
|
|
20
|
+
* | HOLDER_INVALID | false | holder key is not an Ed25519 did:key with a matching kid |
|
|
21
|
+
* | CODE_INVALID | true | local format check (8 digits); no network; pending kept |
|
|
22
|
+
* | RATE_LIMITED | witness | witness `recoverable` flag decides (defaults to true); retryAfterMs set |
|
|
23
|
+
* | ISSUER_UNAVAILABLE | true | transient issuer outage (503); witness flag is honoured |
|
|
24
|
+
* | NETWORK | true | transport failure or step timeout; pending kept |
|
|
25
|
+
* | PROFILE_UNAVAILABLE | false | catalog or descriptor does not match the pinned profile |
|
|
26
|
+
* | CODE_REJECTED | true | wrong code; witness flag decides whether another attempt is allowed |
|
|
27
|
+
* | CODE_ATTEMPTS_EXHAUSTED | false | witness proof-attempt budget spent; pending is dead |
|
|
28
|
+
* | SIGNATURE_REJECTED | true | holder binding rejected; same pending may be retried |
|
|
29
|
+
* | CREDENTIAL_INVALID | false | issued credential failed local verification |
|
|
30
|
+
* | SESSION_EXPIRED | false | pending window or server expiry has passed |
|
|
31
|
+
* | SESSION_INVALID | false | pending does not match holder, descriptor, or requirement |
|
|
32
|
+
* | CANCELED | false | caller aborted; pending is deleted |
|
|
33
|
+
* | FAILED | false | unclassified failure; pending is deleted |
|
|
34
|
+
*/
|
|
35
|
+
type EmailProofErrorCode = "ADDRESS_INVALID" | "HOLDER_INVALID" | "CODE_INVALID" | "RATE_LIMITED" | "ISSUER_UNAVAILABLE" | "NETWORK" | "PROFILE_UNAVAILABLE" | "CODE_REJECTED" | "CODE_ATTEMPTS_EXHAUSTED" | "SIGNATURE_REJECTED" | "CREDENTIAL_INVALID" | "SESSION_EXPIRED" | "SESSION_INVALID" | "CANCELED" | "FAILED";
|
|
36
|
+
/** Stable, redaction-safe error. The message never includes the code, verifier, or key material. */
|
|
37
|
+
declare class EmailProofError extends Error {
|
|
38
|
+
readonly name = "EmailProofError";
|
|
39
|
+
readonly step: EmailProofStep;
|
|
40
|
+
readonly code: EmailProofErrorCode;
|
|
41
|
+
readonly retryAfterMs: number | undefined;
|
|
42
|
+
readonly recoverable: boolean;
|
|
43
|
+
constructor(step: EmailProofStep, code: EmailProofErrorCode, retryAfterMs?: number, recoverable?: boolean);
|
|
44
|
+
}
|
|
45
|
+
type HolderAlgorithm = "EdDSA" | "EIP191";
|
|
46
|
+
/**
|
|
47
|
+
* Holder key adapter. `sign` MUST return a raw signature over exactly the bytes it
|
|
48
|
+
* is given: the signer does no hashing, prefixing, or domain separation. `kid` names
|
|
49
|
+
* the key the witness verifies against. `completeEmailProof` rejects with
|
|
50
|
+
* SESSION_INVALID unless `did === pending.holderDid`.
|
|
51
|
+
*/
|
|
52
|
+
interface HolderSigner {
|
|
53
|
+
readonly did: string;
|
|
54
|
+
readonly alg: HolderAlgorithm;
|
|
55
|
+
readonly kid: string;
|
|
56
|
+
readonly sign: (bytes: Uint8Array) => Promise<Uint8Array>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Ed25519 did:key holder. Accepts `did:key:z6Mk…` or `did:key:z6Mk…#<same multibase>`
|
|
60
|
+
* (the session-manager form) and normalises to the bare DID. `kid` is derived from the bare DID.
|
|
61
|
+
*/
|
|
62
|
+
declare function createEd25519HolderSigner(did: string, sign: (bytes: Uint8Array) => Promise<Uint8Array>): HolderSigner;
|
|
63
|
+
/** Options shared by the public steps. Issuer keys are never caller-supplied. */
|
|
64
|
+
interface EmailProofOptions {
|
|
65
|
+
readonly fetch?: typeof fetch;
|
|
66
|
+
readonly signal?: AbortSignal;
|
|
67
|
+
readonly now?: () => Date;
|
|
68
|
+
}
|
|
69
|
+
interface EmailProofRequestInput extends EmailProofOptions {
|
|
70
|
+
readonly address: string;
|
|
71
|
+
readonly holder: HolderSigner;
|
|
72
|
+
readonly profile?: EmailProofProfileId;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Durable state between `requestEmailProofCode` and `completeEmailProof`.
|
|
76
|
+
* `verifier` is a bearer secret. It is a non-enumerable property, so spread
|
|
77
|
+
* omits it; `toJSON` and `util.inspect` redact it. Persist it only with owner-only storage.
|
|
78
|
+
*/
|
|
79
|
+
interface EmailProofPending {
|
|
80
|
+
readonly type: "TinyCloudEmailProofPending";
|
|
81
|
+
readonly version: 1;
|
|
82
|
+
readonly profile: EmailProofProfileId;
|
|
83
|
+
readonly address: string;
|
|
84
|
+
readonly requestId: string;
|
|
85
|
+
readonly verifier: string;
|
|
86
|
+
readonly holderDid: string;
|
|
87
|
+
readonly descriptorDigest: string;
|
|
88
|
+
readonly requirementDigest: string;
|
|
89
|
+
readonly openerOrigin: string;
|
|
90
|
+
readonly createdAt: string;
|
|
91
|
+
readonly expiresAt: string;
|
|
92
|
+
}
|
|
93
|
+
/** Holds pending requests keyed by requestId. Implementations must never return an expired request from `findLive`. */
|
|
94
|
+
interface EmailProofPendingStore {
|
|
95
|
+
/** Newest unexpired request for `address`, or undefined. */
|
|
96
|
+
findLive(address: string, now: Date): Promise<EmailProofPending | undefined>;
|
|
97
|
+
put(pending: EmailProofPending): Promise<void>;
|
|
98
|
+
delete(requestId: string): Promise<void>;
|
|
99
|
+
/** Pending request by id, or undefined if absent or past its deadline. */
|
|
100
|
+
get(requestId: string, now: Date): Promise<EmailProofPending | undefined>;
|
|
101
|
+
}
|
|
102
|
+
/** Process-local pending store for browsers and tests. Nothing survives a reload. */
|
|
103
|
+
declare function createMemoryEmailProofPendingStore(): EmailProofPendingStore;
|
|
104
|
+
interface EmailProofResult {
|
|
105
|
+
readonly envelope: IssuedCredentialEnvelope;
|
|
106
|
+
readonly verified: VerifiedCredential;
|
|
107
|
+
readonly credentialId: string;
|
|
108
|
+
readonly issuedAt: string;
|
|
109
|
+
readonly expiresAt: string;
|
|
110
|
+
}
|
|
111
|
+
interface EmailProofAcquireInput extends EmailProofRequestInput {
|
|
112
|
+
/** Supplies the 8-digit code. Omit to only request one; the pending request is returned for a later call. */
|
|
113
|
+
readonly getCode?: (context: {
|
|
114
|
+
readonly pending: EmailProofPending;
|
|
115
|
+
}) => Promise<string>;
|
|
116
|
+
/** Resumes an unexpired pending request for this address, and keeps one across recoverable failures. */
|
|
117
|
+
readonly pendingStore?: EmailProofPendingStore;
|
|
118
|
+
}
|
|
119
|
+
type EmailProofAcquisition = {
|
|
120
|
+
readonly status: "issued";
|
|
121
|
+
readonly result: EmailProofResult; /** Non-fatal, e.g. the pending record could not be deleted after success. */
|
|
122
|
+
readonly warnings: readonly string[];
|
|
123
|
+
} | {
|
|
124
|
+
readonly status: "code-requested";
|
|
125
|
+
readonly pending: EmailProofPending;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Step 1: start an email-proof request. The witness sends an 8-digit code to
|
|
129
|
+
* `address`. Returns the pending state to persist until the owner supplies the code.
|
|
130
|
+
*/
|
|
131
|
+
declare function requestEmailProofCode(input: EmailProofRequestInput): Promise<EmailProofPending>;
|
|
132
|
+
/**
|
|
133
|
+
* Step 2: submit the owner's 8-digit code, sign the holder binding, issue, and
|
|
134
|
+
* verify. The caller must delete `pending` after this call, success or failure.
|
|
135
|
+
*/
|
|
136
|
+
declare function completeEmailProof(input: EmailProofOptions & {
|
|
137
|
+
readonly pending: EmailProofPending;
|
|
138
|
+
readonly code: string;
|
|
139
|
+
readonly holder: HolderSigner;
|
|
140
|
+
}): Promise<EmailProofResult>;
|
|
141
|
+
/**
|
|
142
|
+
* Request a code and, when `getCode` is given, complete the flow in one call.
|
|
143
|
+
* With a `pendingStore`, an unexpired request for the address is resumed instead of
|
|
144
|
+
* requesting a new code. A non-recoverable failure deletes the pending request.
|
|
145
|
+
*
|
|
146
|
+
* `store.put` throwing after the code was mailed: the code is in the owner's inbox but
|
|
147
|
+
* not persisted, so the error propagates and the owner must request a new code.
|
|
148
|
+
* `store.delete` failing after success: the credential is returned with a warning.
|
|
149
|
+
* `store.delete` failing on a non-recoverable failure: the original error propagates.
|
|
150
|
+
*/
|
|
151
|
+
declare function acquireEmailProof(input: EmailProofAcquireInput): Promise<EmailProofAcquisition>;
|
|
152
|
+
/** Requirement for an email credential issued to `address` under the default profile. Storage and `show` key on its digest. */
|
|
153
|
+
declare function emailProofRequirement(address: string): CredentialRequirement;
|
|
154
|
+
|
|
155
|
+
export { DEFAULT_EMAIL_PROOF_PROFILE as D, EMAIL_PROOF_CREDENTIAL_TYPE as E, type HolderAlgorithm as H, EMAIL_PROOF_PENDING_MAX_MS as a, type EmailProofAcquireInput as b, type EmailProofAcquisition as c, EmailProofError as d, type EmailProofErrorCode as e, type EmailProofOptions as f, type EmailProofPending as g, type EmailProofPendingStore as h, type EmailProofProfileId as i, type EmailProofRequestInput as j, type EmailProofResult as k, type EmailProofStep as l, type HolderSigner as m, acquireEmailProof as n, completeEmailProof as o, createEd25519HolderSigner as p, createMemoryEmailProofPendingStore as q, emailProofRequirement as r, requestEmailProofCode as s };
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ISigner, Bytes, IWasmBindings, PersistedSessionProof, ISessionManager } from '@tinycloud/sdk-core';
|
|
2
2
|
export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationPage, AccountDelegationQueryOptions, AccountDelegationRecord, AccountDelegationResource, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AuthorityRefusal, AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CallbackStrategy, CanonicalAddress, CanonicalDecryptRequest, CanonicalJson, CanonicalParsedNetworkId, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, CaveatedDelegationUnsupportedError, ClientSession, ColumnInfo, ComposeManifestOptions, ComposedManifestRequest, CreateDelegationParams, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DataVaultConfig, DataVaultService, DatabaseHandle, DecryptCapabilityProof, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, DecryptTransportResponseError, DelegateReceivedShareParams, DelegatedShareAccess, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DelegationRevocationReceipt, DidCacheKeyOptions, DidEqualsOptions, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ENCRYPTION_NETWORK_URN_PREFIX, ENCRYPTION_SERVICE, ENCRYPTION_SERVICE_SHORT, ENVELOPE_VERSION, EncodedShareData, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IENSResolver, IEncryptionService, IHooksService, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISecretsService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IStorageService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InlineEncryptedEnvelope, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVListPage, KVReadThrough, KVReplicaHandle, KVReplicaSpec, KVReplicaStorage, KVReplicationController, KVReplicationDeps, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, LocalGetResult, LocalListResult, LocalReadMeta, LocalReplicaStatus, LocalSyncResult, MAX_SECRET_SCOPE_LENGTH, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, OwnerDelegationPermission, ParsedNetworkId, ParsedSecretCatalogKey, PendingWriteRecord, PendingWriteState, PendingWriteStore, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PinnedKey, PkhDidParts, PrefixedKVService, ProtocolMismatchError, PurgeTarget, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiveOptions, ReceiverKeyPair, ReceiverKeySigner, RegisterBatchSuccess, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ReplicaAuthorityState, ReplicaCoverage, ReplicaDevice, ReplicaGatedHandle, ReplicaGrantInfo, ReplicaInspectedStatus, ReplicaState, ReplicaStatusEntry, ReplicationAuthority, ReplicationControl, ReplicationEvent, ReplicationIdentity, ReplicationOptions, ReplicationPurgeReport, ReplicationReason, ReplicationScheduler, ResolvedCapabilities, ResolvedDelegate, ResolvedReplicationOptions, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SECRET_SCOPE_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, STORAGE_FULL_MESSAGE, STORAGE_MANAGE_URL, STORAGE_WRITE_TOO_LARGE_MESSAGE, SchemaInfo, SecretCatalogEntry, SecretPayload, SecretPutOptions, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceSession, SessionExpiredError, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignInOptions, SignRequest, SignResponse, SignedReceiverKeyInput, SilentNotificationHandler, Space, SpaceAbilitiesMap, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StorageAccountUsage, StorageFullEvent, StorageStatus, StorageStatusOptions, StorageUsage, StorageUsageState, StoredDelegationChain, SubscribeOptions, TC832_RESERVED_SCOPES, TableInfo, TelemetryConfig, TelemetryEventHandler, TinyCloud, TinyCloudConfig, TinyCloudDebugEnableOptions, TinyCloudDebugEvent, TinyCloudDebugLevel, TinyCloudDebugLogger, TinyCloudDebugTimer, TinyCloudSession, UnsupportedFeatureError, VAULT_PERMISSION_SERVICE, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultNetworkReadResult, VaultPublicSpaceKVActions, VaultPutOptions, VerifyDecryptResponseInput, VersionCheckError, ViewInfo, WasmVaultFunctions, WellKnownDescriptorFetcher, addressStorageKey, appSecretScope, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, buildSpaceUri, canonicalHashHex, canonicalSignedResponse, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeEncryptionJson, canonicalizeNetworkId, canonicalizeSecretScope, checkDecryptInvocationInput, checkNodeInfo, clearTinyCloudDebugLogs, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, createVaultCrypto, decryptEnvelopeWithKey, defaultSpaceCreationHandler, deriveSignedReceiverKey, didCacheKey, didEquals, disableTinyCloudDebug, discoverNetwork, enableTinyCloudDebug, encryptToNetwork, encryptionBase64Decode, encryptionBase64Encode, encryptionError, encryptionUtf8Decode, encryptionUtf8Encode, ensureNetworkUsableForDecrypt, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, generateRandomReceiverKey, getTinyCloudDebugLogs, hexDecode, hexEncode, installTinyCloudDebugGlobals, isCapabilitySubset, isEvmAddress, isNetworkId, isStorageFullError, loadManifest, makePkhSpaceId, makePublicSpaceId, networkDiscoveryKey, openWrappedKey, parseCanonicalNetworkId, parseExpiry, parseNetworkId, parsePkhDid, parseSecretCatalogKey, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, storageUsageState, tinyCloudDebugLogger, validateEnvelope, validateManifest, verifyDecryptResponse } from '@tinycloud/sdk-core';
|
|
3
3
|
export { F as FileSessionStorage, M as MemorySessionStorage, W as WasmKeyProvider, a as WasmKeyProviderConfig, c as createWasmKeyProvider } from './WasmKeyProvider-5Ee7fcAw.cjs';
|
|
4
|
-
export { A as ACCEPTED_MARKER_VERSIONS,
|
|
4
|
+
export { A as ACCEPTED_MARKER_VERSIONS, l as BOOTSTRAP_COMPLETION_MARKER_KEY, m as BOOTSTRAP_COMPLETION_MARKER_VERSION, n as BootstrapCompletionMarker, B as BootstrapWarning, C as CreateOwnerDelegationParams, D as DelegateToOptions, a as DelegateToResult, b as DelegatedAccess, E as EnsureEncryptionNetworkOptions, I as InvalidRestoredSessionError, N as NodeEventEmitterStrategy, c as NodeUserAuthorization, o as NodeUserAuthorizationAuthorizeFn, d as NodeUserAuthorizationConfig, p as OpenKeyAuthorizationResultV1, q as OpenKeyAuthorizeInput, r as OpenKeyAuthorizeTinyCloud, s as OpenKeyBridgeInput, O as OwnerDelegationReceipt, t as RestorableSession, R as RuntimePermissionGrantOptions, S as SecretPermissionHint, e as SecretReadInput, f as SecretReadResult, g as SignStrategy, T as TinyCloudNode, h as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, i as UnifiedOwnerRootReceipt, j as UnsupportedSessionRestoreError, k as defaultSignStrategy, w as wireOpenKeyAuthorize } from './TinyCloudNode-CIGurdHw.cjs';
|
|
5
5
|
import { invoke, invokeAny, computeCid, prepareSession, completeSessionSetup, ensureEip55, makeSpaceId, createDelegation, parseRecapFromSiwe, parseVerifiedRecapFromSiwe, generateHostSIWEMessage, siweToDelegationHeaders, protocolVersion, vault_encrypt, vault_decrypt, vault_derive_key, vault_x25519_from_seed, vault_x25519_dh, vault_random_bytes, vault_sha256 } from '@tinycloud/node-sdk-wasm';
|
|
6
|
+
export { A as AuthDelegationArtifact, b as AuthRequestArtifact, C as CompactRuntimeDelegationInput, D as DelegationAuthority, P as PortableDelegation, R as RUNTIME_DELEGATION_REJECTIONS, c as RuntimeDelegationActivator, e as RuntimeDelegationRejectedError, f as RuntimeDelegationRejection, S as SessionGrantProof, V as ValidatedRuntimeDelegation, g as VerifiedSessionGrant, a as activateCompactRuntimeDelegation, h as activateValidatedRuntimeDelegation, d as deserializeDelegation, i as grantAuthRequest, s as serializeDelegation, j as signedCompactUcanExpiry, k as siweRuntimeDelegation } from './delegation-0LKZkmP2.cjs';
|
|
6
7
|
import { KVReplicaStorage } from '@tinycloud/sdk-services';
|
|
7
8
|
import { ProfileReplicaPurge } from '@tinycloud/sdk-services/kv/replication';
|
|
8
9
|
export { ProfileReplicaDeferredToken, ProfileReplicaPurge } from '@tinycloud/sdk-services/kv/replication';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ISigner, Bytes, IWasmBindings, PersistedSessionProof, ISessionManager } from '@tinycloud/sdk-core';
|
|
2
2
|
export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationPage, AccountDelegationQueryOptions, AccountDelegationRecord, AccountDelegationResource, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AuthorityRefusal, AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, BuildCanonicalDecryptRequestInput, BuildDecryptFactsInput, BuildDecryptInvocationInput, BuiltDecryptInvocation, CallbackStrategy, CanonicalAddress, CanonicalDecryptRequest, CanonicalJson, CanonicalParsedNetworkId, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, CaveatedDelegationUnsupportedError, ClientSession, ColumnInfo, ComposeManifestOptions, ComposedManifestRequest, CreateDelegationParams, DECRYPT_ACTION, DECRYPT_FACT_TYPE, DECRYPT_RESULT_TYPE, DEFAULT_ENCRYPTION_ALG, DEFAULT_KEY_VERSION, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DataVaultConfig, DataVaultService, DatabaseHandle, DecryptCapabilityProof, DecryptEnvelopeOptions, DecryptInvocationFact, DecryptInvocationSigner, DecryptRequestBody, DecryptResponseBody, DecryptTransport, DecryptTransportResponseError, DelegateReceivedShareParams, DelegatedShareAccess, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DelegationRevocationReceipt, DidCacheKeyOptions, DidEqualsOptions, DiscoverNetworkInput, DiscoveredNetwork, DiscoverySource, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, ENCRYPTION_NETWORK_URN_PREFIX, ENCRYPTION_SERVICE, ENCRYPTION_SERVICE_SHORT, ENVELOPE_VERSION, EncodedShareData, EncryptToNetworkInput, EncryptToNetworkOptions, EncryptToNetworkResult, EncryptionCrypto, EncryptionError, EncryptionErrorInput, EncryptionService, EncryptionServiceConfig, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, HookEvent, HookServiceName, HookStreamEvent, HookSubscription, HookWebhookListOptions, HookWebhookRecord, HookWebhookRegistration, HookWebhookScope, HookWebhookUnregisterOptions, HooksService, HooksServiceConfig, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IENSResolver, IEncryptionService, IHooksService, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISecretsService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IStorageService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InlineEncryptedEnvelope, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVListPage, KVReadThrough, KVReplicaHandle, KVReplicaSpec, KVReplicaStorage, KVReplicationController, KVReplicationDeps, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, LocalGetResult, LocalListResult, LocalReadMeta, LocalReplicaStatus, LocalSyncResult, MAX_SECRET_SCOPE_LENGTH, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, NETWORK_NAME_PATTERN, NetworkDescriptor, NetworkIdError, NodeDescriptorFetcher, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, OwnerDelegationPermission, ParsedNetworkId, ParsedSecretCatalogKey, PendingWriteRecord, PendingWriteState, PendingWriteStore, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PinnedKey, PkhDidParts, PrefixedKVService, ProtocolMismatchError, PurgeTarget, QueryOptions, QueryResponse, RandomReceiverKeyInput, ReceiveOptions, ReceiverKeyPair, ReceiverKeySigner, RegisterBatchSuccess, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ReplicaAuthorityState, ReplicaCoverage, ReplicaDevice, ReplicaGatedHandle, ReplicaGrantInfo, ReplicaInspectedStatus, ReplicaState, ReplicaStatusEntry, ReplicationAuthority, ReplicationControl, ReplicationEvent, ReplicationIdentity, ReplicationOptions, ReplicationPurgeReport, ReplicationReason, ReplicationScheduler, ResolvedCapabilities, ResolvedDelegate, ResolvedReplicationOptions, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SECRET_SCOPE_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, STORAGE_FULL_MESSAGE, STORAGE_MANAGE_URL, STORAGE_WRITE_TOO_LARGE_MESSAGE, SchemaInfo, SecretCatalogEntry, SecretPayload, SecretPutOptions, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceSession, SessionExpiredError, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignInOptions, SignRequest, SignResponse, SignedReceiverKeyInput, SilentNotificationHandler, Space, SpaceAbilitiesMap, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StorageAccountUsage, StorageFullEvent, StorageStatus, StorageStatusOptions, StorageUsage, StorageUsageState, StoredDelegationChain, SubscribeOptions, TC832_RESERVED_SCOPES, TableInfo, TelemetryConfig, TelemetryEventHandler, TinyCloud, TinyCloudConfig, TinyCloudDebugEnableOptions, TinyCloudDebugEvent, TinyCloudDebugLevel, TinyCloudDebugLogger, TinyCloudDebugTimer, TinyCloudSession, UnsupportedFeatureError, VAULT_PERMISSION_SERVICE, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultNetworkReadResult, VaultPublicSpaceKVActions, VaultPutOptions, VerifyDecryptResponseInput, VersionCheckError, ViewInfo, WasmVaultFunctions, WellKnownDescriptorFetcher, addressStorageKey, appSecretScope, buildCanonicalDecryptRequest, buildDecryptAttenuation, buildDecryptFacts, buildDecryptInvocation, buildNetworkId, buildSpaceUri, canonicalHashHex, canonicalSignedResponse, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeEncryptionJson, canonicalizeNetworkId, canonicalizeSecretScope, checkDecryptInvocationInput, checkNodeInfo, clearTinyCloudDebugLogs, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, createVaultCrypto, decryptEnvelopeWithKey, defaultSpaceCreationHandler, deriveSignedReceiverKey, didCacheKey, didEquals, disableTinyCloudDebug, discoverNetwork, enableTinyCloudDebug, encryptToNetwork, encryptionBase64Decode, encryptionBase64Encode, encryptionError, encryptionUtf8Decode, encryptionUtf8Encode, ensureNetworkUsableForDecrypt, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, generateRandomReceiverKey, getTinyCloudDebugLogs, hexDecode, hexEncode, installTinyCloudDebugGlobals, isCapabilitySubset, isEvmAddress, isNetworkId, isStorageFullError, loadManifest, makePkhSpaceId, makePublicSpaceId, networkDiscoveryKey, openWrappedKey, parseCanonicalNetworkId, parseExpiry, parseNetworkId, parsePkhDid, parseSecretCatalogKey, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, storageUsageState, tinyCloudDebugLogger, validateEnvelope, validateManifest, verifyDecryptResponse } from '@tinycloud/sdk-core';
|
|
3
3
|
export { F as FileSessionStorage, M as MemorySessionStorage, W as WasmKeyProvider, a as WasmKeyProviderConfig, c as createWasmKeyProvider } from './WasmKeyProvider-5Ee7fcAw.js';
|
|
4
|
-
export { A as ACCEPTED_MARKER_VERSIONS,
|
|
4
|
+
export { A as ACCEPTED_MARKER_VERSIONS, l as BOOTSTRAP_COMPLETION_MARKER_KEY, m as BOOTSTRAP_COMPLETION_MARKER_VERSION, n as BootstrapCompletionMarker, B as BootstrapWarning, C as CreateOwnerDelegationParams, D as DelegateToOptions, a as DelegateToResult, b as DelegatedAccess, E as EnsureEncryptionNetworkOptions, I as InvalidRestoredSessionError, N as NodeEventEmitterStrategy, c as NodeUserAuthorization, o as NodeUserAuthorizationAuthorizeFn, d as NodeUserAuthorizationConfig, p as OpenKeyAuthorizationResultV1, q as OpenKeyAuthorizeInput, r as OpenKeyAuthorizeTinyCloud, s as OpenKeyBridgeInput, O as OwnerDelegationReceipt, t as RestorableSession, R as RuntimePermissionGrantOptions, S as SecretPermissionHint, e as SecretReadInput, f as SecretReadResult, g as SignStrategy, T as TinyCloudNode, h as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, i as UnifiedOwnerRootReceipt, j as UnsupportedSessionRestoreError, k as defaultSignStrategy, w as wireOpenKeyAuthorize } from './TinyCloudNode-B5WCe_ps.js';
|
|
5
5
|
import { invoke, invokeAny, computeCid, prepareSession, completeSessionSetup, ensureEip55, makeSpaceId, createDelegation, parseRecapFromSiwe, parseVerifiedRecapFromSiwe, generateHostSIWEMessage, siweToDelegationHeaders, protocolVersion, vault_encrypt, vault_decrypt, vault_derive_key, vault_x25519_from_seed, vault_x25519_dh, vault_random_bytes, vault_sha256 } from '@tinycloud/node-sdk-wasm';
|
|
6
|
+
export { A as AuthDelegationArtifact, b as AuthRequestArtifact, C as CompactRuntimeDelegationInput, D as DelegationAuthority, P as PortableDelegation, R as RUNTIME_DELEGATION_REJECTIONS, c as RuntimeDelegationActivator, e as RuntimeDelegationRejectedError, f as RuntimeDelegationRejection, S as SessionGrantProof, V as ValidatedRuntimeDelegation, g as VerifiedSessionGrant, a as activateCompactRuntimeDelegation, h as activateValidatedRuntimeDelegation, d as deserializeDelegation, i as grantAuthRequest, s as serializeDelegation, j as signedCompactUcanExpiry, k as siweRuntimeDelegation } from './delegation-0LKZkmP2.js';
|
|
6
7
|
import { KVReplicaStorage } from '@tinycloud/sdk-services';
|
|
7
8
|
import { ProfileReplicaPurge } from '@tinycloud/sdk-services/kv/replication';
|
|
8
9
|
export { ProfileReplicaDeferredToken, ProfileReplicaPurge } from '@tinycloud/sdk-services/kv/replication';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '@tinycloud/sdk-core';
|
|
2
2
|
import '@tinycloud/sdk-services';
|
|
3
3
|
import '@tinycloud/sdk-services/kv/replication';
|
|
4
|
-
import '../TinyCloudNode-
|
|
5
|
-
export { A as AUTHORITY_EXPIRY_MARGIN_MS, D as DelegationPlanResult, R as ReplicationAuthorityHost, a as ReplicationAuthoritySession, b as assertRenewalParent, c as assertValidReplicationConfig, d as augmentSignInEntriesWithReplication, e as createReplicationAuthority, f as establishReplicaSessionStamp, h as hasUnrestrictedGetCoverage, m as mintNodeReplicationGrant, r as replicationScopeFromSignedSession, g as reportReplicaDenial, i as restoreReplicaSessionStamp, u as ucanAttCovers, j as ucanAttUnconstrainedFor, v as verifiedOwnerConsentAnchor } from '../authority-
|
|
4
|
+
import '../TinyCloudNode-CIGurdHw.cjs';
|
|
5
|
+
export { A as AUTHORITY_EXPIRY_MARGIN_MS, D as DelegationPlanResult, R as ReplicationAuthorityHost, a as ReplicationAuthoritySession, b as assertRenewalParent, c as assertValidReplicationConfig, d as augmentSignInEntriesWithReplication, e as createReplicationAuthority, f as establishReplicaSessionStamp, h as hasUnrestrictedGetCoverage, m as mintNodeReplicationGrant, r as replicationScopeFromSignedSession, g as reportReplicaDenial, i as restoreReplicaSessionStamp, u as ucanAttCovers, j as ucanAttUnconstrainedFor, v as verifiedOwnerConsentAnchor } from '../authority-Beg1WM2U.cjs';
|
|
6
6
|
import 'events';
|
|
7
|
+
import '../delegation-0LKZkmP2.cjs';
|