@bounded-sh/client 0.0.7 → 0.0.8

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 (32) hide show
  1. package/dist/auth/index.d.ts +15 -0
  2. package/dist/auth/oidc-auth.d.ts +25 -11
  3. package/dist/auth/providers/email-auth-provider.d.ts +10 -0
  4. package/dist/auth/providers/mock-auth-provider.d.ts +1 -0
  5. package/dist/index.d.ts +2 -1
  6. package/dist/index.esm.js +483 -2615
  7. package/dist/index.esm.js.map +1 -1
  8. package/dist/index.js +484 -2614
  9. package/dist/index.js.map +1 -1
  10. package/dist/{index.native-CCc03Zxr.js → index.native-C-duG1XV.js} +488 -2618
  11. package/dist/index.native-C-duG1XV.js.map +1 -0
  12. package/dist/{index.native-BxNuEqgy.esm.js → index.native-DnVLH-7o.esm.js} +487 -2619
  13. package/dist/index.native-DnVLH-7o.esm.js.map +1 -0
  14. package/dist/index.native.d.ts +2 -1
  15. package/dist/index.native.esm.js +1 -1
  16. package/dist/index.native.js +3 -1
  17. package/dist/index.native.js.map +1 -1
  18. package/dist/{phantom-wallet-provider-yMlFdfKn.js → phantom-wallet-provider-DKScS8m6.js} +2 -2
  19. package/dist/{phantom-wallet-provider-yMlFdfKn.js.map → phantom-wallet-provider-DKScS8m6.js.map} +1 -1
  20. package/dist/{phantom-wallet-provider-CxnVOBTM.esm.js → phantom-wallet-provider-DfTqdjx7.esm.js} +2 -2
  21. package/dist/{phantom-wallet-provider-CxnVOBTM.esm.js.map → phantom-wallet-provider-DfTqdjx7.esm.js.map} +1 -1
  22. package/dist/{privy-wallet-provider-BbjUoSdY.esm.js → privy-wallet-provider-BpPAZyUD.esm.js} +3 -3
  23. package/dist/{privy-wallet-provider-BbjUoSdY.esm.js.map → privy-wallet-provider-BpPAZyUD.esm.js.map} +1 -1
  24. package/dist/{privy-wallet-provider-BcbjdOfk.js → privy-wallet-provider-wCTdqpRq.js} +3 -3
  25. package/dist/{privy-wallet-provider-BcbjdOfk.js.map → privy-wallet-provider-wCTdqpRq.js.map} +1 -1
  26. package/dist/{solana-mobile-wallet-provider-BCoTvY5g.js → solana-mobile-wallet-provider-DZx3xVit.js} +2 -2
  27. package/dist/{solana-mobile-wallet-provider-BCoTvY5g.js.map → solana-mobile-wallet-provider-DZx3xVit.js.map} +1 -1
  28. package/dist/{solana-mobile-wallet-provider-wl_xDwIC.esm.js → solana-mobile-wallet-provider-xmASWrPf.esm.js} +2 -2
  29. package/dist/{solana-mobile-wallet-provider-wl_xDwIC.esm.js.map → solana-mobile-wallet-provider-xmASWrPf.esm.js.map} +1 -1
  30. package/package.json +2 -2
  31. package/dist/index.native-BxNuEqgy.esm.js.map +0 -1
  32. package/dist/index.native-CCc03Zxr.js.map +0 -1
@@ -53,11 +53,25 @@ export declare function sendEmailOtp(email: string): Promise<{
53
53
  ok: true;
54
54
  expiresInSeconds?: number;
55
55
  }>;
56
+ /**
57
+ * Send a 6-digit login code by text message. Requires the configured Bounded
58
+ * auth issuer to have text OTP explicitly enabled and SMS delivery configured.
59
+ * Works on web AND React Native.
60
+ */
61
+ export declare function sendTextOtp(phoneNumber: string): Promise<{
62
+ ok: true;
63
+ expiresInSeconds?: number;
64
+ }>;
56
65
  /**
57
66
  * Verify the `code` for `email`, establish the session, and return the user.
58
67
  * Step 2 of the inline email flow. Coexists with signInAnonymously()/wallets.
59
68
  */
