@getpara/core-sdk 2.26.0 → 2.28.0

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.
@@ -1406,6 +1406,15 @@ const _ParaCore = class _ParaCore {
1406
1406
  if (!wallet) {
1407
1407
  throw new Error("wallet not found");
1408
1408
  }
1409
+ if (wallet.scheme === "ED25519") {
1410
+ return yield this.platformUtils.getED25519PrivateKey(
1411
+ this.ctx,
1412
+ this.userId,
1413
+ wallet.id,
1414
+ wallet.signer,
1415
+ this.retrieveSessionCookie()
1416
+ );
1417
+ }
1409
1418
  if (wallet.scheme !== "DKLS") {
1410
1419
  throw new Error("invalid wallet scheme");
1411
1420
  }
@@ -1580,8 +1589,8 @@ const _ParaCore = class _ParaCore {
1580
1589
  * Resend a verification email for the current user.
1581
1590
  */
1582
1591
  resendVerificationCode(_0) {
1583
- return __async(this, arguments, function* ({ type: reason = "SIGNUP" }) {
1584
- return yield __privateGet(this, _authService).resendVerificationCode({ type: reason });
1592
+ return __async(this, arguments, function* ({ type: reason = "SIGNUP", deliveryChannel }) {
1593
+ return yield __privateGet(this, _authService).resendVerificationCode({ type: reason, deliveryChannel });
1585
1594
  });
1586
1595
  }
1587
1596
  /**
@@ -2817,15 +2826,16 @@ const _ParaCore = class _ParaCore {
2817
2826
  }
2818
2827
  sendLoginCode() {
2819
2828
  return __async(this, null, function* () {
2820
- const { userId } = yield this.ctx.client.sendLoginVerificationCode(this.authInfo);
2829
+ const { userId, deliveryChannel, fallbackUsed, fallbackChannel, isSmsAllowed } = yield this.ctx.client.sendLoginVerificationCode(this.authInfo);
2821
2830
  this.setUserId(userId);
2831
+ return { deliveryChannel, fallbackUsed, fallbackChannel, isSmsAllowed };
2822
2832
  });
2823
2833
  }
2824
2834
  exportPrivateKey() {
2825
2835
  return __async(this, arguments, function* (args = {}) {
2826
2836
  let walletId = args == null ? void 0 : args.walletId;
2827
2837
  if (!(args == null ? void 0 : args.walletId)) {
2828
- walletId = this.findWalletId(void 0, { forbidPregen: true, scheme: ["DKLS"] });
2838
+ walletId = this.findWalletId(void 0, { forbidPregen: true, scheme: ["DKLS", "ED25519"] });
2829
2839
  }
2830
2840
  const wallet = this.wallets[walletId];
2831
2841
  if (this.externalWallets[walletId]) {
@@ -2834,9 +2844,6 @@ const _ParaCore = class _ParaCore {
2834
2844
  if (!wallet || !wallet.signer) {
2835
2845
  throw new Error("Wallet not found with id: " + walletId);
2836
2846
  }
2837
- if (wallet.scheme !== "DKLS") {
2838
- throw new Error("Cannot export private key for a Solana wallet");
2839
- }
2840
2847
  if (wallet.isPregen && !!wallet.pregenIdentifier && wallet.pregenIdentifierType !== "GUEST_ID") {
2841
2848
  throw new Error("Cannot export private key for a pregenerated wallet");
2842
2849
  }
@@ -46,7 +46,7 @@ __export(constants_exports, {
46
46
  TRANSACTION_REVIEW_TIMEOUT_MS: () => TRANSACTION_REVIEW_TIMEOUT_MS
47
47
  });
48
48
  module.exports = __toCommonJS(constants_exports);
49
- const PARA_CORE_VERSION = "2.26.0";
49
+ const PARA_CORE_VERSION = "2.28.0";
50
50
  const PREFIX = "@CAPSULE/";
51
51
  const PARA_PREFIX = "@PARA/";
52
52
  const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
package/dist/cjs/index.js CHANGED
@@ -82,6 +82,7 @@ __export(src_exports, {
82
82
  getNetworkPrefix: () => import_onRamps.getNetworkPrefix,
83
83
  getOnRampAssets: () => import_onRamps.getOnRampAssets,
84
84
  getOnRampNetworks: () => import_onRamps.getOnRampNetworks,
85
+ getParaConnectBaseUrl: () => import_url.getParaConnectBaseUrl,
85
86
  getPortalBaseURL: () => import_url.getPortalBaseURL,
86
87
  getPortalDomain: () => import_utils.getPortalDomain,
87
88
  getPublicKeyFromSignature: () => import_utils2.getPublicKeyFromSignature,
@@ -182,6 +183,7 @@ var src_default = import_ParaCore.ParaCore;
182
183
  getNetworkPrefix,
183
184
  getOnRampAssets,
184
185
  getOnRampNetworks,
186
+ getParaConnectBaseUrl,
185
187
  getPortalBaseURL,
186
188
  getPortalDomain,
187
189
  getPublicKeyFromSignature,
@@ -687,7 +687,7 @@ class AuthService {
687
687
  const { url } = yield this.getNewCredentialAndUrl({ isForNewDevice: true, authMethod });
688
688
  return url;
689
689
  });
690
- this.resendVerificationCode = (_0) => __async(this, [_0], function* ({ type: reason = "SIGNUP" }) {
690
+ this.resendVerificationCode = (_0) => __async(this, [_0], function* ({ type: reason = "SIGNUP", deliveryChannel }) {
691
691
  let type, linkedAccountId;
692
692
  switch (reason) {
693
693
  case "SIGNUP":
@@ -709,10 +709,11 @@ class AuthService {
709
709
  if (type !== "EMAIL" && type !== "PHONE") {
710
710
  throw new Error("invalid auth type for verification code");
711
711
  }
712
- yield __privateGet(this, _paraCoreInterface).ctx.client.resendVerificationCode(__spreadValues({
712
+ return yield __privateGet(this, _paraCoreInterface).ctx.client.resendVerificationCode(__spreadValues({
713
713
  userId,
714
714
  type,
715
- linkedAccountId
715
+ linkedAccountId,
716
+ deliveryChannel
716
717
  }, __privateGet(this, _paraCoreInterface).getVerificationEmailProps()));
717
718
  });
718
719
  __privateSet(this, _paraCoreInterface, paraCore.getAuthServiceInterface());
@@ -71,7 +71,7 @@ var import_events = require("../types/events.js");
71
71
  var import_shareDistribution = require("../shares/shareDistribution.js");
72
72
  var import_constants = require("../constants.js");
73
73
  var import_stateListener = require("../utils/stateListener.js");
74
- var _stateManager, _authService, _walletService, _pollingService, _paraCoreInterface, _isCreateGuestWalletsPending, _fetchOverridePromise;
74
+ var _stateManager, _authService, _walletService, _pollingService, _paraCoreInterface, _isCreateGuestWalletsPending, _fetchOverridePromise, _claimPregenWalletEntities;
75
75
  class PregenWalletService {
76
76
  constructor(paraCore) {
77
77
  __privateAdd(this, _stateManager);
@@ -129,37 +129,50 @@ class PregenWalletService {
129
129
  }
130
130
  const { supportedWalletTypes } = yield __privateGet(this, _paraCoreInterface).assertPartner();
131
131
  const pregenWallets = yield this.getPregenWallets();
132
- let recoverySecret, walletIds = {};
132
+ let recoverySecret;
133
+ let walletIds = {};
133
134
  if (pregenWallets.length > 0) {
134
- try {
135
- const shares = yield __privateGet(this, _paraCoreInterface).ctx.enclaveClient.getPregenShares({
136
- userId: __privateGet(this, _authService).userId,
137
- walletIds: pregenWallets.map((w) => w.id),
138
- partnerId: pregenWallets[0].partnerId
139
- });
140
- for (const share of shares) {
141
- const wallet = pregenWallets.find((w) => w.id === share.walletId);
142
- if (wallet) {
143
- __privateGet(this, _walletService).wallets[wallet.id] = {
144
- id: wallet.id,
145
- address: wallet.address,
146
- scheme: wallet.scheme,
147
- type: wallet.type,
148
- partnerId: wallet.partnerId,
149
- isPregen: wallet.isPregen,
150
- pregenIdentifier: wallet.pregenIdentifier,
151
- pregenIdentifierType: wallet.pregenIdentifierType,
152
- signer: share.signer,
153
- createdAt: String(wallet.createdAt)
154
- };
135
+ let candidates = pregenWallets.filter((w) => {
136
+ var _a;
137
+ return !!((_a = __privateGet(this, _walletService).wallets[w.id]) == null ? void 0 : _a.signer);
138
+ });
139
+ if (candidates.length === 0) {
140
+ try {
141
+ const shares = yield __privateGet(this, _paraCoreInterface).ctx.enclaveClient.getPregenShares({
142
+ userId: __privateGet(this, _authService).userId,
143
+ walletIds: pregenWallets.map((w) => w.id),
144
+ partnerId: pregenWallets[0].partnerId
145
+ });
146
+ for (const share of shares) {
147
+ const wallet = pregenWallets.find((w) => w.id === share.walletId);
148
+ if (wallet) {
149
+ __privateGet(this, _walletService).wallets[wallet.id] = {
150
+ id: wallet.id,
151
+ address: wallet.address,
152
+ scheme: wallet.scheme,
153
+ type: wallet.type,
154
+ partnerId: wallet.partnerId,
155
+ isPregen: wallet.isPregen,
156
+ pregenIdentifier: wallet.pregenIdentifier,
157
+ pregenIdentifierType: wallet.pregenIdentifierType,
158
+ signer: share.signer,
159
+ createdAt: String(wallet.createdAt)
160
+ };
161
+ }
155
162
  }
163
+ } catch (err) {
164
+ console.warn("[performClaimPregenWallets] Failed to fetch pregen shares:", err);
156
165
  }
157
- } catch (err) {
158
- console.warn("[performClaimPregenWallets] Failed to fetch pregen shares:", err);
166
+ candidates = pregenWallets.filter((w) => {
167
+ var _a;
168
+ return !!((_a = __privateGet(this, _walletService).wallets[w.id]) == null ? void 0 : _a.signer);
169
+ });
159
170
  }
160
- recoverySecret = yield this.claimPregenWallets();
171
+ const { recoverySecret: claimRecoverySecret, claimedWalletIds } = yield __privateGet(this, _claimPregenWalletEntities).call(this, candidates);
172
+ recoverySecret = claimRecoverySecret;
173
+ const claimed = candidates.filter((w) => claimedWalletIds.includes(w.id));
161
174
  walletIds = supportedWalletTypes.reduce((acc, { type }) => {
162
- const wallet = pregenWallets.find((w) => !!import_wallet2.WalletSchemeTypeMap[w.scheme][type]);
175
+ const wallet = claimed.find((w) => !!import_wallet2.WalletSchemeTypeMap[w.scheme][type]);
163
176
  if (!wallet) {
164
177
  return acc;
165
178
  }
@@ -173,22 +186,42 @@ class PregenWalletService {
173
186
  return resp;
174
187
  });
175
188
  this.claimPregenWallets = (..._0) => __async(this, [..._0], function* ({ pregenId } = {}) {
176
- var _a;
177
189
  __privateGet(this, _paraCoreInterface).requireApiKey();
178
190
  const pregenWallets = pregenId ? yield this.getPregenWallets({ pregenId }) : yield this.getPregenWallets();
179
191
  if (pregenWallets.length === 0) {
180
192
  return void 0;
181
193
  }
182
- const missingWallets = pregenWallets.filter((wallet) => !__privateGet(this, _walletService).wallets[wallet.id]);
183
- if (missingWallets.length > 0) {
184
- throw new Error(
185
- `Cannot claim pregen wallets because wallet data is missing. Please call setUserShare first to load the wallet data for the following wallet IDs: ${missingWallets.map((w) => w.id).join(", ")}`
194
+ const { recoverySecret } = yield __privateGet(this, _claimPregenWalletEntities).call(this, pregenWallets);
195
+ return recoverySecret;
196
+ });
197
+ // Claims only the pregen entities for which the SDK has local signer
198
+ // material. Wallets without signer material are skipped (warned, not
199
+ // thrown) so a stale/duplicate backend row cannot block login.
200
+ // Returns the wallet IDs the backend confirmed claiming so callers can
201
+ // surface only confirmed wallets.
202
+ __privateAdd(this, _claimPregenWalletEntities, (pregenWallets) => __async(this, null, function* () {
203
+ var _a;
204
+ const claimable = pregenWallets.filter((w) => {
205
+ var _a2;
206
+ return !!((_a2 = __privateGet(this, _walletService).wallets[w.id]) == null ? void 0 : _a2.signer);
207
+ });
208
+ const skipped = pregenWallets.filter((w) => {
209
+ var _a2;
210
+ return !((_a2 = __privateGet(this, _walletService).wallets[w.id]) == null ? void 0 : _a2.signer);
211
+ });
212
+ if (skipped.length > 0) {
213
+ console.warn(
214
+ "[claimPregenWallets] Skipping pregen wallets without local share material:",
215
+ skipped.map((w) => w.id)
186
216
  );
187
217
  }
218
+ if (claimable.length === 0) {
219
+ return { recoverySecret: void 0, claimedWalletIds: [] };
220
+ }
188
221
  let newRecoverySecret;
189
222
  const { walletIds } = yield __privateGet(this, _paraCoreInterface).ctx.client.claimPregenWallets({
190
223
  userId: __privateGet(this, _authService).userId,
191
- walletIds: pregenWallets.map((w) => w.id)
224
+ walletIds: claimable.map((w) => w.id)
192
225
  });
193
226
  for (const walletId of walletIds) {
194
227
  const wallet = __privateGet(this, _walletService).wallets[walletId];
@@ -233,8 +266,8 @@ class PregenWalletService {
233
266
  });
234
267
  }
235
268
  yield __privateGet(this, _walletService).setWallets(__privateGet(this, _walletService).wallets);
236
- return newRecoverySecret;
237
- });
269
+ return { recoverySecret: newRecoverySecret, claimedWalletIds: walletIds };
270
+ }));
238
271
  this.getPregenWallets = (..._0) => __async(this, [..._0], function* ({ pregenId } = {}) {
239
272
  const pregenIds = pregenId ? (0, import_user_management_client.toPregenIds)(pregenId) : this.pregenIds;
240
273
  if (!pregenIds || Object.keys(pregenIds).length === 0) {
@@ -438,6 +471,7 @@ _pollingService = new WeakMap();
438
471
  _paraCoreInterface = new WeakMap();
439
472
  _isCreateGuestWalletsPending = new WeakMap();
440
473
  _fetchOverridePromise = new WeakMap();
474
+ _claimPregenWalletEntities = new WeakMap();
441
475
  // Annotate the CommonJS export names for ESM import in node:
442
476
  0 && (module.exports = {
443
477
  PregenWalletService
@@ -115,7 +115,7 @@ const _CoreStateManager = class _CoreStateManager {
115
115
  * Extracts all data needed by UI consumers from authStateResult.
116
116
  */
117
117
  computeAuthStateInfo(authContext, walletContext) {
118
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
118
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E;
119
119
  const defaultAuthStateInfo = {
120
120
  userId: null,
121
121
  isPasskeySupported: false,
@@ -129,6 +129,9 @@ const _CoreStateManager = class _CoreStateManager {
129
129
  pinUrl: null,
130
130
  passkeyId: null,
131
131
  verificationUrl: null,
132
+ deliveryChannel: null,
133
+ fallbackUsed: false,
134
+ fallbackChannel: null,
132
135
  externalWalletVerification: null,
133
136
  recoverySecret: null,
134
137
  isNewUser: false
@@ -164,6 +167,9 @@ const _CoreStateManager = class _CoreStateManager {
164
167
  let verificationUrl = null;
165
168
  let passkeyHints = null;
166
169
  let passkeyId = null;
170
+ let deliveryChannel = null;
171
+ let fallbackUsed = false;
172
+ let fallbackChannel = null;
167
173
  if (stage === "login") {
168
174
  const loginState = authStateResult;
169
175
  const authMethods = (_j = loginState.loginAuthMethods) != null ? _j : [];
@@ -190,6 +196,9 @@ const _CoreStateManager = class _CoreStateManager {
190
196
  } else if (stage === "verify") {
191
197
  const verifyState = authStateResult;
192
198
  verificationUrl = (_w = verifyState.loginUrl) != null ? _w : null;
199
+ deliveryChannel = (_x = verifyState.deliveryChannel) != null ? _x : null;
200
+ fallbackUsed = (_y = verifyState.fallbackUsed) != null ? _y : false;
201
+ fallbackChannel = (_z = verifyState.fallbackChannel) != null ? _z : null;
193
202
  }
194
203
  return {
195
204
  userId,
@@ -204,10 +213,13 @@ const _CoreStateManager = class _CoreStateManager {
204
213
  pinUrl,
205
214
  passkeyId,
206
215
  verificationUrl,
216
+ deliveryChannel,
217
+ fallbackUsed,
218
+ fallbackChannel,
207
219
  externalWalletVerification: externalWalletVerification ? {
208
- signatureVerificationMessage: (_x = externalWalletVerification.signatureVerificationMessage) != null ? _x : "",
209
- walletAddress: (_z = (_y = externalWalletVerification.externalWallet) == null ? void 0 : _y.address) != null ? _z : "",
210
- walletType: (_B = (_A = externalWalletVerification.externalWallet) == null ? void 0 : _A.type) != null ? _B : ""
220
+ signatureVerificationMessage: (_A = externalWalletVerification.signatureVerificationMessage) != null ? _A : "",
221
+ walletAddress: (_C = (_B = externalWalletVerification.externalWallet) == null ? void 0 : _B.address) != null ? _C : "",
222
+ walletType: (_E = (_D = externalWalletVerification.externalWallet) == null ? void 0 : _D.type) != null ? _E : ""
211
223
  } : null,
212
224
  recoverySecret,
213
225
  isNewUser
@@ -268,7 +280,7 @@ const _CoreStateManager = class _CoreStateManager {
268
280
  }
269
281
  authStateInfoEqual(a, b) {
270
282
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
271
- return a.userId === b.userId && a.isPasskeySupported === b.isPasskeySupported && a.hasPasskey === b.hasPasskey && a.hasPassword === b.hasPassword && a.hasPin === b.hasPin && a.passkeyUrl === b.passkeyUrl && a.passkeyKnownDeviceUrl === b.passkeyKnownDeviceUrl && a.passwordUrl === b.passwordUrl && a.pinUrl === b.pinUrl && a.passkeyId === b.passkeyId && a.verificationUrl === b.verificationUrl && a.recoverySecret === b.recoverySecret && a.isNewUser === b.isNewUser && ((_a = a.externalWalletVerification) == null ? void 0 : _a.signatureVerificationMessage) === ((_b = b.externalWalletVerification) == null ? void 0 : _b.signatureVerificationMessage) && ((_c = a.externalWalletVerification) == null ? void 0 : _c.walletAddress) === ((_d = b.externalWalletVerification) == null ? void 0 : _d.walletAddress) && ((_e = a.externalWalletVerification) == null ? void 0 : _e.walletType) === ((_f = b.externalWalletVerification) == null ? void 0 : _f.walletType) && ((_g = a.passkeyHints) == null ? void 0 : _g.length) === ((_h = b.passkeyHints) == null ? void 0 : _h.length) && ((_i = a.passkeyHints) != null ? _i : []).every(
283
+ return a.userId === b.userId && a.isPasskeySupported === b.isPasskeySupported && a.hasPasskey === b.hasPasskey && a.hasPassword === b.hasPassword && a.hasPin === b.hasPin && a.passkeyUrl === b.passkeyUrl && a.passkeyKnownDeviceUrl === b.passkeyKnownDeviceUrl && a.passwordUrl === b.passwordUrl && a.pinUrl === b.pinUrl && a.passkeyId === b.passkeyId && a.verificationUrl === b.verificationUrl && a.deliveryChannel === b.deliveryChannel && a.fallbackUsed === b.fallbackUsed && a.fallbackChannel === b.fallbackChannel && a.recoverySecret === b.recoverySecret && a.isNewUser === b.isNewUser && ((_a = a.externalWalletVerification) == null ? void 0 : _a.signatureVerificationMessage) === ((_b = b.externalWalletVerification) == null ? void 0 : _b.signatureVerificationMessage) && ((_c = a.externalWalletVerification) == null ? void 0 : _c.walletAddress) === ((_d = b.externalWalletVerification) == null ? void 0 : _d.walletAddress) && ((_e = a.externalWalletVerification) == null ? void 0 : _e.walletType) === ((_f = b.externalWalletVerification) == null ? void 0 : _f.walletType) && ((_g = a.passkeyHints) == null ? void 0 : _g.length) === ((_h = b.passkeyHints) == null ? void 0 : _h.length) && ((_i = a.passkeyHints) != null ? _i : []).every(
272
284
  (hint, i) => hint.useragent === b.passkeyHints[i].useragent && hint.aaguid === b.passkeyHints[i].aaguid
273
285
  );
274
286
  }
@@ -215,6 +215,28 @@ function createWalletStateMachine(paraCoreInterface) {
215
215
  ]
216
216
  },
217
217
  needs_wallets: {
218
+ // `needs_wallets` is otherwise a passive state that waits for the consumer
219
+ // to dispatch `WAIT_FOR_WALLET_CREATION`. That contract is fine for
220
+ // `isNewUser` reaching this state without auto-create (`checking_wallet_state`
221
+ // guard at line ~127), but it traps existing users who landed here via
222
+ // `waiting_for_wallets` COMPLETE with `needsWallet=true` — i.e., an
223
+ // authenticated user whose wallets don't satisfy the partner's
224
+ // `supportedWalletTypes` (e.g. EVM-only user logging into a Solana-only
225
+ // partner). Their auth flow set `shouldAutoCreateWallets: true` via
226
+ // `authenticateWithOAuth` / `authenticateWithEmailOrPhone`, but the
227
+ // existing `claiming_wallets` guard requires `isNewUser ||
228
+ // shouldClaimGuestWallets`, neither of which is true for them, so
229
+ // auto-create silently never happens.
230
+ //
231
+ // When `shouldAutoCreate` is true, route directly to `creating_wallets`.
232
+ // `createWalletPerType` is partner-aware via `#getMissingTypes`, so it
233
+ // provisions exactly the missing required types (no duplicates).
234
+ always: [
235
+ {
236
+ target: "creating_wallets",
237
+ guard: "shouldAutoCreate"
238
+ }
239
+ ],
218
240
  on: {
219
241
  WAIT_FOR_WALLET_CREATION: {
220
242
  target: "claiming_wallets",
@@ -45,7 +45,12 @@ function formatStateError(error, defaultMessage) {
45
45
  return new Error(error);
46
46
  }
47
47
  if (error && typeof error === "object" && "message" in error) {
48
- return new Error(String(error.message));
48
+ const src = error;
49
+ const normalized = Object.assign(new Error(String(src.message)), {});
50
+ if ("code" in src) normalized.code = src.code;
51
+ if ("status" in src) normalized.status = src.status;
52
+ if ("data" in src) normalized.data = src.data;
53
+ return normalized;
49
54
  }
50
55
  if (error && typeof error === "object" && "error" in error) {
51
56
  return formatStateError(error.error, defaultMessage);
@@ -1348,6 +1348,15 @@ const _ParaCore = class _ParaCore {
1348
1348
  if (!wallet) {
1349
1349
  throw new Error("wallet not found");
1350
1350
  }
1351
+ if (wallet.scheme === "ED25519") {
1352
+ return yield this.platformUtils.getED25519PrivateKey(
1353
+ this.ctx,
1354
+ this.userId,
1355
+ wallet.id,
1356
+ wallet.signer,
1357
+ this.retrieveSessionCookie()
1358
+ );
1359
+ }
1351
1360
  if (wallet.scheme !== "DKLS") {
1352
1361
  throw new Error("invalid wallet scheme");
1353
1362
  }
@@ -1522,8 +1531,8 @@ const _ParaCore = class _ParaCore {
1522
1531
  * Resend a verification email for the current user.
1523
1532
  */
1524
1533
  resendVerificationCode(_0) {
1525
- return __async(this, arguments, function* ({ type: reason = "SIGNUP" }) {
1526
- return yield __privateGet(this, _authService).resendVerificationCode({ type: reason });
1534
+ return __async(this, arguments, function* ({ type: reason = "SIGNUP", deliveryChannel }) {
1535
+ return yield __privateGet(this, _authService).resendVerificationCode({ type: reason, deliveryChannel });
1527
1536
  });
1528
1537
  }
1529
1538
  /**
@@ -2759,15 +2768,16 @@ const _ParaCore = class _ParaCore {
2759
2768
  }
2760
2769
  sendLoginCode() {
2761
2770
  return __async(this, null, function* () {
2762
- const { userId } = yield this.ctx.client.sendLoginVerificationCode(this.authInfo);
2771
+ const { userId, deliveryChannel, fallbackUsed, fallbackChannel, isSmsAllowed } = yield this.ctx.client.sendLoginVerificationCode(this.authInfo);
2763
2772
  this.setUserId(userId);
2773
+ return { deliveryChannel, fallbackUsed, fallbackChannel, isSmsAllowed };
2764
2774
  });
2765
2775
  }
2766
2776
  exportPrivateKey() {
2767
2777
  return __async(this, arguments, function* (args = {}) {
2768
2778
  let walletId = args == null ? void 0 : args.walletId;
2769
2779
  if (!(args == null ? void 0 : args.walletId)) {
2770
- walletId = this.findWalletId(void 0, { forbidPregen: true, scheme: ["DKLS"] });
2780
+ walletId = this.findWalletId(void 0, { forbidPregen: true, scheme: ["DKLS", "ED25519"] });
2771
2781
  }
2772
2782
  const wallet = this.wallets[walletId];
2773
2783
  if (this.externalWallets[walletId]) {
@@ -2776,9 +2786,6 @@ const _ParaCore = class _ParaCore {
2776
2786
  if (!wallet || !wallet.signer) {
2777
2787
  throw new Error("Wallet not found with id: " + walletId);
2778
2788
  }
2779
- if (wallet.scheme !== "DKLS") {
2780
- throw new Error("Cannot export private key for a Solana wallet");
2781
- }
2782
2789
  if (wallet.isPregen && !!wallet.pregenIdentifier && wallet.pregenIdentifierType !== "GUEST_ID") {
2783
2790
  throw new Error("Cannot export private key for a pregenerated wallet");
2784
2791
  }
@@ -1,5 +1,5 @@
1
1
  import "./chunk-7B52C2XE.js";
2
- const PARA_CORE_VERSION = "2.26.0";
2
+ const PARA_CORE_VERSION = "2.28.0";
3
3
  const PREFIX = "@CAPSULE/";
4
4
  const PARA_PREFIX = "@PARA/";
5
5
  const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
package/dist/esm/index.js CHANGED
@@ -83,7 +83,7 @@ export * from "./utils/phone.js";
83
83
  export * from "./utils/config.js";
84
84
  import { isWalletSupported } from "./utils/wallet.js";
85
85
  import { getNetworkPrefix, getOnRampAssets, getOnRampNetworks, toAssetInfoArray } from "./utils/onRamps.js";
86
- import { getPortalBaseURL } from "./utils/url.js";
86
+ import { getPortalBaseURL, getParaConnectBaseUrl } from "./utils/url.js";
87
87
  import { retrieve } from "./transmission/transmissionUtils.js";
88
88
  const paraVersion = ParaCore.version;
89
89
  var src_default = ParaCore;
@@ -142,6 +142,7 @@ export {
142
142
  getNetworkPrefix,
143
143
  getOnRampAssets,
144
144
  getOnRampNetworks,
145
+ getParaConnectBaseUrl,
145
146
  getPortalBaseURL,
146
147
  getPortalDomain,
147
148
  getPublicKeyFromSignature,
@@ -618,7 +618,7 @@ class AuthService {
618
618
  const { url } = yield this.getNewCredentialAndUrl({ isForNewDevice: true, authMethod });
619
619
  return url;
620
620
  });
621
- this.resendVerificationCode = (_0) => __async(this, [_0], function* ({ type: reason = "SIGNUP" }) {
621
+ this.resendVerificationCode = (_0) => __async(this, [_0], function* ({ type: reason = "SIGNUP", deliveryChannel }) {
622
622
  let type, linkedAccountId;
623
623
  switch (reason) {
624
624
  case "SIGNUP":
@@ -640,10 +640,11 @@ class AuthService {
640
640
  if (type !== "EMAIL" && type !== "PHONE") {
641
641
  throw new Error("invalid auth type for verification code");
642
642
  }
643
- yield __privateGet(this, _paraCoreInterface).ctx.client.resendVerificationCode(__spreadValues({
643
+ return yield __privateGet(this, _paraCoreInterface).ctx.client.resendVerificationCode(__spreadValues({
644
644
  userId,
645
645
  type,
646
- linkedAccountId
646
+ linkedAccountId,
647
+ deliveryChannel
647
648
  }, __privateGet(this, _paraCoreInterface).getVerificationEmailProps()));
648
649
  });
649
650
  __privateSet(this, _paraCoreInterface, paraCore.getAuthServiceInterface());
@@ -6,7 +6,7 @@ import {
6
6
  __spreadProps,
7
7
  __spreadValues
8
8
  } from "../chunk-7B52C2XE.js";
9
- var _stateManager, _authService, _walletService, _pollingService, _paraCoreInterface, _isCreateGuestWalletsPending, _fetchOverridePromise;
9
+ var _stateManager, _authService, _walletService, _pollingService, _paraCoreInterface, _isCreateGuestWalletsPending, _fetchOverridePromise, _claimPregenWalletEntities;
10
10
  import {
11
11
  isPregenAuth,
12
12
  toPregenIds,
@@ -81,37 +81,50 @@ class PregenWalletService {
81
81
  }
82
82
  const { supportedWalletTypes } = yield __privateGet(this, _paraCoreInterface).assertPartner();
83
83
  const pregenWallets = yield this.getPregenWallets();
84
- let recoverySecret, walletIds = {};
84
+ let recoverySecret;
85
+ let walletIds = {};
85
86
  if (pregenWallets.length > 0) {
86
- try {
87
- const shares = yield __privateGet(this, _paraCoreInterface).ctx.enclaveClient.getPregenShares({
88
- userId: __privateGet(this, _authService).userId,
89
- walletIds: pregenWallets.map((w) => w.id),
90
- partnerId: pregenWallets[0].partnerId
91
- });
92
- for (const share of shares) {
93
- const wallet = pregenWallets.find((w) => w.id === share.walletId);
94
- if (wallet) {
95
- __privateGet(this, _walletService).wallets[wallet.id] = {
96
- id: wallet.id,
97
- address: wallet.address,
98
- scheme: wallet.scheme,
99
- type: wallet.type,
100
- partnerId: wallet.partnerId,
101
- isPregen: wallet.isPregen,
102
- pregenIdentifier: wallet.pregenIdentifier,
103
- pregenIdentifierType: wallet.pregenIdentifierType,
104
- signer: share.signer,
105
- createdAt: String(wallet.createdAt)
106
- };
87
+ let candidates = pregenWallets.filter((w) => {
88
+ var _a;
89
+ return !!((_a = __privateGet(this, _walletService).wallets[w.id]) == null ? void 0 : _a.signer);
90
+ });
91
+ if (candidates.length === 0) {
92
+ try {
93
+ const shares = yield __privateGet(this, _paraCoreInterface).ctx.enclaveClient.getPregenShares({
94
+ userId: __privateGet(this, _authService).userId,
95
+ walletIds: pregenWallets.map((w) => w.id),
96
+ partnerId: pregenWallets[0].partnerId
97
+ });
98
+ for (const share of shares) {
99
+ const wallet = pregenWallets.find((w) => w.id === share.walletId);
100
+ if (wallet) {
101
+ __privateGet(this, _walletService).wallets[wallet.id] = {
102
+ id: wallet.id,
103
+ address: wallet.address,
104
+ scheme: wallet.scheme,
105
+ type: wallet.type,
106
+ partnerId: wallet.partnerId,
107
+ isPregen: wallet.isPregen,
108
+ pregenIdentifier: wallet.pregenIdentifier,
109
+ pregenIdentifierType: wallet.pregenIdentifierType,
110
+ signer: share.signer,
111
+ createdAt: String(wallet.createdAt)
112
+ };
113
+ }
107
114
  }
115
+ } catch (err) {
116
+ console.warn("[performClaimPregenWallets] Failed to fetch pregen shares:", err);
108
117
  }
109
- } catch (err) {
110
- console.warn("[performClaimPregenWallets] Failed to fetch pregen shares:", err);
118
+ candidates = pregenWallets.filter((w) => {
119
+ var _a;
120
+ return !!((_a = __privateGet(this, _walletService).wallets[w.id]) == null ? void 0 : _a.signer);
121
+ });
111
122
  }
112
- recoverySecret = yield this.claimPregenWallets();
123
+ const { recoverySecret: claimRecoverySecret, claimedWalletIds } = yield __privateGet(this, _claimPregenWalletEntities).call(this, candidates);
124
+ recoverySecret = claimRecoverySecret;
125
+ const claimed = candidates.filter((w) => claimedWalletIds.includes(w.id));
113
126
  walletIds = supportedWalletTypes.reduce((acc, { type }) => {
114
- const wallet = pregenWallets.find((w) => !!WalletSchemeTypeMap[w.scheme][type]);
127
+ const wallet = claimed.find((w) => !!WalletSchemeTypeMap[w.scheme][type]);
115
128
  if (!wallet) {
116
129
  return acc;
117
130
  }
@@ -125,22 +138,42 @@ class PregenWalletService {
125
138
  return resp;
126
139
  });
127
140
  this.claimPregenWallets = (..._0) => __async(this, [..._0], function* ({ pregenId } = {}) {
128
- var _a;
129
141
  __privateGet(this, _paraCoreInterface).requireApiKey();
130
142
  const pregenWallets = pregenId ? yield this.getPregenWallets({ pregenId }) : yield this.getPregenWallets();
131
143
  if (pregenWallets.length === 0) {
132
144
  return void 0;
133
145
  }
134
- const missingWallets = pregenWallets.filter((wallet) => !__privateGet(this, _walletService).wallets[wallet.id]);
135
- if (missingWallets.length > 0) {
136
- throw new Error(
137
- `Cannot claim pregen wallets because wallet data is missing. Please call setUserShare first to load the wallet data for the following wallet IDs: ${missingWallets.map((w) => w.id).join(", ")}`
146
+ const { recoverySecret } = yield __privateGet(this, _claimPregenWalletEntities).call(this, pregenWallets);
147
+ return recoverySecret;
148
+ });
149
+ // Claims only the pregen entities for which the SDK has local signer
150
+ // material. Wallets without signer material are skipped (warned, not
151
+ // thrown) so a stale/duplicate backend row cannot block login.
152
+ // Returns the wallet IDs the backend confirmed claiming so callers can
153
+ // surface only confirmed wallets.
154
+ __privateAdd(this, _claimPregenWalletEntities, (pregenWallets) => __async(this, null, function* () {
155
+ var _a;
156
+ const claimable = pregenWallets.filter((w) => {
157
+ var _a2;
158
+ return !!((_a2 = __privateGet(this, _walletService).wallets[w.id]) == null ? void 0 : _a2.signer);
159
+ });
160
+ const skipped = pregenWallets.filter((w) => {
161
+ var _a2;
162
+ return !((_a2 = __privateGet(this, _walletService).wallets[w.id]) == null ? void 0 : _a2.signer);
163
+ });
164
+ if (skipped.length > 0) {
165
+ console.warn(
166
+ "[claimPregenWallets] Skipping pregen wallets without local share material:",
167
+ skipped.map((w) => w.id)
138
168
  );
139
169
  }
170
+ if (claimable.length === 0) {
171
+ return { recoverySecret: void 0, claimedWalletIds: [] };
172
+ }
140
173
  let newRecoverySecret;
141
174
  const { walletIds } = yield __privateGet(this, _paraCoreInterface).ctx.client.claimPregenWallets({
142
175
  userId: __privateGet(this, _authService).userId,
143
- walletIds: pregenWallets.map((w) => w.id)
176
+ walletIds: claimable.map((w) => w.id)
144
177
  });
145
178
  for (const walletId of walletIds) {
146
179
  const wallet = __privateGet(this, _walletService).wallets[walletId];
@@ -185,8 +218,8 @@ class PregenWalletService {
185
218
  });
186
219
  }
187
220
  yield __privateGet(this, _walletService).setWallets(__privateGet(this, _walletService).wallets);
188
- return newRecoverySecret;
189
- });
221
+ return { recoverySecret: newRecoverySecret, claimedWalletIds: walletIds };
222
+ }));
190
223
  this.getPregenWallets = (..._0) => __async(this, [..._0], function* ({ pregenId } = {}) {
191
224
  const pregenIds = pregenId ? toPregenIds(pregenId) : this.pregenIds;
192
225
  if (!pregenIds || Object.keys(pregenIds).length === 0) {
@@ -390,6 +423,7 @@ _pollingService = new WeakMap();
390
423
  _paraCoreInterface = new WeakMap();
391
424
  _isCreateGuestWalletsPending = new WeakMap();
392
425
  _fetchOverridePromise = new WeakMap();
426
+ _claimPregenWalletEntities = new WeakMap();
393
427
  export {
394
428
  PregenWalletService
395
429
  };
@@ -80,7 +80,7 @@ const _CoreStateManager = class _CoreStateManager {
80
80
  * Extracts all data needed by UI consumers from authStateResult.
81
81
  */
82
82
  computeAuthStateInfo(authContext, walletContext) {
83
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
83
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E;
84
84
  const defaultAuthStateInfo = {
85
85
  userId: null,
86
86
  isPasskeySupported: false,
@@ -94,6 +94,9 @@ const _CoreStateManager = class _CoreStateManager {
94
94
  pinUrl: null,
95
95
  passkeyId: null,
96
96
  verificationUrl: null,
97
+ deliveryChannel: null,
98
+ fallbackUsed: false,
99
+ fallbackChannel: null,
97
100
  externalWalletVerification: null,
98
101
  recoverySecret: null,
99
102
  isNewUser: false
@@ -129,6 +132,9 @@ const _CoreStateManager = class _CoreStateManager {
129
132
  let verificationUrl = null;
130
133
  let passkeyHints = null;
131
134
  let passkeyId = null;
135
+ let deliveryChannel = null;
136
+ let fallbackUsed = false;
137
+ let fallbackChannel = null;
132
138
  if (stage === "login") {
133
139
  const loginState = authStateResult;
134
140
  const authMethods = (_j = loginState.loginAuthMethods) != null ? _j : [];
@@ -155,6 +161,9 @@ const _CoreStateManager = class _CoreStateManager {
155
161
  } else if (stage === "verify") {
156
162
  const verifyState = authStateResult;
157
163
  verificationUrl = (_w = verifyState.loginUrl) != null ? _w : null;
164
+ deliveryChannel = (_x = verifyState.deliveryChannel) != null ? _x : null;
165
+ fallbackUsed = (_y = verifyState.fallbackUsed) != null ? _y : false;
166
+ fallbackChannel = (_z = verifyState.fallbackChannel) != null ? _z : null;
158
167
  }
159
168
  return {
160
169
  userId,
@@ -169,10 +178,13 @@ const _CoreStateManager = class _CoreStateManager {
169
178
  pinUrl,
170
179
  passkeyId,
171
180
  verificationUrl,
181
+ deliveryChannel,
182
+ fallbackUsed,
183
+ fallbackChannel,
172
184
  externalWalletVerification: externalWalletVerification ? {
173
- signatureVerificationMessage: (_x = externalWalletVerification.signatureVerificationMessage) != null ? _x : "",
174
- walletAddress: (_z = (_y = externalWalletVerification.externalWallet) == null ? void 0 : _y.address) != null ? _z : "",
175
- walletType: (_B = (_A = externalWalletVerification.externalWallet) == null ? void 0 : _A.type) != null ? _B : ""
185
+ signatureVerificationMessage: (_A = externalWalletVerification.signatureVerificationMessage) != null ? _A : "",
186
+ walletAddress: (_C = (_B = externalWalletVerification.externalWallet) == null ? void 0 : _B.address) != null ? _C : "",
187
+ walletType: (_E = (_D = externalWalletVerification.externalWallet) == null ? void 0 : _D.type) != null ? _E : ""
176
188
  } : null,
177
189
  recoverySecret,
178
190
  isNewUser
@@ -233,7 +245,7 @@ const _CoreStateManager = class _CoreStateManager {
233
245
  }
234
246
  authStateInfoEqual(a, b) {
235
247
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
236
- return a.userId === b.userId && a.isPasskeySupported === b.isPasskeySupported && a.hasPasskey === b.hasPasskey && a.hasPassword === b.hasPassword && a.hasPin === b.hasPin && a.passkeyUrl === b.passkeyUrl && a.passkeyKnownDeviceUrl === b.passkeyKnownDeviceUrl && a.passwordUrl === b.passwordUrl && a.pinUrl === b.pinUrl && a.passkeyId === b.passkeyId && a.verificationUrl === b.verificationUrl && a.recoverySecret === b.recoverySecret && a.isNewUser === b.isNewUser && ((_a = a.externalWalletVerification) == null ? void 0 : _a.signatureVerificationMessage) === ((_b = b.externalWalletVerification) == null ? void 0 : _b.signatureVerificationMessage) && ((_c = a.externalWalletVerification) == null ? void 0 : _c.walletAddress) === ((_d = b.externalWalletVerification) == null ? void 0 : _d.walletAddress) && ((_e = a.externalWalletVerification) == null ? void 0 : _e.walletType) === ((_f = b.externalWalletVerification) == null ? void 0 : _f.walletType) && ((_g = a.passkeyHints) == null ? void 0 : _g.length) === ((_h = b.passkeyHints) == null ? void 0 : _h.length) && ((_i = a.passkeyHints) != null ? _i : []).every(
248
+ return a.userId === b.userId && a.isPasskeySupported === b.isPasskeySupported && a.hasPasskey === b.hasPasskey && a.hasPassword === b.hasPassword && a.hasPin === b.hasPin && a.passkeyUrl === b.passkeyUrl && a.passkeyKnownDeviceUrl === b.passkeyKnownDeviceUrl && a.passwordUrl === b.passwordUrl && a.pinUrl === b.pinUrl && a.passkeyId === b.passkeyId && a.verificationUrl === b.verificationUrl && a.deliveryChannel === b.deliveryChannel && a.fallbackUsed === b.fallbackUsed && a.fallbackChannel === b.fallbackChannel && a.recoverySecret === b.recoverySecret && a.isNewUser === b.isNewUser && ((_a = a.externalWalletVerification) == null ? void 0 : _a.signatureVerificationMessage) === ((_b = b.externalWalletVerification) == null ? void 0 : _b.signatureVerificationMessage) && ((_c = a.externalWalletVerification) == null ? void 0 : _c.walletAddress) === ((_d = b.externalWalletVerification) == null ? void 0 : _d.walletAddress) && ((_e = a.externalWalletVerification) == null ? void 0 : _e.walletType) === ((_f = b.externalWalletVerification) == null ? void 0 : _f.walletType) && ((_g = a.passkeyHints) == null ? void 0 : _g.length) === ((_h = b.passkeyHints) == null ? void 0 : _h.length) && ((_i = a.passkeyHints) != null ? _i : []).every(
237
249
  (hint, i) => hint.useragent === b.passkeyHints[i].useragent && hint.aaguid === b.passkeyHints[i].aaguid
238
250
  );
239
251
  }
@@ -161,6 +161,28 @@ function createWalletStateMachine(paraCoreInterface) {
161
161
  ]
162
162
  },
163
163
  needs_wallets: {
164
+ // `needs_wallets` is otherwise a passive state that waits for the consumer
165
+ // to dispatch `WAIT_FOR_WALLET_CREATION`. That contract is fine for
166
+ // `isNewUser` reaching this state without auto-create (`checking_wallet_state`
167
+ // guard at line ~127), but it traps existing users who landed here via
168
+ // `waiting_for_wallets` COMPLETE with `needsWallet=true` — i.e., an
169
+ // authenticated user whose wallets don't satisfy the partner's
170
+ // `supportedWalletTypes` (e.g. EVM-only user logging into a Solana-only
171
+ // partner). Their auth flow set `shouldAutoCreateWallets: true` via
172
+ // `authenticateWithOAuth` / `authenticateWithEmailOrPhone`, but the
173
+ // existing `claiming_wallets` guard requires `isNewUser ||
174
+ // shouldClaimGuestWallets`, neither of which is true for them, so
175
+ // auto-create silently never happens.
176
+ //
177
+ // When `shouldAutoCreate` is true, route directly to `creating_wallets`.
178
+ // `createWalletPerType` is partner-aware via `#getMissingTypes`, so it
179
+ // provisions exactly the missing required types (no duplicates).
180
+ always: [
181
+ {
182
+ target: "creating_wallets",
183
+ guard: "shouldAutoCreate"
184
+ }
185
+ ],
164
186
  on: {
165
187
  WAIT_FOR_WALLET_CREATION: {
166
188
  target: "claiming_wallets",
@@ -23,7 +23,12 @@ function formatStateError(error, defaultMessage) {
23
23
  return new Error(error);
24
24
  }
25
25
  if (error && typeof error === "object" && "message" in error) {
26
- return new Error(String(error.message));
26
+ const src = error;
27
+ const normalized = Object.assign(new Error(String(src.message)), {});
28
+ if ("code" in src) normalized.code = src.code;
29
+ if ("status" in src) normalized.status = src.status;
30
+ if ("data" in src) normalized.data = src.data;
31
+ return normalized;
27
32
  }
28
33
  if (error && typeof error === "object" && "error" in error) {
29
34
  return formatStateError(error.error, defaultMessage);
@@ -489,7 +489,7 @@ export declare abstract class ParaCore implements CoreInterface {
489
489
  /**
490
490
  * Resend a verification email for the current user.
491
491
  */
492
- resendVerificationCode({ type: reason }: ResendVerificationCodeParams): Promise<void>;
492
+ resendVerificationCode({ type: reason, deliveryChannel }: ResendVerificationCodeParams): Promise<import("./services/types").ResendVerificationCodeResponse>;
493
493
  /**
494
494
  * Checks if the current session is active.
495
495
  * @returns `true` if active, `false` otherwise
@@ -866,6 +866,11 @@ export declare abstract class ParaCore implements CoreInterface {
866
866
  config?: BalancesConfig;
867
867
  refetch?: boolean;
868
868
  }): Promise<import("@getpara/user-management-client").ProfileBalance>;
869
- protected sendLoginCode(): Promise<void>;
869
+ protected sendLoginCode(): Promise<{
870
+ deliveryChannel: import("@getpara/user-management-client").DeliveryChannel;
871
+ fallbackUsed: boolean;
872
+ fallbackChannel: import("@getpara/user-management-client").DeliveryChannel;
873
+ isSmsAllowed: boolean;
874
+ }>;
870
875
  exportPrivateKey(args?: CoreMethodParams<'exportPrivateKey'>): CoreMethodResponse<'exportPrivateKey'>;
871
876
  }
@@ -10,6 +10,7 @@ export type EventHandler<T = any> = (data: T) => void;
10
10
  export interface PlatformUtils {
11
11
  sdkType: SDKType;
12
12
  getPrivateKey(ctx: Ctx, userId: string, walletId: string, share: string, sessionCookie: string): Promise<string>;
13
+ getED25519PrivateKey(ctx: Ctx, userId: string, walletId: string, share: string, sessionCookie: string): Promise<string>;
13
14
  keygen(ctx: Ctx, userId: string, type: Exclude<TWalletType, 'SOLANA'>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
14
15
  sessionCookie: string, emailProps?: BackupKitEmailProps): Promise<{
15
16
  signer: string;
@@ -22,7 +22,7 @@ export * from './utils/phone.js';
22
22
  export * from './utils/config.js';
23
23
  export { isWalletSupported } from './utils/wallet.js';
24
24
  export { getNetworkPrefix, getOnRampAssets, getOnRampNetworks, toAssetInfoArray } from './utils/onRamps.js';
25
- export { getPortalBaseURL } from './utils/url.js';
25
+ export { getPortalBaseURL, getParaConnectBaseUrl } from './utils/url.js';
26
26
  export { retrieve as transmissionUtilsRetrieve } from './transmission/transmissionUtils.js';
27
27
  export type { ShareData } from './shares/enclave.js';
28
28
  export type { StateSnapshot, AuthStateInfo } from './state/types/core';
@@ -1,4 +1,4 @@
1
- import type { Auth, AuthExtras, AuthMethod, AuthType, ExternalWalletInfo, PrimaryAuth, PrimaryAuthInfo, ServerAuthState, ServerAuthStateLogin, TAuthMethod, Theme, TOAuthMethod } from '@getpara/user-management-client';
1
+ import type { Auth, AuthExtras, AuthMethod, AuthType, DeliveryChannel, ExternalWalletInfo, PrimaryAuth, PrimaryAuthInfo, ServerAuthState, ServerAuthStateLogin, TAuthMethod, Theme, TOAuthMethod } from '@getpara/user-management-client';
2
2
  import type { AuthState, AuthStateDone, AuthStateLogin, AuthStateSignup, AuthStateVerify, CoreAuthInfo, WithCustomTheme, WithSessionLookupId, WithShorten, WithUseShortUrls } from '../../types/index.js';
3
3
  import type { InitOAuthPollingParams, PollingCallbacks } from './PollingServiceTypes.js';
4
4
  import { PerformConnectExternalWalletResponse, ExternalSignMessageParams } from './ExternalWalletServiceTypes.js';
@@ -142,6 +142,13 @@ export type AddCredentialMethod = (_: AddCredentialParams) => Promise<string | u
142
142
  export type SupportedUserAuthMethodsMethod = () => Promise<Set<AuthMethod>>;
143
143
  export interface ResendVerificationCodeParams {
144
144
  type?: 'SIGNUP' | 'LINK_ACCOUNT' | 'LOGIN';
145
+ deliveryChannel?: DeliveryChannel;
145
146
  }
146
- export type ResendVerificationCodeMethod = (_: ResendVerificationCodeParams) => Promise<void>;
147
+ export interface ResendVerificationCodeResponse {
148
+ deliveryChannel?: DeliveryChannel;
149
+ fallbackUsed?: boolean;
150
+ fallbackChannel?: DeliveryChannel;
151
+ isSmsAllowed?: boolean;
152
+ }
153
+ export type ResendVerificationCodeMethod = (_: ResendVerificationCodeParams) => Promise<ResendVerificationCodeResponse>;
147
154
  export {};
@@ -2784,6 +2784,10 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
2784
2784
  }];
2785
2785
  };
2786
2786
  readonly needs_wallets: {
2787
+ readonly always: readonly [{
2788
+ readonly target: "creating_wallets";
2789
+ readonly guard: "shouldAutoCreate";
2790
+ }];
2787
2791
  readonly on: {
2788
2792
  readonly WAIT_FOR_WALLET_CREATION: {
2789
2793
  readonly target: "claiming_wallets";
@@ -6426,6 +6430,10 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
6426
6430
  }];
6427
6431
  };
6428
6432
  readonly needs_wallets: {
6433
+ readonly always: readonly [{
6434
+ readonly target: "creating_wallets";
6435
+ readonly guard: "shouldAutoCreate";
6436
+ }];
6429
6437
  readonly on: {
6430
6438
  readonly WAIT_FOR_WALLET_CREATION: {
6431
6439
  readonly target: "claiming_wallets";
@@ -10141,6 +10149,10 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
10141
10149
  }];
10142
10150
  };
10143
10151
  readonly needs_wallets: {
10152
+ readonly always: readonly [{
10153
+ readonly target: "creating_wallets";
10154
+ readonly guard: "shouldAutoCreate";
10155
+ }];
10144
10156
  readonly on: {
10145
10157
  readonly WAIT_FOR_WALLET_CREATION: {
10146
10158
  readonly target: "claiming_wallets";
@@ -13794,6 +13806,10 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
13794
13806
  }];
13795
13807
  };
13796
13808
  readonly needs_wallets: {
13809
+ readonly always: readonly [{
13810
+ readonly target: "creating_wallets";
13811
+ readonly guard: "shouldAutoCreate";
13812
+ }];
13797
13813
  readonly on: {
13798
13814
  readonly WAIT_FOR_WALLET_CREATION: {
13799
13815
  readonly target: "claiming_wallets";
@@ -17541,6 +17557,10 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
17541
17557
  }];
17542
17558
  };
17543
17559
  readonly needs_wallets: {
17560
+ readonly always: readonly [{
17561
+ readonly target: "creating_wallets";
17562
+ readonly guard: "shouldAutoCreate";
17563
+ }];
17544
17564
  readonly on: {
17545
17565
  readonly WAIT_FOR_WALLET_CREATION: {
17546
17566
  readonly target: "claiming_wallets";
@@ -21195,6 +21215,10 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
21195
21215
  }];
21196
21216
  };
21197
21217
  readonly needs_wallets: {
21218
+ readonly always: readonly [{
21219
+ readonly target: "creating_wallets";
21220
+ readonly guard: "shouldAutoCreate";
21221
+ }];
21198
21222
  readonly on: {
21199
21223
  readonly WAIT_FOR_WALLET_CREATION: {
21200
21224
  readonly target: "claiming_wallets";
@@ -211,6 +211,10 @@ export declare function createWalletStateMachine(paraCoreInterface: StateMachine
211
211
  }];
212
212
  };
213
213
  readonly needs_wallets: {
214
+ readonly always: readonly [{
215
+ readonly target: "creating_wallets";
216
+ readonly guard: "shouldAutoCreate";
217
+ }];
214
218
  readonly on: {
215
219
  readonly WAIT_FOR_WALLET_CREATION: {
216
220
  readonly target: "claiming_wallets";
@@ -1,4 +1,4 @@
1
- import type { BiometricLocationHint, CurrentWalletIds, ServerAuthState } from '@getpara/user-management-client';
1
+ import type { BiometricLocationHint, CurrentWalletIds, DeliveryChannel, ServerAuthState } from '@getpara/user-management-client';
2
2
  import type { AuthState, Wallet, WithCustomTheme, WithUseShortUrls } from '../../types/index.js';
3
3
  import { AuthMachine, AuthPhase } from './auth.js';
4
4
  import { WalletMachine, WalletPhase } from './wallet.js';
@@ -87,6 +87,12 @@ export type AuthStateInfo = {
87
87
  passkeyId: string | null;
88
88
  /** Verification URL for email/phone verification in SLO */
89
89
  verificationUrl: string | null;
90
+ /** Channel the OTP was sent over — set on phone verifications so the UI can render channel-specific copy */
91
+ deliveryChannel: DeliveryChannel | null;
92
+ /** True when the server had to fall back from the primary channel (WhatsApp → SMS typically) */
93
+ fallbackUsed: boolean;
94
+ /** The channel actually used when fallbackUsed is true */
95
+ fallbackChannel: DeliveryChannel | null;
90
96
  /** External wallet verification data when signature is needed */
91
97
  externalWalletVerification: {
92
98
  signatureVerificationMessage: string;
@@ -1,9 +1,9 @@
1
- import { ExternalWalletInfo, OnRampPurchase, OnRampPurchaseCreateParams, Setup2faResponse, VerifiedAuth, WalletEntity, WalletParams, TWalletType, IssueJwtParams, IssueJwtResponse, TLinkedAccountType, LinkedAccounts, AuthMethod } from '@getpara/user-management-client';
1
+ import { ExternalWalletInfo, OnRampPurchase, OnRampPurchaseCreateParams, Setup2faResponse, VerifiedAuth, WalletEntity, WalletParams, TWalletType, IssueJwtParams, IssueJwtResponse, TLinkedAccountType, LinkedAccounts, AuthMethod, DeliveryChannel } from '@getpara/user-management-client';
2
2
  import type { OAuthResponse, WithCustomTheme, WithUseShortUrls, Verify2faParams, Verify2faResponse, AuthStateSignup, StorageType, CoreAuthInfo, TelegramParams } from './';
3
3
  import { ParaCore } from '../ParaCore.js';
4
4
  import { FullSignatureRes, Wallet } from './wallet.js';
5
5
  import { AccountLinkInProgress } from './accountLinking.js';
6
- import type { WaitForLoginParams, WaitForLoginResponse, WaitForSignupParams, WaitForWalletCreationParams, WaitForWalletCreationResponse, GetOAuthUrlParams, AddCredentialParams, LoginExternalWalletParams, LoginExternalWalletResponse, ResendVerificationCodeParams, SignUpOrLogInParams, SignUpOrLogInResponse, VerifyOAuthProcessParams, VerifyExternalWalletParams, VerifyExternalWalletResponse, VerifyFarcasterParams, VerifyTelegramParams, ClaimPregenWalletsParams, ClaimPregenWalletsResponse, CreateGuestWalletsResponse, CreatePregenWalletParams, CreatePregenWalletPerTypeParams, CreatePregenWalletPerTypeResponse, CreatePregenWalletResponse, CreateWalletParams, CreateWalletPerTypeParams, CreateWalletPerTypeResponse, CreateWalletResponse, DistributeNewWalletShareParams, GetPregenWalletsParams, GetPregenWalletsResponse, GetWalletBalanceParams, HasPregenWalletParams, PollingCallbacks, RefreshShareParams, RefreshShareResponse, RequestFaucetParams, RequestFaucetResponse, UpdatePregenWalletIdentifierParams, BaseVerifyExternalWalletParams, AuthenticateWithEmailOrPhoneParams, AuthenticateWithEmailOrPhoneResponse, AuthenticateWithOAuthParams, AuthenticateWithOAuthResponse } from '../services/types';
6
+ import type { WaitForLoginParams, WaitForLoginResponse, WaitForSignupParams, WaitForWalletCreationParams, WaitForWalletCreationResponse, GetOAuthUrlParams, AddCredentialParams, LoginExternalWalletParams, LoginExternalWalletResponse, ResendVerificationCodeParams, ResendVerificationCodeResponse, SignUpOrLogInParams, SignUpOrLogInResponse, VerifyOAuthProcessParams, VerifyExternalWalletParams, VerifyExternalWalletResponse, VerifyFarcasterParams, VerifyTelegramParams, ClaimPregenWalletsParams, ClaimPregenWalletsResponse, CreateGuestWalletsResponse, CreatePregenWalletParams, CreatePregenWalletPerTypeParams, CreatePregenWalletPerTypeResponse, CreatePregenWalletResponse, CreateWalletParams, CreateWalletPerTypeParams, CreateWalletPerTypeResponse, CreateWalletResponse, DistributeNewWalletShareParams, GetPregenWalletsParams, GetPregenWalletsResponse, GetWalletBalanceParams, HasPregenWalletParams, PollingCallbacks, RefreshShareParams, RefreshShareResponse, RequestFaucetParams, RequestFaucetResponse, UpdatePregenWalletIdentifierParams, BaseVerifyExternalWalletParams, AuthenticateWithEmailOrPhoneParams, AuthenticateWithEmailOrPhoneResponse, AuthenticateWithOAuthParams, AuthenticateWithOAuthResponse } from '../services/types';
7
7
  export declare const PARA_CORE_METHODS: readonly ["getAuthInfo", "signUpOrLogIn", "verifyNewAccount", "waitForLogin", "waitForSignup", "waitForWalletCreation", "getOAuthUrl", "verifyOAuth", "getFarcasterConnectUri", "verifyFarcaster", "verifyTelegram", "resendVerificationCode", "loginExternalWallet", "verifyExternalWallet", "setup2fa", "enable2fa", "verify2fa", "logout", "clearStorage", "isSessionActive", "isFullyLoggedIn", "refreshSession", "keepSessionAlive", "exportSession", "waitAndExportSession", "importSession", "getVerificationToken", "getWallets", "getWalletsByType", "fetchWallets", "createWallet", "createWalletPerType", "getPregenWallets", "hasPregenWallet", "updatePregenWalletIdentifier", "createPregenWallet", "createPregenWalletPerType", "claimPregenWallets", "createGuestWallets", "distributeNewWalletShare", "getUserShare", "setUserShare", "refreshShare", "signMessage", "signTransaction", "initiateOnRampTransaction", "getWalletBalance", "requestFaucet", "issueJwt", "getLinkedAccounts", "accountLinkInProgress", "addCredential", "exportPrivateKey", "authenticateWithEmailOrPhone", "authenticateWithOAuth"];
8
8
  export declare const PARA_INTERNAL_METHODS: readonly ["linkAccount", "unlinkAccount", "verifyEmailOrPhoneLink", "verifyOAuthLink", "verifyFarcasterLink", "verifyTelegramLink", "verifyExternalWalletLink", "accountLinkInProgress", "prepareLogin", "sendLoginCode", "supportedUserAuthMethods"];
9
9
  export type CoreMethodName = (typeof PARA_CORE_METHODS)[number];
@@ -189,7 +189,7 @@ export type CoreMethods = Record<CoreMethodName, {
189
189
  };
190
190
  resendVerificationCode: {
191
191
  params: ResendVerificationCodeParams;
192
- response: void;
192
+ response: ResendVerificationCodeResponse;
193
193
  };
194
194
  logout: {
195
195
  params: LogoutParams;
@@ -427,7 +427,12 @@ export type InternalMethods = {
427
427
  };
428
428
  sendLoginCode: {
429
429
  params: void;
430
- response: void;
430
+ response: {
431
+ deliveryChannel?: DeliveryChannel;
432
+ fallbackUsed?: boolean;
433
+ fallbackChannel?: DeliveryChannel;
434
+ isSmsAllowed?: boolean;
435
+ };
431
436
  };
432
437
  supportedUserAuthMethods: {
433
438
  params: void;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@getpara/core-sdk",
3
- "version": "2.26.0",
3
+ "version": "2.28.0",
4
4
  "dependencies": {
5
5
  "@celo/utils": "^8.0.2",
6
6
  "@cosmjs/encoding": "^0.32.4",
7
7
  "@ethereumjs/util": "^9.1.0",
8
- "@getpara/user-management-client": "2.26.0",
8
+ "@getpara/user-management-client": "2.28.0",
9
9
  "@noble/hashes": "^1.5.0",
10
10
  "axios": "^1.8.4",
11
11
  "base64url": "^3.0.1",
@@ -30,7 +30,7 @@
30
30
  "dist",
31
31
  "package.json"
32
32
  ],
33
- "gitHead": "02eb43f55b1c5f8bed6685940b6344551610f42a",
33
+ "gitHead": "cb74d2b02aed6a8a5373249418b315d686b83b66",
34
34
  "main": "dist/cjs/index.js",
35
35
  "module": "dist/esm/index.js",
36
36
  "scripts": {