@getpara/core-sdk 3.0.0-alpha.0 → 3.0.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.
Files changed (106) hide show
  1. package/dist/cjs/ParaCore.js +436 -86
  2. package/dist/cjs/constants.js +1 -1
  3. package/dist/cjs/cryptography/utils.js +5 -2
  4. package/dist/cjs/errors.js +10 -0
  5. package/dist/cjs/external/userManagementClient.js +21 -4
  6. package/dist/cjs/index.js +67 -1
  7. package/dist/cjs/services/AuthService.js +66 -47
  8. package/dist/cjs/services/LoginFlowService.js +30 -27
  9. package/dist/cjs/services/PollingService.js +100 -75
  10. package/dist/cjs/services/PortalUrlService.js +112 -19
  11. package/dist/cjs/services/PregenWalletService.js +125 -76
  12. package/dist/cjs/services/SessionManagementService.js +15 -8
  13. package/dist/cjs/services/SignupFlowService.js +52 -47
  14. package/dist/cjs/services/VerificationFlowService.js +13 -10
  15. package/dist/cjs/services/WalletService.js +51 -36
  16. package/dist/cjs/shares/enclave.js +46 -26
  17. package/dist/cjs/state/CoreStateManager.js +17 -5
  18. package/dist/cjs/state/actors/setupPara.js +4 -1
  19. package/dist/cjs/state/machines/walletStateMachine.js +22 -0
  20. package/dist/cjs/telemetry/config.js +15 -0
  21. package/dist/cjs/telemetry/init.js +185 -0
  22. package/dist/cjs/telemetry/modalSession.js +54 -0
  23. package/dist/cjs/telemetry/session.js +39 -0
  24. package/dist/cjs/telemetry/tracer.js +126 -0
  25. package/dist/cjs/telemetry/uxAction.js +30 -0
  26. package/dist/cjs/telemetry/uxBaggagePropagator.js +58 -0
  27. package/dist/cjs/telemetry/uxState.js +46 -0
  28. package/dist/cjs/telemetry/uxStateSpanProcessor.js +51 -0
  29. package/dist/cjs/utils/configEncoding.js +98 -0
  30. package/dist/cjs/utils/deprecation.js +13 -13
  31. package/dist/cjs/utils/formatting.js +5 -0
  32. package/dist/cjs/utils/index.js +11 -0
  33. package/dist/cjs/utils/partnerConfig.js +103 -0
  34. package/dist/cjs/utils/partnerConfigGating.js +83 -0
  35. package/dist/cjs/utils/stateErrorHelpers.js +6 -1
  36. package/dist/cjs/utils/url.js +10 -2
  37. package/dist/esm/ParaCore.js +441 -88
  38. package/dist/esm/constants.js +1 -1
  39. package/dist/esm/cryptography/utils.js +5 -2
  40. package/dist/esm/errors.js +9 -0
  41. package/dist/esm/external/userManagementClient.js +21 -4
  42. package/dist/esm/index.js +58 -4
  43. package/dist/esm/services/AuthService.js +66 -47
  44. package/dist/esm/services/LoginFlowService.js +30 -27
  45. package/dist/esm/services/PollingService.js +100 -75
  46. package/dist/esm/services/PortalUrlService.js +112 -19
  47. package/dist/esm/services/PregenWalletService.js +125 -76
  48. package/dist/esm/services/SessionManagementService.js +15 -8
  49. package/dist/esm/services/SignupFlowService.js +52 -47
  50. package/dist/esm/services/VerificationFlowService.js +13 -10
  51. package/dist/esm/services/WalletService.js +51 -36
  52. package/dist/esm/shares/enclave.js +46 -26
  53. package/dist/esm/state/CoreStateManager.js +17 -5
  54. package/dist/esm/state/actors/setupPara.js +4 -1
  55. package/dist/esm/state/machines/walletStateMachine.js +22 -0
  56. package/dist/esm/telemetry/config.js +0 -0
  57. package/dist/esm/telemetry/init.js +118 -0
  58. package/dist/esm/telemetry/modalSession.js +29 -0
  59. package/dist/esm/telemetry/session.js +16 -0
  60. package/dist/esm/telemetry/tracer.js +84 -0
  61. package/dist/esm/telemetry/uxAction.js +8 -0
  62. package/dist/esm/telemetry/uxBaggagePropagator.js +35 -0
  63. package/dist/esm/telemetry/uxState.js +21 -0
  64. package/dist/esm/telemetry/uxStateSpanProcessor.js +28 -0
  65. package/dist/esm/utils/configEncoding.js +45 -0
  66. package/dist/esm/utils/deprecation.js +11 -12
  67. package/dist/esm/utils/formatting.js +4 -0
  68. package/dist/esm/utils/index.js +6 -0
  69. package/dist/esm/utils/partnerConfig.js +67 -0
  70. package/dist/esm/utils/partnerConfigGating.js +61 -0
  71. package/dist/esm/utils/stateErrorHelpers.js +6 -1
  72. package/dist/esm/utils/url.js +10 -2
  73. package/dist/types/ParaCore.d.ts +101 -19
  74. package/dist/types/PlatformUtils.d.ts +1 -0
  75. package/dist/types/errors.d.ts +26 -0
  76. package/dist/types/external/userManagementClient.d.ts +2 -1
  77. package/dist/types/index.d.ts +15 -3
  78. package/dist/types/services/types/AuthServiceTypes.d.ts +10 -3
  79. package/dist/types/services/types/PortalUrlServiceTypes.d.ts +3 -3
  80. package/dist/types/services/types/WalletServiceTypes.d.ts +4 -0
  81. package/dist/types/state/actors/setupPara.d.ts +18 -0
  82. package/dist/types/state/machines/authStateMachine.d.ts +1 -1
  83. package/dist/types/state/machines/coreStateMachine.d.ts +30 -6
  84. package/dist/types/state/machines/walletStateMachine.d.ts +4 -0
  85. package/dist/types/state/types/core.d.ts +7 -1
  86. package/dist/types/telemetry/config.d.ts +4 -0
  87. package/dist/types/telemetry/init.d.ts +17 -0
  88. package/dist/types/telemetry/modalSession.d.ts +5 -0
  89. package/dist/types/telemetry/session.d.ts +2 -0
  90. package/dist/types/telemetry/tracer.d.ts +10 -0
  91. package/dist/types/telemetry/uxAction.d.ts +3 -0
  92. package/dist/types/telemetry/uxBaggagePropagator.d.ts +7 -0
  93. package/dist/types/telemetry/uxState.d.ts +8 -0
  94. package/dist/types/telemetry/uxStateSpanProcessor.d.ts +9 -0
  95. package/dist/types/types/config.d.ts +15 -3
  96. package/dist/types/types/coreApi.d.ts +7 -9
  97. package/dist/types/types/serviceInterfaces.d.ts +5 -3
  98. package/dist/types/types/util.d.ts +2 -15
  99. package/dist/types/utils/configEncoding.d.ts +51 -0
  100. package/dist/types/utils/deprecation.d.ts +3 -1
  101. package/dist/types/utils/formatting.d.ts +1 -0
  102. package/dist/types/utils/index.d.ts +2 -0
  103. package/dist/types/utils/partnerConfig.d.ts +28 -0
  104. package/dist/types/utils/partnerConfigGating.d.ts +48 -0
  105. package/dist/types/utils/url.d.ts +3 -2
  106. package/package.json +14 -4
