@motherbase/client 1.3.1 → 1.5.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 (74) hide show
  1. package/README.md +127 -13
  2. package/package.json +10 -2
  3. package/dist/admin.d.ts +0 -81
  4. package/dist/admin.d.ts.map +0 -1
  5. package/dist/admin.js +0 -85
  6. package/dist/admin.js.map +0 -1
  7. package/dist/auth.d.ts +0 -233
  8. package/dist/auth.d.ts.map +0 -1
  9. package/dist/auth.js +0 -418
  10. package/dist/auth.js.map +0 -1
  11. package/dist/channel.d.ts +0 -119
  12. package/dist/channel.d.ts.map +0 -1
  13. package/dist/channel.js +0 -213
  14. package/dist/channel.js.map +0 -1
  15. package/dist/cookie.d.ts +0 -60
  16. package/dist/cookie.d.ts.map +0 -1
  17. package/dist/cookie.js +0 -144
  18. package/dist/cookie.js.map +0 -1
  19. package/dist/database.d.ts +0 -169
  20. package/dist/database.d.ts.map +0 -1
  21. package/dist/database.js +0 -2
  22. package/dist/database.js.map +0 -1
  23. package/dist/devices.d.ts +0 -13
  24. package/dist/devices.d.ts.map +0 -1
  25. package/dist/devices.js +0 -13
  26. package/dist/devices.js.map +0 -1
  27. package/dist/edge.d.ts +0 -7
  28. package/dist/edge.d.ts.map +0 -1
  29. package/dist/edge.js +0 -13
  30. package/dist/edge.js.map +0 -1
  31. package/dist/functions.d.ts +0 -24
  32. package/dist/functions.d.ts.map +0 -1
  33. package/dist/functions.js +0 -24
  34. package/dist/functions.js.map +0 -1
  35. package/dist/http.d.ts +0 -96
  36. package/dist/http.d.ts.map +0 -1
  37. package/dist/http.js +0 -157
  38. package/dist/http.js.map +0 -1
  39. package/dist/index.d.ts +0 -118
  40. package/dist/index.d.ts.map +0 -1
  41. package/dist/index.js +0 -180
  42. package/dist/index.js.map +0 -1
  43. package/dist/mfa.d.ts +0 -109
  44. package/dist/mfa.d.ts.map +0 -1
  45. package/dist/mfa.js +0 -134
  46. package/dist/mfa.js.map +0 -1
  47. package/dist/postgrest.d.ts +0 -239
  48. package/dist/postgrest.d.ts.map +0 -1
  49. package/dist/postgrest.js +0 -467
  50. package/dist/postgrest.js.map +0 -1
  51. package/dist/profile.d.ts +0 -16
  52. package/dist/profile.d.ts.map +0 -1
  53. package/dist/profile.js +0 -26
  54. package/dist/profile.js.map +0 -1
  55. package/dist/realtime.d.ts +0 -114
  56. package/dist/realtime.d.ts.map +0 -1
  57. package/dist/realtime.js +0 -372
  58. package/dist/realtime.js.map +0 -1
  59. package/dist/rest.d.ts +0 -50
  60. package/dist/rest.d.ts.map +0 -1
  61. package/dist/rest.js +0 -75
  62. package/dist/rest.js.map +0 -1
  63. package/dist/session.d.ts +0 -36
  64. package/dist/session.d.ts.map +0 -1
  65. package/dist/session.js +0 -90
  66. package/dist/session.js.map +0 -1
  67. package/dist/storage.d.ts +0 -72
  68. package/dist/storage.d.ts.map +0 -1
  69. package/dist/storage.js +0 -148
  70. package/dist/storage.js.map +0 -1
  71. package/dist/types.d.ts +0 -106
  72. package/dist/types.d.ts.map +0 -1
  73. package/dist/types.js +0 -2
  74. package/dist/types.js.map +0 -1
