cauthy-auth 0.11.0 → 0.12.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/index.mjs CHANGED
@@ -1102,6 +1102,8 @@ function createCauthy(given = {}) {
1102
1102
  "/look",
1103
1103
  "/sign-in/passkey/begin",
1104
1104
  "/sign-in/passkey/finish",
1105
+ "/sign-in/google-one-tap/begin",
1106
+ "/sign-in/google-one-tap",
1105
1107
  "/me/passkeys",
1106
1108
  "/me/passkeys/add/begin",
1107
1109
  "/me/passkeys/add/finish",
@@ -1410,6 +1412,17 @@ function createCauthy(given = {}) {
1410
1412
  }
1411
1413
  return signedIn(request, res.data, [clear]);
1412
1414
  }
1415
+ if (route === "/sign-in/google-one-tap/begin") {
1416
+ const res = await ask(request, "POST", "/v1/auth/google/one-tap/begin", {});
1417
+ if (res.error) return problem(res.status, res.error.code, res.error.message);
1418
+ return json({ status: "started", clientId: String(res.data?.client_id ?? ""), nonce: String(res.data?.nonce ?? "") });
1419
+ }
1420
+ if (route === "/sign-in/google-one-tap") {
1421
+ if (typeof b.credential !== "string" || b.credential === "") return problem(400, "bad_request", "Send the credential Google gave the page.");
1422
+ const res = await ask(request, "POST", "/v1/auth/google/one-tap", { credential: b.credential });
1423
+ if (res.error) return problem(res.status, res.error.code, res.error.message);
1424
+ return signedIn(request, res.data);
1425
+ }
1413
1426
  if (route === "/sign-in/magic-link") {
1414
1427
  const bad = checkEmail(b.email);
1415
1428
  if (bad) return invalid(bad);