@@ -842,7 +842,7 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
842
842
  data: {
843
843
  authState: import("@getpara/shared").ServerAuthState;
844
844
  sessionLookupId: string;
845
- portalTheme: import("../../types/util.js").PortalTheme;
845
+ portalTheme: import("@getpara/shared/dist/types/types/partnerAppConfig.js").PartnerThemeConfig;
846
846
  useShortUrls: boolean;
847
847
  };
848
848
  finished: boolean;
@@ -2889,6 +2889,10 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
2889
2889
  }];
2890
2890
  };
2891
2891
  readonly needs_wallets: {
2892
+ readonly always: readonly [{
2893
+ readonly target: "creating_wallets";
2894
+ readonly guard: "shouldAutoCreate";
2895
+ }];
2892
2896
  readonly on: {
2893
2897
  readonly WAIT_FOR_WALLET_CREATION: {
2894
2898
  readonly target: "claiming_wallets";
@@ -4584,7 +4588,7 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
4584
4588
  data: {
4585
4589
  authState: import("@getpara/shared").ServerAuthState;
4586
4590
  sessionLookupId: string;
4587
- portalTheme: import("../../types/util.js").PortalTheme;
4591
+ portalTheme: import("@getpara/shared/dist/types/types/partnerAppConfig.js").PartnerThemeConfig;
4588
4592
  useShortUrls: boolean;
4589
4593
  };
4590
4594
  finished: boolean;
@@ -6636,6 +6640,10 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
6636
6640
  }];
6637
6641
  };
6638
6642
  readonly needs_wallets: {
6643
+ readonly always: readonly [{
6644
+ readonly target: "creating_wallets";
6645
+ readonly guard: "shouldAutoCreate";
6646
+ }];
6639
6647
  readonly on: {
6640
6648
  readonly WAIT_FOR_WALLET_CREATION: {
6641
6649
  readonly target: "claiming_wallets";
@@ -8404,7 +8412,7 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
8404
8412
  data: {
8405
8413
  authState: import("@getpara/shared").ServerAuthState;
8406
8414
  sessionLookupId: string;
8407
- portalTheme: import("../../types/util.js").PortalTheme;
8415
+ portalTheme: import("@getpara/shared/dist/types/types/partnerAppConfig.js").PartnerThemeConfig;
8408
8416
  useShortUrls: boolean;
8409
8417
  };
8410
8418
  finished: boolean;
@@ -10456,6 +10464,10 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
10456
10464
  }];
10457
10465
  };
