@tinycloud/web-sdk 3.0.0-beta.1 → 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/adapters/BrowserSessionStorage.d.ts +4 -0
- package/dist/credentials/element.d.ts +21 -1
- package/dist/credentials/interpreter.d.ts +3 -1
- package/dist/credentials/service.d.ts +2 -0
- package/dist/credentials/types.d.ts +32 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.mjs +1 -1
- package/dist/modules/Storage/tinycloud/types.schema.d.ts +2 -2
- package/dist/modules/WebSecretsService.d.ts +1 -0
- package/dist/modules/tcw.d.ts +25 -8
- package/dist/notifications/types.schema.d.ts +2 -2
- package/dist/share/index.d.ts +5 -0
- package/dist/share/receiver-credentials.d.ts +21 -0
- package/dist/share/receiver-session.d.ts +22 -0
- package/dist/share/service.d.ts +56 -0
- package/dist/share/types.d.ts +99 -0
- package/package.json +5 -3
|
@@ -19,8 +19,12 @@ export declare class BrowserSessionStorage implements ISessionStorage {
|
|
|
19
19
|
constructor(options?: BrowserSessionStorageOptions);
|
|
20
20
|
private defaultStorage;
|
|
21
21
|
private key;
|
|
22
|
+
private activeAddressKey;
|
|
23
|
+
private clearActiveAddress;
|
|
22
24
|
private assertPersistable;
|
|
23
25
|
save(address: string, data: PersistedSessionData): Promise<void>;
|
|
26
|
+
/** Most recently saved, still-valid session address for provider-free reloads. */
|
|
27
|
+
activeAddress(): string | undefined;
|
|
24
28
|
load(address: string): Promise<PersistedSessionData | null>;
|
|
25
29
|
loadWithStatus(address: string): Promise<BrowserSessionLoadResult>;
|
|
26
30
|
clear(address: string): Promise<void>;
|
|
@@ -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;
|
|
@@ -18,6 +18,8 @@ export declare class CredentialsService {
|
|
|
18
18
|
store(verified: VerifiedCredential, requirementValue: CredentialRequirement, options?: CredentialsOperationOptions): Promise<{
|
|
19
19
|
readonly record: StoredCredentialRecord;
|
|
20
20
|
readonly receipt: import("@tinycloud/sdk-core").CredentialStorageReceipt;
|
|
21
|
+
} | {
|
|
22
|
+
record: StoredCredentialRecord;
|
|
21
23
|
}>;
|
|
22
24
|
acquire(requirementValue: CredentialRequirement, options: CredentialsAcquireOptions): Promise<VerifiedCredential>;
|
|
23
25
|
ensure(requirementValue: CredentialRequirement, options: CredentialsEnsureOptions): Promise<CredentialsEnsureResult>;
|
|
@@ -21,6 +21,23 @@ export interface CredentialClient {
|
|
|
21
21
|
* than on {@link ClientSession} so the CID stays out of the public session.
|
|
22
22
|
*/
|
|
23
23
|
accountAuthorizationCid(): string;
|
|
24
|
+
/** Receiver-local credential custody. Its presence selects accountless mode. */
|
|
25
|
+
readonly receiverCredentialCustody?: ReceiverCredentialCustody;
|
|
26
|
+
}
|
|
27
|
+
export interface ReceiverCredentialCustody {
|
|
28
|
+
find(input: {
|
|
29
|
+
readonly requirement: CredentialRequirement;
|
|
30
|
+
readonly requirementDigest: string;
|
|
31
|
+
readonly holderDid: string;
|
|
32
|
+
readonly now?: Date;
|
|
33
|
+
}): Promise<StoredCredentialRecord | undefined>;
|
|
34
|
+
store(input: {
|
|
35
|
+
readonly verified: VerifiedCredential;
|
|
36
|
+
readonly requirement: CredentialRequirement;
|
|
37
|
+
readonly requirementDigest: string;
|
|
38
|
+
readonly holderDid: string;
|
|
39
|
+
readonly now?: Date;
|
|
40
|
+
}): Promise<StoredCredentialRecord>;
|
|
24
41
|
}
|
|
25
42
|
export interface CredentialSigningAdapter {
|
|
26
43
|
/** Return undefined when the existing exact-request auto-sign policy does not apply. */
|
|
@@ -55,8 +72,22 @@ export interface InlineCredentialProofRequest {
|
|
|
55
72
|
readonly label: string;
|
|
56
73
|
readonly schema: CredentialFlowDescriptor["inputs"][number]["schema"];
|
|
57
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
|
+
};
|
|
58
80
|
readonly signal?: AbortSignal;
|
|
59
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
|
+
}
|
|
60
91
|
export type InlineCredentialProofHandler = (input: InlineCredentialProofRequest) => Promise<PrimitiveStepResult>;
|
|
61
92
|
export type CredentialInteractionKind = "popup" | "redirect" | "headless" | "inline";
|
|
62
93
|
export interface CredentialInteractionSurface {
|
|
@@ -200,6 +231,7 @@ export interface CredentialsPolicyAdmissionOptions {
|
|
|
200
231
|
readonly requestedCapabilities: readonly UnifiedPolicyCapability[];
|
|
201
232
|
readonly nodeOrigin: string;
|
|
202
233
|
readonly fetch?: typeof fetch;
|
|
234
|
+
readonly signal?: AbortSignal;
|
|
203
235
|
readonly now?: Date;
|
|
204
236
|
readonly jti?: string;
|
|
205
237
|
}
|