@zerodev/wallet-react 0.0.1-alpha.12 → 0.0.1-alpha.14

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @zerodev/wallet-react
2
2
 
3
+ ## 0.0.1-alpha.14
4
+
5
+ ### Patch Changes
6
+
7
+ - Add optional `otpCodeCustomization` parameter to OTP and magic link send flows for configuring code length (6-9) and alphanumeric mode
8
+ - Updated dependencies
9
+ - @zerodev/wallet-core@0.0.1-alpha.13
10
+
11
+ ## 0.0.1-alpha.13
12
+
13
+ ### Patch Changes
14
+
15
+ - feat: expose applySettings on iframe stamper and accept iframeStyles in export actions
16
+ - Updated dependencies
17
+ - @zerodev/wallet-core@0.0.1-alpha.12
18
+
3
19
  ## 0.0.1-alpha.12
4
20
 
5
21
  ### Patch Changes
package/README.md CHANGED
@@ -76,7 +76,7 @@ function LoginPage() {
76
76
  return (
77
77
  <>
78
78
  <button
79
- onClick={() => registerPasskey.mutate({ email: 'user@example.com' })}
79
+ onClick={() => registerPasskey.mutate()}
80
80
  disabled={registerPasskey.isPending}
81
81
  >
82
82
  {registerPasskey.isPending ? 'Registering...' : 'Register with Passkey'}
@@ -134,10 +134,10 @@ const registerPasskey = useRegisterPasskey()
134
134
  const loginPasskey = useLoginPasskey()
135
135
 
136
136
  // Register new passkey
137
- await registerPasskey.mutateAsync({ email: 'user@example.com' })
137
+ await registerPasskey.mutateAsync()
138
138
 
139
139
  // Login with existing passkey
140
- await loginPasskey.mutateAsync({ email: 'user@example.com' })
140
+ await loginPasskey.mutateAsync()
141
141
  ```
142
142
 
143
143
  ### OAuth (Google)
@@ -152,6 +152,30 @@ await authenticateOAuth.mutateAsync({
152
152
  })
153
153
  ```
154
154
 
155
+ ### Email Magic Link
156
+
157
+ ```typescript
158
+ const sendMagicLink = useSendMagicLink()
159
+ const verifyMagicLink = useVerifyMagicLink()
160
+
161
+ // Send magic link
162
+ const { otpId } = await sendMagicLink.mutateAsync({
163
+ email: 'user@example.com',
164
+ redirectURL: 'https://yourapp.com/verify',
165
+ })
166
+
167
+ // With custom OTP code settings
168
+ const { otpId } = await sendMagicLink.mutateAsync({
169
+ email: 'user@example.com',
170
+ redirectURL: 'https://yourapp.com/verify',
171
+ otpCodeCustomization: { length: 8, alphanumeric: false },
172
+ })
173
+
174
+ // Verify (on /verify page, extract code from URL)
175
+ const code = new URLSearchParams(window.location.search).get('code')
176
+ await verifyMagicLink.mutateAsync({ otpId, code })
177
+ ```
178
+
155
179
  ### Email OTP
156
180
 
157
181
  ```typescript
@@ -163,13 +187,28 @@ const { otpId } = await sendOTP.mutateAsync({
163
187
  email: 'user@example.com'
164
188
  })
165
189
 
190
+ // With custom OTP code settings
191
+ const { otpId } = await sendOTP.mutateAsync({
192
+ email: 'user@example.com',
193
+ otpCodeCustomization: { length: 8, alphanumeric: false },
194
+ })
195
+
166
196
  // Verify OTP code
167
197
  await verifyOTP.mutateAsync({
168
- code: '123456',
198
+ code: '12345678',
169
199
  otpId,
170
200
  })
171
201
  ```
172
202
 
203
+ ### OTP Code Customization
204
+
205
+ Both `useSendOTP` and `useSendMagicLink` accept an optional `otpCodeCustomization` parameter:
206
+
207
+ | Field | Type | Description |
208
+ |---|---|---|
209
+ | `length` | `6 \| 7 \| 8 \| 9` | Code length (default: 6) |
210
+ | `alphanumeric` | `boolean` | Use alphanumeric characters instead of digits only (default: false) |
211
+
173
212
  ## Configuration Options
174
213
 
175
214
  ```typescript
@@ -255,6 +294,8 @@ All hooks follow the TanStack Query mutation pattern:
255
294
  - `useRegisterPasskey()` - Register with passkey
256
295
  - `useLoginPasskey()` - Login with passkey
257
296
  - `useAuthenticateOAuth()` - OAuth (Google popup)
297
+ - `useSendMagicLink()` - Send magic link via email
298
+ - `useVerifyMagicLink()` - Verify magic link code
258
299
  - `useSendOTP()` - Send OTP via email
259
300
  - `useVerifyOTP()` - Verify OTP code
260
301
  - `useRefreshSession()` - Manually refresh session
@@ -9,6 +9,8 @@ exports.refreshSession = refreshSession;
9
9
  exports.getUserEmail = getUserEmail;
10
10
  exports.exportWallet = exportWallet;
11
11
  exports.exportPrivateKey = exportPrivateKey;
12
+ exports.sendMagicLink = sendMagicLink;
13
+ exports.verifyMagicLink = verifyMagicLink;
12
14
  const actions_1 = require("@wagmi/core/actions");
13
15
  const wallet_core_1 = require("@zerodev/wallet-core");
14
16
  const oauth_js_1 = require("./oauth.js");
@@ -20,14 +22,13 @@ function getZeroDevConnector(config) {
20
22
  return connector;
21
23
  }
22
24
  async function registerPasskey(config, parameters) {
23
- const connector = parameters.connector ?? getZeroDevConnector(config);
25
+ const connector = parameters?.connector ?? getZeroDevConnector(config);
24
26
  const store = await connector.getStore();
25
27
  const wallet = store.getState().wallet;
26
28
  if (!wallet)
27
29
  throw new Error('Wallet not initialized');
28
30
  await wallet.auth({
29
31
  type: 'passkey',
30
- email: parameters.email,
31
32
  mode: 'register',
32
33
  });
33
34
  const [session, eoaAccount] = await Promise.all([
@@ -39,14 +40,13 @@ async function registerPasskey(config, parameters) {
39
40
  await (0, actions_1.connect)(config, { connector });
40
41
  }
41
42
  async function loginPasskey(config, parameters) {
42
- const connector = parameters.connector ?? getZeroDevConnector(config);
43
+ const connector = parameters?.connector ?? getZeroDevConnector(config);
43
44
  const store = await connector.getStore();
44
45
  const wallet = store.getState().wallet;
45
46
  if (!wallet)
46
47
  throw new Error('Wallet not initialized');
47
48
  await wallet.auth({
48
49
  type: 'passkey',
49
- email: parameters.email,
50
50
  mode: 'login',
51
51
  });
52
52
  const [session, eoaAccount] = await Promise.all([
@@ -121,6 +121,9 @@ async function sendOTP(config, parameters) {
121
121
  ...(parameters.emailCustomization && {
122
122
  emailCustomization: parameters.emailCustomization,
123
123
  }),
124
+ ...(parameters.otpCodeCustomization && {
125
+ otpCodeCustomization: parameters.otpCodeCustomization,
126
+ }),
124
127
  });
125
128
  return {
126
129
  otpId: result.otpId,
@@ -194,6 +197,9 @@ async function exportWallet(config, parameters) {
194
197
  iframeElementId: 'export-wallet-iframe',
195
198
  });
196
199
  const publicKey = await iframeStamper.init();
200
+ if (parameters.iframeStyles) {
201
+ await iframeStamper.applySettings({ styles: parameters.iframeStyles });
202
+ }
197
203
  const { exportBundle, organizationId } = await (0, wallet_core_1.exportWallet)({
198
204
  wallet,
199
205
  targetPublicKey: publicKey,
@@ -219,6 +225,9 @@ async function exportPrivateKey(config, parameters) {
219
225
  iframeElementId: 'export-private-key-iframe',
220
226
  });
221
227
  const publicKey = await iframeStamper.init();
228
+ if (parameters.iframeStyles) {
229
+ await iframeStamper.applySettings({ styles: parameters.iframeStyles });
230
+ }
222
231
  const { exportBundle, organizationId } = await (0, wallet_core_1.exportPrivateKey)({
223
232
  wallet,
224
233
  targetPublicKey: publicKey,
@@ -229,3 +238,42 @@ async function exportPrivateKey(config, parameters) {
229
238
  throw new Error('Failed to inject export bundle');
230
239
  }
231
240
  }
241
+ async function sendMagicLink(config, parameters) {
242
+ const connector = parameters.connector ?? getZeroDevConnector(config);
243
+ const store = await connector.getStore();
244
+ const wallet = store.getState().wallet;
245
+ if (!wallet)
246
+ throw new Error('Wallet not initialized');
247
+ const result = await wallet.auth({
248
+ type: 'magicLink',
249
+ mode: 'send',
250
+ email: parameters.email,
251
+ redirectURL: parameters.redirectURL,
252
+ ...(parameters.otpCodeCustomization && {
253
+ otpCodeCustomization: parameters.otpCodeCustomization,
254
+ }),
255
+ });
256
+ return {
257
+ otpId: result.otpId,
258
+ };
259
+ }
260
+ async function verifyMagicLink(config, parameters) {
261
+ const connector = parameters.connector ?? getZeroDevConnector(config);
262
+ const store = await connector.getStore();
263
+ const wallet = store.getState().wallet;
264
+ if (!wallet)
265
+ throw new Error('Wallet not initialized');
266
+ await wallet.auth({
267
+ type: 'magicLink',
268
+ mode: 'verify',
269
+ otpId: parameters.otpId,
270
+ code: parameters.code,
271
+ });
272
+ const [session, eoaAccount] = await Promise.all([
273
+ wallet.getSession(),
274
+ wallet.toAccount(),
275
+ ]);
276
+ store.getState().setEoaAccount(eoaAccount);
277
+ store.getState().setSession(session || null);
278
+ await (0, actions_1.connect)(config, { connector });
279
+ }
@@ -11,7 +11,7 @@ function useLoginPasskey(parameters = {}) {
11
11
  return (0, react_query_1.useMutation)({
12
12
  ...mutation,
13
13
  async mutationFn(variables) {
14
- return (0, actions_js_1.loginPasskey)(config, variables);
14
+ return (0, actions_js_1.loginPasskey)(config, variables ?? undefined);
15
15
  },
16
16
  mutationKey: ['loginPasskey'],
17
17
  });
@@ -11,7 +11,7 @@ function useRegisterPasskey(parameters = {}) {
11
11
  return (0, react_query_1.useMutation)({
12
12
  ...mutation,
13
13
  async mutationFn(variables) {
14
- return (0, actions_js_1.registerPasskey)(config, variables);
14
+ return (0, actions_js_1.registerPasskey)(config, variables ?? undefined);
15
15
  },
16
16
  mutationKey: ['registerPasskey'],
17
17
  });
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useSendMagicLink = useSendMagicLink;
5
+ const react_query_1 = require("@tanstack/react-query");
6
+ const wagmi_1 = require("wagmi");
7
+ const actions_js_1 = require("../actions.js");
8
+ function useSendMagicLink(parameters = {}) {
9
+ const { mutation } = parameters;
10
+ const config = (0, wagmi_1.useConfig)(parameters);
11
+ return (0, react_query_1.useMutation)({
12
+ ...mutation,
13
+ async mutationFn(variables) {
14
+ return (0, actions_js_1.sendMagicLink)(config, variables);
15
+ },
16
+ mutationKey: ['sendMagicLink'],
17
+ });
18
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.useVerifyMagicLink = useVerifyMagicLink;
5
+ const react_query_1 = require("@tanstack/react-query");
6
+ const wagmi_1 = require("wagmi");
7
+ const actions_js_1 = require("../actions.js");
8
+ function useVerifyMagicLink(parameters = {}) {
9
+ const { mutation } = parameters;
10
+ const config = (0, wagmi_1.useConfig)(parameters);
11
+ return (0, react_query_1.useMutation)({
12
+ ...mutation,
13
+ async mutationFn(variables) {
14
+ return (0, actions_js_1.verifyMagicLink)(config, variables);
15
+ },
16
+ mutationKey: ['verifyMagicLink'],
17
+ });
18
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createZeroDevWalletStore = exports.OAUTH_PROVIDERS = exports.listenForOAuthMessage = exports.handleOAuthCallback = exports.buildBackendOAuthUrl = exports.useVerifyOTP = exports.useSendOTP = exports.useRegisterPasskey = exports.useRefreshSession = exports.useLoginPasskey = exports.useGetUserEmail = exports.useExportWallet = exports.useExportPrivateKey = exports.useAuthenticateOAuth = exports.zeroDevWallet = void 0;
3
+ exports.createZeroDevWalletStore = exports.OAUTH_PROVIDERS = exports.listenForOAuthMessage = exports.handleOAuthCallback = exports.buildBackendOAuthUrl = exports.useVerifyOTP = exports.useVerifyMagicLink = exports.useSendOTP = exports.useSendMagicLink = exports.useRegisterPasskey = exports.useRefreshSession = exports.useLoginPasskey = exports.useGetUserEmail = exports.useExportWallet = exports.useExportPrivateKey = exports.useAuthenticateOAuth = exports.zeroDevWallet = void 0;
4
4
  var connector_js_1 = require("./connector.js");
5
5
  Object.defineProperty(exports, "zeroDevWallet", { enumerable: true, get: function () { return connector_js_1.zeroDevWallet; } });
6
6
  var useAuthenticateOAuth_js_1 = require("./hooks/useAuthenticateOAuth.js");
@@ -17,8 +17,12 @@ var useRefreshSession_js_1 = require("./hooks/useRefreshSession.js");
17
17
  Object.defineProperty(exports, "useRefreshSession", { enumerable: true, get: function () { return useRefreshSession_js_1.useRefreshSession; } });
18
18
  var useRegisterPasskey_js_1 = require("./hooks/useRegisterPasskey.js");
19
19
  Object.defineProperty(exports, "useRegisterPasskey", { enumerable: true, get: function () { return useRegisterPasskey_js_1.useRegisterPasskey; } });
20
+ var useSendMagicLink_js_1 = require("./hooks/useSendMagicLink.js");
21
+ Object.defineProperty(exports, "useSendMagicLink", { enumerable: true, get: function () { return useSendMagicLink_js_1.useSendMagicLink; } });
20
22
  var useSendOTP_js_1 = require("./hooks/useSendOTP.js");
21
23
  Object.defineProperty(exports, "useSendOTP", { enumerable: true, get: function () { return useSendOTP_js_1.useSendOTP; } });
24
+ var useVerifyMagicLink_js_1 = require("./hooks/useVerifyMagicLink.js");
25
+ Object.defineProperty(exports, "useVerifyMagicLink", { enumerable: true, get: function () { return useVerifyMagicLink_js_1.useVerifyMagicLink; } });
22
26
  var useVerifyOTP_js_1 = require("./hooks/useVerifyOTP.js");
23
27
  Object.defineProperty(exports, "useVerifyOTP", { enumerable: true, get: function () { return useVerifyOTP_js_1.useVerifyOTP; } });
24
28
  var oauth_js_1 = require("./oauth.js");
@@ -15,7 +15,7 @@ function getZeroDevConnector(config) {
15
15
  * Register with passkey
16
16
  */
17
17
  export async function registerPasskey(config, parameters) {
18
- const connector = parameters.connector ?? getZeroDevConnector(config);
18
+ const connector = parameters?.connector ?? getZeroDevConnector(config);
19
19
  // @ts-expect-error - getStore is a custom method
20
20
  const store = await connector.getStore();
21
21
  const wallet = store.getState().wallet;
@@ -23,7 +23,6 @@ export async function registerPasskey(config, parameters) {
23
23
  throw new Error('Wallet not initialized');
24
24
  await wallet.auth({
25
25
  type: 'passkey',
26
- email: parameters.email,
27
26
  mode: 'register',
28
27
  });
29
28
  const [session, eoaAccount] = await Promise.all([
@@ -39,7 +38,7 @@ export async function registerPasskey(config, parameters) {
39
38
  * Login with passkey
40
39
  */
41
40
  export async function loginPasskey(config, parameters) {
42
- const connector = parameters.connector ?? getZeroDevConnector(config);
41
+ const connector = parameters?.connector ?? getZeroDevConnector(config);
43
42
  // @ts-expect-error - getStore is a custom method
44
43
  const store = await connector.getStore();
45
44
  const wallet = store.getState().wallet;
@@ -47,7 +46,6 @@ export async function loginPasskey(config, parameters) {
47
46
  throw new Error('Wallet not initialized');
48
47
  await wallet.auth({
49
48
  type: 'passkey',
50
- email: parameters.email,
51
49
  mode: 'login',
52
50
  });
53
51
  const [session, eoaAccount] = await Promise.all([
@@ -140,6 +138,9 @@ export async function sendOTP(config, parameters) {
140
138
  ...(parameters.emailCustomization && {
141
139
  emailCustomization: parameters.emailCustomization,
142
140
  }),
141
+ ...(parameters.otpCodeCustomization && {
142
+ otpCodeCustomization: parameters.otpCodeCustomization,
143
+ }),
143
144
  });
144
145
  return {
145
146
  otpId: result.otpId,
@@ -231,6 +232,9 @@ export async function exportWallet(config, parameters) {
231
232
  iframeElementId: 'export-wallet-iframe',
232
233
  });
233
234
  const publicKey = await iframeStamper.init();
235
+ if (parameters.iframeStyles) {
236
+ await iframeStamper.applySettings({ styles: parameters.iframeStyles });
237
+ }
234
238
  const { exportBundle, organizationId } = await exportWalletSdk({
235
239
  wallet,
236
240
  targetPublicKey: publicKey,
@@ -260,6 +264,9 @@ export async function exportPrivateKey(config, parameters) {
260
264
  iframeElementId: 'export-private-key-iframe',
261
265
  });
262
266
  const publicKey = await iframeStamper.init();
267
+ if (parameters.iframeStyles) {
268
+ await iframeStamper.applySettings({ styles: parameters.iframeStyles });
269
+ }
263
270
  const { exportBundle, organizationId } = await exportPrivateKeySdk({
264
271
  wallet,
265
272
  targetPublicKey: publicKey,
@@ -270,3 +277,51 @@ export async function exportPrivateKey(config, parameters) {
270
277
  throw new Error('Failed to inject export bundle');
271
278
  }
272
279
  }
280
+ /**
281
+ * Send magic link via email
282
+ */
283
+ export async function sendMagicLink(config, parameters) {
284
+ const connector = parameters.connector ?? getZeroDevConnector(config);
285
+ // @ts-expect-error - getStore is a custom method
286
+ const store = await connector.getStore();
287
+ const wallet = store.getState().wallet;
288
+ if (!wallet)
289
+ throw new Error('Wallet not initialized');
290
+ const result = await wallet.auth({
291
+ type: 'magicLink',
292
+ mode: 'send',
293
+ email: parameters.email,
294
+ redirectURL: parameters.redirectURL,
295
+ ...(parameters.otpCodeCustomization && {
296
+ otpCodeCustomization: parameters.otpCodeCustomization,
297
+ }),
298
+ });
299
+ return {
300
+ otpId: result.otpId,
301
+ };
302
+ }
303
+ /**
304
+ * Verify magic link code
305
+ */
306
+ export async function verifyMagicLink(config, parameters) {
307
+ const connector = parameters.connector ?? getZeroDevConnector(config);
308
+ // @ts-expect-error - getStore is a custom method
309
+ const store = await connector.getStore();
310
+ const wallet = store.getState().wallet;
311
+ if (!wallet)
312
+ throw new Error('Wallet not initialized');
313
+ await wallet.auth({
314
+ type: 'magicLink',
315
+ mode: 'verify',
316
+ otpId: parameters.otpId,
317
+ code: parameters.code,
318
+ });
319
+ const [session, eoaAccount] = await Promise.all([
320
+ wallet.getSession(),
321
+ wallet.toAccount(),
322
+ ]);
323
+ store.getState().setEoaAccount(eoaAccount);
324
+ store.getState().setSession(session || null);
325
+ // Auto-connect to Wagmi
326
+ await wagmiConnect(config, { connector });
327
+ }
@@ -11,7 +11,7 @@ export function useLoginPasskey(parameters = {}) {
11
11
  return useMutation({
12
12
  ...mutation,
13
13
  async mutationFn(variables) {
14
- return loginPasskey(config, variables);
14
+ return loginPasskey(config, variables ?? undefined);
15
15
  },
16
16
  mutationKey: ['loginPasskey'],
17
17
  });
@@ -11,7 +11,7 @@ export function useRegisterPasskey(parameters = {}) {
11
11
  return useMutation({
12
12
  ...mutation,
13
13
  async mutationFn(variables) {
14
- return registerPasskey(config, variables);
14
+ return registerPasskey(config, variables ?? undefined);
15
15
  },
16
16
  mutationKey: ['registerPasskey'],
17
17
  });
@@ -0,0 +1,18 @@
1
+ 'use client';
2
+ import { useMutation, } from '@tanstack/react-query';
3
+ import { useConfig } from 'wagmi';
4
+ import { sendMagicLink } from '../actions.js';
5
+ /**
6
+ * Hook to send a magic link via email
7
+ */
8
+ export function useSendMagicLink(parameters = {}) {
9
+ const { mutation } = parameters;
10
+ const config = useConfig(parameters);
11
+ return useMutation({
12
+ ...mutation,
13
+ async mutationFn(variables) {
14
+ return sendMagicLink(config, variables);
15
+ },
16
+ mutationKey: ['sendMagicLink'],
17
+ });
18
+ }
@@ -0,0 +1,18 @@
1
+ 'use client';
2
+ import { useMutation, } from '@tanstack/react-query';
3
+ import { useConfig } from 'wagmi';
4
+ import { verifyMagicLink } from '../actions.js';
5
+ /**
6
+ * Hook to verify a magic link code
7
+ */
8
+ export function useVerifyMagicLink(parameters = {}) {
9
+ const { mutation } = parameters;
10
+ const config = useConfig(parameters);
11
+ return useMutation({
12
+ ...mutation,
13
+ async mutationFn(variables) {
14
+ return verifyMagicLink(config, variables);
15
+ },
16
+ mutationKey: ['verifyMagicLink'],
17
+ });
18
+ }
@@ -6,7 +6,9 @@ export { useGetUserEmail } from './hooks/useGetUserEmail.js';
6
6
  export { useLoginPasskey } from './hooks/useLoginPasskey.js';
7
7
  export { useRefreshSession } from './hooks/useRefreshSession.js';
8
8
  export { useRegisterPasskey } from './hooks/useRegisterPasskey.js';
9
+ export { useSendMagicLink } from './hooks/useSendMagicLink.js';
9
10
  export { useSendOTP } from './hooks/useSendOTP.js';
11
+ export { useVerifyMagicLink } from './hooks/useVerifyMagicLink.js';
10
12
  export { useVerifyOTP } from './hooks/useVerifyOTP.js';
11
13
  export { buildBackendOAuthUrl, handleOAuthCallback, listenForOAuthMessage, OAUTH_PROVIDERS, } from './oauth.js';
12
14
  export { createZeroDevWalletStore } from './store.js';
@@ -109,7 +109,8 @@ export function createProvider({ store, config, }) {
109
109
  if (!kernelClient) {
110
110
  throw new Error(`No kernel client for chain ${chainId}`);
111
111
  }
112
- // Send gasless transaction (always UserOp for EIP-7702)
112
+ // Transactions are sent as UserOperations under the hood (EIP-7702).
113
+ // Gasless if a paymaster is configured on the ZeroDev dashboard.
113
114
  const hash = await kernelClient.sendTransaction({
114
115
  calls: [
115
116
  {
@@ -3,13 +3,11 @@ import type { OAuthProvider } from './oauth.js';
3
3
  /**
4
4
  * Register with passkey
5
5
  */
6
- export declare function registerPasskey(config: Config, parameters: {
7
- email: string;
6
+ export declare function registerPasskey(config: Config, parameters?: {
8
7
  connector?: Connector;
9
8
  }): Promise<void>;
10
9
  export declare namespace registerPasskey {
11
- type Parameters = {
12
- email: string;
10
+ type Parameters = void | {
13
11
  connector?: Connector;
14
12
  };
15
13
  type ReturnType = void;
@@ -18,13 +16,11 @@ export declare namespace registerPasskey {
18
16
  /**
19
17
  * Login with passkey
20
18
  */
21
- export declare function loginPasskey(config: Config, parameters: {
22
- email: string;
19
+ export declare function loginPasskey(config: Config, parameters?: {
23
20
  connector?: Connector;
24
21
  }): Promise<void>;
25
22
  export declare namespace loginPasskey {
26
- type Parameters = {
27
- email: string;
23
+ type Parameters = void | {
28
24
  connector?: Connector;
29
25
  };
30
26
  type ReturnType = void;
@@ -54,6 +50,10 @@ export declare function sendOTP(config: Config, parameters: {
54
50
  emailCustomization?: {
55
51
  magicLinkTemplate?: string;
56
52
  };
53
+ otpCodeCustomization?: {
54
+ length: 6 | 7 | 8 | 9;
55
+ alphanumeric: boolean;
56
+ };
57
57
  connector?: Connector;
58
58
  }): Promise<{
59
59
  otpId: string;
@@ -64,6 +64,10 @@ export declare namespace sendOTP {
64
64
  emailCustomization?: {
65
65
  magicLinkTemplate?: string;
66
66
  };
67
+ otpCodeCustomization?: {
68
+ length: 6 | 7 | 8 | 9;
69
+ alphanumeric: boolean;
70
+ };
67
71
  connector?: Connector;
68
72
  };
69
73
  type ReturnType = {
@@ -121,11 +125,13 @@ export declare namespace getUserEmail {
121
125
  */
122
126
  export declare function exportWallet(config: Config, parameters: {
123
127
  iframeContainerId: string;
128
+ iframeStyles?: Record<string, string>;
124
129
  connector?: Connector;
125
130
  }): Promise<void>;
126
131
  export declare namespace exportWallet {
127
132
  type Parameters = {
128
133
  iframeContainerId: string;
134
+ iframeStyles?: Record<string, string>;
129
135
  connector?: Connector;
130
136
  };
131
137
  type ReturnType = void;
@@ -136,6 +142,7 @@ export declare namespace exportWallet {
136
142
  */
137
143
  export declare function exportPrivateKey(config: Config, parameters: {
138
144
  iframeContainerId: string;
145
+ iframeStyles?: Record<string, string>;
139
146
  address?: string;
140
147
  keyFormat?: 'Hexadecimal' | 'Solana';
141
148
  connector?: Connector;
@@ -143,6 +150,7 @@ export declare function exportPrivateKey(config: Config, parameters: {
143
150
  export declare namespace exportPrivateKey {
144
151
  type Parameters = {
145
152
  iframeContainerId: string;
153
+ iframeStyles?: Record<string, string>;
146
154
  address?: string;
147
155
  keyFormat?: 'Hexadecimal' | 'Solana';
148
156
  connector?: Connector;
@@ -150,4 +158,50 @@ export declare namespace exportPrivateKey {
150
158
  type ReturnType = void;
151
159
  type ErrorType = Error;
152
160
  }
161
+ /**
162
+ * Send magic link via email
163
+ */
164
+ export declare function sendMagicLink(config: Config, parameters: {
165
+ email: string;
166
+ redirectURL: string;
167
+ otpCodeCustomization?: {
168
+ length: 6 | 7 | 8 | 9;
169
+ alphanumeric: boolean;
170
+ };
171
+ connector?: Connector;
172
+ }): Promise<{
173
+ otpId: string;
174
+ }>;
175
+ export declare namespace sendMagicLink {
176
+ type Parameters = {
177
+ email: string;
178
+ redirectURL: string;
179
+ otpCodeCustomization?: {
180
+ length: 6 | 7 | 8 | 9;
181
+ alphanumeric: boolean;
182
+ };
183
+ connector?: Connector;
184
+ };
185
+ type ReturnType = {
186
+ otpId: string;
187
+ };
188
+ type ErrorType = Error;
189
+ }
190
+ /**
191
+ * Verify magic link code
192
+ */
193
+ export declare function verifyMagicLink(config: Config, parameters: {
194
+ otpId: string;
195
+ code: string;
196
+ connector?: Connector;
197
+ }): Promise<void>;
198
+ export declare namespace verifyMagicLink {
199
+ type Parameters = {
200
+ otpId: string;
201
+ code: string;
202
+ connector?: Connector;
203
+ };
204
+ type ReturnType = void;
205
+ type ErrorType = Error;
206
+ }
153
207
  //# sourceMappingURL=actions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAOpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAkB/C;;GAEG;AACH,wB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