@txnlab/use-wallet-ui-react 1.3.0 → 1.4.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 (57) hide show
  1. package/README.md +95 -2
  2. package/dist/cjs/chunks/passkey-C8Dw6sNL.cjs +2 -0
  3. package/dist/cjs/chunks/passkey-C8Dw6sNL.cjs.map +1 -0
  4. package/dist/cjs/index.cjs +14 -14
  5. package/dist/cjs/index.cjs.map +1 -1
  6. package/dist/cjs/plugins/passkey.cjs +2 -0
  7. package/dist/cjs/plugins/passkey.cjs.map +1 -0
  8. package/dist/esm/chunks/passkey-BbgvIGki.js +44 -0
  9. package/dist/esm/chunks/passkey-BbgvIGki.js.map +1 -0
  10. package/dist/esm/index.js +2966 -2679
  11. package/dist/esm/index.js.map +1 -1
  12. package/dist/esm/plugins/passkey.js +578 -0
  13. package/dist/esm/plugins/passkey.js.map +1 -0
  14. package/dist/style.css +152 -0
  15. package/dist/types/components/ConnectWalletMenu.d.ts +7 -1
  16. package/dist/types/components/ConnectWalletMenu.d.ts.map +1 -1
  17. package/dist/types/components/ConnectedWalletMenu.d.ts.map +1 -1
  18. package/dist/types/components/PasskeyConnect.d.ts +29 -0
  19. package/dist/types/components/PasskeyConnect.d.ts.map +1 -0
  20. package/dist/types/components/WalletButton.d.ts +7 -1
  21. package/dist/types/components/WalletButton.d.ts.map +1 -1
  22. package/dist/types/components/WalletGroupLabel.d.ts +6 -0
  23. package/dist/types/components/WalletGroupLabel.d.ts.map +1 -0
  24. package/dist/types/components/WalletIcon.d.ts +6 -0
  25. package/dist/types/components/WalletIcon.d.ts.map +1 -0
  26. package/dist/types/components/WalletList.d.ts.map +1 -1
  27. package/dist/types/index.d.cts +5 -0
  28. package/dist/types/index.d.ts +5 -0
  29. package/dist/types/index.d.ts.map +1 -1
  30. package/dist/types/plugins/passkey/PasskeyDisclosure.d.ts +11 -0
  31. package/dist/types/plugins/passkey/PasskeyDisclosure.d.ts.map +1 -0
  32. package/dist/types/plugins/passkey/PasskeyRecoveryDialog.d.ts +10 -0
  33. package/dist/types/plugins/passkey/PasskeyRecoveryDialog.d.ts.map +1 -0
  34. package/dist/types/plugins/passkey/PasskeyRecoveryMenuButton.d.ts +5 -0
  35. package/dist/types/plugins/passkey/PasskeyRecoveryMenuButton.d.ts.map +1 -0
  36. package/dist/types/plugins/passkey/PasskeySessionControl.d.ts +6 -0
  37. package/dist/types/plugins/passkey/PasskeySessionControl.d.ts.map +1 -0
  38. package/dist/types/plugins/passkey/constants.d.ts +3 -0
  39. package/dist/types/plugins/passkey/constants.d.ts.map +1 -0
  40. package/dist/types/plugins/passkey/index.d.cts +36 -0
  41. package/dist/types/plugins/passkey/index.d.ts +36 -0
  42. package/dist/types/plugins/passkey/index.d.ts.map +1 -0
  43. package/dist/types/plugins/passkey/index.test.d.ts +2 -0
  44. package/dist/types/plugins/passkey/index.test.d.ts.map +1 -0
  45. package/dist/types/plugins/passkey/storage.d.ts +5 -0
  46. package/dist/types/plugins/passkey/storage.d.ts.map +1 -0
  47. package/dist/types/plugins/passkey/storage.test.d.ts +2 -0
  48. package/dist/types/plugins/passkey/storage.test.d.ts.map +1 -0
  49. package/dist/types/plugins/passkey/usePasskeyAdapter.d.ts +10 -0
  50. package/dist/types/plugins/passkey/usePasskeyAdapter.d.ts.map +1 -0
  51. package/dist/types/providers/WalletUIProvider.d.ts +15 -1
  52. package/dist/types/providers/WalletUIProvider.d.ts.map +1 -1
  53. package/dist/types/utils/passkey.d.ts +59 -0
  54. package/dist/types/utils/passkey.d.ts.map +1 -0
  55. package/dist/types/utils/passkey.test.d.ts +2 -0
  56. package/dist/types/utils/passkey.test.d.ts.map +1 -0
  57. package/package.json +13 -2
