@keyringnetwork/keyring-connect-sdk 4.1.0-alpha.3 → 4.1.0-alpha.4

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/index.cjs CHANGED
@@ -57,7 +57,7 @@ var import_pino = __toESM(require("pino"), 1);
57
57
  // package.json
58
58
  var package_default = {
59
59
  name: "@keyringnetwork/keyring-connect-sdk",
60
- version: "4.1.0-alpha.3",
60
+ version: "4.1.0-alpha.4",
61
61
  description: "An SDK for interacting with Keyring Connect browser extension",
62
62
  type: "module",
63
63
  main: "dist/index.cjs",
@@ -2545,18 +2545,14 @@ var Environment = class {
2545
2545
  switch (env) {
2546
2546
  case "production":
2547
2547
  return {
2548
- apiUrl: "http://localhost:8000",
2549
- timeout: 6e4,
2550
- retryAttempts: 5,
2551
- extensionTimeout: 1e4
2548
+ apiUrl: "https://main.api.keyring-backend.krnprod.net",
2549
+ timeout: 6e4
2552
2550
  };
2553
2551
  case "development":
2554
2552
  default:
2555
2553
  return {
2556
- apiUrl: "http://localhost:8000",
2557
- timeout: 3e4,
2558
- retryAttempts: 3,
2559
- extensionTimeout: 5e3
2554
+ apiUrl: "https://main.api.keyring-backend.krndev.net",
2555
+ timeout: 3e4
2560
2556
  };
2561
2557
  }
2562
2558
  }
@@ -2849,7 +2845,10 @@ var VerificationSession = class _VerificationSession {
2849
2845
  try {
2850
2846
  await this.closeBackendSession(this.sessionId, this.sessionToken);
2851
2847
  } catch (error) {
2852
- this.logger.warn({ error, sessionId: this.sessionId }, "Failed to delete backend session");
2848
+ this.logger.warn(
2849
+ { error, sessionId: this.sessionId },
2850
+ "Failed to delete backend session"
2851
+ );
2853
2852
  }
2854
2853
  }
2855
2854
  this.eventListeners.clear();
@@ -2894,8 +2893,9 @@ var VerificationSession = class _VerificationSession {
2894
2893
  * Initialize mobile-specific resources (HTTP client, session, WebSocket)
2895
2894
  */
2896
2895
  async initializeSession() {
2896
+ const baseUrl = this.sessionConfig.krn_config?.keyring_api_url || Environment.getConfig().apiUrl;
2897
2897
  this.httpClient = new import_keyring_core_sdk2.HttpClient({
2898
- baseUrl: Environment.getConfig().apiUrl,
2898
+ baseUrl,
2899
2899
  timeout: Environment.getConfig().timeout,
2900
2900
  headers: {
2901
2901
  Authorization: `Bearer ${this.sessionConfig.clientToken}`
@@ -2975,6 +2975,19 @@ var VerificationSession = class _VerificationSession {
2975
2975
  this.emit("processingCompleted", data);
2976
2976
  this.complete(data.result.credential_data);
2977
2977
  break;
2978
+ case "processing_failed":
2979
+ this.logger.error(data, "Processing failed");
2980
+ if (this.flowType === "mobile") {
2981
+ this.uiManager?.updateStatus("Verification failed", "failed");
2982
+ }
2983
+ this.emit("processingFailed", data);
2984
+ this.fail(
2985
+ new KeyringError(
2986
+ "PROCESSING_FAILED" /* PROCESSING_FAILED */,
2987
+ data?.error ?? "Verification processing failed on mobile"
2988
+ )
2989
+ );
2990
+ break;
2978
2991
  case "session_expired":
2979
2992
  if (this.flowType === "mobile") {
2980
2993
  this.uiManager?.updateStatus("Session expired", "expired");
@@ -3008,10 +3021,11 @@ var VerificationSession = class _VerificationSession {
3008
3021
  this.fail(KeyringError.fromUnknown(data.message, { sessionId: this.sessionId }));
3009
3022
  }
3010
3023
  };
3024
+ const wsUrl = this.sessionConfig.krn_config?.keyring_api_url || Environment.getConfig().apiUrl;
3011
3025
  this.wsClient = new import_keyring_core_sdk2.WebSocketClient(
3012
3026
  this.sessionResponse.session_id,
3013
3027
  this.sessionResponse.session_token,
3014
- Environment.getConfig().apiUrl,
3028
+ wsUrl,
3015
3029
  wsCallbacks
3016
3030
  );
3017
3031
  this.isWebsocketActive = true;
@@ -3191,7 +3205,7 @@ var VerificationSession = class _VerificationSession {
3191
3205
  "Received polling update"
3192
3206
  );
3193
3207
  switch (session.status) {
3194
- case "processing_completed":
3208
+ case "processing_completed": {
3195
3209
  this.logger.debug("Session completed via polling");
3196
3210
  const result = session.result;
3197
3211
  const hasRequiredData = result?.credential_data && result?.entity_type && result?.datasourceObject;
@@ -3217,6 +3231,7 @@ var VerificationSession = class _VerificationSession {
3217
3231
  );
3218
3232
  }
3219
3233
  break;
3234
+ }
3220
3235
  case "processing_failed":
3221
3236
  this.logger.debug("Session failed via polling");
3222
3237
  if (this.flowType === "mobile") {
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ import pino from "pino";
29
29
  // package.json
30
30
  var package_default = {
31
31
  name: "@keyringnetwork/keyring-connect-sdk",
32
- version: "4.1.0-alpha.3",
32
+ version: "4.1.0-alpha.4",
33
33
  description: "An SDK for interacting with Keyring Connect browser extension",
34
34
  type: "module",
35
35
  main: "dist/index.cjs",
@@ -2517,18 +2517,14 @@ var Environment = class {
2517
2517
  switch (env) {
2518
2518
  case "production":
2519
2519
  return {
2520
- apiUrl: "http://localhost:8000",
2521
- timeout: 6e4,
2522
- retryAttempts: 5,
2523
- extensionTimeout: 1e4
2520
+ apiUrl: "https://main.api.keyring-backend.krnprod.net",
2521
+ timeout: 6e4
2524
2522
  };
2525
2523
  case "development":
2526
2524
  default:
2527
2525
  return {
2528
- apiUrl: "http://localhost:8000",
2529
- timeout: 3e4,
2530
- retryAttempts: 3,
2531
- extensionTimeout: 5e3
2526
+ apiUrl: "https://main.api.keyring-backend.krndev.net",
2527
+ timeout: 3e4
2532
2528
  };
2533
2529
  }
2534
2530
  }
@@ -2821,7 +2817,10 @@ var VerificationSession = class _VerificationSession {
2821
2817
  try {
2822
2818
  await this.closeBackendSession(this.sessionId, this.sessionToken);
2823
2819
  } catch (error) {
2824
- this.logger.warn({ error, sessionId: this.sessionId }, "Failed to delete backend session");
2820
+ this.logger.warn(
2821
+ { error, sessionId: this.sessionId },
2822
+ "Failed to delete backend session"
2823
+ );
2825
2824
  }
2826
2825
  }
2827
2826
  this.eventListeners.clear();
@@ -2866,8 +2865,9 @@ var VerificationSession = class _VerificationSession {
2866
2865
  * Initialize mobile-specific resources (HTTP client, session, WebSocket)
2867
2866
  */
2868
2867
  async initializeSession() {
2868
+ const baseUrl = this.sessionConfig.krn_config?.keyring_api_url || Environment.getConfig().apiUrl;
2869
2869
  this.httpClient = new HttpClient({
2870
- baseUrl: Environment.getConfig().apiUrl,
2870
+ baseUrl,
2871
2871
  timeout: Environment.getConfig().timeout,
2872
2872
  headers: {
2873
2873
  Authorization: `Bearer ${this.sessionConfig.clientToken}`
@@ -2947,6 +2947,19 @@ var VerificationSession = class _VerificationSession {
2947
2947
  this.emit("processingCompleted", data);
2948
2948
  this.complete(data.result.credential_data);
2949
2949
  break;
2950
+ case "processing_failed":
2951
+ this.logger.error(data, "Processing failed");
2952
+ if (this.flowType === "mobile") {
2953
+ this.uiManager?.updateStatus("Verification failed", "failed");
2954
+ }
2955
+ this.emit("processingFailed", data);
2956
+ this.fail(
2957
+ new KeyringError(
2958
+ "PROCESSING_FAILED" /* PROCESSING_FAILED */,
2959
+ data?.error ?? "Verification processing failed on mobile"
2960
+ )
2961
+ );
2962
+ break;
2950
2963
  case "session_expired":
2951
2964
  if (this.flowType === "mobile") {
2952
2965
  this.uiManager?.updateStatus("Session expired", "expired");
@@ -2980,10 +2993,11 @@ var VerificationSession = class _VerificationSession {
2980
2993
  this.fail(KeyringError.fromUnknown(data.message, { sessionId: this.sessionId }));
2981
2994
  }
2982
2995
  };
2996
+ const wsUrl = this.sessionConfig.krn_config?.keyring_api_url || Environment.getConfig().apiUrl;
2983
2997
  this.wsClient = new WebSocketClient(
2984
2998
  this.sessionResponse.session_id,
2985
2999
  this.sessionResponse.session_token,
2986
- Environment.getConfig().apiUrl,
3000
+ wsUrl,
2987
3001
  wsCallbacks
2988
3002
  );
2989
3003
  this.isWebsocketActive = true;
@@ -3163,7 +3177,7 @@ var VerificationSession = class _VerificationSession {
3163
3177
  "Received polling update"
3164
3178
  );
3165
3179
  switch (session.status) {
3166
- case "processing_completed":
3180
+ case "processing_completed": {
3167
3181
  this.logger.debug("Session completed via polling");
3168
3182
  const result = session.result;
3169
3183
  const hasRequiredData = result?.credential_data && result?.entity_type && result?.datasourceObject;
@@ -3189,6 +3203,7 @@ var VerificationSession = class _VerificationSession {
3189
3203
  );
3190
3204
  }
3191
3205
  break;
3206
+ }
3192
3207
  case "processing_failed":
3193
3208
  this.logger.debug("Session failed via polling");
3194
3209
  if (this.flowType === "mobile") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keyringnetwork/keyring-connect-sdk",
3
- "version": "4.1.0-alpha.3",
3
+ "version": "4.1.0-alpha.4",
4
4
  "description": "An SDK for interacting with Keyring Connect browser extension",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",