@tinycloud/web-sdk 3.0.0-beta.11 → 3.0.0-beta.13

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.
@@ -1,5 +1,5 @@
1
1
  import { type CredentialFlowDescriptor } from "@tinycloud/sdk-core";
2
- import type { CredentialAcquisitionTheme, CredentialInteractionSurface, CredentialProofSubject, 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
4
  /** Length of the mailbox code OpenCredentials issues for the `mailbox_otp` step. */
5
5
  export declare const MAILBOX_OTP_LENGTH = 8;
@@ -14,9 +14,11 @@ export declare function normalizeMailboxCode(value: string): string;
14
14
  export declare class TinyCloudCredentialAcquisitionElement extends ElementBase {
15
15
  private root?;
16
16
  private resolver?;
17
+ private inputResolver?;
17
18
  private rejecter?;
18
19
  private closed;
19
20
  private subject?;
21
+ private mailboxDomain?;
20
22
  private codeTtlSeconds?;
21
23
  connectedCallback(): void;
22
24
  disconnectedCallback(): void;
@@ -24,15 +26,21 @@ export declare class TinyCloudCredentialAcquisitionElement extends ElementBase {
24
26
  /** Context known before the first proof request, used for the opening state. */
25
27
  prepare(input: {
26
28
  readonly subject?: CredentialProofSubject;
29
+ readonly mailboxDomain?: string;
27
30
  readonly codeTtlSeconds?: number;
28
31
  }): void;
29
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>>>;
30
35
  report(state: "signing" | "verifying" | "saving" | "success" | "recovery", message?: string): void;
31
36
  finish(): void;
32
37
  cancel(): void;
33
38
  isClosed(): boolean;
34
39
  private renderShell;
35
40
  private renderPrompt;
41
+ private settleInputs;
42
+ private mailboxEntryForm;
43
+ private collectForm;
36
44
  private settle;
37
45
  private actions;
38
46
  private mailboxForm;
@@ -49,6 +57,7 @@ export declare class CredentialAcquisitionController {
49
57
  readonly mountTarget?: Element | string;
50
58
  readonly theme?: CredentialAcquisitionTheme;
51
59
  readonly subject?: CredentialProofSubject;
60
+ readonly mailboxDomain?: string;
52
61
  });
53
62
  start(input: {
54
63
  readonly signal?: AbortSignal;
@@ -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;
@@ -100,6 +100,22 @@ export interface CredentialInteractionSurface {
100
100
  * acquisition locator, request verifier, or transport capability.
101
101
  */
102
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;
103
119
  }
104
120
  /** A browser-owned interaction that navigates to the OpenCredentials locator. */
105
121
  export interface CredentialBrowserInteractionAdapter {
@@ -164,6 +180,7 @@ export interface CredentialAcquisitionTransport {
164
180
  readonly holderDid: string;
165
181
  readonly openerOrigin: string;
166
182
  readonly completionVerifierChallenge: string;
183
+ readonly inputs?: Readonly<Record<string, string>>;
167
184
  readonly signal?: AbortSignal;
168
185
  }): Promise<{
169
186
  readonly requestId: string;
@@ -207,6 +224,12 @@ export interface CredentialsAcquireOptions extends CredentialsOperationOptions {
207
224
  readonly openerOrigin?: string;
208
225
  /** Same-origin, request-scoped persistence used to resume a full-page redirect. */
209
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>>;
210
233
  }
211
234
  export interface CredentialAcquisitionTheme {
212
235
  readonly accentColor?: string;