@@ -0,0 +1,11 @@
1
+ import { MenuRenderContext } from '../types';
2
+ /**
3
+ * Tells users the passkey account belongs to the site that created it. Shows
4
+ * until the user chooses "Got it", once per account; the domain tag in the
5
+ * menu stays after that.
6
+ */
7
+ export declare function PasskeyDisclosure({ ctx, text, }: {
8
+ ctx: MenuRenderContext;
9
+ text: string;
10
+ }): import("react/jsx-runtime").JSX.Element | null;
11
+ //# sourceMappingURL=PasskeyDisclosure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PasskeyDisclosure.d.ts","sourceRoot":"","sources":["../../../../src/plugins/passkey/PasskeyDisclosure.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAEjD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,GAAG,EACH,IAAI,GACL,EAAE;IACD,GAAG,EAAE,iBAAiB,CAAA;IACtB,IAAI,EAAE,MAAM,CAAA;CACb,kDAgCA"}
@@ -0,0 +1,10 @@
1
+ import { PluginRenderContext } from '../types';
2
+ export declare const DEFAULT_PASSKEY_DISPLAY_TIMEOUT = 60;
3
+ export interface PasskeyRecoveryDialogProps {
4
+ ctx: PluginRenderContext;
5
+ onClose: () => void;
6
+ /** Seconds to show the phrase before the dialog closes. Default: 60 */
7
+ displayTimeout?: number;
8
+ }
9
+ export declare function PasskeyRecoveryDialog({ ctx, onClose, displayTimeout, }: PasskeyRecoveryDialogProps): import("react/jsx-runtime").JSX.Element;
10
+ //# sourceMappingURL=PasskeyRecoveryDialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PasskeyRecoveryDialog.d.ts","sourceRoot":"","sources":["../../../../src/plugins/passkey/PasskeyRecoveryDialog.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAInD,eAAO,MAAM,+BAA+B,KAAK,CAAA;AAEjD,MAAM,WAAW,0BAA0B;IACzC,GAAG,EAAE,mBAAmB,CAAA;IACxB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,uEAAuE;IACvE,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,wBAAgB,qBAAqB,CAAC,EACpC,GAAG,EACH,OAAO,EACP,cAAgD,GACjD,EAAE,0BAA0B,2CA2S5B"}
@@ -0,0 +1,5 @@
1
+ import { MenuRenderContext } from '../types';
2
+ export declare function PasskeyRecoveryMenuButton({ ctx }: {
3
+ ctx: MenuRenderContext;
4
+ }): import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=PasskeyRecoveryMenuButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PasskeyRecoveryMenuButton.d.ts","sourceRoot":"","sources":["../../../../src/plugins/passkey/PasskeyRecoveryMenuButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAEjD,wBAAgB,yBAAyB,CAAC,EAAE,GAAG,EAAE,EAAE;IAAE,GAAG,EAAE,iBAAiB,CAAA;CAAE,2CA4C5E"}
@@ -0,0 +1,6 @@
1
+ import { MenuRenderContext } from '../types';
2
+ /** Shows whether the passkey session is unlocked, with Unlock and Lock */
3
+ export declare function PasskeySessionControl({ ctx }: {
4
+ ctx: MenuRenderContext;
5
+ }): import("react/jsx-runtime").JSX.Element | null;
6
+ //# sourceMappingURL=PasskeySessionControl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PasskeySessionControl.d.ts","sourceRoot":"","sources":["../../../../src/plugins/passkey/PasskeySessionControl.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAMjD,0EAA0E;AAC1E,wBAAgB,qBAAqB,CAAC,EAAE,GAAG,EAAE,EAAE;IAAE,GAAG,EAAE,iBAAiB,CAAA;CAAE,kDA+ExE"}
@@ -0,0 +1,3 @@
1
+ export declare const PASSKEY_RECOVERY_DIALOG = "passkey-recovery-dialog";
2
+ export declare const DEFAULT_PASSKEY_DISCLOSURE = "This account is created by and for {domain}. Keep only what you need here, and move larger amounts to a wallet you control.";
3
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/plugins/passkey/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,4BAA4B,CAAA;AAEhE,eAAO,MAAM,0BAA0B,gIACwF,CAAA"}
@@ -0,0 +1,36 @@
1
+ import { WalletUIPlugin } from '../types';
2
+ export { DEFAULT_PASSKEY_DISCLOSURE, PASSKEY_RECOVERY_DIALOG, } from './constants';
3
+ export { usePasskeyAdapter } from './usePasskeyAdapter';
4
+ export type { PasskeyWalletAdapter } from '../../utils/passkey';
5
+ export interface PasskeyPluginOptions {
6
+ /**
7
+ * Add "Back up account" to the menu, which reveals the recovery phrase.
8
+ * Pass an object to set how long the phrase stays visible (seconds,
9
+ * default 60). Default: true
10
+ */
11
+ recoveryPhrase?: boolean | {
12
+ displayTimeout?: number;
13
+ };
14
+ /**
15
+ * Show the session's lock status with Unlock and Lock buttons. Turn it on
16
+ * when the passkey wallet is configured with `passkey({ session })`.
17
+ * Default: false
18
+ */
19
+ session?: boolean;
20
+ /**
21
+ * Tell users the account belongs to this site, until they choose "Got it"
22
+ * (remembered per account). Pass a string to replace the text; `{domain}`
23
+ * is replaced with the account's domain. The menu always shows the domain
24
+ * as a tag. Default: false
25
+ */
26
+ disclosure?: boolean | string;
27
+ }
28
+ /**
29
+ * Plugin that adds passkey account features to the ConnectedWalletMenu:
30
+ * recovery phrase export, session lock status, and an optional note on whose
31
+ * account it is. Only visible when the passkey wallet is active.
32
+ *
33
+ * Requires @txnlab/use-wallet-react 5.2 or later.
34
+ */
35
+ export declare function passkeyPlugin(options?: PasskeyPluginOptions): WalletUIPlugin;
36
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,36 @@
1
+ import { WalletUIPlugin } from '../types';
2
+ export { DEFAULT_PASSKEY_DISCLOSURE, PASSKEY_RECOVERY_DIALOG, } from './constants';
3
+ export { usePasskeyAdapter } from './usePasskeyAdapter';
4
+ export type { PasskeyWalletAdapter } from '../../utils/passkey';
5
+ export interface PasskeyPluginOptions {
6
+ /**
7
+ * Add "Back up account" to the menu, which reveals the recovery phrase.
8
+ * Pass an object to set how long the phrase stays visible (seconds,
9
+ * default 60). Default: true
10
+ */
11
+ recoveryPhrase?: boolean | {
12
+ displayTimeout?: number;
13
+ };
14
+ /**
15
+ * Show the session's lock status with Unlock and Lock buttons. Turn it on
16
+ * when the passkey wallet is configured with `passkey({ session })`.
17
+ * Default: false
18
+ */
19
+ session?: boolean;
20
+ /**
21
+ * Tell users the account belongs to this site, until they choose "Got it"
22
+ * (remembered per account). Pass a string to replace the text; `{domain}`
23
+ * is replaced with the account's domain. The menu always shows the domain
24
+ * as a tag. Default: false
25
+ */
26
+ disclosure?: boolean | string;
27
+ }
28
+ /**
29
+ * Plugin that adds passkey account features to the ConnectedWalletMenu:
30
+ * recovery phrase export, session lock status, and an optional note on whose
31
+ * account it is. Only visible when the passkey wallet is active.
32
+ *
33
+ * Requires @txnlab/use-wallet-react 5.2 or later.
34
+ */
35
+ export declare function passkeyPlugin(options?: PasskeyPluginOptions): WalletUIPlugin;
36
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/passkey/index.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAgC,cAAc,EAAE,MAAM,UAAU,CAAA;AAE5E,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAE/D,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG;QAAE,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACtD;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CAC9B;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,OAAO,GAAE,oBAAyB,GACjC,cAAc,CA6DhB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../../src/plugins/passkey/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ /** Whether the user dismissed the passkey disclosure for this account */
2
+ export declare const isDisclosureDismissed: (address: string) => boolean;
3
+ /** Remember that the user dismissed the passkey disclosure for this account */
4
+ export declare const dismissDisclosure: (address: string) => void;
5
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/plugins/passkey/storage.ts"],"names":[],"mappings":"AAoCA,yEAAyE;AACzE,eAAO,MAAM,qBAAqB,GAAI,SAAS,MAAM,KAAG,OACtB,CAAA;AAElC,+EAA+E;AAC/E,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,KAAG,IAClB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=storage.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.test.d.ts","sourceRoot":"","sources":["../../../../src/plugins/passkey/storage.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import { PasskeyWalletAdapter } from '../../utils/passkey';
2
+ import { Wallet } from '@txnlab/use-wallet-react';
3
+ /**
4
+ * Returns the passkey adapter behind a `useWallet()` wallet object, or null
5
+ * for any other wallet. Adapter-specific methods (`unlock`, `lock`,
6
+ * `exportRecoveryPhrase`) aren't on the hook's wallet objects, so reach the
7
+ * adapter through the manager. Requires @txnlab/use-wallet-react 5.2+.
8
+ */
9
+ export declare function usePasskeyAdapter(wallet: Wallet | null): PasskeyWalletAdapter | null;
10
+ //# sourceMappingURL=usePasskeyAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePasskeyAdapter.d.ts","sourceRoot":"","sources":["../../../../src/plugins/passkey/usePasskeyAdapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAEhF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAEtD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,GAAG,IAAI,GACpB,oBAAoB,GAAG,IAAI,CAK7B"}
@@ -3,10 +3,13 @@ import { ReactNode } from 'react';
3
3
  import { Theme, ResolvedTheme } from '../hooks/useResolvedTheme';
