@mattrglobal/verifier-sdk-web 1.1.1-unstable.142 → 1.1.1-unstable.144

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.
@@ -24,5 +24,6 @@ export type SafeFetchError = BaseError<SafeFetchErrorType> & {
24
24
  };
25
25
  /**
26
26
  * Safe fetch function that wraps the fetch function and returns a Result type
27
+ * injects the package version number into the x-mattr-sdk-version header to help support backwards compatibility
27
28
  */
28
29
  export declare const safeFetch: (input: RequestInfo, init?: RequestInit) => Promise<Result<Response, SafeFetchError>>;
@@ -5,6 +5,7 @@ export { Mode, OpenidPresentationCredentialProfileSupported, MobileCredentialVer
5
5
  export type { InitialiseOptions, RequestCredentialsOptions, RequestCredentialsSameDeviceOptions, RequestCredentialsCrossDeviceDeviceOptions, RequestCredentialsAutoDetectOptions, CredentialQuery, CredentialQueryClaim, RequestCredentialsResponse, RequestCredentialsError, Claim, ClaimData, HandleRedirectCallbackResponse, PresentationSessionResult, PresentationSuccessResult, PresentationFailureResult, PresentationHiddenResult, PresentationErrorType, MobileCredentialPresentationCredential, MobileCredentialError, ValidityInfoRequest, CredentialBranding, CredentialBrandingImage, MobileCredentialVerificationResult, HandleRedirectCallbackError, };
6
6
  declare const utils: {
7
7
  generateChallenge: () => string;
8
+ getVersion: () => string;
8
9
  unwrap: <T = unknown>(result: import("neverthrow").Result<T, unknown>, errMessage?: string) => T;
9
10
  };
10
11
  export { initialise, requestCredentials, handleRedirectCallback, abortCredentialRequest, utils };
@@ -5,6 +5,8 @@ export declare enum LocalStorageKey {
5
5
  challenge = "mattr_chg",
6
6
  sessionId = "mattr_sid"
7
7
  }
8
+ export declare const MATTR_SDK_VERSION_HEADER = "x-mattr-sdk-version";
9
+ export declare const MATTR_SDK_VERSION_VALUE = "2.0.0";
8
10
  /**
9
11
  * The mode in which the credentials are requested
10
12
  */
@@ -65,3 +65,7 @@ export declare const exchangeSessionResult: ({ challenge, responseCode, sessionI
65
65
  * @returns A boolean indicating whether the user agent is a mobile device.
66
66
  */
67
67
  export declare const isMobileDetect: (userAgent: string) => boolean;
68
+ /**
69
+ * Returns the value that is being set in the x-mattr-sdk-version header
70
+ */
71
+ export declare const getVersion: () => string;
@@ -7,7 +7,7 @@
7
7
  * Do Not Translate or Localize
8
8
  *
9
9
  * Bundle of @mattrglobal/verifier-sdk-web
10
- * Generated: 2025-05-06
10
+ * Generated: 2025-05-12
11
11
  * Version: 1.1.0
12
12
  * Dependencies:
13
13
  *
@@ -1213,34 +1213,6 @@
1213
1213
  });
1214
1214
  }
1215
1215
  };
1216
- var SafeFetchCommonRespondErrorType;
1217
- (function(SafeFetchCommonRespondErrorType) {
1218
- SafeFetchCommonRespondErrorType["UnexpectedRespond"] = "UnexpectedRespond";
1219
- })(SafeFetchCommonRespondErrorType || (SafeFetchCommonRespondErrorType = {}));
1220
- var SafeFetchErrorType;
1221
- (function(SafeFetchErrorType) {
1222
- SafeFetchErrorType["HttpError"] = "HttpError";
1223
- SafeFetchErrorType["UnknownError"] = "UnknownError";
1224
- })(SafeFetchErrorType || (SafeFetchErrorType = {}));
1225
- const safeFetch = async (input, init) => {
1226
- try {
1227
- const response = await fetch(input, init);
1228
- if (response.status > 299 || response.status < 200) {
1229
- return err({
1230
- type: SafeFetchErrorType.HttpError,
1231
- message: `HTTP error, status = ${response.status}`,
1232
- status: response.status
1233
- });
1234
- }
1235
- return ok(response);
1236
- } catch (error) {
1237
- return err({
1238
- type: SafeFetchErrorType.UnknownError,
1239
- message: "Unknown error",
1240
- cause: error
1241
- });
1242
- }
1243
- };
1244
1216
  exports.MobileCredentialVerificationReasonType = void 0;
