@protobase/client 0.66.7 → 0.66.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.
- package/dist/account-security.d.ts +7 -0
- package/dist/account-security.js +16 -0
- package/dist/auth.d.ts +2 -0
- package/dist/static-session.js +2 -0
- package/package.json +3 -3
|
@@ -81,6 +81,13 @@ export declare const accountSecurity: (client: BetterAuthClient) => {
|
|
|
81
81
|
connectedApps: () => Promise<ConnectedApp[]>;
|
|
82
82
|
/** Disconnects an app: it is forgotten, and its access ends within 15 minutes; it has to ask again to come back. */
|
|
83
83
|
disconnectApp: (clientId: string) => Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Emails a code that confirms it's them in this session, for an account without a passkey or a second step: a new one
|
|
86
|
+
* ends the one before. Rejects when the email cannot be sent.
|
|
87
|
+
*/
|
|
88
|
+
sendConfirmationCode: () => Promise<void>;
|
|
89
|
+
/** Confirms it's them in this session with the emailed code; a few wrong codes end it, and a new one has to be asked for. */
|
|
90
|
+
confirmWithCode: (code: string) => Promise<void>;
|
|
84
91
|
/** New backup codes for the authenticator app; the old ones stop working. */
|
|
85
92
|
newBackupCodes: (password?: string) => Promise<string[]>;
|
|
86
93
|
};
|
package/dist/account-security.js
CHANGED
|
@@ -123,6 +123,22 @@ const accountSecurity = (client) => ({
|
|
|
123
123
|
});
|
|
124
124
|
if (error) throw authError(error, "Could not disconnect the app");
|
|
125
125
|
},
|
|
126
|
+
/**
|
|
127
|
+
* Emails a code that confirms it's them in this session, for an account without a passkey or a second step: a new one
|
|
128
|
+
* ends the one before. Rejects when the email cannot be sent.
|
|
129
|
+
*/
|
|
130
|
+
sendConfirmationCode: async () => {
|
|
131
|
+
const { error } = await client.$fetch("/account/confirmation-code/send", { method: "POST" });
|
|
132
|
+
if (error) throw authError(error, "Could not email a code");
|
|
133
|
+
},
|
|
134
|
+
/** Confirms it's them in this session with the emailed code; a few wrong codes end it, and a new one has to be asked for. */
|
|
135
|
+
confirmWithCode: async (code) => {
|
|
136
|
+
const { error } = await client.$fetch("/account/confirmation-code/verify", {
|
|
137
|
+
method: "POST",
|
|
138
|
+
body: { code }
|
|
139
|
+
});
|
|
140
|
+
if (error) throw authError(error, "The code did not work");
|
|
141
|
+
},
|
|
126
142
|
/** New backup codes for the authenticator app; the old ones stop working. */
|
|
127
143
|
newBackupCodes: async (password) => {
|
|
128
144
|
const { data, error } = await client.twoFactor.generateBackupCodes(password ? { password } : {});
|
package/dist/auth.d.ts
CHANGED
|
@@ -80,6 +80,8 @@ export declare const createAuthSession: (options?: AuthSessionOptions) => {
|
|
|
80
80
|
linkPersonalMail: (link: PersonalMailLink, callbackURL: string) => Promise<string>;
|
|
81
81
|
connectedApps: () => Promise<ConnectedApp[]>;
|
|
82
82
|
disconnectApp: (clientId: string) => Promise<void>;
|
|
83
|
+
sendConfirmationCode: () => Promise<void>;
|
|
84
|
+
confirmWithCode: (code: string) => Promise<void>;
|
|
83
85
|
newBackupCodes: (password?: string) => Promise<string[]>;
|
|
84
86
|
};
|
|
85
87
|
connect: {
|
package/dist/static-session.js
CHANGED
|
@@ -73,6 +73,8 @@ const createStaticSession = (token, user = {
|
|
|
73
73
|
turnOnEmailedCodes: unsupported("turn on two-factor authentication"),
|
|
74
74
|
turnOffTwoFactor: unsupported("turn off two-factor authentication"),
|
|
75
75
|
newBackupCodes: unsupported("make backup codes"),
|
|
76
|
+
sendConfirmationCode: unsupported("email a confirmation code"),
|
|
77
|
+
confirmWithCode: unsupported("confirm with a code"),
|
|
76
78
|
linkedProviders: async () => [],
|
|
77
79
|
linkProvider: unsupported("link a sign-in provider"),
|
|
78
80
|
linkedPersonalMail: async () => [],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/client",
|
|
3
|
-
"version": "0.66.
|
|
3
|
+
"version": "0.66.8",
|
|
4
4
|
"description": "Typed fetch client for the Protobase REST API.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@better-auth/passkey": "^1.7.12",
|
|
34
|
-
"@protobase/layout": "0.66.
|
|
35
|
-
"@protobase/schema": "0.66.
|
|
34
|
+
"@protobase/layout": "0.66.8",
|
|
35
|
+
"@protobase/schema": "0.66.8",
|
|
36
36
|
"@simplewebauthn/browser": "^13.3.0",
|
|
37
37
|
"better-auth": "^1.7.12"
|
|
38
38
|
}
|