@bluxcc/core 0.3.1 → 0.3.3

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.
@@ -1,9 +1,2 @@
1
- export type PasskeyFlowResult = {
2
- step: 'login';
3
- credential: PublicKeyCredential;
4
- } | {
5
- step: 'register';
6
- credential: PublicKeyCredential;
7
- };
8
1
  declare const PasskeyOnboardingPage: () => import("react/jsx-runtime").JSX.Element;
9
2
  export default PasskeyOnboardingPage;
@@ -0,0 +1,2 @@
1
+ declare const OtherSocials: () => import("react/jsx-runtime").JSX.Element;
2
+ export default OtherSocials;
@@ -0,0 +1,7 @@
1
+ type SocialLoginButtonProps = {
2
+ provider: string;
3
+ onClick: (provider: string) => void;
4
+ nameOnly?: boolean;
5
+ };
6
+ declare const SocialLoginButton: ({ provider, onClick, nameOnly, }: SocialLoginButtonProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default SocialLoginButton;
@@ -0,0 +1,6 @@
1
+ type TelegramWidgetProps = {
2
+ botUsername: string;
3
+ onAuth: (user: Record<string, unknown>) => void;
4
+ };
5
+ declare const TelegramWidget: ({ botUsername, onAuth }: TelegramWidgetProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default TelegramWidget;
@@ -1,4 +1,12 @@
1
1
  import { IWallet } from '../../types';
2
- import { IStore } from '../../store';
3
- declare const connectWalletProcess: (store: IStore, wallet: IWallet) => Promise<void>;
2
+ import { IStore, IUser } from '../../store';
3
+ export type ConnectWalletProcessOptions = {
4
+ /**
5
+ * Skip Blux waiting/success/failed screens and persist the session as soon
6
+ * as the wallet returns a signed challenge. Wallet extension / hardware
7
+ * prompts still appear.
8
+ */
9
+ headless?: boolean;
10
+ };
11
+ declare const connectWalletProcess: (store: IStore, wallet: IWallet, options?: ConnectWalletProcessOptions) => Promise<IUser | void>;
4
12
  export default connectWalletProcess;
@@ -0,0 +1,8 @@
1
+ import { IUser } from '../../store';
2
+ /**
3
+ * Loads the user for a freshly issued session JWT and writes them into the
4
+ * store without persisting the session. Callers then either show the terms /
5
+ * success UI ({@link continueLoginProcess}) or persist immediately
6
+ * ({@link completeLoginProcess}) for headless / whitelabel logins.
7
+ */
8
+ export declare const hydrateUserFromJwt: (jwt: string, authMethod: string, authValue?: string) => Promise<IUser>;
package/dist/store.d.ts CHANGED
@@ -67,6 +67,11 @@ export interface IStoreProperties {
67
67
  };
68
68
  };
69
69
  showAllWallets: boolean;
70
+ /**
71
+ * When true, onboarding shows only the scrollable wallet list (no email /
72
+ * SMS / social / passkey). Set by loginWallet() with no wallet name.
73
+ */
74
+ walletOnlyOnboarding: boolean;
70
75
  waitingStatus: WaitingStatus;
71
76
  wallets: IWallet[];
72
77
  stellar?: IStellarConfig;
@@ -98,10 +103,13 @@ export interface IStoreMethods {
98
103
  connectWalletSuccessful: (publicKey: string, passphrase: string) => void;
99
104
  closeModal: () => void;
100
105
  logoutAction: () => void;
101
- openModal: (route: Route) => void;
106
+ openModal: (route: Route, options?: {
107
+ walletOnly?: boolean;
108
+ }) => void;
102
109
  setConfig: (config: IInternalConfig) => void;
103
110
  setIsReady: (isReady: boolean) => void;
104
111
  setShowAllWallets: (showAllWallets: boolean) => void;
112
+ setWalletOnlyOnboarding: (walletOnlyOnboarding: boolean) => void;
105
113
  setRoute: (route: Route) => void;
106
114
  setSendTransaction: (sendTransaction: ISendTransaction, isOpen: boolean, route?: Route) => void;
107
115
  setSignMessage: (messageDetails: ISignMessage, isOpen: boolean, route?: Route) => void;
package/dist/types.d.ts CHANGED
@@ -10,7 +10,7 @@ type LooseString = string & {};
10
10
  /** Block explorer used to build account/transaction links. */
11
11
  export type IExplorer = 'steexp' | 'stellarchain' | 'stellarexpert' | 'lumenscan';
12
12
  /** Social login providers supported by Blux. */
13
- export type ISocialProvider = 'google';
13
+ export type ISocialProvider = 'google' | 'apple' | 'discord' | 'telegram' | 'meta' | 'github' | 'farcaster' | 'tiktok' | 'linkedin' | 'twitch' | 'kick' | 'spotify' | 'instagram' | 'microsoft' | 'gitlab' | 'twitter' | 'steam';
14
14
  /** Login methods to offer in the modal. */
15
15
  export type ILoginMethods = Array<'wallet' | 'sms' | 'email' | 'passkey' | ISocialProvider>;
16
16
  /** Canonical names of the wallets Blux can integrate with. */
@@ -58,7 +58,13 @@ export interface IConfig {
58
58
  explorer?: IExplorer;
59
59
  /** Persist the session across page reloads. Defaults to `false` and should remain `false` in most scenarios. */
60
60
  isPersistent?: boolean;
61
- /** Show Blux's built-in signing/approval UIs. When `false`, signing happens headlessly. Defaults to `true`. */
61
+ /**
62
+ * Show Blux's built-in signing/approval UIs. When `false`, signing happens
63
+ * headlessly so you can render your own confirmation UI. Login is independent:
64
+ * `login()` still opens the Blux modal, while `loginEmail` / `loginSms` /
65
+ * `loginOAuth` / `loginPasskey` / `loginWallet(name)` never do (WalletConnect
66
+ * still uses the Blux QR). Defaults to `true`.
67
+ */
62
68
  showWalletUIs?: boolean;
63
69
  /** Login methods to offer. Defaults to `['wallet']`. `'sms'` is shown only when `/auth/validate` reports a paid plan. */
64
70
  loginMethods?: Array<ILoginMethods[number] | LooseString>;
@@ -259,6 +265,12 @@ export interface ISignAuthEntry {
259
265
  export interface ISocialConfigEntry {
260
266
  provider: string;
261
267
  displayName: string;
268
+ /** Login mechanism from /auth/validate: oauth2, steam, farcaster, or telegram. */
269
+ kind?: string;
270
+ /** Telegram bot username the on-page widget needs; empty for other providers. */
271
+ publicId?: string;
272
+ /** Telegram Mini App / in-app login is enabled for this project. */
273
+ miniApps?: boolean;
262
274
  }
263
275
  export interface AuthenticateApiResponse {
264
276
  isValid: boolean;
@@ -1,6 +1,6 @@
1
1
  import { IUser } from '../store';
2
2
  import { AuthenticateApiResponse, WalletProofType } from '../types';
3
- import { PasskeyFlowResult } from '../pages/Onboarding/Passkey';
3
+ import type { PasskeyFlowResult } from './passkey';
4
4
  type ApiPasskeyChallenge = {
5
5
  user_id: string;
6
6
  challenge: string;
@@ -48,4 +48,5 @@ export type ApiGroupedTokens = {
48
48
  export declare const apiGetTokens: (JWT: string) => Promise<ApiGroupedTokens>;
49
49
  export declare const apiAddToken: (JWT: string, contractAddress: string, network: "mainnet" | "testnet") => Promise<ApiTokenView>;
50
50
  export declare const apiDeleteToken: (JWT: string, tokenId: number) => Promise<boolean>;
51
+ export declare const apiTelegramLogin: (appId: string, payload: Record<string, unknown>) => Promise<string>;
51
52
  export {};
@@ -0,0 +1,14 @@
1
+ export type PasskeyFlowResult = {
2
+ step: 'login';
3
+ credential: PublicKeyCredential;
4
+ } | {
5
+ step: 'register';
6
+ credential: PublicKeyCredential;
7
+ };
8
+ export declare function ensurePasskeySupport(): Promise<void>;
9
+ export declare function runPasskeyCeremony(challenge: string, userId: string, mode: 'login' | 'register', credentialId?: string): Promise<PasskeyFlowResult>;
10
+ /**
11
+ * Runs the full passkey register-or-login ceremony and returns a session JWT.
12
+ * Does not persist the session; the caller hydrates the user and completes login.
13
+ */
14
+ export declare function authenticateWithPasskey(appId: string): Promise<string>;
@@ -1,12 +1,21 @@
1
+ import type { ComponentType } from 'react';
1
2
  import CDNFiles from '../constants/cdnFiles';
2
3
  import { ILoginMethods, AuthenticateApiResponse } from '../types';
3
4
  type SocialProviderMeta = {
4
5
  displayName: string;
5
- icon: CDNFiles;
6
+ icon: CDNFiles | ComponentType<{
7
+ fill?: string;
8
+ }>;
6
9
  };
7
10
  export declare const SOCIAL_PROVIDERS: Record<string, SocialProviderMeta>;
11
+ export declare const canonicalSocialName: (method: string) => string;
8
12
  export declare const isSocialProvider: (method: string) => boolean;
13
+ export declare const getSocialDisplayName: (provider: string) => string;
9
14
  export declare const getEnabledSocials: (loginMethods: ILoginMethods | string[], apiResponse?: AuthenticateApiResponse) => string[];
15
+ export declare const telegramBotUsername: (apiResponse?: AuthenticateApiResponse) => string;
16
+ export declare const telegramMiniAppsEnabled: (apiResponse?: AuthenticateApiResponse) => boolean;
17
+ export declare const telegramWebAppInitData: () => string;
18
+ export declare const isTelegramLogin: (provider: string, apiResponse?: AuthenticateApiResponse) => boolean;
10
19
  export type ISocialSession = {
11
20
  provider: string;
12
21
  popup: Window | null;
@@ -15,5 +24,6 @@ export type ISocialSession = {
15
24
  export declare const getActiveSocialSession: () => ISocialSession | null;
16
25
  export declare const cancelActiveSocialSession: () => void;
17
26
  export declare const beginSocialLogin: (provider: string, appId: string) => ISocialSession;
27
+ export declare const startSocialLogin: (provider: string, appId: string, apiResponse?: AuthenticateApiResponse) => void;
18
28
  export declare const awaitSocialLogin: (session: ISocialSession) => Promise<string>;
19
29
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluxcc/core",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "homepage": "https://blux.cc",
5
5
  "description": "Blux is a wallet infra for the Stellar network",
6
6
  "type": "module",