cauthy-auth 0.18.0 → 0.19.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/client.d.mts +13 -1
- package/dist/client.d.ts +13 -1
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +1 -1
- package/dist/client.mjs.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -1
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +17 -1
- package/dist/react.d.ts +17 -1
- package/dist/react.js +13 -5
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +13 -5
- package/dist/react.mjs.map +1 -1
- package/dist/svelte.d.mts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/svelte.js +1 -1
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +1 -1
- package/dist/svelte.mjs.map +1 -1
- package/dist/vue.d.mts +1 -1
- package/dist/vue.d.ts +1 -1
- package/dist/vue.js +1 -1
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +1 -1
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.d.mts
CHANGED
|
@@ -266,11 +266,19 @@ interface AuthMethods {
|
|
|
266
266
|
*/
|
|
267
267
|
captchaSiteKey?: string;
|
|
268
268
|
}
|
|
269
|
+
/**
|
|
270
|
+
* What holds a passkey, as its authenticator says: a security key (a YubiKey),
|
|
271
|
+
* one synced across the person's devices (iCloud Keychain, Google Password
|
|
272
|
+
* Manager), one on a single device (Windows Hello), or unknown (made before
|
|
273
|
+
* Cauthy kept this).
|
|
274
|
+
*/
|
|
275
|
+
type PasskeyKind = 'security_key' | 'synced' | 'device' | 'unknown';
|
|
269
276
|
/** A passkey of the signed-in account. Moments are UTC. */
|
|
270
277
|
interface Passkey {
|
|
271
278
|
id: string;
|
|
272
279
|
/** What the person called it ("My laptop"), or "". */
|
|
273
280
|
name: string;
|
|
281
|
+
kind: PasskeyKind;
|
|
274
282
|
createdAt: string;
|
|
275
283
|
/** When it last signed the person in, or null. */
|
|
276
284
|
lastUsedAt: string | null;
|
|
@@ -444,10 +452,14 @@ interface AccountClient {
|
|
|
444
452
|
* Makes a passkey on this device, on this page: the browser asks the person
|
|
445
453
|
* for their fingerprint, face or screen lock. An account with a password
|
|
446
454
|
* proves it again first. `cancelled`: the person closed the browser's prompt.
|
|
455
|
+
* `kind` sends the browser straight to one: `'device'`, this device's
|
|
456
|
+
* fingerprint, face or screen lock; `'security_key'`, a security key.
|
|
457
|
+
* Without it, the browser offers all.
|
|
447
458
|
*/
|
|
448
459
|
addPasskey(form?: {
|
|
449
460
|
password?: string;
|
|
450
461
|
name?: string;
|
|
462
|
+
kind?: 'device' | 'security_key';
|
|
451
463
|
}): Promise<AuthResult<'added', {
|
|
452
464
|
passkey: Passkey;
|
|
453
465
|
}>>;
|
|
@@ -687,7 +699,11 @@ interface AuthTexts {
|
|
|
687
699
|
passkeysHelp: string;
|
|
688
700
|
noPasskeys: string;
|
|
689
701
|
passkeyName: string;
|
|
702
|
+
/** @deprecated Unused since 0.19.0: the account screen offers `addPasskeyDevice` and `addSecurityKey`. */
|
|
690
703
|
addPasskey: string;
|
|
704
|
+
addPasskeyDevice: string;
|
|
705
|
+
addSecurityKey: string;
|
|
706
|
+
passkeyKinds: Record<'security_key' | 'synced' | 'device', string>;
|
|
691
707
|
removePasskey: string;
|
|
692
708
|
passkeyAdded: string;
|
|
693
709
|
passkeyUnnamed: string;
|
|
@@ -856,4 +872,4 @@ declare function useSession(): SessionContext;
|
|
|
856
872
|
*/
|
|
857
873
|
declare function useAuth(): AuthClient & Pick<SessionContext, 'session' | 'status' | 'refresh'>;
|
|
858
874
|
|
|
859
|
-
export { Account, type AccountClient, type Account$1 as AccountDetails, type AccountProps, type AccountSession, type AuthClient, type AuthError, type AuthFormProps, type AuthMethods, type AuthResult, type AuthTexts, CauthyProvider, type CauthyProviderProps, type ConnectedAgent, ForgotPassword, GoogleOneTap, type GoogleOneTapProps, type JsonValue, type LinkedIdentity, type Passkey, type PermissionOf, type Policy, type PublicSession, ResetPassword, type RoleOf, type SecondStep, type SessionContext, type SessionOrganization, type SessionUser, SignIn, SignUp, VerifyEmail, can, canAutofillPasskeys, canUsePasskeys, createAuthClient, definePolicy, useAuth, useSession };
|
|
875
|
+
export { Account, type AccountClient, type Account$1 as AccountDetails, type AccountProps, type AccountSession, type AuthClient, type AuthError, type AuthFormProps, type AuthMethods, type AuthResult, type AuthTexts, CauthyProvider, type CauthyProviderProps, type ConnectedAgent, ForgotPassword, GoogleOneTap, type GoogleOneTapProps, type JsonValue, type LinkedIdentity, type Passkey, type PasskeyKind, type PermissionOf, type Policy, type PublicSession, ResetPassword, type RoleOf, type SecondStep, type SessionContext, type SessionOrganization, type SessionUser, SignIn, SignUp, VerifyEmail, can, canAutofillPasskeys, canUsePasskeys, createAuthClient, definePolicy, useAuth, useSession };
|
package/dist/react.d.ts
CHANGED
|
@@ -266,11 +266,19 @@ interface AuthMethods {
|
|
|
266
266
|
*/
|
|
267
267
|
captchaSiteKey?: string;
|
|
268
268
|
}
|
|
269
|
+
/**
|
|
270
|
+
* What holds a passkey, as its authenticator says: a security key (a YubiKey),
|
|
271
|
+
* one synced across the person's devices (iCloud Keychain, Google Password
|
|
272
|
+
* Manager), one on a single device (Windows Hello), or unknown (made before
|
|
273
|
+
* Cauthy kept this).
|
|
274
|
+
*/
|
|
275
|
+
type PasskeyKind = 'security_key' | 'synced' | 'device' | 'unknown';
|
|
269
276
|
/** A passkey of the signed-in account. Moments are UTC. */
|
|
270
277
|
interface Passkey {
|
|
271
278
|
id: string;
|
|
272
279
|
/** What the person called it ("My laptop"), or "". */
|
|
273
280
|
name: string;
|
|
281
|
+
kind: PasskeyKind;
|
|
274
282
|
createdAt: string;
|
|
275
283
|
/** When it last signed the person in, or null. */
|
|
276
284
|
lastUsedAt: string | null;
|
|
@@ -444,10 +452,14 @@ interface AccountClient {
|
|
|
444
452
|
* Makes a passkey on this device, on this page: the browser asks the person
|
|
445
453
|
* for their fingerprint, face or screen lock. An account with a password
|
|
446
454
|
* proves it again first. `cancelled`: the person closed the browser's prompt.
|
|
455
|
+
* `kind` sends the browser straight to one: `'device'`, this device's
|
|
456
|
+
* fingerprint, face or screen lock; `'security_key'`, a security key.
|
|
457
|
+
* Without it, the browser offers all.
|
|
447
458
|
*/
|
|
448
459
|
addPasskey(form?: {
|
|
449
460
|
password?: string;
|
|
450
461
|
name?: string;
|
|
462
|
+
kind?: 'device' | 'security_key';
|
|
451
463
|
}): Promise<AuthResult<'added', {
|
|
452
464
|
passkey: Passkey;
|
|
453
465
|
}>>;
|
|
@@ -687,7 +699,11 @@ interface AuthTexts {
|
|
|
687
699
|
passkeysHelp: string;
|
|
688
700
|
noPasskeys: string;
|
|
689
701
|
passkeyName: string;
|
|
702
|
+
/** @deprecated Unused since 0.19.0: the account screen offers `addPasskeyDevice` and `addSecurityKey`. */
|
|
690
703
|
addPasskey: string;
|
|
704
|
+
addPasskeyDevice: string;
|
|
705
|
+
addSecurityKey: string;
|
|
706
|
+
passkeyKinds: Record<'security_key' | 'synced' | 'device', string>;
|
|
691
707
|
removePasskey: string;
|
|
692
708
|
passkeyAdded: string;
|
|
693
709
|
passkeyUnnamed: string;
|
|
@@ -856,4 +872,4 @@ declare function useSession(): SessionContext;
|
|
|
856
872
|
*/
|
|
857
873
|
declare function useAuth(): AuthClient & Pick<SessionContext, 'session' | 'status' | 'refresh'>;
|
|
858
874
|
|
|
859
|
-
export { Account, type AccountClient, type Account$1 as AccountDetails, type AccountProps, type AccountSession, type AuthClient, type AuthError, type AuthFormProps, type AuthMethods, type AuthResult, type AuthTexts, CauthyProvider, type CauthyProviderProps, type ConnectedAgent, ForgotPassword, GoogleOneTap, type GoogleOneTapProps, type JsonValue, type LinkedIdentity, type Passkey, type PermissionOf, type Policy, type PublicSession, ResetPassword, type RoleOf, type SecondStep, type SessionContext, type SessionOrganization, type SessionUser, SignIn, SignUp, VerifyEmail, can, canAutofillPasskeys, canUsePasskeys, createAuthClient, definePolicy, useAuth, useSession };
|
|
875
|
+
export { Account, type AccountClient, type Account$1 as AccountDetails, type AccountProps, type AccountSession, type AuthClient, type AuthError, type AuthFormProps, type AuthMethods, type AuthResult, type AuthTexts, CauthyProvider, type CauthyProviderProps, type ConnectedAgent, ForgotPassword, GoogleOneTap, type GoogleOneTapProps, type JsonValue, type LinkedIdentity, type Passkey, type PasskeyKind, type PermissionOf, type Policy, type PublicSession, ResetPassword, type RoleOf, type SecondStep, type SessionContext, type SessionOrganization, type SessionUser, SignIn, SignUp, VerifyEmail, can, canAutofillPasskeys, canUsePasskeys, createAuthClient, definePolicy, useAuth, useSession };
|
package/dist/react.js
CHANGED
|
@@ -439,7 +439,7 @@ function createAuthClient(options = {}) {
|
|
|
439
439
|
},
|
|
440
440
|
addPasskey(f = {}) {
|
|
441
441
|
if (!canUsePasskeys()) return Promise.resolve({ ok: false, error: { code: "passkey_unavailable", message: "This browser cannot make passkeys." } });
|
|
442
|
-
return ceremony("/me/passkeys/add/begin", "/me/passkeys/add/finish", { password: f.password ?? "" }, makePasskey, { name: f.name ?? "" });
|
|
442
|
+
return ceremony("/me/passkeys/add/begin", "/me/passkeys/add/finish", { password: f.password ?? "", ...f.kind ? { kind: f.kind } : {} }, makePasskey, { name: f.name ?? "" });
|
|
443
443
|
},
|
|
444
444
|
removePasskey: (id) => post("/me/passkeys/remove", { id }, null)
|
|
445
445
|
},
|
|
@@ -580,6 +580,9 @@ var TEXTS = {
|
|
|
580
580
|
passkeyName: "A name for this device (optional)",
|
|
581
581
|
addPasskey: "Add a passkey on this device",
|
|
582
582
|
removePasskey: "Remove",
|
|
583
|
+
addPasskeyDevice: "Add this device (fingerprint or face)",
|
|
584
|
+
addSecurityKey: "Add a security key",
|
|
585
|
+
passkeyKinds: { security_key: "Security key", synced: "Synced across your devices", device: "On this device only" },
|
|
583
586
|
passkeyAdded: "The passkey was added. Next time, sign in with it.",
|
|
584
587
|
passkeyUnnamed: "Passkey",
|
|
585
588
|
sessions: "Where you are signed in",
|
|
@@ -692,6 +695,9 @@ var TEXTS = {
|
|
|
692
695
|
passkeyName: "Un nombre para este dispositivo (opcional)",
|
|
693
696
|
addPasskey: "Agregar una llave en este dispositivo",
|
|
694
697
|
removePasskey: "Quitar",
|
|
698
|
+
addPasskeyDevice: "Agregar este dispositivo (huella o rostro)",
|
|
699
|
+
addSecurityKey: "Agregar una llave f\xEDsica",
|
|
700
|
+
passkeyKinds: { security_key: "Llave f\xEDsica", synced: "Sincronizada entre tus dispositivos", device: "Solo en un dispositivo" },
|
|
695
701
|
passkeyAdded: "La llave de acceso qued\xF3 agregada. La pr\xF3xima vez, entra con ella.",
|
|
696
702
|
passkeyUnnamed: "Llave de acceso",
|
|
697
703
|
sessions: "D\xF3nde tienes la sesi\xF3n abierta",
|
|
@@ -1267,9 +1273,9 @@ function PasskeysPart({ props, account, accountUrl, when }) {
|
|
|
1267
1273
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { className: f.cx("link"), href: accountUrl, children: f.t.managePasskeys })
|
|
1268
1274
|
] });
|
|
1269
1275
|
}
|
|
1270
|
-
const add = async (e) => {
|
|
1271
|
-
e
|
|
1272
|
-
const r = await run(() => auth.account.addPasskey({ name, password }));
|
|
1276
|
+
const add = async (e, kind = "device") => {
|
|
1277
|
+
e?.preventDefault();
|
|
1278
|
+
const r = await run(() => auth.account.addPasskey({ name, password, kind }));
|
|
1273
1279
|
if (!r.ok) {
|
|
1274
1280
|
if (r.error.code === "cancelled") f.setError(null);
|
|
1275
1281
|
return;
|
|
@@ -1289,6 +1295,7 @@ function PasskeysPart({ props, account, accountUrl, when }) {
|
|
|
1289
1295
|
general && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { role: "alert", className: f.cx("error"), children: f.say(general) }),
|
|
1290
1296
|
list.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: f.cx("notice"), children: f.t.noPasskeys }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: f.cx("sessions"), children: list.map((p) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { className: f.cx("session"), children: [
|
|
1291
1297
|
p.name || f.t.passkeyUnnamed,
|
|
1298
|
+
p.kind !== "unknown" ? ` \xB7 ${f.t.passkeyKinds[p.kind]}` : "",
|
|
1292
1299
|
" \xB7 ",
|
|
1293
1300
|
when(p.createdAt),
|
|
1294
1301
|
" ",
|
|
@@ -1296,7 +1303,8 @@ function PasskeysPart({ props, account, accountUrl, when }) {
|
|
|
1296
1303
|
] }, p.id)) }),
|
|
1297
1304
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { f, name: "name", type: "text", label: f.t.passkeyName, value: name, autoComplete: "off", onChange: setName }),
|
|
1298
1305
|
account.hasPassword && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { f, name: "password", type: "password", label: f.t.currentPassword, value: password, autoComplete: "current-password", required: true, onChange: setPassword }),
|
|
1299
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(f.Button, { type: "submit", disabled: f.busy, className: f.cx("button"), children: f.t.
|
|
1306
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(f.Button, { type: "submit", disabled: f.busy, className: f.cx("button"), children: f.t.addPasskeyDevice }),
|
|
1307
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(f.Button, { type: "button", disabled: f.busy, className: f.cx("providerButton"), onClick: () => void add(null, "security_key"), children: f.t.addSecurityKey }),
|
|
1300
1308
|
done && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { role: "status", className: f.cx("notice"), children: done })
|
|
1301
1309
|
] });
|
|
1302
1310
|
}
|