@palbase/web 7.0.0 → 7.2.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.
- package/dist/{analytics-facade-CdTK9Y0s.d.ts → analytics-facade-DLfnVVwL.d.ts} +62 -0
- package/dist/{analytics-facade-TB-D4ww8.d.cts → analytics-facade-jyXv7Cu4.d.cts} +62 -0
- package/dist/{chunk-7SNSLY5M.js → chunk-VXQUBBHG.js} +225 -2
- package/dist/chunk-VXQUBBHG.js.map +1 -0
- package/dist/index.cjs +210 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/internal.cjs +224 -1
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +3 -3
- package/dist/internal.d.ts +3 -3
- package/dist/internal.js +1 -1
- package/dist/next/client.cjs +224 -1
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.js +1 -1
- package/dist/next/index.cjs +224 -1
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.d.cts +2 -2
- package/dist/next/index.d.ts +2 -2
- package/dist/next/index.js +1 -1
- package/dist/{pb-CiSj4lM3.d.cts → pb-CfYQGEn0.d.cts} +1 -1
- package/dist/{pb-B6ZcZy8v.d.ts → pb-DdzpEkPY.d.ts} +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-7SNSLY5M.js.map +0 -1
|
@@ -245,6 +245,15 @@ interface PasswordChangeParams {
|
|
|
245
245
|
current_password: string;
|
|
246
246
|
new_password: string;
|
|
247
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* Body of POST /auth/password/set — a passwordless account's FIRST password.
|
|
250
|
+
*
|
|
251
|
+
* No current password on purpose: the accounts this serves (passkey-first,
|
|
252
|
+
* social-only) do not have one, which is why `changePassword` answers them 401.
|
|
253
|
+
*/
|
|
254
|
+
interface PasswordSetParams {
|
|
255
|
+
new_password: string;
|
|
256
|
+
}
|
|
248
257
|
interface MFAEnrollParams {
|
|
249
258
|
type: 'totp' | 'email';
|
|
250
259
|
}
|
|
@@ -435,6 +444,18 @@ declare class AuthClient {
|
|
|
435
444
|
changePassword(params: PasswordChangeParams): Promise<PalbaseResponse<{
|
|
436
445
|
success: boolean;
|
|
437
446
|
}>>;
|
|
447
|
+
/**
|
|
448
|
+
* Give a PASSWORDLESS account its first password.
|
|
449
|
+
*
|
|
450
|
+
* Separate from `changePassword` because that one cannot serve the case: it
|
|
451
|
+
* sends a current password and palauth answers an account that has none with
|
|
452
|
+
* 401. Requires a RECENT sign-in (403 `reauthentication_required` otherwise,
|
|
453
|
+
* the same gate passkey enrollment carries); an account that already has a
|
|
454
|
+
* password gets 409 `password_already_set`.
|
|
455
|
+
*/
|
|
456
|
+
setPassword(params: PasswordSetParams): Promise<PalbaseResponse<{
|
|
457
|
+
success: boolean;
|
|
458
|
+
}>>;
|
|
438
459
|
refresh(): Promise<PalbaseResponse<TokenResponse>>;
|
|
439
460
|
getAccessToken(): string | null;
|
|
440
461
|
onTokenChange(callback: (tokens: {
|
|
@@ -1826,6 +1847,24 @@ declare class PalbeAuth {
|
|
|
1826
1847
|
currentPassword: string;
|
|
1827
1848
|
newPassword: string;
|
|
1828
1849
|
}): Promise<void>;
|
|
1850
|
+
/**
|
|
1851
|
+
* Give a passwordless account its FIRST password, in-app.
|
|
1852
|
+
*
|
|
1853
|
+
* For accounts created with a passkey or a social provider: they have no
|
|
1854
|
+
* current password, so `updatePassword` cannot serve them — it sends one and
|
|
1855
|
+
* the server answers 401. Before this existed the only route was the
|
|
1856
|
+
* password-RESET e-mail, which asks someone already signed in to go find
|
|
1857
|
+
* their inbox.
|
|
1858
|
+
*
|
|
1859
|
+
* Requires a RECENT sign-in, not merely a session: a first password is a
|
|
1860
|
+
* credential that outlives the rest, so the server answers 403
|
|
1861
|
+
* `reauthentication_required` on a stale one — the same gate
|
|
1862
|
+
* `registerPasskey` carries. An account that already has a password gets 409
|
|
1863
|
+
* `password_already_set`; change it with `updatePassword` instead.
|
|
1864
|
+
*
|
|
1865
|
+
* The session stays valid — no re-login.
|
|
1866
|
+
*/
|
|
1867
|
+
setPassword(newPassword: string): Promise<void>;
|
|
1829
1868
|
verifyEmail(params: {
|
|
1830
1869
|
token: string;
|
|
1831
1870
|
} | {
|
|
@@ -1839,6 +1878,29 @@ declare class PalbeAuth {
|
|
|
1839
1878
|
provider: string;
|
|
1840
1879
|
credential: string;
|
|
1841
1880
|
}): Promise<AuthSuccess>;
|
|
1881
|
+
/**
|
|
1882
|
+
* Sign in with a passkey stored for this Environment. No identifier is typed:
|
|
1883
|
+
* the browser lists the accounts it holds and the user picks one.
|
|
1884
|
+
*
|
|
1885
|
+
* Throws when the browser cannot run a ceremony — check `passkeysSupported`
|
|
1886
|
+
* first and keep a password or e-mail path beside the button.
|
|
1887
|
+
*/
|
|
1888
|
+
signInWithPasskey(): Promise<AuthSuccess>;
|
|
1889
|
+
/**
|
|
1890
|
+
* Create an account whose only credential is a passkey — the e-mail is the
|
|
1891
|
+
* identifier, the passkey is the credential, and no password ever exists.
|
|
1892
|
+
*/
|
|
1893
|
+
signUpWithPasskey(email: string, displayName?: string): Promise<AuthSuccess>;
|
|
1894
|
+
/**
|
|
1895
|
+
* Add a passkey to the signed-in account, so the next sign-in is one tap.
|
|
1896
|
+
*
|
|
1897
|
+
* Rejects with a 403 `reauthentication_required` when the session is not
|
|
1898
|
+
* recent: a passkey outlives a password reset, so enrolling one takes more
|
|
1899
|
+
* than a valid session.
|
|
1900
|
+
*/
|
|
1901
|
+
registerPasskey(name?: string): Promise<void>;
|
|
1902
|
+
/** Whether this browser can run a passkey ceremony at all. */
|
|
1903
|
+
get passkeysSupported(): boolean;
|
|
1842
1904
|
signInWithOAuth(params: {
|
|
1843
1905
|
provider: string;
|
|
1844
1906
|
redirectTo?: string;
|
|
@@ -245,6 +245,15 @@ interface PasswordChangeParams {
|
|
|
245
245
|
current_password: string;
|
|
246
246
|
new_password: string;
|
|
247
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* Body of POST /auth/password/set — a passwordless account's FIRST password.
|
|
250
|
+
*
|
|
251
|
+
* No current password on purpose: the accounts this serves (passkey-first,
|
|
252
|
+
* social-only) do not have one, which is why `changePassword` answers them 401.
|
|
253
|
+
*/
|
|
254
|
+
interface PasswordSetParams {
|
|
255
|
+
new_password: string;
|
|
256
|
+
}
|
|
248
257
|
interface MFAEnrollParams {
|
|
249
258
|
type: 'totp' | 'email';
|
|
250
259
|
}
|
|
@@ -435,6 +444,18 @@ declare class AuthClient {
|
|
|
435
444
|
changePassword(params: PasswordChangeParams): Promise<PalbaseResponse<{
|
|
436
445
|
success: boolean;
|
|
437
446
|
}>>;
|
|
447
|
+
/**
|
|
448
|
+
* Give a PASSWORDLESS account its first password.
|
|
449
|
+
*
|
|
450
|
+
* Separate from `changePassword` because that one cannot serve the case: it
|
|
451
|
+
* sends a current password and palauth answers an account that has none with
|
|
452
|
+
* 401. Requires a RECENT sign-in (403 `reauthentication_required` otherwise,
|
|
453
|
+
* the same gate passkey enrollment carries); an account that already has a
|
|
454
|
+
* password gets 409 `password_already_set`.
|
|
455
|
+
*/
|
|
456
|
+
setPassword(params: PasswordSetParams): Promise<PalbaseResponse<{
|
|
457
|
+
success: boolean;
|
|
458
|
+
}>>;
|
|
438
459
|
refresh(): Promise<PalbaseResponse<TokenResponse>>;
|
|
439
460
|
getAccessToken(): string | null;
|
|
440
461
|
onTokenChange(callback: (tokens: {
|
|
@@ -1826,6 +1847,24 @@ declare class PalbeAuth {
|
|
|
1826
1847
|
currentPassword: string;
|
|
1827
1848
|
newPassword: string;
|
|
1828
1849
|
}): Promise<void>;
|
|
1850
|
+
/**
|
|
1851
|
+
* Give a passwordless account its FIRST password, in-app.
|
|
1852
|
+
*
|
|
1853
|
+
* For accounts created with a passkey or a social provider: they have no
|
|
1854
|
+
* current password, so `updatePassword` cannot serve them — it sends one and
|
|
1855
|
+
* the server answers 401. Before this existed the only route was the
|
|
1856
|
+
* password-RESET e-mail, which asks someone already signed in to go find
|
|
1857
|
+
* their inbox.
|
|
1858
|
+
*
|
|
1859
|
+
* Requires a RECENT sign-in, not merely a session: a first password is a
|
|
1860
|
+
* credential that outlives the rest, so the server answers 403
|
|
1861
|
+
* `reauthentication_required` on a stale one — the same gate
|
|
1862
|
+
* `registerPasskey` carries. An account that already has a password gets 409
|
|
1863
|
+
* `password_already_set`; change it with `updatePassword` instead.
|
|
1864
|
+
*
|
|
1865
|
+
* The session stays valid — no re-login.
|
|
1866
|
+
*/
|
|
1867
|
+
setPassword(newPassword: string): Promise<void>;
|
|
1829
1868
|
verifyEmail(params: {
|
|
1830
1869
|
token: string;
|
|
1831
1870
|
} | {
|
|
@@ -1839,6 +1878,29 @@ declare class PalbeAuth {
|
|
|
1839
1878
|
provider: string;
|
|
1840
1879
|
credential: string;
|
|
1841
1880
|
}): Promise<AuthSuccess>;
|
|
1881
|
+
/**
|
|
1882
|
+
* Sign in with a passkey stored for this Environment. No identifier is typed:
|
|
1883
|
+
* the browser lists the accounts it holds and the user picks one.
|
|
1884
|
+
*
|
|
1885
|
+
* Throws when the browser cannot run a ceremony — check `passkeysSupported`
|
|
1886
|
+
* first and keep a password or e-mail path beside the button.
|
|
1887
|
+
*/
|
|
1888
|
+
signInWithPasskey(): Promise<AuthSuccess>;
|
|
1889
|
+
/**
|
|
1890
|
+
* Create an account whose only credential is a passkey — the e-mail is the
|
|
1891
|
+
* identifier, the passkey is the credential, and no password ever exists.
|
|
1892
|
+
*/
|
|
1893
|
+
signUpWithPasskey(email: string, displayName?: string): Promise<AuthSuccess>;
|
|
1894
|
+
/**
|
|
1895
|
+
* Add a passkey to the signed-in account, so the next sign-in is one tap.
|
|
1896
|
+
*
|
|
1897
|
+
* Rejects with a 403 `reauthentication_required` when the session is not
|
|
1898
|
+
* recent: a passkey outlives a password reset, so enrolling one takes more
|
|
1899
|
+
* than a valid session.
|
|
1900
|
+
*/
|
|
1901
|
+
registerPasskey(name?: string): Promise<void>;
|
|
1902
|
+
/** Whether this browser can run a passkey ceremony at all. */
|
|
1903
|
+
get passkeysSupported(): boolean;
|
|
1842
1904
|
signInWithOAuth(params: {
|
|
1843
1905
|
provider: string;
|
|
1844
1906
|
redirectTo?: string;
|
|
@@ -512,6 +512,20 @@ var AuthClient = class {
|
|
|
512
512
|
body: params
|
|
513
513
|
});
|
|
514
514
|
}
|
|
515
|
+
/**
|
|
516
|
+
* Give a PASSWORDLESS account its first password.
|
|
517
|
+
*
|
|
518
|
+
* Separate from `changePassword` because that one cannot serve the case: it
|
|
519
|
+
* sends a current password and palauth answers an account that has none with
|
|
520
|
+
* 401. Requires a RECENT sign-in (403 `reauthentication_required` otherwise,
|
|
521
|
+
* the same gate passkey enrollment carries); an account that already has a
|
|
522
|
+
* password gets 409 `password_already_set`.
|
|
523
|
+
*/
|
|
524
|
+
async setPassword(params) {
|
|
525
|
+
return this.httpClient.request("POST", "/auth/password/set", {
|
|
526
|
+
body: params
|
|
527
|
+
});
|
|
528
|
+
}
|
|
515
529
|
// ── Token ───────────────────────────────────────────────
|
|
516
530
|
async refresh() {
|
|
517
531
|
const refreshToken = this.tokenManager.getRefreshToken();
|
|
@@ -1048,6 +1062,162 @@ function asWireAuthResult(raw) {
|
|
|
1048
1062
|
return raw;
|
|
1049
1063
|
}
|
|
1050
1064
|
|
|
1065
|
+
// src/passkey.ts
|
|
1066
|
+
function base64UrlToBytes(value) {
|
|
1067
|
+
const padded = value.replace(/-/g, "+").replace(/_/g, "/");
|
|
1068
|
+
const binary = atob(padded.padEnd(padded.length + (4 - padded.length % 4) % 4, "="));
|
|
1069
|
+
const bytes = new Uint8Array(new ArrayBuffer(binary.length));
|
|
1070
|
+
for (let i = 0; i < binary.length; i += 1) bytes[i] = binary.charCodeAt(i);
|
|
1071
|
+
return bytes;
|
|
1072
|
+
}
|
|
1073
|
+
function bytesToBase64Url(buffer) {
|
|
1074
|
+
const bytes = new Uint8Array(buffer);
|
|
1075
|
+
let binary = "";
|
|
1076
|
+
for (const b of bytes) binary += String.fromCharCode(b);
|
|
1077
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1078
|
+
}
|
|
1079
|
+
function requireString(source, key) {
|
|
1080
|
+
const value = source[key];
|
|
1081
|
+
if (typeof value !== "string" || value === "") {
|
|
1082
|
+
throw new Error(`passkey options are missing ${key}`);
|
|
1083
|
+
}
|
|
1084
|
+
return value;
|
|
1085
|
+
}
|
|
1086
|
+
function toCreationOptions(publicKey) {
|
|
1087
|
+
const rp = publicKey.rp;
|
|
1088
|
+
const user = publicKey.user;
|
|
1089
|
+
if (!user?.id) {
|
|
1090
|
+
throw new Error("passkey options carry no user id \u2014 the credential would be unusable");
|
|
1091
|
+
}
|
|
1092
|
+
const excludeCredentials = Array.isArray(publicKey.excludeCredentials) ? publicKey.excludeCredentials.map((c) => ({
|
|
1093
|
+
id: base64UrlToBytes(c.id),
|
|
1094
|
+
type: "public-key"
|
|
1095
|
+
})) : void 0;
|
|
1096
|
+
return {
|
|
1097
|
+
challenge: base64UrlToBytes(requireString(publicKey, "challenge")),
|
|
1098
|
+
rp: { id: rp?.id, name: rp?.name ?? rp?.id ?? "" },
|
|
1099
|
+
user: {
|
|
1100
|
+
id: base64UrlToBytes(user.id),
|
|
1101
|
+
name: user.name ?? "",
|
|
1102
|
+
displayName: user.displayName ?? user.name ?? ""
|
|
1103
|
+
},
|
|
1104
|
+
pubKeyCredParams: publicKey.pubKeyCredParams ?? [],
|
|
1105
|
+
authenticatorSelection: publicKey.authenticatorSelection,
|
|
1106
|
+
timeout: publicKey.timeout,
|
|
1107
|
+
attestation: publicKey.attestation,
|
|
1108
|
+
excludeCredentials
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
function toRequestOptions(publicKey) {
|
|
1112
|
+
const allowCredentials = Array.isArray(publicKey.allowCredentials) ? publicKey.allowCredentials.map((c) => ({
|
|
1113
|
+
id: base64UrlToBytes(c.id),
|
|
1114
|
+
type: "public-key"
|
|
1115
|
+
})) : void 0;
|
|
1116
|
+
return {
|
|
1117
|
+
challenge: base64UrlToBytes(requireString(publicKey, "challenge")),
|
|
1118
|
+
rpId: publicKey.rpId,
|
|
1119
|
+
timeout: publicKey.timeout,
|
|
1120
|
+
userVerification: publicKey.userVerification,
|
|
1121
|
+
allowCredentials
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
function attestationToJSON(credential) {
|
|
1125
|
+
const response = credential.response;
|
|
1126
|
+
return {
|
|
1127
|
+
id: credential.id,
|
|
1128
|
+
rawId: bytesToBase64Url(credential.rawId),
|
|
1129
|
+
type: credential.type,
|
|
1130
|
+
response: {
|
|
1131
|
+
clientDataJSON: bytesToBase64Url(response.clientDataJSON),
|
|
1132
|
+
attestationObject: bytesToBase64Url(response.attestationObject)
|
|
1133
|
+
}
|
|
1134
|
+
};
|
|
1135
|
+
}
|
|
1136
|
+
function assertionToJSON(credential) {
|
|
1137
|
+
const response = credential.response;
|
|
1138
|
+
return {
|
|
1139
|
+
id: credential.id,
|
|
1140
|
+
rawId: bytesToBase64Url(credential.rawId),
|
|
1141
|
+
type: credential.type,
|
|
1142
|
+
response: {
|
|
1143
|
+
clientDataJSON: bytesToBase64Url(response.clientDataJSON),
|
|
1144
|
+
authenticatorData: bytesToBase64Url(response.authenticatorData),
|
|
1145
|
+
signature: bytesToBase64Url(response.signature),
|
|
1146
|
+
// The user handle is how palauth resolves WHO signed in on a discoverable
|
|
1147
|
+
// login — there is no identifier in the request.
|
|
1148
|
+
userHandle: response.userHandle ? bytesToBase64Url(response.userHandle) : null
|
|
1149
|
+
}
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1152
|
+
function isPasskeySupported() {
|
|
1153
|
+
return typeof window !== "undefined" && typeof window.PublicKeyCredential === "function" && typeof navigator !== "undefined" && navigator.credentials !== void 0;
|
|
1154
|
+
}
|
|
1155
|
+
function ensureSupported() {
|
|
1156
|
+
if (!isPasskeySupported()) {
|
|
1157
|
+
throw new Error("This browser cannot use passkeys \u2014 offer a password or e-mail sign-in");
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
async function createCredential(publicKey) {
|
|
1161
|
+
const credential = await navigator.credentials.create({
|
|
1162
|
+
publicKey: toCreationOptions(publicKey)
|
|
1163
|
+
});
|
|
1164
|
+
if (credential === null) {
|
|
1165
|
+
throw new Error("the browser returned no credential");
|
|
1166
|
+
}
|
|
1167
|
+
return credential;
|
|
1168
|
+
}
|
|
1169
|
+
async function getCredential(publicKey) {
|
|
1170
|
+
const credential = await navigator.credentials.get({
|
|
1171
|
+
publicKey: toRequestOptions(publicKey)
|
|
1172
|
+
});
|
|
1173
|
+
if (credential === null) {
|
|
1174
|
+
throw new Error("the browser returned no credential");
|
|
1175
|
+
}
|
|
1176
|
+
return credential;
|
|
1177
|
+
}
|
|
1178
|
+
async function passkeySignIn(rt) {
|
|
1179
|
+
ensureSupported();
|
|
1180
|
+
const envelope = await palbeRequest(rt, "POST", "/auth/webauthn/login/begin", {
|
|
1181
|
+
body: {}
|
|
1182
|
+
});
|
|
1183
|
+
const credential = await getCredential(envelope.options.publicKey);
|
|
1184
|
+
const raw = await palbeRequest(rt, "POST", "/auth/webauthn/login/finish", {
|
|
1185
|
+
body: assertionToJSON(credential)
|
|
1186
|
+
});
|
|
1187
|
+
const result = asWireAuthResult(raw);
|
|
1188
|
+
if (result === null) {
|
|
1189
|
+
throw new Error("passkey sign-in returned an unusable session");
|
|
1190
|
+
}
|
|
1191
|
+
return result;
|
|
1192
|
+
}
|
|
1193
|
+
async function passkeySignUp(rt, email, displayName) {
|
|
1194
|
+
ensureSupported();
|
|
1195
|
+
const begun = await palbeRequest(rt, "POST", "/auth/webauthn/signup/begin", {
|
|
1196
|
+
body: { email, user_name: displayName }
|
|
1197
|
+
});
|
|
1198
|
+
const credential = await createCredential(begun.options.publicKey);
|
|
1199
|
+
await palbeRequest(
|
|
1200
|
+
rt,
|
|
1201
|
+
"POST",
|
|
1202
|
+
`/auth/webauthn/signup/finish?user_id=${encodeURIComponent(begun.user_id)}`,
|
|
1203
|
+
{ body: attestationToJSON(credential) }
|
|
1204
|
+
);
|
|
1205
|
+
return await passkeySignIn(rt);
|
|
1206
|
+
}
|
|
1207
|
+
async function passkeyRegister(rt, name) {
|
|
1208
|
+
ensureSupported();
|
|
1209
|
+
const envelope = await palbeRequest(
|
|
1210
|
+
rt,
|
|
1211
|
+
"POST",
|
|
1212
|
+
"/auth/webauthn/register/begin",
|
|
1213
|
+
{ body: { name } }
|
|
1214
|
+
);
|
|
1215
|
+
const credential = await createCredential(envelope.options.publicKey);
|
|
1216
|
+
await palbeRequest(rt, "POST", "/auth/webauthn/register/finish", {
|
|
1217
|
+
body: attestationToJSON(credential)
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1051
1221
|
// src/auth-facade.ts
|
|
1052
1222
|
function mapWireUser(raw) {
|
|
1053
1223
|
return {
|
|
@@ -1379,6 +1549,26 @@ var PalbeAuth = class {
|
|
|
1379
1549
|
})
|
|
1380
1550
|
);
|
|
1381
1551
|
}
|
|
1552
|
+
/**
|
|
1553
|
+
* Give a passwordless account its FIRST password, in-app.
|
|
1554
|
+
*
|
|
1555
|
+
* For accounts created with a passkey or a social provider: they have no
|
|
1556
|
+
* current password, so `updatePassword` cannot serve them — it sends one and
|
|
1557
|
+
* the server answers 401. Before this existed the only route was the
|
|
1558
|
+
* password-RESET e-mail, which asks someone already signed in to go find
|
|
1559
|
+
* their inbox.
|
|
1560
|
+
*
|
|
1561
|
+
* Requires a RECENT sign-in, not merely a session: a first password is a
|
|
1562
|
+
* credential that outlives the rest, so the server answers 403
|
|
1563
|
+
* `reauthentication_required` on a stale one — the same gate
|
|
1564
|
+
* `registerPasskey` carries. An account that already has a password gets 409
|
|
1565
|
+
* `password_already_set`; change it with `updatePassword` instead.
|
|
1566
|
+
*
|
|
1567
|
+
* The session stays valid — no re-login.
|
|
1568
|
+
*/
|
|
1569
|
+
async setPassword(newPassword) {
|
|
1570
|
+
unwrap(await this.rt.authClient.setPassword({ new_password: newPassword }));
|
|
1571
|
+
}
|
|
1382
1572
|
async verifyEmail(params) {
|
|
1383
1573
|
unwrap(await this.rt.authClient.verifyEmail(params));
|
|
1384
1574
|
}
|
|
@@ -1402,6 +1592,39 @@ var PalbeAuth = class {
|
|
|
1402
1592
|
return this.adopt(data);
|
|
1403
1593
|
});
|
|
1404
1594
|
}
|
|
1595
|
+
/**
|
|
1596
|
+
* Sign in with a passkey stored for this Environment. No identifier is typed:
|
|
1597
|
+
* the browser lists the accounts it holds and the user picks one.
|
|
1598
|
+
*
|
|
1599
|
+
* Throws when the browser cannot run a ceremony — check `passkeysSupported`
|
|
1600
|
+
* first and keep a password or e-mail path beside the button.
|
|
1601
|
+
*/
|
|
1602
|
+
async signInWithPasskey() {
|
|
1603
|
+
return this.withSigningIn(async () => this.adoptWire(await passkeySignIn(this.rt)));
|
|
1604
|
+
}
|
|
1605
|
+
/**
|
|
1606
|
+
* Create an account whose only credential is a passkey — the e-mail is the
|
|
1607
|
+
* identifier, the passkey is the credential, and no password ever exists.
|
|
1608
|
+
*/
|
|
1609
|
+
async signUpWithPasskey(email, displayName) {
|
|
1610
|
+
return this.withSigningIn(
|
|
1611
|
+
async () => this.adoptWire(await passkeySignUp(this.rt, email, displayName))
|
|
1612
|
+
);
|
|
1613
|
+
}
|
|
1614
|
+
/**
|
|
1615
|
+
* Add a passkey to the signed-in account, so the next sign-in is one tap.
|
|
1616
|
+
*
|
|
1617
|
+
* Rejects with a 403 `reauthentication_required` when the session is not
|
|
1618
|
+
* recent: a passkey outlives a password reset, so enrolling one takes more
|
|
1619
|
+
* than a valid session.
|
|
1620
|
+
*/
|
|
1621
|
+
async registerPasskey(name) {
|
|
1622
|
+
await passkeyRegister(this.rt, name);
|
|
1623
|
+
}
|
|
1624
|
+
/** Whether this browser can run a passkey ceremony at all. */
|
|
1625
|
+
get passkeysSupported() {
|
|
1626
|
+
return isPasskeySupported();
|
|
1627
|
+
}
|
|
1405
1628
|
async signInWithOAuth(params) {
|
|
1406
1629
|
const { redirect = true, ...opts } = params;
|
|
1407
1630
|
const { url } = unwrap(await this.rt.authClient.getOAuthURL(opts));
|
|
@@ -8650,7 +8873,7 @@ function defaultSessionStorage(key) {
|
|
|
8650
8873
|
}
|
|
8651
8874
|
|
|
8652
8875
|
// src/version.ts
|
|
8653
|
-
var VERSION = "7.
|
|
8876
|
+
var VERSION = "7.2.0";
|
|
8654
8877
|
|
|
8655
8878
|
// src/runtime.ts
|
|
8656
8879
|
function buildRuntime(config) {
|
|
@@ -9075,4 +9298,4 @@ export {
|
|
|
9075
9298
|
pb,
|
|
9076
9299
|
createBoundClient
|
|
9077
9300
|
};
|
|
9078
|
-
//# sourceMappingURL=chunk-
|
|
9301
|
+
//# sourceMappingURL=chunk-VXQUBBHG.js.map
|