@tinycloud/web-sdk 3.0.0-beta.8 → 3.0.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/dist/credentials/element.d.ts +30 -1
- package/dist/credentials/interpreter.d.ts +3 -1
- package/dist/credentials/transport.d.ts +1 -0
- package/dist/credentials/types.d.ts +39 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/modules/Storage/tinycloud/types.schema.d.ts +2 -2
- package/dist/modules/tcw.d.ts +14 -5
- package/dist/share/service.d.ts +22 -22
- package/dist/share/types.d.ts +50 -0
- package/package.json +5 -5
|
@@ -1,23 +1,50 @@
|
|
|
1
1
|
import { type CredentialFlowDescriptor } from "@tinycloud/sdk-core";
|
|
2
|
-
import type { CredentialAcquisitionTheme, CredentialInteractionSurface, InlineCredentialProofRequest, PrimitiveStepResult } from "./types";
|
|
2
|
+
import type { CredentialAcquisitionTheme, CredentialInputRequest, CredentialInteractionSurface, CredentialProofSubject, InlineCredentialProofRequest, PrimitiveStepResult } from "./types";
|
|
3
3
|
export declare const TINYCLOUD_CREDENTIAL_ACQUISITION_TAG = "tinycloud-credential-acquisition";
|
|
4
|
+
/** Length of the mailbox code OpenCredentials issues for the `mailbox_otp` step. */
|
|
5
|
+
export declare const MAILBOX_OTP_LENGTH = 8;
|
|
4
6
|
declare const ElementBase: typeof HTMLElement;
|
|
7
|
+
/**
|
|
8
|
+
* Reduces typed, pasted, or autofilled text to the mailbox code digits.
|
|
9
|
+
* Full-width digits are folded to ASCII, and a pasted sentence contributes
|
|
10
|
+
* only its first eight-digit group (optionally split as `1234 5678`).
|
|
11
|
+
*/
|
|
12
|
+
export declare function normalizeMailboxCode(value: string): string;
|
|
5
13
|
/** SDK-owned Shadow-DOM view. It is deliberately unaware of locators, verifiers, sessions, and transport. */
|
|
6
14
|
export declare class TinyCloudCredentialAcquisitionElement extends ElementBase {
|
|
7
15
|
private root?;
|
|
8
16
|
private resolver?;
|
|
17
|
+
private inputResolver?;
|
|
9
18
|
private rejecter?;
|
|
10
19
|
private closed;
|
|
20
|
+
private subject?;
|
|
21
|
+
private mailboxDomain?;
|
|
22
|
+
private codeTtlSeconds?;
|
|
11
23
|
connectedCallback(): void;
|
|
12
24
|
disconnectedCallback(): void;
|
|
13
25
|
configure(theme?: CredentialAcquisitionTheme): void;
|
|
26
|
+
/** Context known before the first proof request, used for the opening state. */
|
|
27
|
+
prepare(input: {
|
|
28
|
+
readonly subject?: CredentialProofSubject;
|
|
29
|
+
readonly mailboxDomain?: string;
|
|
30
|
+
readonly codeTtlSeconds?: number;
|
|
31
|
+
}): void;
|
|
14
32
|
requestProof(request: InlineCredentialProofRequest): Promise<PrimitiveStepResult>;
|
|
33
|
+
/** Collects inputs the requirement does not carry, such as the recipient's own mailbox. */
|
|
34
|
+
requestInputs(request: CredentialInputRequest): Promise<Readonly<Record<string, string>>>;
|
|
15
35
|
report(state: "signing" | "verifying" | "saving" | "success" | "recovery", message?: string): void;
|
|
16
36
|
finish(): void;
|
|
17
37
|
cancel(): void;
|
|
18
38
|
isClosed(): boolean;
|
|
19
39
|
private renderShell;
|
|
20
40
|
private renderPrompt;
|
|
41
|
+
private settleInputs;
|
|
42
|
+
private mailboxEntryForm;
|
|
43
|
+
private collectForm;
|
|
44
|
+
private settle;
|
|
45
|
+
private actions;
|
|
46
|
+
private mailboxForm;
|
|
47
|
+
private inputForm;
|
|
21
48
|
}
|
|
22
49
|
/** Registers the element once in a browser document. */
|
|
23
50
|
export declare function defineTinyCloudCredentialAcquisitionElement(): void;
|
|
@@ -29,6 +56,8 @@ export declare class CredentialAcquisitionController {
|
|
|
29
56
|
readonly descriptor: CredentialFlowDescriptor;
|
|
30
57
|
readonly mountTarget?: Element | string;
|
|
31
58
|
readonly theme?: CredentialAcquisitionTheme;
|
|
59
|
+
readonly subject?: CredentialProofSubject;
|
|
60
|
+
readonly mailboxDomain?: string;
|
|
32
61
|
});
|
|
33
62
|
start(input: {
|
|
34
63
|
readonly signal?: AbortSignal;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type CredentialFlowDescriptor, type CredentialProgressEvent, type CredentialRequirement } from "@tinycloud/sdk-core";
|
|
2
|
-
import type { CredentialAcquisitionTransport, CredentialSigningAdapter, InlineCredentialProofHandler, PrimitiveStepHandler } from "./types";
|
|
2
|
+
import type { CredentialAcquisitionTransport, CredentialProofSubject, CredentialSigningAdapter, InlineCredentialProofHandler, PrimitiveStepHandler } from "./types";
|
|
3
|
+
/** The mailbox named by an email requirement, which the issuer delivers the code to. */
|
|
4
|
+
export declare function mailboxSubject(requirement: CredentialRequirement): CredentialProofSubject | undefined;
|
|
3
5
|
/** Finite step interpreter. Dispatch is exclusively by registered primitive and version. */
|
|
4
6
|
export declare function interpretCredentialFlow(input: {
|
|
5
7
|
readonly descriptor: CredentialFlowDescriptor;
|
|
@@ -16,6 +16,7 @@ export declare class OpenCredentialsHttpTransport implements CredentialAcquisiti
|
|
|
16
16
|
holderDid: string;
|
|
17
17
|
openerOrigin: string;
|
|
18
18
|
completionVerifierChallenge: string;
|
|
19
|
+
inputs?: Readonly<Record<string, string>>;
|
|
19
20
|
signal?: AbortSignal;
|
|
20
21
|
}): Promise<{
|
|
21
22
|
requestId: string;
|
|
@@ -72,8 +72,22 @@ export interface InlineCredentialProofRequest {
|
|
|
72
72
|
readonly label: string;
|
|
73
73
|
readonly schema: CredentialFlowDescriptor["inputs"][number]["schema"];
|
|
74
74
|
}[];
|
|
75
|
+
/** Present when this step's previous proof was rejected and may be retried. */
|
|
76
|
+
readonly feedback?: {
|
|
77
|
+
readonly kind: "rejected";
|
|
78
|
+
readonly attemptsRemaining: number;
|
|
79
|
+
};
|
|
75
80
|
readonly signal?: AbortSignal;
|
|
76
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* The mailbox a `mailbox_otp` code is sent to, copied from the digest-bound
|
|
84
|
+
* credential requirement. Only the SDK-owned inline view receives it; host
|
|
85
|
+
* proof handlers never see requirement values.
|
|
86
|
+
*/
|
|
87
|
+
export interface CredentialProofSubject {
|
|
88
|
+
readonly kind: "email";
|
|
89
|
+
readonly value: string;
|
|
90
|
+
}
|
|
77
91
|
export type InlineCredentialProofHandler = (input: InlineCredentialProofRequest) => Promise<PrimitiveStepResult>;
|
|
78
92
|
export type CredentialInteractionKind = "popup" | "redirect" | "headless" | "inline";
|
|
79
93
|
export interface CredentialInteractionSurface {
|
|
@@ -86,6 +100,22 @@ export interface CredentialInteractionSurface {
|
|
|
86
100
|
* acquisition locator, request verifier, or transport capability.
|
|
87
101
|
*/
|
|
88
102
|
readonly requestProof?: InlineCredentialProofHandler;
|
|
103
|
+
/**
|
|
104
|
+
* Collects descriptor inputs the requirement does not already supply, such
|
|
105
|
+
* as the recipient's own mailbox for an email-domain requirement. It
|
|
106
|
+
* receives only the input schema and the public domain constraint.
|
|
107
|
+
*/
|
|
108
|
+
readonly requestInputs?: (request: CredentialInputRequest) => Promise<Readonly<Record<string, string>>>;
|
|
109
|
+
}
|
|
110
|
+
export interface CredentialInputRequest {
|
|
111
|
+
readonly inputs: readonly {
|
|
112
|
+
readonly id: string;
|
|
113
|
+
readonly label: string;
|
|
114
|
+
readonly schema: CredentialFlowDescriptor["inputs"][number]["schema"];
|
|
115
|
+
}[];
|
|
116
|
+
/** The exact canonical domain the entered mailbox must belong to. */
|
|
117
|
+
readonly mailboxDomain?: string;
|
|
118
|
+
readonly signal?: AbortSignal;
|
|
89
119
|
}
|
|
90
120
|
/** A browser-owned interaction that navigates to the OpenCredentials locator. */
|
|
91
121
|
export interface CredentialBrowserInteractionAdapter {
|
|
@@ -150,6 +180,7 @@ export interface CredentialAcquisitionTransport {
|
|
|
150
180
|
readonly holderDid: string;
|
|
151
181
|
readonly openerOrigin: string;
|
|
152
182
|
readonly completionVerifierChallenge: string;
|
|
183
|
+
readonly inputs?: Readonly<Record<string, string>>;
|
|
153
184
|
readonly signal?: AbortSignal;
|
|
154
185
|
}): Promise<{
|
|
155
186
|
readonly requestId: string;
|
|
@@ -193,6 +224,12 @@ export interface CredentialsAcquireOptions extends CredentialsOperationOptions {
|
|
|
193
224
|
readonly openerOrigin?: string;
|
|
194
225
|
/** Same-origin, request-scoped persistence used to resume a full-page redirect. */
|
|
195
226
|
readonly redirectStore?: CredentialRedirectStore;
|
|
227
|
+
/**
|
|
228
|
+
* Acquisition inputs the requirement does not carry (for example a
|
|
229
|
+
* recipient-chosen mailbox for an email-domain requirement). When omitted,
|
|
230
|
+
* an inline surface collects them.
|
|
231
|
+
*/
|
|
232
|
+
readonly inputs?: Readonly<Record<string, string>>;
|
|
196
233
|
}
|
|
197
234
|
export interface CredentialAcquisitionTheme {
|
|
198
235
|
readonly accentColor?: string;
|
|
@@ -216,6 +253,8 @@ export interface CredentialsPolicyAdmissionOptions {
|
|
|
216
253
|
readonly requirement: CredentialRequirement;
|
|
217
254
|
readonly requestedCapabilities: readonly UnifiedPolicyCapability[];
|
|
218
255
|
readonly nodeOrigin: string;
|
|
256
|
+
/** How long the minted session should last; see `admitPolicyCredentialV3`. */
|
|
257
|
+
readonly requestedExpiresAt?: string | null;
|
|
219
258
|
readonly fetch?: typeof fetch;
|
|
220
259
|
readonly signal?: AbortSignal;
|
|
221
260
|
readonly now?: Date;
|