@bounded-sh/client 0.0.32 → 0.0.34
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/REACT_NATIVE.md +3 -3
- package/dist/auth/index.d.ts +1 -40
- package/dist/auth/oidc-auth.d.ts +2 -16
- package/dist/auth/providers/email-auth-provider.d.ts +0 -34
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -572
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -568
- package/dist/index.mjs.map +1 -1
- package/dist/index.native.d.ts +2 -2
- package/dist/index.native.js +8 -572
- package/dist/index.native.js.map +1 -1
- package/dist/index.native.mjs +10 -568
- package/dist/index.native.mjs.map +1 -1
- package/package.json +5 -3
package/REACT_NATIVE.md
CHANGED
|
@@ -33,9 +33,9 @@ requests.
|
|
|
33
33
|
|
|
34
34
|
## 2. Hosted email / social login
|
|
35
35
|
|
|
36
|
-
Human login runs through the hosted Bounded issuer.
|
|
37
|
-
helpers (`sendEmailOtp`, `verifyEmailOtp`, `sendTextOtp`, `verifyTextOtp`)
|
|
38
|
-
|
|
36
|
+
Human login runs through the hosted Bounded issuer. Retired app-origin OTP
|
|
37
|
+
helpers (`sendEmailOtp`, `verifyEmailOtp`, `sendTextOtp`, `verifyTextOtp`) are
|
|
38
|
+
not exported by the package.
|
|
39
39
|
|
|
40
40
|
Install the Expo optional peers if your RN app uses hosted login:
|
|
41
41
|
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -42,47 +42,8 @@ export declare function signInAnonymously(): Promise<User | null>;
|
|
|
42
42
|
* (web localStorage / RN storage) and identity model. `init()` must have run first.
|
|
43
43
|
*/
|
|
44
44
|
export declare function loginWithPrivy(options?: LoginOptions): Promise<User | null>;
|
|
45
|
-
/**
|
|
46
|
-
* Send a 6-digit login code to `email` (Bounded Better Auth). Step 1 of the
|
|
47
|
-
* inline email flow — build your own email/code UI for full control over the
|
|
48
|
-
* look, or just call `login()` for the built-in modal. Works on web AND React
|
|
49
|
-
* Native (no DOM needed). Prefer `loginWithRedirect()`/`loginWithPopup()` if you
|
|
50
|
-
* want the credential entered on Bounded's hosted page instead.
|
|
51
|
-
*/
|
|
52
|
-
export declare function sendEmailOtp(email: string): Promise<{
|
|
53
|
-
ok: true;
|
|
54
|
-
expiresInSeconds?: number;
|
|
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
|
-
}>;
|
|
65
|
-
/**
|
|
66
|
-
* Verify the `code` for `email`, establish the session, and return the user.
|
|
67
|
-
* Step 2 of the inline email flow. Coexists with signInAnonymously()/wallets.
|
|
68
|
-
*/
|
|
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>;
|
|
75
|
-
/**
|
|
76
|
-
* UPGRADE the current anonymous (guest) session by linking an email — Firebase
|
|
77
|
-
* `linkWithCredential` parity. Send the code first with `sendEmailOtp(email)`,
|
|
78
|
-
* then call `linkEmail(email, code)`. If the email is brand-new the guest's
|
|
79
|
-
* `@user.id` (and its data) is preserved; if the email already exists the user
|
|
80
|
-
* just signs into it (no merge). Requires an active guest session, and the issuer
|
|
81
|
-
* refuses if the wallet is already linked. Browser/React-Native only.
|
|
82
|
-
*/
|
|
83
|
-
export declare function linkEmail(email: string, code: string): Promise<User | null>;
|
|
84
45
|
export declare function login(options?: LoginOptions): Promise<User | null>;
|
|
85
46
|
export declare function getCurrentAuthMethod(): string | null;
|
|
86
47
|
export declare function logout(): Promise<void>;
|
|
87
|
-
export { loginWithRedirect,
|
|
48
|
+
export { loginWithRedirect, completeLoginFromRedirect, loginWithPopup, completeLoginInPopup } from './oidc-auth';
|
|
88
49
|
export type { HostedAuthMethod, OidcLoginOptions, PopupLoginOptions } from './oidc-auth';
|
package/dist/auth/oidc-auth.d.ts
CHANGED
|
@@ -46,26 +46,12 @@ export interface PopupLoginOptions extends OidcLoginOptions {
|
|
|
46
46
|
* (custom `myapp://` schemes are rejected by the issuer). Needs the optional peer deps
|
|
47
47
|
* expo-web-browser + (expo-crypto or react-native-get-random-values). */
|
|
48
48
|
export declare function loginWithRedirect(opts: OidcLoginOptions): Promise<User | void>;
|
|
49
|
-
/** UPGRADE the current anonymous (guest) session by linking a SOCIAL/redirect login
|
|
50
|
-
* (e.g. Google) — Firebase `linkWithPopup`/redirect parity. Carries the guest's signed
|
|
51
|
-
* id-token THROUGH the OIDC authorize request (as a single-use hint bound to the PKCE
|
|
52
|
-
* challenge), then runs the normal redirect login. The issuer completes the link during
|
|
53
|
-
* the standard code→token exchange: if the chosen account is brand-new the guest's
|
|
54
|
-
* `@user.id` is preserved (the returned id_token is minted under it), else the account
|
|
55
|
-
* stays separate (guest id discarded). Requires an active guest session.
|
|
56
|
-
*
|
|
57
|
-
* Works on WEB (navigates, finish with completeLoginFromRedirect) and REACT NATIVE
|
|
58
|
-
* (opens expo-web-browser and resolves with the upgraded User inline). */
|
|
59
|
-
export declare function linkWithRedirect(opts: OidcLoginOptions): Promise<User | void>;
|
|
60
49
|
/** Finish login on the redirect_uri page (WEB ONLY): exchange ?code= for a token (PKCE-verified),
|
|
61
50
|
* store the session, and return the User. Idempotent: returns null if there's no ?code= in the URL.
|
|
62
|
-
* When the redirect was a guest UPGRADE (linkWithRedirect) and the issuer adopted the guest
|
|
63
|
-
* id, the exchanged id_token already carries the preserved `@user.id`, so the returned User
|
|
64
|
-
* reflects it automatically (no extra round-trip).
|
|
65
51
|
*
|
|
66
52
|
* On REACT NATIVE this returns null and is a no-op: native login completes INLINE inside
|
|
67
|
-
* loginWithRedirect()
|
|
68
|
-
*
|
|
53
|
+
* loginWithRedirect() (which resolves with the User), so there is no separate redirect
|
|
54
|
+
* page to finish from. Calling it on RN is harmless. */
|
|
69
55
|
export declare function completeLoginFromRedirect(): Promise<User | null>;
|
|
70
56
|
/** Popup variant: open the hosted login in a popup; resolves with the User once the popup's
|
|
71
57
|
* redirect_uri page posts the code back. The redirect_uri page just calls the usual
|
|
@@ -1,39 +1,5 @@
|
|
|
1
1
|
import type { AuthProvider, User, TransactionResult, SolTransaction, EVMTransaction, SetOptions } from '@bounded-sh/core';
|
|
2
2
|
import { Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
3
|
-
/** Send a login code to `email`. Step 1 of the inline email-OTP flow. */
|
|
4
|
-
export declare function sendEmailOtp(email: string): Promise<{
|
|
5
|
-
ok: true;
|
|
6
|
-
expiresInSeconds?: number;
|
|
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
|
-
}>;
|
|
13
|
-
/**
|
|
14
|
-
* Verify the code for `email` and establish the session. Step 2 of the flow.
|
|
15
|
-
* Stores the Bounded id token (the realtime bearer) and sets the current user.
|
|
16
|
-
*/
|
|
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>;
|
|
23
|
-
/**
|
|
24
|
-
* UPGRADE an anonymous (guest) session by LINKING an email credential — Firebase
|
|
25
|
-
* `linkWithCredential` parity. The guest's `guestToken` is sent to the auth issuer
|
|
26
|
-
* which, IF the email is brand-new, makes the new account ADOPT the guest's id so
|
|
27
|
-
* `@user.id` is preserved and the guest's data carries over. If the email already
|
|
28
|
-
* exists, the user just signs into it (stays separate; `linked:false`). On success
|
|
29
|
-
* the upgraded session replaces the guest session and the user is no longer
|
|
30
|
-
* anonymous. `guestToken` is captured by the caller BEFORE switching auth methods.
|
|
31
|
-
*/
|
|
32
|
-
export declare function linkEmailWithGuest(email: string, otp: string, guestToken: string): Promise<{
|
|
33
|
-
user: User;
|
|
34
|
-
linked: boolean;
|
|
35
|
-
isNewAccount: boolean;
|
|
36
|
-
}>;
|
|
37
3
|
export declare class EmailAuthProvider implements AuthProvider {
|
|
38
4
|
login(): Promise<User | null>;
|
|
39
5
|
restoreSession(): Promise<User | null>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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,
|
|
5
|
-
export { loginWithRedirect,
|
|
4
|
+
export { getAuthProvider, signInAnonymously, loginWithPrivy } from "./auth";
|
|
5
|
+
export { loginWithRedirect, completeLoginFromRedirect, loginWithPopup, completeLoginInPopup } from "./auth";
|
|
6
6
|
export type { HostedAuthMethod, OidcLoginOptions, PopupLoginOptions } from "./auth";
|
|
7
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";
|
|
8
8
|
export type { GetOptions as BoundedGetOptions } from "@bounded-sh/core";
|