@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.
@@ -5018,7 +5018,16 @@ class IdentityRenderer {
5018
5018
  }
5019
5019
  }, 10000);
5020
5020
  ws.onopen = () => {
5021
- ws.send(JSON.stringify({ action: 'init' }));
5021
+ try {
5022
+ ws.send(JSON.stringify({ action: 'init' }));
5023
+ }
5024
+ catch {
5025
+ if (!resolved) {
5026
+ resolved = true;
5027
+ clearTimeout(timeout);
5028
+ resolve(null);
5029
+ }
5030
+ }
5022
5031
  };
5023
5032
  ws.onmessage = (event) => {
5024
5033
  let data;
@@ -5140,6 +5149,11 @@ class IdentityRenderer {
5140
5149
  const connectionId = await this.openSparkLinkWebSocket();
5141
5150
  if (!connectionId) {
5142
5151
  this.cleanupSparkLink();
5152
+ this.setState({
5153
+ view: 'error',
5154
+ message: 'Unable to establish a secure connection. Please try again or choose a different method.',
5155
+ code: 'sparklink_ws_failed',
5156
+ });
5143
5157
  return;
5144
5158
  }
5145
5159
  const result = await this.sparkLinkHandler.send(connectionId);
@@ -5152,6 +5166,11 @@ class IdentityRenderer {
5152
5166
  }
5153
5167
  else {
5154
5168
  this.cleanupSparkLink();
5169
+ this.setState({
5170
+ view: 'error',
5171
+ message: result.error ?? 'Failed to resend verification link. Please try again.',
5172
+ code: 'sparklink_resend_failed',
5173
+ });
5155
5174
  }
5156
5175
  }
5157
5176
  /**
@@ -5610,7 +5629,7 @@ class IdentityModule {
5610
5629
  if (payload.exp < now) {
5611
5630
  throw new ValidationError('Token has expired');
5612
5631
  }
5613
- const expectedIssuer = `${this.config.apiBaseUrl}/apps/identity/${this.config.accountId}`;
5632
+ const expectedIssuer = `${this.config.identityBaseUrl}/${this.config.accountId}`;
5614
5633
  if (payload.iss !== expectedIssuer) {
5615
5634
  throw new ValidationError('Invalid token issuer');
5616
5635
  }