1245
1217
  (function(MobileCredentialVerificationReasonType) {
1246
1218
  MobileCredentialVerificationReasonType["TrustedIssuerCertificateExpired"] = "TrustedIssuerCertificateExpired";
@@ -1332,6 +1304,8 @@
1332
1304
  LocalStorageKey["challenge"] = "mattr_chg";
1333
1305
  LocalStorageKey["sessionId"] = "mattr_sid";
1334
1306
  })(LocalStorageKey || (LocalStorageKey = {}));
1307
+ const MATTR_SDK_VERSION_HEADER = "x-mattr-sdk-version";
1308
+ const MATTR_SDK_VERSION_VALUE = "2.0.0";
1335
1309
  exports.Mode = void 0;
1336
1310
  (function(Mode) {
1337
1311
  Mode["sameDevice"] = "sameDevice";
@@ -1390,6 +1364,39 @@
1390
1364
  apiBaseUrl: pipe(string(), nonEmpty("Must not be empty")),
1391
1365
  applicationId: pipe(string(), nonEmpty("Must not be empty"))
1392
1366
  });
1367
+ var SafeFetchCommonRespondErrorType;
1368
+ (function(SafeFetchCommonRespondErrorType) {
1369
+ SafeFetchCommonRespondErrorType["UnexpectedRespond"] = "UnexpectedRespond";
1370
+ })(SafeFetchCommonRespondErrorType || (SafeFetchCommonRespondErrorType = {}));
1371
+ var SafeFetchErrorType;
1372
+ (function(SafeFetchErrorType) {
1373
+ SafeFetchErrorType["HttpError"] = "HttpError";
1374
+ SafeFetchErrorType["UnknownError"] = "UnknownError";
1375
+ })(SafeFetchErrorType || (SafeFetchErrorType = {}));
1376
+ const safeFetch = async (input, init) => {
1377
+ try {
1378
+ const headers = Object.assign(Object.assign({}, init === null || init === void 0 ? void 0 : init.headers), {
1379
+ [MATTR_SDK_VERSION_HEADER]: `verifier-sdk-web/${MATTR_SDK_VERSION_VALUE}`
1380
+ });
1381
+ const response = await fetch(input, Object.assign(Object.assign({}, init), {
1382
+ headers: headers
1383
+ }));
1384
+ if (response.status > 299 || response.status < 200) {
1385
+ return err({
1386
+ type: SafeFetchErrorType.HttpError,
1387
+ message: `HTTP error, status = ${response.status}`,
1388
+ status: response.status
1389
+ });
1390
+ }
1391
+ return ok(response);
1392
+ } catch (error) {
1393
+ return err({
1394
+ type: SafeFetchErrorType.UnknownError,
1395
+ message: "Unknown error",
1396
+ cause: error
1397
+ });
1398
+ }
1399
+ };
1393
1400
  let initialiseOptions = undefined;
1394
1401
  var InitialiseErrorMessage;
1395
1402
  (function(InitialiseErrorMessage) {
@@ -1590,6 +1597,7 @@
1590
1597
  ua: userAgent,
1591
1598
  tablet: false
1592
1599
  });
1600
+ const getVersion = () => MATTR_SDK_VERSION_VALUE;
1593
1601
  var WindowEventListenerType;
1594
1602
  (function(WindowEventListenerType) {
1595
1603
  WindowEventListenerType["message"] = "message";
@@ -1900,6 +1908,7 @@
1900
1908
  };
1901
1909
  const utils = {
1902
1910
  generateChallenge: generateChallenge,
1911
+ getVersion: getVersion,
1903
1912
  unwrap: unwrap
1904
1913
  };
1905
1914
  exports.abortCredentialRequest = abortCredentialRequest;