10458
10466
  readonly needs_wallets: {
10467
+ readonly always: readonly [{
10468
+ readonly target: "creating_wallets";
10469
+ readonly guard: "shouldAutoCreate";
10470
+ }];
10459
10471
  readonly on: {
10460
10472
  readonly WAIT_FOR_WALLET_CREATION: {
10461
10473
  readonly target: "claiming_wallets";
@@ -12162,7 +12174,7 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
12162
12174
  data: {
12163
12175
  authState: import("@getpara/shared").ServerAuthState;
12164
12176
  sessionLookupId: string;
12165
- portalTheme: import("../../types/util.js").PortalTheme;
12177
+ portalTheme: import("@getpara/shared/dist/types/types/partnerAppConfig.js").PartnerThemeConfig;
12166
12178
  useShortUrls: boolean;
12167
12179
  };
12168
12180
  finished: boolean;
@@ -14214,6 +14226,10 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
14214
14226
  }];
14215
14227
  };
14216
14228
  readonly needs_wallets: {
14229
+ readonly always: readonly [{
14230
+ readonly target: "creating_wallets";
14231
+ readonly guard: "shouldAutoCreate";
14232
+ }];
14217
14233
  readonly on: {
14218
14234
  readonly WAIT_FOR_WALLET_CREATION: {
14219
14235
  readonly target: "claiming_wallets";
@@ -16014,7 +16030,7 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
16014
16030
  data: {
16015
16031
  authState: import("@getpara/shared").ServerAuthState;
16016
16032
  sessionLookupId: string;
16017
- portalTheme: import("../../types/util.js").PortalTheme;
16033
+ portalTheme: import("@getpara/shared/dist/types/types/partnerAppConfig.js").PartnerThemeConfig;
16018
16034
  useShortUrls: boolean;
16019
16035
  };
16020
16036
  finished: boolean;
@@ -18066,6 +18082,10 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
18066
18082
  }];
18067
18083
  };
