@sparkvault/sdk 1.21.4 → 1.21.6

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.
@@ -5014,7 +5014,16 @@ class IdentityRenderer {
5014
5014
  }
5015
5015
  }, 10000);
5016
5016
  ws.onopen = () => {
5017
- ws.send(JSON.stringify({ action: 'init' }));
5017
+ try {
5018
+ ws.send(JSON.stringify({ action: 'init' }));
5019
+ }
5020
+ catch {
5021
+ if (!resolved) {
5022
+ resolved = true;
5023
+ clearTimeout(timeout);
5024
+ resolve(null);
5025
+ }
5026
+ }
5018
5027
  };
5019
5028
  ws.onmessage = (event) => {
5020
5029
  let data;
@@ -5136,6 +5145,11 @@ class IdentityRenderer {
5136
5145
  const connectionId = await this.openSparkLinkWebSocket();
5137
5146
  if (!connectionId) {
5138
5147
  this.cleanupSparkLink();
5148
+ this.setState({
5149
+ view: 'error',
5150
+ message: 'Unable to establish a secure connection. Please try again or choose a different method.',
5151
+ code: 'sparklink_ws_failed',
5152
+ });
5139
5153
  return;
5140
5154
  }
5141
5155
  const result = await this.sparkLinkHandler.send(connectionId);
@@ -5148,6 +5162,11 @@ class IdentityRenderer {
5148
5162
  }
5149
5163
  else {
5150
5164
  this.cleanupSparkLink();
5165
+ this.setState({
5166
+ view: 'error',
5167
+ message: result.error ?? 'Failed to resend verification link. Please try again.',
5168
+ code: 'sparklink_resend_failed',
5169
+ });
5151
5170
  }
5152
5171
  }
5153
5172
  /**
@@ -5606,7 +5625,7 @@ class IdentityModule {
5606
5625
  if (payload.exp < now) {
5607
5626
  throw new ValidationError('Token has expired');
5608
5627
  }
5609
- const expectedIssuer = `${this.config.apiBaseUrl}/apps/identity/${this.config.accountId}`;
5628
+ const expectedIssuer = `${this.config.identityBaseUrl}/${this.config.accountId}`;
5610
5629
  if (payload.iss !== expectedIssuer) {
5611
5630
  throw new ValidationError('Invalid token issuer');
5612
5631
  }