@mattrglobal/verifier-sdk-web 2.2.1-unstable.42 → 2.2.1-unstable.44

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,6 +1,6 @@
1
1
  import * as v from "valibot";
2
2
  import { BaseError } from "../../common";
3
- import { CredentialQuery, Mode, PresentationSessionResult } from "./credential-presentation";
3
+ import { CreateSessionResponse, CredentialQuery, Mode, PresentationSessionResult } from "./credential-presentation";
4
4
  export declare enum LocalStorageKey {
5
5
  challenge = "mattr_chg",
6
6
  sessionId = "mattr_sid",
@@ -132,6 +132,11 @@ export type RequestCredentialsOptions = {
132
132
  * appended as a plain query parameter to the auth request URI.
133
133
  */
134
134
  state?: string;
135
+ /**
136
+ * An optional hook executed after presentation session creation but before continuing the presentation flow.
137
+ * Any errors thrown/rejected by this hook are ignored.
138
+ */
139
+ onSessionCreate?: (result: CreateSessionResponse) => void | Promise<void>;
135
140
  };
136
141
  export declare const RequestCredentialsOptionsValidator: v.ObjectSchema<{
137
142
  readonly credentialQuery: v.SchemaWithPipe<readonly [v.ArraySchema<v.ObjectSchema<{
@@ -7,7 +7,7 @@
7
7
  * Do Not Translate or Localize
8
8
  *
9
9
  * Bundle of @mattrglobal/verifier-sdk-web
10
- * Generated: 2026-07-07
10
+ * Generated: 2026-07-09
11
11
  * Version: 2.2.0
12
12
  * Dependencies:
13
13
  *
@@ -2074,7 +2074,7 @@
2074
2074
  }
2075
2075
  assertType(RequestCredentialsOptionsValidator, "Invalid request credential options")(options);
2076
2076
  const {apiBaseUrl: apiBaseUrl, applicationId: applicationId} = initializeOptions;
2077
- const {challenge: challenge = generateChallenge(), credentialQuery: credentialQuery, openid4vpConfiguration: openid4vpConfiguration, state: state} = options;
2077
+ const {challenge: challenge = generateChallenge(), credentialQuery: credentialQuery, openid4vpConfiguration: openid4vpConfiguration, state: state, onSessionCreate: onSessionCreate} = options;
2078
2078
  const dcApiSupported = isDigitalCredentialsApiSupported();
2079
2079
  const openId4VpRedirectUri = deriveOpenId4vpRedirectUri(openid4vpConfiguration);
2080
2080
  const createSessionResult = await createSession({
@@ -2096,6 +2096,11 @@
2096
2096
  }
2097
2097
  const session = createSessionResult.value;
2098
2098
  const {sessionKey: sessionKey, sessionId: sessionId} = session;
2099
+ if (onSessionCreate) {
2100
+ try {
2101
+ await onSessionCreate(session);
2102
+ } catch (_b) {}
2103
+ }
2099
2104
  if (session.type === SessionType.DigitalCredentialsApi) {
2100
2105
  const {request: request, sessionTtl: sessionTtl} = session;
2101
2106
  return await requestCredentialsWithDigitalCredentialsApi({