60
69
  export declare function verifyEmailOtp(email: string, code: string): Promise<User | null>;
70
+ /**
71
+ * Verify the text-message `code`, establish the session, and return the user.
72
+ * Phone-only users have no `user.email`; use `user.id` for app identity.
73
+ */
74
+ export declare function verifyTextOtp(phoneNumber: string, code: string): Promise<User | null>;
61
75
  /**
62
76
  * UPGRADE the current anonymous (guest) session by linking an email — Firebase
63
77
  * `linkWithCredential` parity. Send the code first with `sendEmailOtp(email)`,
@@ -71,3 +85,4 @@ export declare function login(options?: LoginOptions): Promise<User | null>;
71
85
  export declare function getCurrentAuthMethod(): string | null;
72
86
  export declare function logout(): Promise<void>;
73
87
  export { loginWithRedirect, linkWithRedirect, completeLoginFromRedirect, loginWithPopup, completeLoginInPopup } from './oidc-auth';
88
+ export type { HostedAuthMethod, OidcLoginOptions, PopupLoginOptions } from './oidc-auth';
@@ -1,27 +1,41 @@
1
1
  import type { User } from '@bounded-sh/core';
2
+ export type HostedAuthMethod = 'email' | 'text' | 'phone' | 'google' | 'apple' | 'github' | (string & {});
3
+ export interface OidcLoginOptions {
4
+ redirectUri: string;
5
+ /**
6
+ * Hosted-login methods to show. Omit to show every method enabled on the
7
+ * Bounded issuer. Include social provider ids directly, e.g.
8
+ * `['email', 'google']` or `['google', 'github']`. `text`/`phone`
9
+ * are shown only when the issuer explicitly enables text OTP.
10
+ */
11
+ methods?: readonly HostedAuthMethod[];
12
+ /**
13
+ * Start this provider immediately. Use for app-owned buttons like
14
+ * "Continue with Google". For `provider: 'email'`, the hosted OTP form is
15
+ * shown without social alternatives. `provider: 'text'`/`'phone'` works only
16
+ * when the issuer explicitly enables text OTP.
17
+ */
18
+ provider?: HostedAuthMethod;
19
+ }
20
+ export interface PopupLoginOptions extends OidcLoginOptions {
21
+ width?: number;
22
+ height?: number;
23
+ }
2
24
  /** Start login: navigate the whole page to the hosted Bounded login. Returns after redirect
3
25
  * to `redirectUri?code=...`, where you call completeLoginFromRedirect(). Web only. */
4
- export declare function loginWithRedirect(opts: {
5
- redirectUri: string;
6
- }): Promise<void>;
26
+ export declare function loginWithRedirect(opts: OidcLoginOptions): Promise<void>;
7
27
  /** UPGRADE the current anonymous (guest) session by linking a SOCIAL/redirect login
8
28
  * (e.g. Google) — Firebase `linkWithPopup`/redirect parity. Stashes the guest token,
9
29
  * then runs the normal redirect login; `completeLoginFromRedirect()` on the callback
10
30
  * page finishes the link automatically (if the social account is brand-new the guest's
11
31
  * `@user.id` is preserved, else it stays separate). Requires an active guest session. */
12
- export declare function linkWithRedirect(opts: {
13
- redirectUri: string;
14
- }): Promise<void>;
32
+ export declare function linkWithRedirect(opts: OidcLoginOptions): Promise<void>;
15
33
  /** Finish login on the redirect_uri page: exchange ?code= for a token (PKCE-verified), store
16
34
  * the session, and return the User. Idempotent: returns null if there's no ?code= in the URL. */
17
35
  export declare function completeLoginFromRedirect(): Promise<User | null>;
