@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.
- package/README.md +122 -70
- package/dist/assets/AdditionalSocialLogos.d.ts +15 -0
- package/dist/assets/AppleLogo.d.ts +3 -0
- package/dist/assets/DiscordLogo.d.ts +1 -0
- package/dist/assets/GitHubLogo.d.ts +3 -0
- package/dist/assets/MetaLogo.d.ts +1 -0
- package/dist/assets/TelegramLogo.d.ts +1 -0
- package/dist/components/SocialProviderIcon.d.ts +5 -0
- package/dist/constants/assets.d.ts +10 -1
- package/dist/enums.d.ts +2 -1
- package/dist/exports/blux.d.ts +11 -17
- package/dist/exports/exportedStore.d.ts +4 -0
- package/dist/exports/index.d.ts +2 -1
- package/dist/exports/loginMethods.d.ts +93 -0
- package/dist/index.cjs.js +14 -14
- package/dist/index.esm.js +14 -14
- package/dist/pages/Onboarding/Passkey/index.d.ts +0 -7
- package/dist/pages/Onboarding/Socials/OtherSocials.d.ts +2 -0
- package/dist/pages/Onboarding/Socials/SocialLoginButton.d.ts +7 -0
- package/dist/pages/Onboarding/Socials/TelegramWidget.d.ts +6 -0
- package/dist/stellar/processes/connectWalletProcess.d.ts +10 -2
- package/dist/stellar/processes/hydrateUserFromJwt.d.ts +8 -0
- package/dist/store.d.ts +9 -1
- package/dist/types.d.ts +14 -2
- package/dist/utils/api.d.ts +2 -1
- package/dist/utils/passkey.d.ts +14 -0
- package/dist/utils/socialLogin.d.ts +11 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,27 +6,27 @@ Blux Core is a JavaScript/TypeScript SDK for adding authentication, Stellar wall
|
|
|
6
6
|
|
|
7
7
|
## Useful Links
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
- **Website:** [blux.cc](https://blux.cc/)
|
|
10
|
+
- **Documentation:** [docs.blux.cc](https://docs.blux.cc/)
|
|
11
|
+
- **Live Demo:** [demo.blux.cc](https://demo.blux.cc/)
|
|
12
|
+
- **Dashboard:** [dashboard.blux.cc](https://dashboard.blux.cc/)
|
|
13
13
|
|
|
14
14
|
## Features
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
16
|
+
- **Framework-Agnostic**: Use Blux Core with vanilla JavaScript, TypeScript, or any frontend framework.
|
|
17
|
+
- **Multi-Wallet Support**: Integrate Stellar wallets such as **Rabet, xBull, LOBSTR, Freighter, Albedo, HOT Wallet, Hana, and more**.
|
|
18
|
+
- **Email, Passkey & Social Authentication**: Onboard users without requiring them to install or manage a traditional wallet.
|
|
19
|
+
- **Transaction Signing**: Connect wallets and request transaction signatures through a consistent interface.
|
|
20
|
+
- **Soroban Support**: Add Stellar smart contract interactions to your application.
|
|
21
|
+
- **Customizable UI**: Adjust themes, fonts, backgrounds, logos, border radius, text colors, and other interface elements.
|
|
22
|
+
- **Wallet Configuration**: Include or exclude individual wallets and control their display order.
|
|
23
|
+
- **Configurable Networks**: Choose the Stellar networks supported by your application and set a default network.
|
|
24
|
+
- **Custom Explorer**: Configure the block explorer used for account and transaction links.
|
|
25
|
+
- **Localization**: Provide the authentication experience in multiple supported languages.
|
|
26
|
+
- **User Management & Analytics**: Review authentication methods, login activity, timestamps, and associated wallet addresses through the Blux dashboard.
|
|
27
|
+
- **Testing Tools**: Use predefined test accounts and reusable OTP credentials in configured testing environments.
|
|
28
|
+
- **Multiple Projects**: Create and manage multiple applications from a single Blux account.
|
|
29
|
+
- **Future-Proof**: More wallets and authentication methods will be added based on community feedback.
|
|
30
30
|
|
|
31
31
|
## Installation
|
|
32
32
|
|
|
@@ -77,24 +77,73 @@ document.getElementById('loginBtn').onclick = async () => {
|
|
|
77
77
|
|
|
78
78
|
Create a project through the [Blux Dashboard](https://dashboard.blux.cc/) to obtain your application ID. You can create and manage multiple projects from the same account.
|
|
79
79
|
|
|
80
|
+
### Social Login
|
|
81
|
+
|
|
82
|
+
Add any supported provider to `loginMethods`. The first enabled social is
|
|
83
|
+
shown on the login screen; the rest appear on **Other socials**.
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
createConfig({
|
|
87
|
+
appName: 'My App',
|
|
88
|
+
appId: 'GET_FROM_BLUX_DASHBOARD',
|
|
89
|
+
networks: [core.networks.mainnet],
|
|
90
|
+
loginMethods: [
|
|
91
|
+
'wallet',
|
|
92
|
+
'google',
|
|
93
|
+
'apple',
|
|
94
|
+
'discord',
|
|
95
|
+
'telegram',
|
|
96
|
+
'meta',
|
|
97
|
+
'github',
|
|
98
|
+
'farcaster',
|
|
99
|
+
'tiktok',
|
|
100
|
+
'linkedin',
|
|
101
|
+
'twitch',
|
|
102
|
+
'kick',
|
|
103
|
+
'spotify',
|
|
104
|
+
'instagram',
|
|
105
|
+
'microsoft',
|
|
106
|
+
'gitlab',
|
|
107
|
+
'twitter',
|
|
108
|
+
'steam',
|
|
109
|
+
'email',
|
|
110
|
+
'passkey',
|
|
111
|
+
],
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Each provider is shown only when requested in `loginMethods` and returned in
|
|
116
|
+
the app's enabled `socials` by `/auth/validate`. Most providers open
|
|
117
|
+
`/auth/social/{provider}/start` on the Blux API (for example,
|
|
118
|
+
`/auth/social/meta/start` or `/auth/social/github/start`) and use the
|
|
119
|
+
shared social-login success, retry, and cancellation flow. Telegram uses
|
|
120
|
+
the on-page [Login Widget](https://core.telegram.org/widgets/login) instead
|
|
121
|
+
of a popup, because the bot is bound to the site's domain; Mini Apps can
|
|
122
|
+
complete login via WebApp init data when that is enabled for the project.
|
|
123
|
+
|
|
124
|
+
The backend must support each provider and have the project's credentials
|
|
125
|
+
and callbacks configured. Private keys, client secrets, and bot tokens never
|
|
126
|
+
belong in this browser configuration. Token verification is the backend's
|
|
127
|
+
responsibility; the SDK accepts only the resulting Blux session.
|
|
128
|
+
|
|
80
129
|
## Customization
|
|
81
130
|
|
|
82
131
|
Developers can customize various UI elements:
|
|
83
132
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
133
|
+
- **Themes & Fonts**
|
|
134
|
+
- **Backgrounds, Logos**
|
|
135
|
+
- **Border Radius & Text Colors**
|
|
136
|
+
- **Authentication Limits** (Free tier supports 500-1000 accounts per auth method)
|
|
88
137
|
|
|
89
138
|
Developers can also configure:
|
|
90
139
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
140
|
+
- Enabled authentication methods
|
|
141
|
+
- Included and excluded wallets
|
|
142
|
+
- Wallet display order
|
|
143
|
+
- Supported networks
|
|
144
|
+
- Default network
|
|
145
|
+
- Block explorer
|
|
146
|
+
- Interface language
|
|
98
147
|
|
|
99
148
|
Configuration options can be set via the `BluxProvider` config or environment variables.
|
|
100
149
|
|
|
@@ -104,11 +153,11 @@ The Blux dashboard provides information about the users who have connected to yo
|
|
|
104
153
|
|
|
105
154
|
Available information includes:
|
|
106
155
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
156
|
+
- Authentication method
|
|
157
|
+
- Login and connection timestamps
|
|
158
|
+
- Associated wallet addresses, when available
|
|
159
|
+
- Recent authentication activity
|
|
160
|
+
- Individual user information
|
|
112
161
|
|
|
113
162
|
This information can help developers understand how their applications are being used and troubleshoot authentication or wallet connection issues.
|
|
114
163
|
|
|
@@ -124,57 +173,60 @@ These credentials are intended only for the configured testing environment. Refe
|
|
|
124
173
|
|
|
125
174
|
Currently supported connection methods:
|
|
126
175
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
176
|
+
- [x] **Freighter**
|
|
177
|
+
- [x] **Rabet**
|
|
178
|
+
- [x] **WalletConnect**
|
|
179
|
+
- [x] **HOT Wallet**
|
|
180
|
+
- [x] **Hana**
|
|
181
|
+
- [x] **xBull**
|
|
182
|
+
- [x] **LOBSTR**
|
|
183
|
+
- [x] **Ledger**
|
|
184
|
+
- [x] **Albedo**
|
|
185
|
+
- [x] **Klever Wallet**
|
|
186
|
+
- [x] **Bitget Wallet**
|
|
187
|
+
- [x] **OneKey**
|
|
188
|
+
- [x] **CactusLink**
|
|
189
|
+
- [x] **Fordefi**
|
|
190
|
+
- [x] **Trezor**
|
|
191
|
+
- [x] **Email**
|
|
192
|
+
- [x] **Google**
|
|
193
|
+
- [x] **Apple**
|
|
194
|
+
- [x] **Discord**
|
|
195
|
+
- [x] **Telegram**
|
|
196
|
+
- [x] **Passkey**
|
|
145
197
|
|
|
146
198
|
## Supported Languages
|
|
147
199
|
|
|
148
200
|
Currently supported languages:
|
|
149
201
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
202
|
+
- [x] **English**
|
|
203
|
+
- [x] **Spanish**
|
|
204
|
+
- [x] **Portuguese**
|
|
205
|
+
- [x] **French**
|
|
206
|
+
- [x] **German**
|
|
207
|
+
- [x] **Russian**
|
|
208
|
+
- [x] **Chinese**
|
|
209
|
+
- [x] **Japanese**
|
|
210
|
+
- [x] **Korean**
|
|
159
211
|
|
|
160
212
|
## License & Usage Restrictions
|
|
161
213
|
|
|
162
|
-
|
|
163
|
-
|
|
214
|
+
- **No Forking or Unauthorized Modifications**: Removing references to **Blux Team** or forking without attribution is strictly prohibited.
|
|
215
|
+
- **Custom Licensing Available**: Contact us at [support@blux.cc](mailto:support@blux.cc) to discuss licensing options.
|
|
164
216
|
|
|
165
217
|
## Support & Contact
|
|
166
218
|
|
|
167
219
|
For support, licensing, custom SMS authentication, or other inquiries, reach out via:
|
|
168
220
|
|
|
169
|
-
|
|
170
|
-
|
|
221
|
+
- **Email**: [support@blux.cc](mailto:support@blux.cc)
|
|
222
|
+
- **X**: [@BluxOfficial](https://x.com/bluxofficial)
|
|
171
223
|
|
|
172
224
|
## Roadmap & Future Plans
|
|
173
225
|
|
|
174
226
|
Blux is evolving. Follow our updates on [X](https://x.com/BluxOfficial) for:
|
|
175
227
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
228
|
+
- **Additional OAuth and Social Authentication Methods**
|
|
229
|
+
- **More Wallet Integrations**
|
|
230
|
+
- **Enhanced Developer Hooks**
|
|
231
|
+
- **Expanded Soroban Support**
|
|
232
|
+
- **Enhanced Customization, Analytics, and Security Features**
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const FarcasterLogo: () => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const TikTokLogo: () => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const LinkedInLogo: () => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const TwitchLogo: () => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const KickLogo: () => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const SpotifyLogo: () => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const InstagramLogo: () => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const MicrosoftLogo: () => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const GitLabLogo: () => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const XLogo: ({ fill }: {
|
|
11
|
+
fill?: string;
|
|
12
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const SteamLogo: ({ fill }: {
|
|
14
|
+
fill?: string;
|
|
15
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DiscordLogo: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MetaLogo: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TelegramLogo: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -23,4 +23,13 @@ export declare const MAINNET_EURC: {
|
|
|
23
23
|
assetBalance: string;
|
|
24
24
|
assetType: string;
|
|
25
25
|
};
|
|
26
|
-
export declare const
|
|
26
|
+
export declare const isPublicNetwork: (network: string) => boolean;
|
|
27
|
+
export declare const isTestnetNetwork: (network: string) => boolean;
|
|
28
|
+
/** Circle USDC for the active network. Testnet uses Circle's test issuer. */
|
|
29
|
+
export declare const usdcForNetwork: (network: string) => IAsset;
|
|
30
|
+
/**
|
|
31
|
+
* Curated logos are pubnet-only. Map a well-known testnet (or same-network)
|
|
32
|
+
* issuer to the pubnet issuer whose icon we should reuse.
|
|
33
|
+
*/
|
|
34
|
+
export declare const pubnetLogoIssuer: (assetCode: string, assetIssuer: string) => string | undefined;
|
|
35
|
+
export declare const getSuggestedAssets: (network: string) => IAsset[];
|
package/dist/enums.d.ts
CHANGED
|
@@ -26,7 +26,8 @@ export declare enum StellarNetwork {
|
|
|
26
26
|
export declare enum Route {
|
|
27
27
|
ONBOARDING = "ONBOARDING",// View for selecting a wallet
|
|
28
28
|
PASSKEY_ONBOARDING = "PASSKEY_ONBOARDING",
|
|
29
|
-
SOCIALS_ONBOARDING = "SOCIALS_ONBOARDING",// Social
|
|
29
|
+
SOCIALS_ONBOARDING = "SOCIALS_ONBOARDING",// Social login waiting / widget / popup flow
|
|
30
|
+
OTHER_SOCIALS = "OTHER_SOCIALS",// Remaining social providers after the primary one
|
|
30
31
|
WRONG_NETWORK = "WRONG_NETWORK",// View for selecting a wallet
|
|
31
32
|
WAITING = "WAITING",// View for connection process
|
|
32
33
|
SUCCESSFUL = "SUCCESSFUL",// View for connection success process
|
package/dist/exports/blux.d.ts
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* @param isSilent - When `true`, tries to restore a recent session without opening the modal.
|
|
6
|
-
* @returns A promise that resolves to the authenticated user.
|
|
7
|
-
*/
|
|
8
|
-
export declare const _login: (isSilent: boolean) => Promise<IUser>;
|
|
9
|
-
/**
|
|
10
|
-
* Opens the Blux modal so the user can connect a wallet or sign in, resolving
|
|
11
|
-
* once authenticated. Waits for the SDK to finish initializing first.
|
|
12
|
-
*
|
|
13
|
-
* @returns The authenticated user.
|
|
14
|
-
*/
|
|
15
|
-
export declare const login: () => Promise<IUser>;
|
|
1
|
+
import { loginWallet } from './loginMethods';
|
|
2
|
+
export { _login } from './loginMethods';
|
|
3
|
+
export { login, loginEmail, loginOAuth, loginPasskey, loginSms, loginWallet, } from './loginMethods';
|
|
4
|
+
export type { LoginCodeApi, LoginCodeFn, LoginOAuthOptions, } from './loginMethods';
|
|
16
5
|
/**
|
|
17
6
|
* Signs a transaction XDR with the connected wallet, without submitting it.
|
|
18
7
|
*
|
|
@@ -59,7 +48,12 @@ export declare const signAuthEntry: (authEntry: string, options?: {
|
|
|
59
48
|
* Each method carries its own documentation; the getters expose live auth state.
|
|
60
49
|
*/
|
|
61
50
|
export declare const blux: {
|
|
62
|
-
login: () => Promise<IUser>;
|
|
51
|
+
login: () => Promise<import("../store").IUser>;
|
|
52
|
+
loginEmail: import("./loginMethods").LoginCodeFn;
|
|
53
|
+
loginSms: import("./loginMethods").LoginCodeFn;
|
|
54
|
+
loginOAuth: (provider: import("../types").ISocialProvider | string, options?: import("./loginMethods").LoginOAuthOptions) => Promise<import("../store").IUser>;
|
|
55
|
+
loginPasskey: () => Promise<import("../store").IUser>;
|
|
56
|
+
loginWallet: typeof loginWallet;
|
|
63
57
|
logout: () => void;
|
|
64
58
|
fundMe: () => void;
|
|
65
59
|
profile: () => void;
|
|
@@ -79,5 +73,5 @@ export declare const blux: {
|
|
|
79
73
|
/** Whether a user is currently authenticated. */
|
|
80
74
|
readonly isAuthenticated: boolean;
|
|
81
75
|
/** The currently authenticated user, or `undefined` when logged out. */
|
|
82
|
-
readonly user: IUser | undefined;
|
|
76
|
+
readonly user: import("../store").IUser | undefined;
|
|
83
77
|
};
|
|
@@ -8,6 +8,10 @@ export interface IExportedStore {
|
|
|
8
8
|
isAuthenticated: boolean;
|
|
9
9
|
};
|
|
10
10
|
stellar?: IStellarConfig;
|
|
11
|
+
/** Installed wallets currently offered in the picker. */
|
|
12
|
+
wallets: Array<{
|
|
13
|
+
name: string;
|
|
14
|
+
}>;
|
|
11
15
|
}
|
|
12
16
|
export declare const exportedStore: import("zustand").StoreApi<IExportedStore>;
|
|
13
17
|
export declare const syncExportedStore: (mainStore: typeof store) => () => void;
|
package/dist/exports/index.d.ts
CHANGED
|
@@ -2,11 +2,12 @@ import { BluxEventMap, ReadOnlyEmitter } from '../utils/events';
|
|
|
2
2
|
export type { IAppearance, IConfig, IExplorer, ILoginMethods, IServers, ISocialProvider, ITrezorMetaData, ITransports, IWalletConnectMetaData, IWalletNames, LanguageKey, } from '../types';
|
|
3
3
|
export type { IUser } from '../store';
|
|
4
4
|
export type { IExportedStore } from './exportedStore';
|
|
5
|
+
export type { LoginCodeApi, LoginCodeFn, LoginOAuthOptions } from './blux';
|
|
5
6
|
export { Asset } from '@stellar/stellar-sdk';
|
|
6
7
|
export * as StellarSdk from '@stellar/stellar-sdk';
|
|
7
8
|
export * from './core';
|
|
8
9
|
export * as core from './core';
|
|
9
|
-
export { blux } from './blux';
|
|
10
|
+
export { blux, loginEmail, loginSms, loginOAuth, loginPasskey, loginWallet, } from './blux';
|
|
10
11
|
export { BluxEvent } from '../utils/events';
|
|
11
12
|
export { getState, subscribe, getInitialState, useExportedStore, } from './exportedStore';
|
|
12
13
|
export declare const setAppearance: (newAppearance: Partial<import("../types").IAppearance>) => void;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { ISocialProvider } from '../types';
|
|
2
|
+
import { IUser } from '../store';
|
|
3
|
+
/** sendCode + loginWithCode pair returned by {@link loginEmail} / {@link loginSms}. */
|
|
4
|
+
export type LoginCodeApi = {
|
|
5
|
+
/** Send a one-time code to the identifier (email address or phone number). */
|
|
6
|
+
sendCode: (identifier: string) => Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Verify the one-time code and complete login.
|
|
9
|
+
*
|
|
10
|
+
* @returns The authenticated user.
|
|
11
|
+
*/
|
|
12
|
+
loginWithCode: (identifier: string, code: string) => Promise<IUser>;
|
|
13
|
+
};
|
|
14
|
+
/** {@link loginEmail} / {@link loginSms}: call it for the hook-shaped pair, or use the methods directly. */
|
|
15
|
+
export type LoginCodeFn = (() => LoginCodeApi) & LoginCodeApi;
|
|
16
|
+
/**
|
|
17
|
+
* Internal login driver. Prefer the public {@link login}.
|
|
18
|
+
*
|
|
19
|
+
* @param isSilent - When `true`, tries to restore a recent session without opening the modal.
|
|
20
|
+
* @returns A promise that resolves to the authenticated user.
|
|
21
|
+
*/
|
|
22
|
+
export declare const _login: (isSilent: boolean) => Promise<IUser>;
|
|
23
|
+
/**
|
|
24
|
+
* Opens the Blux modal so the user can connect a wallet or sign in, resolving
|
|
25
|
+
* once authenticated. Waits for the SDK to finish initializing first.
|
|
26
|
+
*
|
|
27
|
+
* @returns The authenticated user.
|
|
28
|
+
*/
|
|
29
|
+
export declare const login: () => Promise<IUser>;
|
|
30
|
+
/**
|
|
31
|
+
* Headless email login. Mirrors Privy's `sendCode` + `loginWithCode` so a React
|
|
32
|
+
* hook can wrap this directly:
|
|
33
|
+
*
|
|
34
|
+
* ```ts
|
|
35
|
+
* const { sendCode, loginWithCode } = blux.loginEmail();
|
|
36
|
+
* await sendCode('user@example.com');
|
|
37
|
+
* const user = await loginWithCode('user@example.com', '123456');
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* `blux.loginEmail.sendCode(...)` works the same way without calling the function.
|
|
41
|
+
* Does not open the Blux modal; render your own email / OTP UI.
|
|
42
|
+
*/
|
|
43
|
+
export declare const loginEmail: LoginCodeFn;
|
|
44
|
+
/**
|
|
45
|
+
* Headless SMS login. Same shape as {@link loginEmail}:
|
|
46
|
+
*
|
|
47
|
+
* ```ts
|
|
48
|
+
* const { sendCode, loginWithCode } = blux.loginSms();
|
|
49
|
+
* await sendCode('+15555555555');
|
|
50
|
+
* const user = await loginWithCode('+15555555555', '123456');
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* Does not open the Blux modal. SMS must be in `loginMethods` and the app must
|
|
54
|
+
* be on a paid plan (`smsEnabled` from `/auth/validate`).
|
|
55
|
+
*/
|
|
56
|
+
export declare const loginSms: LoginCodeFn;
|
|
57
|
+
export type LoginOAuthOptions = {
|
|
58
|
+
/**
|
|
59
|
+
* Telegram Login Widget user object, or `{ init_data }` from a Telegram Mini
|
|
60
|
+
* App. Required for Telegram unless Mini App init data is already on `window`.
|
|
61
|
+
*/
|
|
62
|
+
telegramUser?: Record<string, unknown>;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Headless social login. Opens the provider popup (must run from a click
|
|
66
|
+
* handler so the browser does not block it) and resolves with the user.
|
|
67
|
+
*
|
|
68
|
+
* Telegram cannot use that popup (the bot is bound to this origin). Pass the
|
|
69
|
+
* widget payload as `options.telegramUser`, or call this from a Mini App where
|
|
70
|
+
* init data is present. To show Blux's Telegram widget instead, use {@link login}.
|
|
71
|
+
*
|
|
72
|
+
* @param provider - A social name from {@link ISocialProvider} (`'google'`, `'apple'`, ...).
|
|
73
|
+
* @param options - Telegram-only extras.
|
|
74
|
+
*/
|
|
75
|
+
export declare const loginOAuth: (provider: ISocialProvider | string, options?: LoginOAuthOptions) => Promise<IUser>;
|
|
76
|
+
/**
|
|
77
|
+
* Headless passkey login. Triggers the WebAuthn ceremony (register on first
|
|
78
|
+
* visit, assert on later visits) and resolves with the user. Must run from a
|
|
79
|
+
* user gesture. Does not open the Blux modal.
|
|
80
|
+
*/
|
|
81
|
+
export declare const loginPasskey: () => Promise<IUser>;
|
|
82
|
+
/**
|
|
83
|
+
* Wallet login.
|
|
84
|
+
*
|
|
85
|
+
* - No argument: opens the Blux onboarding modal showing only the scrollable
|
|
86
|
+
* wallet list (email / SMS / social / passkey rows are hidden).
|
|
87
|
+
* - With a wallet name (`'freighter'`, `'rabet'`, ...): opens that wallet's
|
|
88
|
+
* own prompt and never the Blux modal. WalletConnect is the exception and
|
|
89
|
+
* still uses the Blux QR screen.
|
|
90
|
+
*
|
|
91
|
+
* @returns The authenticated user.
|
|
92
|
+
*/
|
|
93
|
+
export declare function loginWallet(walletName?: string): Promise<IUser>;
|