18068
18084
  readonly needs_wallets: {
18085
+ readonly always: readonly [{
18086
+ readonly target: "creating_wallets";
18087
+ readonly guard: "shouldAutoCreate";
18088
+ }];
18069
18089
  readonly on: {
18070
18090
  readonly WAIT_FOR_WALLET_CREATION: {
18071
18091
  readonly target: "claiming_wallets";
@@ -19773,7 +19793,7 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
19773
19793
  data: {
19774
19794
  authState: import("@getpara/shared").ServerAuthState;
19775
19795
  sessionLookupId: string;
19776
- portalTheme: import("../../types/util.js").PortalTheme;
19796
+ portalTheme: import("@getpara/shared/dist/types/types/partnerAppConfig.js").PartnerThemeConfig;
19777
19797
  useShortUrls: boolean;
19778
19798
  };
19779
19799
  finished: boolean;
@@ -21825,6 +21845,10 @@ export declare function createCoreStateMachine(paraCoreInterface: StateMachineIn
21825
21845
  }];
21826
21846
  };
21827
21847
  readonly needs_wallets: {
21848
+ readonly always: readonly [{
21849
+ readonly target: "creating_wallets";
21850
+ readonly guard: "shouldAutoCreate";
21851
+ }];
21828
21852
  readonly on: {
21829
21853
  readonly WAIT_FOR_WALLET_CREATION: {
21830
21854
  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, TOAuthMethod } from '@getpara/user-management-client';
1
+ import type { BiometricLocationHint, CurrentWalletIds, DeliveryChannel, ServerAuthState, TOAuthMethod } 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';
@@ -96,6 +96,12 @@ export type AuthStateInfo = {
96
96
  verificationUrl: string | null;
97
97
  /** Full (unshortened) verification URL. Used by preloaded iframe. */
98
98
  verificationFullUrl: string | null;
99
+ /** Channel the OTP was sent over — set on phone verifications so the UI can render channel-specific copy */
100
+ deliveryChannel: DeliveryChannel | null;
101
+ /** True when the server had to fall back from the primary channel (WhatsApp → SMS typically) */
102
+ fallbackUsed: boolean;
103
+ /** The channel actually used when fallbackUsed is true */
104
+ fallbackChannel: DeliveryChannel | null;
99
105
  /** External wallet verification data when signature is needed */
100
106
  externalWalletVerification: {
101
107
  signatureVerificationMessage: string;
@@ -0,0 +1,4 @@
1
+ export type PartnerTelemetryConfig = {
2
+ enabled: boolean;
3
+ sample_rate: number;
4
+ };
@@ -0,0 +1,17 @@
1
+ import { type Attributes } from '@opentelemetry/api';
2
+ import type { SDKType } from '@getpara/user-management-client';
3
+ export type InitTelemetryOpts = {
4
+ tunnelUrl: string;
5
+ sampleRate: number;
6
+ sdkType: SDKType;
7
+ sdkVersion: string;
8
+ partnerId?: string;
9
+ resourceAttributes?: Attributes;
10
+ isDev?: boolean;
11
+ isPortal?: boolean;
12
+ };
13
+ export declare function onTelemetryReady(cb: () => void): void;
14
+ export declare function initTelemetry(opts: InitTelemetryOpts): Promise<void>;
15
+ export declare function isTelemetryInitialized(): boolean;
16
+ export declare function flushTelemetry(): Promise<void>;
17
+ export declare function __resetTelemetryForTests(): void;
@@ -0,0 +1,5 @@
1
+ import { type Context } from '@opentelemetry/api';
2
+ export declare function startModalSession(): void;
3
+ export declare function endModalSession(): void;
4
+ export declare function getModalSessionContext(): Context | undefined;
5
+ export declare function __resetModalSessionForTests(): void;
@@ -0,0 +1,2 @@
1
+ export declare function getOrCreateSessionId(): string;
2
+ export declare function __resetSessionForTests(): void;
@@ -0,0 +1,10 @@
1
+ import { type Attributes, type Context, type Span } from '@opentelemetry/api';
2
+ export declare function getTracer(): import("@opentelemetry/api").Tracer;
3
+ export declare function setDefaultParentContext(ctx: Context): void;
4
+ export declare function getDefaultParentContext(): Context | undefined;
5
+ export declare function wrapWithSpan<T>(name: string, fn: (span: Span) => Promise<T> | T, attributes?: Attributes): Promise<T>;
6
+ export declare function extractTraceContextFromUrl(search?: string): Context;
7
+ export declare function getUrlTraceCarrier(search?: string): Record<string, string>;
8
+ export declare function wrapWithSpanInContext<T>(parentContext: Context, name: string, fn: (span: Span, traceHeaders: Record<string, string>) => Promise<T> | T): Promise<T>;
9
+ export { SpanStatusCode } from '@opentelemetry/api';
10
+ export type { Span, Attributes, Context } from '@opentelemetry/api';
@@ -0,0 +1,3 @@
1
+ import type { Span } from '@opentelemetry/api';
2
+ export type UxActionOutcome = 'success' | 'error';
3
+ export declare function recordActionOnSpan(span: Span, targetId: string, outcome: UxActionOutcome): void;
@@ -0,0 +1,7 @@
1
+ import { type Context, type TextMapGetter, type TextMapPropagator, type TextMapSetter } from '@opentelemetry/api';
2
+ export declare class UxBaggagePropagator implements TextMapPropagator {
3
+ #private;
4
+ inject(ctx: Context, carrier: unknown, setter: TextMapSetter): void;
5
+ extract(ctx: Context, carrier: unknown, getter: TextMapGetter): Context;
6
+ fields(): string[];
7
+ }
@@ -0,0 +1,8 @@
1
+ export type UxState = {
2
+ view?: string;
3
+ lastInteraction?: string;
4
+ };
5
+ export declare function getUxState(): Readonly<UxState>;
6
+ export declare function setCurrentView(view: string | undefined): void;
7
+ export declare function setLastInteraction(targetId: string | undefined): void;
8
+ export declare function __resetUxStateForTests(): void;
@@ -0,0 +1,9 @@
1
+ import type { Context } from '@opentelemetry/api';
2
+ import type { Span, SpanProcessor } from '@opentelemetry/sdk-trace-base';
3
+ export declare function setCurrentUserId(userId: string | undefined): void;
4
+ export declare class UxStateSpanProcessor implements SpanProcessor {
5
+ onStart(span: Span, _parentContext: Context): void;
6
+ onEnd(): void;
7
+ forceFlush(): Promise<void>;
8
+ shutdown(): Promise<void>;
9
+ }
@@ -1,7 +1,6 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import Client, { EmailTheme, Network, OnRampAsset, OnRampProvider, PregenAuth, TWalletScheme, TWalletType } from '@getpara/user-management-client';
2
+ import Client, { EmailTheme, Network, OnRampAsset, OnRampProvider, PregenAuth, SdkOverridableAppConfig, TWalletScheme, TWalletType, PartnerThemeConfig } from '@getpara/user-management-client';
3
3
  import { EnclaveClient } from '../shares/enclave.js';
4
- import type { PortalTheme } from './util.js';
5
4
  export declare enum Environment {
6
5
  DEV = "DEV",
7
6
  SANDBOX = "SANDBOX",
@@ -95,7 +94,7 @@ export interface ConstructorOpts {
95
94
  * Theme to use for the portal
96
95
  * @deprecated configure theming through the developer portal
97
96
  */
98
- portalTheme?: PortalTheme;
97
+ portalTheme?: PartnerThemeConfig;
99
98
  useDKLSForCreation?: boolean;
100
99
  disableWebSockets?: boolean;
101
100
  wasmOverride?: ArrayBuffer;
@@ -157,4 +156,17 @@ export interface ConstructorOpts {
157
156
  * @default false
158
157
  */
159
158
  enableDebugLogs?: boolean;
159
+ /**
160
+ * SDK-side overrides for partner-driven app config. Applied as the
161
+ * `#constructorOverrides` layer in `paraCore.config`'s merge chain. The React
162
+ * provider's `configOverrides` prop sits on top via a separate layer; React
163
+ * always wins when both surfaces touch the same key.
164
+ *
165
+ * Most partners should configure these in the developer portal — the constructor
166
+ * surface exists primarily for non-React contexts (`@getpara/server-sdk`,
167
+ * custom integrations) and dev-time iteration.
168
+ *
169
+ * The overridable subset is `SdkOverridableAppConfig`, enforced at compile time.
170
+ */
171
+ configOverrides?: Partial<SdkOverridableAppConfig>;
160
172
  }
@@ -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;
@@ -278,32 +278,26 @@ export type CoreMethods = Record<CoreMethodName, {
278
278
  params: CreateWalletPerTypeParams;
279
279
  response: CreateWalletPerTypeResponse;
280
280
  };
281
- /** @deprecated Use the REST API instead. See https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen */
282
281
  getPregenWallets: {
283
282
  params: GetPregenWalletsParams;
284
283
  response: GetPregenWalletsResponse;
285
284
  };
286
- /** @deprecated Use the REST API instead. See https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen */
287
285
  updatePregenWalletIdentifier: {
288
286
  params: UpdatePregenWalletIdentifierParams;
289
287
  response: void;
290
288
  };
291
- /** @deprecated Use the REST API instead. See https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen */
292
289
  hasPregenWallet: {
293
290
  params: HasPregenWalletParams;
294
291
  response: boolean;
295
292
  };
296
- /** @deprecated Use the REST API instead. See https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen */
297
293
  createPregenWallet: {
298
294
  params: CreatePregenWalletParams;
299
295
  response: CreatePregenWalletResponse;
300
296
  };
301
- /** @deprecated Use the REST API instead. See https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen */
302
297
  createPregenWalletPerType: {
303
298
  params: CreatePregenWalletPerTypeParams;
304
299
  response: CreatePregenWalletPerTypeResponse;
305
300
  };
306
- /** @deprecated Use the REST API instead. See https://docs.getpara.com/v2/rest/migrate-from-sdk-pregen */
307
301
  claimPregenWallets: {
308
302
  params: ClaimPregenWalletsParams;
309
303
  response: ClaimPregenWalletsResponse;
@@ -429,6 +423,10 @@ export type InternalMethods = {
429
423
  params: void;
430
424
  response: {
431
425
  userId: string;
426
+ deliveryChannel?: DeliveryChannel;
427
+ fallbackUsed?: boolean;
428
+ fallbackChannel?: DeliveryChannel;
429
+ isSmsAllowed?: boolean;
432
430
  };
433
431
  };
434
432
  supportedUserAuthMethods: {
@@ -1,6 +1,6 @@
1
1
  import type { pki as pkiType } from 'node-forge';
2
- import type { PartnerEntity, BackupKitEmailProps, VerificationEmailProps, TLinkedAccountType } from '@getpara/user-management-client';
3
- import type { Ctx, Environment, AccountLinkInProgress, ConstructorOpts, PortalTheme } from './index.js';
2
+ import type { PartnerAppConfig, PartnerEntity, BackupKitEmailProps, VerificationEmailProps, TLinkedAccountType, PartnerThemeConfig } from '@getpara/user-management-client';
3
+ import type { Ctx, Environment, AccountLinkInProgress, ConstructorOpts } from './index.js';
4
4
  import type { PlatformUtils } from '../PlatformUtils.js';
5
5
  import type { AuthService } from '../services/AuthService.js';
6
6
  import type { WalletService } from '../services/WalletService.js';
@@ -71,13 +71,15 @@ export interface PortalUrlServiceInterface {
71
71
  isPartnerOptional: boolean | undefined;
72
72
  ctx: Ctx;
73
73
  get loginEncryptionKeyPair(): pkiType.rsa.KeyPair | undefined;
74
- portalTheme?: PortalTheme;
74
+ portalTheme?: PartnerThemeConfig;
75
75
  portalPrimaryButtonColor?: string;
76
76
  portalTextColor?: string;
77
77
  portalPrimaryButtonTextColor?: string;
78
78
  portalBackgroundColor?: string;
79
79
  borderRadius?: string;
80
80
  get accountLinkInProgress(): AccountLinkInProgress | undefined;
81
+ /** Merged partner-config surface (partner ⊕ SDK overrides); `{}` before the partner record loads. */
82
+ get config(): PartnerAppConfig;
81
83
  }
82
84
  export interface SessionManagementServiceInterface {
83
85
  displayModalError: (error?: string) => void;
@@ -1,17 +1,4 @@
1
- import { TAuthMethod, Theme } from '@getpara/user-management-client';
2
- /**
3
- * Extended portal theme type that adds new theming fields not yet in the
4
- * backend `Theme` type from `@getpara/user-management-client`.
5
- *
6
- * TODO: Remove this extension once the UMC `Theme` type includes
7
- * `foregroundMixRatio` and `cssOverrides`.
8
- */
9
- export type PortalTheme = Theme & {
10
- /** Controls how much the foreground/accent color is mixed into generated UI palette steps. */
11
- foregroundMixRatio?: number;
12
- /** Raw CSS variable overrides applied after theme generation. Advanced use. */
13
- cssOverrides?: Record<string, string>;
14
- };
1
+ import { TAuthMethod, PartnerThemeConfig } from '@getpara/user-management-client';
15
2
  export type WithAuthMethod = {
16
3
  /**
17
4
  * Which authorization method to use for the URL, either `'PASSKEY'`, `'PASSWORD'` or `'PIN'`.
@@ -22,7 +9,7 @@ export type WithCustomTheme = {
22
9
  /**
23
10
  * The theme to apply to generated URLs, if different from your configured theme.
24
11
  */
25
- portalTheme?: PortalTheme;
12
+ portalTheme?: PartnerThemeConfig;
26
13
  };
27
14
  export type WithUseShortUrls = {
28
15
  /**
@@ -0,0 +1,51 @@
1
+ import type { PartnerThemeConfig } from '@getpara/user-management-client';
2
+ /**
3
+ * Versioned envelope carried by the optional `c` URL search param when the
4
+ * plain-form portal URL would exceed the tier-1 length threshold. Mirrors the
5
+ * top-level shape of the partner config blob (theme + app slices); the auth
6
+ * slice was intentionally omitted since the portal renders no
7
+ * auth-method-selection UI and the params had no consumer.
8
+ *
9
+ * `v` is required and acts as the compat key. The portal validates it on
10
+ * decode and silently falls back to individual URL params on unknown versions
11
+ * — so future schema evolution (e.g. adding an auth slice if portal-side
12
+ * gating ever ships) is BW-compat: older portals just ignore the blob.
13
+ */
14
+ export declare const ENCODED_CONFIG_VERSION: 1;
15
+ export type EncodedAppConfig = {
16
+ appName?: string;
17
+ homepageUrl?: string;
18
+ };
19
+ export type EncodedConfig = {
20
+ v: typeof ENCODED_CONFIG_VERSION;
21
+ theme?: PartnerThemeConfig;
22
+ app?: EncodedAppConfig;
23
+ };
24
+ /**
25
+ * Feature detection — `CompressionStream` lands in Chrome 80 (2020), Firefox 113
26
+ * (May 2023), and Safari 16.4 (March 2023). The current portal browserslist
27
+ * resolves a minimum of iOS Safari 15.6 + Safari 15.6, which DON'T have it.
28
+ *
29
+ * On unsupported browsers, the SDK skips tier 2 emission and lets the portal
30
+ * URL fall through to tier 3 (`shortenUrl`) at the cost of ~150ms RTT. Adding
31
+ * a sync pako fallback (~45 KB on the cold path) is an option if iOS 15.x
32
+ * latency on long-URL flows becomes a real complaint — the seam lives here.
33
+ */
34
+ export declare function isCompressionStreamSupported(): boolean;
35
+ /**
36
+ * Encode the config blob as `base64url(gzip(JSON))`. Async because both
37
+ * `CompressionStream` (encode side) and `DecompressionStream` (decode side)
38
+ * are Streams API and produce async output.
39
+ *
40
+ * Returns `null` when `CompressionStream` is unavailable so callers can
41
+ * gracefully degrade to tier 3 instead of throwing.
42
+ */
43
+ export declare function encodeConfigParams(config: EncodedConfig): Promise<string | null>;
44
+ /**
45
+ * Inverse of `encodeConfigParams`. Never throws — returns `null` on any
46
+ * failure (corrupt base64, invalid gzip, invalid JSON, unknown `v`, etc.)
47
+ * so the portal can silently fall back to individual URL params.
48
+ *
49
+ * Async because `DecompressionStream` is part of the Streams API.
50
+ */
51
+ export declare function tryDecodeConfig(s: string): Promise<EncodedConfig | null>;
@@ -1 +1,3 @@
1
- export declare function warnPregenDeprecation(methodName: string): void;
1
+ export declare function warnOnce(scope: string, key: string, message: string): void;
2
+ /** Test-only: clear the warned set so tests can assert "warns once" across cases. */
3
+ export declare function _resetWarnOnceForTests(): void;
@@ -6,6 +6,7 @@ export interface Signature {
6
6
  v: bigint;
7
7
  }
8
8
  export declare function hexStringToBase64(hexString: string): string;
9
+ export declare function base58ToBase64(base58Str: string): string;
9
10
  export declare function hexToSignature(hexSig: string): Signature;
10
11
  export declare function hexToUint8Array(hex: string): Uint8Array;
11
12
  export declare function hexToDecimal(hex: string): string;
@@ -1,10 +1,12 @@
1
1
  export * from './autobind.js';
2
2
  export * from './config.js';
3
+ export { warnOnce } from './deprecation.js';
3
4
  export * from './events.js';
4
5
  export * from './formatting.js';
5
6
  export * from './json.js';
6
7
  export * from './listeners.js';
7
8
  export * from './onRamps.js';
9
+ export * from './partnerConfig.js';
8
10
  export * from './phone.js';
9
11
  export * from './polling.js';
10
12
  export * from './types.js';
@@ -0,0 +1,28 @@
1
+ import { mergePartnerAppConfig } from '@getpara/user-management-client';
2
+ import type { PartnerAppConfig, PartnerEntity } from '@getpara/user-management-client';
3
+ export { mergePartnerAppConfig };
4
+ /**
5
+ * Base defaults layer for `paraCore.config`. First argument to
6
+ * `mergePartnerAppConfig(defaults, partner, sdkOverrides)`.
7
+ *
8
+ * Empty today: there are no SDK-side config defaults. OAuth has no default
9
+ * allowlist — an unset `oAuthMethods` means "not configured", which the
10
+ * `assertConfigAllowed` gate treats as "allow any" (so the deprecated
11
+ * `oAuthMethods` prop keeps working) and the modal renders from the resolved
12
+ * config or the prop. Partners opt into an allowlist via the developer portal.
13
+ * Kept as a named const so the merge contract and any future defaults have a
14
+ * single home.
15
+ */
16
+ export declare const DEFAULT_PARTNER_APP_CONFIG: Partial<PartnerAppConfig>;
17
+ /**
18
+ * Extract the app-config layer from a partner entity returned by GET /:partnerId.
19
+ *
20
+ * The server already merges defaults ⊕ organization ⊕ partner before returning,
21
+ * so the entity's JSONB fields are the canonical resolved values. This function
22
+ * shapes them into a `PartnerAppConfig` for downstream merging with SDK overrides.
23
+ *
24
+ * If the JSONB columns are absent but legacy color/social columns are populated,
25
+ * synthesize equivalents so callers see a consistent shape during the transition.
26
+ * Compatibility shim drops at the major release (Phase 7).
27
+ */
28
+ export declare function partnerToAppConfigLayer(partner: PartnerEntity): Partial<PartnerAppConfig>;
@@ -0,0 +1,48 @@
1
+ import type { PartnerAppConfig } from '@getpara/user-management-client';
2
+ /**
3
+ * Discriminated union describing a partner-config check the SDK wants to run
4
+ * before initiating an auth/wallet flow. `assertConfigAllowed` dispatches on
5
+ * `kind` and reads the relevant fields off the merged `PartnerAppConfig`.
6
+ */
7
+ export type ConfigCheck = {
8
+ kind: 'email';
9
+ } | {
10
+ kind: 'phone';
11
+ } | {
12
+ kind: 'oauth';
13
+ method: string;
14
+ } | {
15
+ kind: '2fa';
16
+ } | {
17
+ kind: 'guest';
18
+ };
19
+ /**
20
+ * Throws a `PartnerConfigError` if `check` is disallowed by the resolved
21
+ * partner config.
22
+ *
23
+ * Wired in at the 9 SDK auth entry points (signUpOrLogIn,
24
+ * authenticateWithEmailOrPhone, authenticateWithOAuth, getOAuthUrl,
25
+ * verifyOAuth, setup2fa, verify2fa, enable2fa, createGuestWallets) so
26
+ * partner posture is enforced for direct SDK calls, not just the modal.
27
+ * resendVerificationCode is intentionally not gated — callers can only
28
+ * reach it after the initial auth gate has already fired.
29
+ *
30
+ * Pure helper: takes the merged config + check. No `ParaCore` reference,
31
+ * no I/O. Easy to unit-test.
32
+ *
33
+ * Unset means "not configured" — the gate stays permissive (legacy behavior,
34
+ * also what the deprecated `ParaModalProps` rely on, since those never reach
35
+ * the merged config). Enforcement only fires on an *explicit* partner choice:
36
+ * a `false` opt-in flag, a `true` disable flag, or a non-undefined OAuth
37
+ * allowlist. This keeps the migration non-breaking — restrictions take effect
38
+ * once a partner configures them in the developer portal, not before.
39
+ *
40
+ * Note: the merge is symmetric — SDK overrides can widen or narrow every
41
+ * auth-posture flag (`twoFactorAuthEnabled`, `isGuestModeEnabled`,
42
+ * `disableEmailLogin`, `disablePhoneLogin`), so an override may re-enable
43
+ * something the partner disabled. This gate runs on the post-merge config, so
44
+ * it reflects the override, not the raw partner record. A future partner-level
45
+ * "locked" flag (ecosystem lock primitive) would let a partner pin a value so
46
+ * the override is ignored; until then, overrides always win.
47
+ */
48
+ export declare function assertConfigAllowed(config: PartnerAppConfig, check: ConfigCheck): void;
@@ -1,10 +1,11 @@
1
1
  import { Ctx, Environment } from '../types/index.js';
2
2
  export declare function getPortalDomain(env: Environment, isE2E?: boolean, isLegacy?: boolean): string;
3
- export declare function getPortalBaseURL({ env, isE2E }: {
3
+ export declare function getPortalBaseURL({ env, isE2E, portalUrlOverride }: {
4
4
  env: Environment;
5
5
  isE2E?: boolean;
6
+ portalUrlOverride?: string;
6
7
  }, useLocalIp?: boolean, isForWasm?: boolean, isLegacy?: boolean): string;
7
- export declare function getParaConnectDomain(env: Environment): "localhost" | "connect.sandbox.getpara.com" | "connect.beta.getpara.com" | "connect.getpara.com";
8
+ export declare function getParaConnectDomain(env: Environment): "localhost" | "connect.sandbox.getpara.com" | "connect.getpara.com";
8
9
  export declare function getParaConnectBaseUrl({ env }: {
9
10
  env: Environment;
10
11
  }, useLocalIp?: boolean): string;
package/package.json CHANGED
@@ -1,12 +1,22 @@
1
1
  {
2
2
  "name": "@getpara/core-sdk",
3
- "version": "3.0.0-alpha.0",
3
+ "version": "3.0.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": "3.0.0-alpha.0",
8
+ "@getpara/user-management-client": "3.0.0",
9
9
  "@noble/hashes": "^1.5.0",
10
+ "@opentelemetry/api": "^1.9.1",
11
+ "@opentelemetry/context-zone": "^2.7.1",
12
+ "@opentelemetry/core": "^2.7.0",
13
+ "@opentelemetry/exporter-trace-otlp-http": "^0.215.0",
14
+ "@opentelemetry/instrumentation": "^0.215.0",
15
+ "@opentelemetry/instrumentation-fetch": "^0.215.0",
16
+ "@opentelemetry/instrumentation-xml-http-request": "^0.216.0",
17
+ "@opentelemetry/resources": "^2.7.0",
18
+ "@opentelemetry/sdk-trace-base": "^2.7.0",
19
+ "@opentelemetry/semantic-conventions": "^1.40.0",
10
20
  "axios": "^1.8.4",
11
21
  "base64url": "^3.0.1",
12
22
  "elliptic": "^6.6.1",
@@ -30,14 +40,14 @@
30
40
  "dist",
31
41
  "package.json"
32
42
  ],
33
- "gitHead": "f58e6e365ca63a447edaa44fba3b157e5ca7a368",
43
+ "gitHead": "e6c42e42adfcfadb0114b1ac65ba5203e6274712",
34
44
  "main": "dist/cjs/index.js",
35
45
  "module": "dist/esm/index.js",
36
46
  "scripts": {
37
47
  "build": "rm -rf dist && node ./scripts/build.mjs && yarn build:types",
38
48
  "build:cjs": "rm -rf dist/cjs && tsc --module commonjs --outDir dist/cjs && printf '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
39
49
  "build:esm": "rm -rf dist/esm && tsc --module es6 --outDir dist/esm && printf '{\"type\":\"module\",\"sideEffects\":false}' > dist/esm/package.json",
40
- "build:types": "rm -rf dist/types && tsc --module es6 --declarationDir dist/types --emitDeclarationOnly --declaration",
50
+ "build:types": "rm -rf dist/types && tsc --module es2020 --declarationDir dist/types --emitDeclarationOnly --declaration",
41
51
  "old-build": "yarn build:cjs && yarn build:esm && yarn build:types; yarn post-build",
42
52
  "post-build": "./scripts/set-version.sh",
43
53
  "test": "vitest run --coverage"