package/dist/index.js DELETED
@@ -1,180 +0,0 @@
1
- import { HttpClient, toError } from './http.js';
2
- import { contractPath } from '@motherbase/contracts';
3
- import { SessionStore, memoryStorage, localStorageStorage } from './session.js';
4
- import { AuthClient } from './auth.js';
5
- import { StorageClient } from './storage.js';
6
- import { FunctionsClient } from './functions.js';
7
- import { RealtimeModule } from './realtime.js';
8
- import { RealtimeChannel } from './channel.js';
9
- import { PostgrestQueryBuilder } from './postgrest.js';
10
- import { isProduction } from './cookie.js';
11
- /**
12
- * Supabase-js-compatible client for a Motherbase backend.
13
- *
14
- * Drop-in shaped: `client.from(table).select()…`, `client.auth.signInWithPassword()`,
15
- * `client.storage.from(bucket)`, `client.channel(name)`, `client.functions.invoke()`.
16
- *
17
- * Pass the type generated by `motherbase gen types typescript` to get real
18
- * inference: `createClient<Database>(url, key)` then types every row, rejects
19
- * unknown columns in `.select()`, checks `.insert()` payloads against the
20
- * Insert shape and types `.rpc()` from `Functions`. Without it the client
21
- * behaves exactly as it did before generics existed.
22
- */
23
- export class MotherbaseClient {
24
- constructor(url,
25
- /** Accepted for supabase-js signature parity; sent as an `apikey` header when set. */
26
- key, options = {}) {
27
- this.url = url;
28
- this.key = key;
29
- this.channels = new Map();
30
- // `globalThis.fetch` is a native function that requires `this === window`
31
- // (or an equivalent global) when invoked — copying the reference without
32
- // binding it throws "Illegal invocation" the moment it's called as
33
- // `this.opts.fetch(...)` inside HttpClient. Bind it once here.
34
- const fetchImpl = options.fetch ?? globalThis.fetch?.bind(globalThis);
35
- if (!fetchImpl) {
36
- throw new Error('No fetch implementation found. Pass `fetch` in options for this runtime.');
37
- }
38
- const autoRefresh = options.autoRefresh ?? true;
39
- const headers = { ...options.headers };
40
- if (key)
41
- headers['apikey'] = key;
42
- // A secret key runs every request as service_role, which bypasses row level
43
- // security. In a browser it is readable by anyone who opens devtools, so it
44
- // is not "a key that leaked", it is the whole database published. Warn
45
- // rather than throw: a legitimate caller may run in a runtime that defines
46
- // `window` (a test harness, an Electron main process), and refusing to
47
- // construct would break them for a heuristic.
48
- if (key?.startsWith('mb_secret_') && typeof window !== 'undefined') {
49
- console.warn('[motherbase] A secret API key was passed to createClient in a browser context. '
50
- + 'Secret keys bypass row level security and must stay server side. '
51
- + 'Use the publishable key here.');
52
- }
53
- // The default adapter keeps the session in memory only: it does not survive
54
- // a reload, and the server never sees it. That is the right default for a
55
- // script or a test, and a bug in a browser app — and it presents as
56
- // "getUser() returns null everywhere", which reads like an auth problem
57
- // rather than a storage one. Point at the fix once, in development.
58
- if (!options.storage && typeof window !== 'undefined' && !MotherbaseClient.warnedAboutStorage) {
59
- MotherbaseClient.warnedAboutStorage = true;
60
- if (!isProduction()) {
61
- console.warn('[motherbase] createClient() was called in a browser without a `storage` adapter, so the '
62
- + 'session lives in memory and is lost on reload. Pass `storage: cookieStorage()` (or '
63
- + '`localStorageStorage()`), or use `createBrowserClient` from `@motherbase/ssr`, which '
64
- + 'writes the cookie the server needs to read.');
65
- }
66
- }
67
- this.store = new SessionStore(options.storage ?? memoryStorage());
68
- // auth needs the http client, and http needs auth._refresh for the 401 path,
69
- // so wire them in two steps with a late-bound refresh callback.
70
- // prefer-const cannot see the closure above: `auth` is read by the refresh
71
- // callback before this line's assignment happens, so it has to be a `let`.
72
- // eslint-disable-next-line prefer-const
73
- let auth;
74
- this.http = new HttpClient(url, this.store, { autoRefresh, fetch: fetchImpl, headers }, () => auth._refresh());
75
- auth = new AuthClient(this.http, this.store);
76
- this.auth = auth;
77
- this.storage = new StorageClient(this.http, url);
78
- this.functions = new FunctionsClient(this.http);
79
- this.realtime = new RealtimeModule(url, this.store, fetchImpl, options.realtimeIoFactory);
80
- }
81
- from(table) {
82
- return new PostgrestQueryBuilder(this.http, table);
83
- }
84
- /**
85
- * Call a database function, typed from the generated `Functions` map.
86
- *
87
- * The transport is `POST /rest/v1/rpc/<fn>`, which the REST layer gains in
88
- * Phase 2.8. The typing is independent of that work: it reads only the
89
- * generated `Database`, so it is correct the moment the route exists.
90
- *
91
- * `get` and `head` switch to the read-only forms, which carry their arguments
92
- * as query parameters rather than as a body, exactly as supabase-js does.
93
- */
94
- async rpc(fn, args, options = {}) {
95
- try {
96
- const method = options.head ? 'HEAD' : options.get ? 'GET' : 'POST';
97
- const params = new URLSearchParams();
98
- if (method !== 'POST') {
99
- for (const [name, value] of Object.entries((args ?? {}))) {
100
- if (value === undefined)
101
- continue;
102
- params.append(name, Array.isArray(value) ? `{${value.join(',')}}` : String(value));
103
- }
104
- }
105
- const query = params.toString();
106
- const path = `${contractPath.rest('rpc')}/${encodeURIComponent(fn)}${query ? `?${query}` : ''}`;
107
- const headers = options.count ? { Prefer: `count=${options.count}` } : undefined;
108
- const result = await this.http.requestWithHeaders(path, {
109
- method,
110
- body: method === 'POST' ? (args ?? {}) : undefined,
111
- headers,
112
- });
113
- const range = result.headers.get('content-range');
114
- const total = range?.split('/')[1];
115
- const count = total && total !== '*' && Number.isFinite(Number(total)) ? Number(total) : null;
116
- return { data: options.head ? null : result.data, error: null, count };
117
- }
118
- catch (err) {
119
- return { data: null, error: toError(err), count: null };
120
- }
121
- }
122
- /** Create (or reuse) a realtime channel. */
123
- channel(name, opts = {}) {
124
- const existing = this.channels.get(name);
125
- if (existing)
126
- return existing;
127
- const channel = new RealtimeChannel(name, this.realtime, opts);
128
- this.channels.set(name, channel);
129
- return channel;
130
- }
131
- /** Unsubscribe and drop a channel. */
132
- async removeChannel(channel) {
133
- await channel.unsubscribe();
134
- this.channels.delete(channel.topic);
135
- return 'ok';
136
- }
137
- /** Unsubscribe and drop every channel. */
138
- async removeAllChannels() {
139
- await Promise.all(Array.from(this.channels.values()).map(c => c.unsubscribe()));
140
- this.channels.clear();
141
- return 'ok';
142
- }
143
- /** Load any persisted session before first use. Optional but recommended. */
144
- hydrate() {
145
- return this.store.hydrate();
146
- }
147
- }
148
- MotherbaseClient.warnedAboutStorage = false;
149
- /**
150
- * Create a Supabase-compatible Motherbase client.
151
- *
152
- * In a Next.js app, prefer `createBrowserClient` / `createServerClient` from
153
- * `@motherbase/ssr`: they persist the session to a cookie both halves can read.
154
- * `createClient()` on its own keeps the session in memory, which the server
155
- * cannot see, so every server-rendered `getUser()` returns null.
156
- *
157
- * @param url Backend API base URL.
158
- * @param key Anon/publishable key (optional). Sent as an `apikey` header.
159
- * @param options Session storage, fetch override, extra headers.
160
- *
161
- * @example
162
- * ```ts
163
- * import type { Database } from './database.types'
164
- * const client = createClient<Database>(url, anonKey)
165
- * ```
166
- */
167
- export function createClient(url, key, options = {}) {
168
- return new MotherbaseClient(url, key, options);
169
- }
170
- export { BackendError } from './http.js';
171
- export { memoryStorage, localStorageStorage };
172
- export { cookieStorage, serverCookieStorage, SESSION_COOKIE_KEY } from './cookie.js';
173
- export { PostgrestQueryBuilder } from './postgrest.js';
174
- export { AuthClient } from './auth.js';
175
- export { MfaClient } from './mfa.js';
176
- export { AuthAdminClient } from './admin.js';
177
- export { StorageClient, StorageBucket } from './storage.js';
178
- export { FunctionsClient } from './functions.js';
179
- export { RealtimeChannel } from './channel.js';
180
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,eAAe,EAA+B,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAyB3C;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,gBAAgB;IAgB3B,YACmB,GAAW;IAC5B,sFAAsF;IAC7E,GAAY,EACrB,UAAyB,EAAE;QAHV,QAAG,GAAH,GAAG,CAAQ;QAEnB,QAAG,GAAH,GAAG,CAAS;QANN,aAAQ,GAAG,IAAI,GAAG,EAA2B,CAAC;QAS7D,0EAA0E;QAC1E,yEAAyE;QACzE,mEAAmE;QACnE,+DAA+D;QAC/D,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACtE,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC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;AA+J5C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,YAAY,CAI1B,GAAW,EAAE,GAAY,EAAE,UAAyB,EAAE;IACtD,OAAO,IAAI,gBAAgB,CAA+B,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AAC/E,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AA6CvD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAmB7C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
package/dist/mfa.d.ts DELETED
@@ -1,109 +0,0 @@
1
- import type { HttpClient } from './http.js';
2
- import type { MotherbaseResponse } from './types.js';
3
- /**
4
- * Two-factor authentication, shaped like `supabase.auth.mfa`.
5
- *
6
- * The server has shipped TOTP with backup codes and trusted devices since the
7
- * beginning; only the client namespace was missing, which meant the product's
8
- * strongest auth feature could not be reached from the SDK that sells it.
9
- *
10
- * The mapping onto Better Auth is not one-to-one, and the differences are stated
11
- * per method rather than papered over:
12
- *
13
- * * A factor here is TOTP or nothing. Better Auth models two-factor as a
14
- * property of the user, not as a list of enrolled factors, so `listFactors`
15
- * reports the single TOTP factor rather than an arbitrary set, and there is
16
- * no phone factor to enrol.
17
- * * Enrolment needs the user's password. supabase-js does not ask for one;
18
- * Better Auth does, because enabling two-factor is a credential change.
19
- * * `challenge()` is a local no-op for TOTP: there is nothing to send, the
20
- * code is already on the user's device. It exists so the supabase-js
21
- * challenge/verify sequence compiles unchanged. For the email or SMS second
22
- * factor, `challenge()` does send a code.
23
- */
24
- export interface MfaFactor {
25
- id: string;
26
- /** Always `totp` today. */
27
- factor_type: 'totp';
28
- status: 'verified' | 'unverified';
29
- friendly_name?: string;
30
- }
31
- export interface MfaEnrollResponse {
32
- id: string;
33
- type: 'totp';
34
- totp: {
35
- /** otpauth:// URI to render as a QR code. */
36
- uri: string;
37
- /** The shared secret, for users who type it in by hand. */
38
- secret: string;
39
- };
40
- /** One-time codes to store somewhere safe. Shown only at enrolment. */
41
- backupCodes: string[];
42
- }
43
- export interface MfaChallengeResponse {
44
- id: string;
45
- expires_at: number | null;
46
- }
47
- export declare class MfaClient {
48
- private readonly http;
49
- /** Re-reads the session after a verify, so a stepped-up token is persisted. */
50
- private readonly onVerified;
51
- constructor(http: HttpClient,
52
- /** Re-reads the session after a verify, so a stepped-up token is persisted. */
53
- onVerified: () => Promise<void>);
54
- /**
55
- * Start TOTP enrolment. Returns the otpauth URI, the secret and the backup
56
- * codes. The factor is not usable until `verify()` accepts a code from it.
57
- */
58
- enroll(params: {
59
- password: string;
60
- issuer?: string;
61
- }): Promise<MotherbaseResponse<MfaEnrollResponse>>;
62
- /**
63
- * For TOTP this resolves immediately and sends nothing: the code already lives
64
- * on the user's device. Pass `channel` to send a second-factor code by email
65
- * or SMS instead, when the project has that enabled.
66
- */
67
- challenge(params?: {
68
- factorId?: string;
69
- channel?: 'email' | 'sms';
70
- }): Promise<MotherbaseResponse<MfaChallengeResponse>>;
71
- /**
72
- * Verify a code. `code` is a TOTP code by default; set `type` to `otp` for an
73
- * emailed or texted second factor, or `backup` to spend a recovery code.
74
- */
75
- verify(params: {
76
- code: string;
77
- factorId?: string;
78
- challengeId?: string;
79
- type?: 'totp' | 'otp' | 'backup';
80
- /** Remember this device for the project's configured trust window. */
81
- trustDevice?: boolean;
82
- }): Promise<MotherbaseResponse<{
83
- verified: true;
84
- }>>;
85
- /** Turn two-factor off. Requires the password, as enabling did. */
86
- unenroll(params: {
87
- password: string;
88
- factorId?: string;
89
- }): Promise<MotherbaseResponse<{
90
- id: string;
91
- }>>;
92
- /** Issue a fresh set of backup codes, invalidating the previous set. */
93
- regenerateBackupCodes(params: {
94
- password: string;
95
- }): Promise<MotherbaseResponse<{
96
- backupCodes: string[];
97
- }>>;
98
- /**
99
- * The user's factors. Reads the TOTP URI: getting one back means TOTP is
100
- * enrolled, a failure means it is not. There is no list endpoint to call
101
- * because there is no list, and inventing one client-side would be a lie about
102
- * what the server models.
103
- */
104
- listFactors(): Promise<MotherbaseResponse<{
105
- totp: MfaFactor[];
106
- all: MfaFactor[];
107
- }>>;
108
- }
109
- //# sourceMappingURL=mfa.d.ts.map
package/dist/mfa.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"mfa.d.ts","sourceRoot":"","sources":["../src/mfa.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,UAAU,GAAG,YAAY,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE;QACJ,6CAA6C;QAC7C,GAAG,EAAE,MAAM,CAAC;QACZ,2DAA2D;QAC3D,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,uEAAuE;IACvE,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB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EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC;QAAE,WAAW,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IAajH;;;;;OAKG;IACG,WAAW,IAAI,OAAO,CAAC,kBAAkB,CAAC;QAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAAC,GAAG,EAAE,SAAS,EAAE,CAAA;KAAE,CAAC,CAAC;CAU1F"}
package/dist/mfa.js DELETED
@@ -1,134 +0,0 @@
1
- import { toError } from './http.js';
2
- const R = {
3
- enable: '/api/auth/two-factor/enable',
4
- disable: '/api/auth/two-factor/disable',
5
- totpUri: '/api/auth/two-factor/get-totp-uri',
6
- verifyTotp: '/api/auth/two-factor/verify-totp',
7
- sendOtp: '/api/auth/two-factor/send-otp',
8
- verifyOtp: '/api/auth/two-factor/verify-otp',
9
- verifyBackupCode: '/api/auth/two-factor/verify-backup-code',
10
- generateBackupCodes: '/api/auth/two-factor/generate-backup-codes',
11
- };
12
- export class MfaClient {
13
- constructor(http,
14
- /** Re-reads the session after a verify, so a stepped-up token is persisted. */
15
- onVerified) {
16
- this.http = http;
17
- this.onVerified = onVerified;
18
- }
19
- /**
20
- * Start TOTP enrolment. Returns the otpauth URI, the secret and the backup
21
- * codes. The factor is not usable until `verify()` accepts a code from it.
22
- */
23
- async enroll(params) {
24
- try {
25
- const payload = await this.http.request(R.enable, {
26
- method: 'POST',
27
- body: { password: params.password, ...(params.issuer ? { issuer: params.issuer } : {}) },
28
- raw: true,
29
- });
30
- const uri = payload.totpURI ?? payload.totpUri ?? '';
31
- return {
32
- data: {
33
- // Better Auth has no per-factor id: the user is the factor. `totp` is
34
- // used as a stable handle so unenroll/challenge/verify have something
35
- // to take, matching the supabase-js shape.
36
- id: 'totp',
37
- type: 'totp',
38
- totp: { uri, secret: secretFromUri(uri) },
39
- backupCodes: payload.backupCodes ?? [],
40
- },
41
- error: null,
42
- };
43
- }
44
- catch (err) {
45
- return { data: null, error: toError(err) };
46
- }
47
- }
48
- /**
49
- * For TOTP this resolves immediately and sends nothing: the code already lives
50
- * on the user's device. Pass `channel` to send a second-factor code by email
51
- * or SMS instead, when the project has that enabled.
52
- */
53
- async challenge(params = {}) {
54
- if (!params.channel) {
55
- return { data: { id: params.factorId ?? 'totp', expires_at: null }, error: null };
56
- }
57
- try {
58
- await this.http.request(R.sendOtp, { method: 'POST', body: {}, raw: true });
59
- return { data: { id: params.factorId ?? 'otp', expires_at: null }, error: null };
60
- }
61
- catch (err) {
62
- return { data: null, error: toError(err) };
63
- }
64
- }
65
- /**
66
- * Verify a code. `code` is a TOTP code by default; set `type` to `otp` for an
67
- * emailed or texted second factor, or `backup` to spend a recovery code.
68
- */
69
- async verify(params) {
70
- // All three routes take the code under the same key.
71
- const route = params.type === 'backup' ? R.verifyBackupCode : params.type === 'otp' ? R.verifyOtp : R.verifyTotp;
72
- try {
73
- await this.http.request(route, {
74
- method: 'POST',
75
- body: { code: params.code, ...(params.trustDevice ? { trustDevice: true } : {}) },
76
- raw: true,
77
- });
78
- // Verification can hand back a stepped-up session; adopt it before the
79
- // caller makes its next request with the old one.
80
- await this.onVerified();
81
- return { data: { verified: true }, error: null };
82
- }
83
- catch (err) {
84
- return { data: null, error: toError(err) };
85
- }
86
- }
87
- /** Turn two-factor off. Requires the password, as enabling did. */
88
- async unenroll(params) {
89
- try {
90
- await this.http.request(R.disable, { method: 'POST', body: { password: params.password }, raw: true });
91
- return { data: { id: params.factorId ?? 'totp' }, error: null };
92
- }
93
- catch (err) {
94
- return { data: null, error: toError(err) };
95
- }
96
- }
97
- /** Issue a fresh set of backup codes, invalidating the previous set. */
98
- async regenerateBackupCodes(params) {
99
- try {
100
- const payload = await this.http.request(R.generateBackupCodes, {
101
- method: 'POST',
102
- body: { password: params.password },
103
- raw: true,
104
- });
105
- return { data: { backupCodes: payload.backupCodes ?? [] }, error: null };
106
- }
107
- catch (err) {
108
- return { data: null, error: toError(err) };
109
- }
110
- }
111
- /**
112
- * The user's factors. Reads the TOTP URI: getting one back means TOTP is
113
- * enrolled, a failure means it is not. There is no list endpoint to call
114
- * because there is no list, and inventing one client-side would be a lie about
115
- * what the server models.
116
- */
117
- async listFactors() {
118
- try {
119
- await this.http.request(R.totpUri, { method: 'POST', body: {}, raw: true });
120
- const factor = { id: 'totp', factor_type: 'totp', status: 'verified', friendly_name: 'TOTP' };
121
- return { data: { totp: [factor], all: [factor] }, error: null };
122
- }
123
- catch {
124
- // Not enrolled is a normal state, not an error the caller should branch on.
125
- return { data: { totp: [], all: [] }, error: null };
126
- }
127
- }
128
- }
129
- /** Pull the `secret` query parameter out of an otpauth:// URI. */
130
- function secretFromUri(uri) {
131
- const match = /[?&]secret=([^&]+)/i.exec(uri);
132
- return match ? decodeURIComponent(match[1]) : '';
133
- }
134
- //# sourceMappingURL=mfa.js.map
package/dist/mfa.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"mfa.js","sourceRoot":"","sources":["../src/mfa.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoDpC,MAAM,CAAC,GAAG;IACR,MAAM,EAAE,6BAA6B;IACrC,OAAO,EAAE,8BAA8B;IACvC,OAAO,EAAE,mCAAmC;IAC5C,UAAU,EAAE,kCAAkC;IAC9C,OAAO,EAAE,+BAA+B;IACxC,SAAS,EAAE,iCAAiC;IAC5C,gBAAgB,EAAE,yCAAyC;IAC3D,mBAAmB,EAAE,4CAA4C;CACzD,CAAC;AAEX,MAAM,OAAO,SAAS;IACpB,YACmB,IAAgB;IACjC,+EAA+E;IAC9D,UAA+B;QAF/B,SAAI,GAAJ,IAAI,CAAY;QAEhB,eAAU,GAAV,UAAU,CAAqB;IAC/C,CAAC;IAEJ;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,MAA6C;QACxD,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAIpC,CAAC,CAA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