4
4
  import { NfdView } from '../hooks/useNfd';
5
5
  import { WalletUIPlugin } from '../plugins/types';
6
+ import { PasskeyConnectLayout } from '../utils/passkey';
6
7
  interface WalletUIContextType {
7
8
  queryClient: QueryClient;
8
9
  theme: Theme;
9
10
  resolvedTheme: ResolvedTheme;
11
+ /** The app-wide passkey layout for connect dialogs */
12
+ passkeyLayout: PasskeyConnectLayout;
10
13
  }
11
14
  interface WalletUIProviderProps {
12
15
  children: ReactNode;
@@ -34,6 +37,17 @@ interface WalletUIProviderProps {
34
37
  * lifecycle hooks, and context providers.
35
38
  */
36
39
  plugins?: WalletUIPlugin[];
40
+ /**
41
+ * How connect dialogs present a passkey wallet, when one is configured.
42
+ * - 'list': "Sign in with passkey" and "Create a passkey" rows in a Passkey
43
+ * group above a Wallets group (default). Suits apps where most users bring
44
+ * a wallet.
45
+ * - 'featured': a "Continue with passkey" button leads, with the other
46
+ * wallets below. Suits apps where the passkey is the main way in.
47
+ *
48
+ * A `passkeyLayout` prop on `WalletButton` or `ConnectWalletMenu` overrides it.
49
+ */
50
+ passkeyLayout?: PasskeyConnectLayout;
37
51
  }
38
52
  /**
39
53
  * Provider that enables wallet UI components to work with TanStack Query.
@@ -48,7 +62,7 @@ interface WalletUIProviderProps {
48
62
  * - 'dark': Always use dark mode
49
63
  * - 'system': Follow the user's OS/browser preference (default)
50
64
  */
51
- export declare function WalletUIProvider({ children, queryClient: externalQueryClient, enablePrefetching, prefetchNfdView, theme, plugins, }: WalletUIProviderProps): import("react/jsx-runtime").JSX.Element;
65
+ export declare function WalletUIProvider({ children, queryClient: externalQueryClient, enablePrefetching, prefetchNfdView, theme, plugins, passkeyLayout, }: WalletUIProviderProps): import("react/jsx-runtime").JSX.Element;
52
66
  /**
53
67
  * Hook to access the WalletUI context
54
68
  * @throws Error if used outside of WalletUIProvider
@@ -1 +1 @@
1
- {"version":3,"file":"WalletUIProvider.d.ts","sourceRoot":"","sources":["../../../src/providers/WalletUIProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAGZ,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAEL,SAAS,EAKV,MAAM,OAAO,CAAA;AAEd,OAAO,EAEL,KAAK,KAAK,EACV,KAAK,aAAa,EACnB,MAAM,2BAA2B,CAAA;AAKlC,OAAO,KAAK,EAAqB,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACjE,OAAO,KAAK,EAAuB,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAoF3E,UAAU,mBAAmB;IAC3B,WAAW,EAAE,WAAW,CAAA;IACxB,KAAK,EAAE,KAAK,CAAA;IACZ,aAAa,EAAE,aAAa,CAAA;CAC7B;AAED,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,SAAS,CAAA;IACnB,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;IACb;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,EAAE,CAAA;CAC3B;AA0KD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,WAAW,EAAE,mBAAmB,EAChC,iBAAwB,EACxB,eAA6B,EAC7B,KAAgB,EAChB,OAAY,GACb,EAAE,qBAAqB,2CAmDvB;AA2CD;;;GAGG;AACH,wBAAgB,WAAW,IAAI,mBAAmB,CAMjD"}
1
+ {"version":3,"file":"WalletUIProvider.d.ts","sourceRoot":"","sources":["../../../src/providers/WalletUIProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAGZ,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAEL,SAAS,EAKV,MAAM,OAAO,CAAA;AAEd,OAAO,EAEL,KAAK,KAAK,EACV,KAAK,aAAa,EACnB,MAAM,2BAA2B,CAAA;AAKlC,OAAO,KAAK,EAAqB,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACjE,OAAO,KAAK,EAAuB,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC3E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAoF5D,UAAU,mBAAmB;IAC3B,WAAW,EAAE,WAAW,CAAA;IACxB,KAAK,EAAE,KAAK,CAAA;IACZ,aAAa,EAAE,aAAa,CAAA;IAC5B,sDAAsD;IACtD,aAAa,EAAE,oBAAoB,CAAA;CACpC;AAED,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,SAAS,CAAA;IACnB,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;IACb;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,EAAE,CAAA;IAC1B;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,oBAAoB,CAAA;CACrC;AA0KD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,WAAW,EAAE,mBAAmB,EAChC,iBAAwB,EACxB,eAA6B,EAC7B,KAAgB,EAChB,OAAY,EACZ,aAAsB,GACvB,EAAE,qBAAqB,2CAoDvB;AA2CD;;;GAGG;AACH,wBAAgB,WAAW,IAAI,mBAAmB,CAMjD"}
@@ -0,0 +1,59 @@
1
+ /** The wallet id registered by `passkey()` from `@txnlab/use-wallet-passkey` */
2
+ export declare const PASSKEY_WALLET_ID = "passkey";
3
+ /**
4
+ * The `PasskeyAdapter` members this library uses. Typed structurally so the
5
+ * library needs no dependency on `@txnlab/use-wallet-passkey`.
6
+ */
7
+ export interface PasskeyWalletAdapter {
8
+ /** True when the session key is unlocked */
9
+ readonly isUnlocked: boolean;
10
+ /** Unlock the session with one passkey prompt */
11
+ unlock: () => Promise<void>;
12
+ /** Drop the session key; the account stays connected */
13
+ lock: () => void;
14
+ /** Return the account's recovery phrase after a fresh passkey prompt */
15
+ exportRecoveryPhrase: () => Promise<{
16
+ scheme: 'falcon-1024';
17
+ phrase: string;
18
+ }>;
19
+ }
20
+ /** The status of a passkey connect request, shown under the passkey section */
21
+ export interface PasskeyConnectStatus {
22
+ walletId: string;
23
+ pending: boolean;
24
+ error: string | null;
25
+ /** Which control started the request, so it can show the pending state */
26
+ action?: 'sign-in' | 'create';
27
+ }
28
+ /**
29
+ * How the connect dialog presents a passkey wallet:
30
+ * - `'list'` (default): "Sign in with passkey" and "Create a passkey" rows in
31
+ * a Passkey group above a Wallets group. Suits apps where most users bring
32
+ * a wallet.
33
+ * - `'featured'`: a "Continue with passkey" button leads, with the other
34
+ * wallets below. Suits apps where most users have no wallet.
35
+ */
36
+ export type PasskeyConnectLayout = 'featured' | 'list';
37
+ /** A menu's own layout wins over the provider's; the default is `'list'` */
38
+ export declare function resolvePasskeyLayout(menuLayout?: PasskeyConnectLayout, providerLayout?: PasskeyConnectLayout): PasskeyConnectLayout;
39
+ /** Arguments for connecting the passkey wallet */
40
+ export interface PasskeyConnectArgs {
41
+ /** Create a new passkey (and account) instead of signing in */
42
+ create?: boolean;
43
+ }
44
+ export declare function isPasskeyWallet(wallet: {
45
+ id: string;
46
+ } | null | undefined): boolean;
47
+ /** Returns a `PasskeyError`'s code, or null for any other error */
48
+ export declare function getPasskeyErrorCode(error: unknown): string | null;
49
+ /**
50
+ * Returns a message to show users for a `PasskeyError`, or null for any other
51
+ * error.
52
+ */
53
+ export declare function getPasskeyErrorMessage(error: unknown): string | null;
54
+ /**
55
+ * The domain a passkey account belongs to. The adapter names the account
56
+ * `Passkey · <domain>`; fall back to the page's hostname.
57
+ */
58
+ export declare function getPasskeyAccountDomain(accountName?: string | null): string;
59
+ //# sourceMappingURL=passkey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"passkey.d.ts","sourceRoot":"","sources":["../../../src/utils/passkey.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,eAAO,MAAM,iBAAiB,YAAY,CAAA;AAE1C;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,4CAA4C;IAC5C,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B,iDAAiD;IACjD,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3B,wDAAwD;IACxD,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,wEAAwE;IACxE,oBAAoB,EAAE,MAAM,OAAO,CAAC;QAAE,MAAM,EAAE,aAAa,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC/E;AAED,+EAA+E;AAC/E,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;CAC9B;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,MAAM,CAAA;AAEtD,4EAA4E;AAC5E,wBAAgB,oBAAoB,CAClC,UAAU,CAAC,EAAE,oBAAoB,EACjC,cAAc,CAAC,EAAE,oBAAoB,GACpC,oBAAoB,CAEtB;AAED,kDAAkD;AAClD,MAAM,WAAW,kBAAkB;IACjC,+DAA+D;IAC/D,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GACxC,OAAO,CAET;AAED,mEAAmE;AACnE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAIjE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAgBpE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAQ3E"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=passkey.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"passkey.test.d.ts","sourceRoot":"","sources":["../../../src/utils/passkey.test.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@txnlab/use-wallet-ui-react",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "React components for use-wallet UI",
5
5
  "type": "module",
6
6
  "main": "dist/cjs/index.cjs",
@@ -27,6 +27,16 @@
27
27
  "default": "./dist/cjs/plugins/export-key.cjs"
28
28
  }
29
29
  },
30
+ "./plugins/passkey": {
31
+ "import": {
32
+ "types": "./dist/types/plugins/passkey/index.d.ts",
33
+ "default": "./dist/esm/plugins/passkey.js"
34
+ },
35
+ "require": {
36
+ "types": "./dist/types/plugins/passkey/index.d.cts",
37
+ "default": "./dist/cjs/plugins/passkey.cjs"
38
+ }
39
+ },
30
40
  "./dist/style.css": "./dist/style.css",
31
41
  "./theme.css": "./src/theme.css",
32
42
  "./package.json": "./package.json"
@@ -89,7 +99,8 @@
89
99
  },
90
100
  "devDependencies": {
91
101
  "@tailwindcss/cli": "4.3.0",
92
- "@txnlab/use-wallet-react": "^5.1.3",
102
+ "@txnlab/use-wallet-passkey": "5.2.0",
103
+ "@txnlab/use-wallet-react": "^5.2.0",
93
104
  "@types/react": "19.2.14",
94
105
  "@types/react-dom": "19.2.3",
95
106
  "@vitest/coverage-v8": "3.2.4",