18
36
  /** Popup variant: open the hosted login in a popup; resolves with the User once the popup's
19
37
  * redirect_uri page posts the code back. The redirect_uri page must call completeLoginInPopup(). */
20
- export declare function loginWithPopup(opts: {
21
- redirectUri: string;
22
- width?: number;
23
- height?: number;
24
- }): Promise<User>;
38
+ export declare function loginWithPopup(opts: PopupLoginOptions): Promise<User>;
25
39
  /** Call this on the redirect_uri page when login was opened via loginWithPopup(): posts the
26
40
  * code back to the opener and closes. (For the redirect variant use completeLoginFromRedirect.) */
27
41
  export declare function completeLoginInPopup(openerOrigin: string): void;
@@ -5,11 +5,21 @@ export declare function sendEmailOtp(email: string): Promise<{
5
5
  ok: true;
6
6
  expiresInSeconds?: number;
7
7
  }>;
8
+ /** Send a login code by text message. Requires the Bounded issuer to have text OTP explicitly enabled and SMS configured. */
9
+ export declare function sendTextOtp(phoneNumber: string): Promise<{
10
+ ok: true;
11
+ expiresInSeconds?: number;
12
+ }>;
8
13
  /**
9
14
  * Verify the code for `email` and establish the session. Step 2 of the flow.
10
15
  * Stores the Bounded id token (the realtime bearer) and sets the current user.
11
16
  */
12
17
  export declare function verifyEmailOtp(email: string, otp: string): Promise<User>;
18
+ /**
19
+ * Verify the text-message code for `phoneNumber` and establish the session.
20
+ * Phone-only users have `user.email === null`; use `user.id` for ownership.
21
+ */
22
+ export declare function verifyTextOtp(phoneNumber: string, otp: string): Promise<User>;
13
23
  /**
14
24
  * UPGRADE an anonymous (guest) session by LINKING an email credential — Firebase
15
25
  * `linkWithCredential` parity. The guest's `guestToken` is sent to the auth issuer
@@ -23,6 +23,7 @@ export declare class MockAuthProvider implements AuthProvider {
23
23
  */
24
24
  signMessage(message: string): Promise<string>;
25
25
  signMessageMock(message: string): Promise<string>;
26
+ private generateOffchainSignature;
26
27
  /**
27
28
  * Mock transaction signing - returns the transaction as-is (no actual signing)
28
29
  */
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  export { init, getCurrentUser, onAuthStateChanged, onAuthLoadingChanged, getAuthLoading, login, logout, } from "./global";
2
2
  export type { LoginOptions } from "./global";
3
3
  export { getConfig } from "@bounded-sh/core";
4
- export { getAuthProvider, signInAnonymously, sendEmailOtp, verifyEmailOtp, linkEmail, loginWithPrivy } from "./auth";
4
+ export { getAuthProvider, signInAnonymously, sendEmailOtp, sendTextOtp, verifyEmailOtp, verifyTextOtp, linkEmail, loginWithPrivy } from "./auth";
5
5
  export { loginWithRedirect, linkWithRedirect, completeLoginFromRedirect, loginWithPopup, completeLoginInPopup } from "./auth";
6
+ export type { HostedAuthMethod, OidcLoginOptions, PopupLoginOptions } from "./auth";
6
7
  export { get, getMany, docId, set, setMany, setFile, getFiles, search, queryAggregate, runQuery, runQueryMany, runExpression, runExpressionMany, signMessage, signTransaction, signAndSubmitTransaction, count, aggregate, GetOptions, SearchOptions, SetOptions, CountOptions, AggregateOptions, AggregateOperation, AggregateResult, AggregateSpec, AggregateRow, QueryAggregateOptions, } from "@bounded-sh/core";
7
8
  export type { GetOptions as BoundedGetOptions } from "@bounded-sh/core";
8
9
  export { subscribe } from "@bounded-sh/core";