@tinycloud/web-sdk 3.0.0-beta.10 → 3.0.0-beta.11
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 +21 -1
- package/dist/credentials/interpreter.d.ts +3 -1
- package/dist/credentials/types.d.ts +14 -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/share/service.d.ts +11 -2
- package/dist/share/types.d.ts +10 -0
- package/package.json +3 -3
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
import { type CredentialFlowDescriptor } from "@tinycloud/sdk-core";
|
|
2
|
-
import type { CredentialAcquisitionTheme, CredentialInteractionSurface, InlineCredentialProofRequest, PrimitiveStepResult } from "./types";
|
|
2
|
+
import type { CredentialAcquisitionTheme, 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?;
|
|
9
17
|
private rejecter?;
|
|
10
18
|
private closed;
|
|
19
|
+
private subject?;
|
|
20
|
+
private codeTtlSeconds?;
|
|
11
21
|
connectedCallback(): void;
|
|
12
22
|
disconnectedCallback(): void;
|
|
13
23
|
configure(theme?: CredentialAcquisitionTheme): void;
|
|
24
|
+
/** Context known before the first proof request, used for the opening state. */
|
|
25
|
+
prepare(input: {
|
|
26
|
+
readonly subject?: CredentialProofSubject;
|
|
27
|
+
readonly codeTtlSeconds?: number;
|
|
28
|
+
}): void;
|
|
14
29
|
requestProof(request: InlineCredentialProofRequest): Promise<PrimitiveStepResult>;
|
|
15
30
|
report(state: "signing" | "verifying" | "saving" | "success" | "recovery", message?: string): void;
|
|
16
31
|
finish(): void;
|
|
@@ -18,6 +33,10 @@ export declare class TinyCloudCredentialAcquisitionElement extends ElementBase {
|
|
|
18
33
|
isClosed(): boolean;
|
|
19
34
|
private renderShell;
|
|
20
35
|
private renderPrompt;
|
|
36
|
+
private settle;
|
|
37
|
+
private actions;
|
|
38
|
+
private mailboxForm;
|
|
39
|
+
private inputForm;
|
|
21
40
|
}
|
|
22
41
|
/** Registers the element once in a browser document. */
|
|
23
42
|
export declare function defineTinyCloudCredentialAcquisitionElement(): void;
|
|
@@ -29,6 +48,7 @@ export declare class CredentialAcquisitionController {
|
|
|
29
48
|
readonly descriptor: CredentialFlowDescriptor;
|
|
30
49
|
readonly mountTarget?: Element | string;
|
|
31
50
|
readonly theme?: CredentialAcquisitionTheme;
|
|
51
|
+
readonly subject?: CredentialProofSubject;
|
|
32
52
|
});
|
|
33
53
|
start(input: {
|
|
34
54
|
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;
|
|
@@ -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 {
|