@voltro/plugin-auth-social 0.87.0 → 0.88.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/apple.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { SocialConfigError as e } from "./errors.js";
2
2
  import { createPrivateKey as t, sign as n } from "node:crypto";
3
- //#region src/apple.ts
3
+ // src/apple.ts
4
4
  var r = 15777e3, i = 900, a = "https://appleid.apple.com", o = (e) => (typeof e == "string" ? Buffer.from(e, "utf8") : e).toString("base64url"), s = /* @__PURE__ */ new Map(), c = (n) => {
5
5
  let r = s.get(n);
6
6
  if (r) return r;
@@ -60,5 +60,4 @@ var r = 15777e3, i = 900, a = "https://appleid.apple.com", o = (e) => (typeof e
60
60
  };
61
61
  return a.firstName === null && a.lastName === null && a.email === null ? null : a;
62
62
  }, p = (e) => e !== null && e.toLowerCase().endsWith("@privaterelay.appleid.com");
63
- //#endregion
64
63
  export { i as APPLE_CLIENT_SECRET_DEFAULT_TTL_S, r as APPLE_CLIENT_SECRET_MAX_TTL_S, u as _resetAppleSecretCache, d as appleClientSecret, p as isApplePrivateRelayEmail, f as parseAppleUserPayload };
package/dist/callback.js CHANGED
@@ -6,7 +6,7 @@ import { fetchDiscordIdentity as u } from "./discord.js";
6
6
  import { fetchEpicIdentity as d } from "./epic.js";
7
7
  import { timingSafeStringEqual as f } from "@voltro/protocol/session";
8
8
  import { JwtVerifyError as p, verifyJwt as m } from "@voltro/protocol/jwt";
9
- //#region src/callback.ts
9
+ // src/callback.ts
10
10
  var h = (e) => e === !0 || e === "true", g = (e) => typeof e == "string" && e.length > 0 ? e : null, _ = async (_) => {
11
11
  let v = a(_.provider, _.endpoints ?? {});
12
12
  if (!_.code) throw new e(400, "missing_code", "socialCompleteLogin: missing `code`");
@@ -125,5 +125,4 @@ var h = (e) => e === !0 || e === "true", g = (e) => typeof e == "string" && e.le
125
125
  raw: w
126
126
  };
127
127
  };
128
- //#endregion
129
128
  export { _ as socialCompleteLogin };
package/dist/discord.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { SocialExchangeError as e } from "./errors.js";
2
- //#region src/discord.ts
2
+ // src/discord.ts
3
3
  var t = async (t, n) => {
4
4
  if (!t) throw new e("malformed_token_response", "discord: missing access token");
5
5
  let r;
@@ -34,5 +34,4 @@ var t = async (t, n) => {
34
34
  emailVerified: o !== null && a.verified === !0
35
35
  };
36
36
  };
37
- //#endregion
38
37
  export { t as fetchDiscordIdentity };
package/dist/epic.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { SocialExchangeError as e } from "./errors.js";
2
- //#region src/epic.ts
2
+ // src/epic.ts
3
3
  var t = async (t, n) => {
4
4
  if (!t || !n.clientId) throw new e("malformed_token_response", "epic: missing token/client binding");
5
5
  let r;
@@ -35,5 +35,4 @@ var t = async (t, n) => {
35
35
  emailVerified: !1
36
36
  };
37
37
  };
38
- //#endregion
39
38
  export { t as fetchEpicIdentity };
package/dist/errors.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/errors.ts
1
+ // src/errors.ts
2
2
  var e = class extends Error {
3
3
  status;
4
4
  code;
@@ -30,5 +30,4 @@ var e = class extends Error {
30
30
  super(n, e, t), this.name = "SocialAccountLinkError";
31
31
  }
32
32
  };
33
- //#endregion
34
33
  export { i as PlatformTicketError, o as SocialAccountLinkError, e as SocialAuthError, a as SocialConfigError, n as SocialExchangeError, r as SocialIdTokenError, t as SocialStateMismatchError };
package/dist/github.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { SocialExchangeError as e } from "./errors.js";
2
- //#region src/github.ts
2
+ // src/github.ts
3
3
  var t = (e) => ({
4
4
  authorization: `Bearer ${e}`,
5
5
  accept: "application/vnd.github+json",
@@ -33,5 +33,4 @@ var t = (e) => ({
33
33
  emailVerified: c
34
34
  };
35
35
  };
36
- //#endregion
37
36
  export { n as fetchGithubIdentity };
@@ -1,7 +1,7 @@
1
1
  import { SocialConfigError as e } from "./errors.js";
2
2
  import { isSocialProviderId as t } from "./providers.js";
3
3
  import { signAuthClaims as n, verifyAuthClaims as r } from "@voltro/plugin-auth";
4
- //#region src/guestHandoff.ts
4
+ // src/guestHandoff.ts
5
5
  var i = (t, r) => {
6
6
  let i = t.profile, a = n({
7
7
  exp: t.exp,
@@ -57,5 +57,4 @@ var i = (t, r) => {
57
57
  }
58
58
  };
59
59
  };
60
- //#endregion
61
60
  export { s as decodeGuestUpgradeHandoff, i as encodeGuestUpgradeHandoff, o as guestIdentityOf };
@@ -2,7 +2,7 @@ import { SOCIAL_IDENTITY_TABLE as e, dataStoreSocialIdentityStore as t } from ".
2
2
  import { Effect as n } from "effect";
3
3
  import { and as r, eq as i } from "@voltro/database";
4
4
  import { GuestAuthError as a, dataStoreGuestAuth as o, dataStoreSessionRegistry as s, issueUserSession as c, runSubjectGuards as l } from "@voltro/plugin-auth";
5
- //#region src/guestUpgrade.ts
5
+ // src/guestUpgrade.ts
6
6
  var u = (e, t, n) => ({
7
7
  table: e,
8
8
  predicate: i(t, n),
@@ -93,5 +93,4 @@ var u = (e, t, n) => ({
93
93
  message: e.code === "upgrade_conflict" ? "The provider or email belongs to an existing account. Confirm both accounts before merging." : e.code === "credential_rejected" ? "Guest upgrade was refused." : "Guest upgrade storage is unavailable."
94
94
  })));
95
95
  };
96
- //#endregion
97
96
  export { d as completeGuestSocialUpgrade };
@@ -1,6 +1,6 @@
1
1
  import { Data as e, Effect as t } from "effect";
2
2
  import { and as n, boolean as r, classifyConstraintViolation as i, eq as a, extractDbCause as o, generateId as s, id as c, table as l, text as u, timestamp as d } from "@voltro/database";
3
- //#region src/identityStore.ts
3
+ // src/identityStore.ts
4
4
  var f = "_voltro_oauth_identities", p = l(f, {
5
5
  id: c({ prefix: "oauthid" }),
6
6
  userId: u(),
@@ -120,5 +120,4 @@ var f = "_voltro_oauth_identities", p = l(f, {
120
120
  userId: n
121
121
  });
122
122
  });
123
- //#endregion
124
123
  export { f as SOCIAL_IDENTITY_TABLE, h as SocialIdentityConflict, x as dataStoreSocialIdentityStore, S as linkSocialIdentity, v as memorySocialIdentityStore, m as socialAuthTables, p as socialIdentitiesTable };
package/dist/linking.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { SocialAccountLinkError as e } from "./errors.js";
2
- //#region src/linking.ts
2
+ // src/linking.ts
3
3
  var t = (t) => {
4
4
  let { profile: n, linkedUserId: r, existingUserIdByEmail: i, policy: a } = t;
5
5
  return r === null ? n.email === null || i === null ? { kind: "create-user" } : a === "never" ? {
@@ -19,5 +19,4 @@ var t = (t) => {
19
19
  userId: r
20
20
  };
21
21
  };
22
- //#endregion
23
22
  export { t as decideSocialLink };
package/dist/login.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { randomToken as e, s256 as t } from "./pkce.js";
2
2
  import { SocialConfigError as n } from "./errors.js";
3
3
  import { socialProvider as r } from "./providers.js";
4
- //#region src/login.ts
4
+ // src/login.ts
5
5
  var i = (i) => {
6
6
  if (!i.clientId) throw new n("socialBeginLogin: `clientId` is required");
7
7
  if (!i.redirectUri) throw new n("socialBeginLogin: `redirectUri` is required");
@@ -28,5 +28,4 @@ var i = (i) => {
28
28
  responseMode: a.responseMode
29
29
  };
30
30
  };
31
- //#endregion
32
31
  export { i as socialBeginLogin };
@@ -1,7 +1,7 @@
1
1
  import { guestIdentityOf as e } from "./guestHandoff.js";
2
2
  import { signAuthClaims as t, verifyAuthClaims as n } from "@voltro/plugin-auth";
3
3
  import { createCipheriv as r, createDecipheriv as i, createHash as a, hkdfSync as o, randomBytes as s, timingSafeEqual as c } from "node:crypto";
4
- //#region src/nativeGuestUpgrade.ts
4
+ // src/nativeGuestUpgrade.ts
5
5
  var l = /^[A-Za-z0-9_-]{43}$/, u = /^[A-Za-z0-9._~-]{43,128}$/, d = /^[A-Za-z0-9._~-]{1,256}$/, f = (e, t) => {
6
6
  if (!e || typeof e != "object" || Array.isArray(e)) return null;
7
7
  let n = e;
@@ -62,5 +62,4 @@ var l = /^[A-Za-z0-9_-]{43}$/, u = /^[A-Za-z0-9._~-]{43,128}$/, d = /^[A-Za-z0-9
62
62
  } catch {}
63
63
  return null;
64
64
  };
65
- //#endregion
66
65
  export { p as isNativeVerifier, f as nativeUpgradeRequestOf, b as openNativeUpgradeCode, y as sealNativeUpgradeCode, g as signNativeUpgradeTicket, m as verifierMatches, _ as verifyNativeUpgradeTicket };
package/dist/pkce.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { createHash as e, randomBytes as t } from "node:crypto";
2
- //#region src/pkce.ts
2
+ // src/pkce.ts
3
3
  var n = () => t(32).toString("base64url"), r = (t) => e("sha256").update(t, "ascii").digest().toString("base64url");
4
- //#endregion
5
4
  export { n as randomToken, r as s256 };
package/dist/platform.js CHANGED
@@ -2,7 +2,7 @@ import { PlatformTicketError as e, SocialAuthError as t, SocialConfigError as n,
2
2
  import { isSocialProviderId as i } from "./providers.js";
3
3
  import { verifySteamWebApiTicket as a } from "./steam.js";
4
4
  import { JwtVerifyError as o, verifyJwt as s } from "@voltro/protocol/jwt";
5
- //#region src/platform.ts
5
+ // src/platform.ts
6
6
  var c = /^[a-z][a-z0-9-]{1,31}$/, l = /^[\x21-\x7e]{1,255}$/, u = (e) => {
7
7
  if (!c.test(e.id) || i(e.id)) throw new n("definePlatformLogin: id must be 2–32 lowercase letters, digits or hyphens and not a social provider id");
8
8
  let t = e.verify;
@@ -111,5 +111,4 @@ var c = /^[a-z][a-z0-9-]{1,31}$/, l = /^[\x21-\x7e]{1,255}$/, u = (e) => {
111
111
  throw n instanceof t ? n : new r("exchange_failed", `${e.id}: ticket verification failed`, 503);
112
112
  }
113
113
  };
114
- //#endregion
115
114
  export { u as definePlatformLogin, h as eosPlatformLogin, d as steamPlatformLogin, g as verifyPlatformTicket };
package/dist/plugin.js CHANGED
@@ -13,7 +13,7 @@ import { and as b, eq as x } from "@voltro/database";
13
13
  import { definePlugin as re } from "@voltro/protocol";
14
14
  import { SESSION_HEADER_NAME as S, buildSetCookie as C, readCookie as w } from "@voltro/protocol/session";
15
15
  import { CSRF_COOKIE_NAME as T, CSRF_HEADER_NAME as ie, configSessionSecrets as E, dataStoreGuestAuth as ae, dataStoreSessionRegistry as oe, issueCsrfToken as se, parseGuestCredential as D, readSessionFromHeaders as O, signAuthClaims as ce, verifyAuthClaims as k, verifyCsrf as le } from "@voltro/plugin-auth";
16
- //#region src/plugin.ts
16
+ // src/plugin.ts
17
17
  var ue = "/auth/social", de = 600, fe = "voltro:oauth", A = {
18
18
  google: [{
19
19
  name: "VOLTRO_GOOGLE_CLIENT_ID",
@@ -737,5 +737,4 @@ var ue = "/auth/social", de = 600, fe = "voltro:oauth", A = {
737
737
  onDeactivate: () => v.void
738
738
  });
739
739
  };
740
- //#endregion
741
740
  export { P as socialAuthPlugin };
package/dist/providers.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { SocialConfigError as e } from "./errors.js";
2
- //#region src/providers.ts
2
+ // src/providers.ts
3
3
  var t = {
4
4
  id: "google",
5
5
  label: "Google",
@@ -126,5 +126,4 @@ var t = {
126
126
  ...n.apiBase === void 0 ? {} : { apiBase: n.apiBase }
127
127
  };
128
128
  };
129
- //#endregion
130
129
  export { l as SOCIAL_PROVIDERS, u as SOCIAL_PROVIDER_IDS, d as isSocialProviderId, f as socialProvider };
package/dist/signIn.js CHANGED
@@ -2,7 +2,7 @@ import { SocialAccountLinkError as e } from "./errors.js";
2
2
  import { decideSocialLink as t } from "./linking.js";
3
3
  import { Effect as n } from "effect";
4
4
  import { issueUserSession as r, newAuthId as i, runSubjectGuards as a } from "@voltro/plugin-auth";
5
- //#region src/signIn.ts
5
+ // src/signIn.ts
6
6
  var o = (e) => ({
7
7
  kind: "refused",
8
8
  status: e.status,
@@ -80,5 +80,4 @@ var o = (e) => ({
80
80
  } : null
81
81
  };
82
82
  });
83
- //#endregion
84
83
  export { s as completeSocialSignIn };
package/dist/steam.js CHANGED
@@ -3,7 +3,7 @@ import { PlatformTicketError as t, SocialAuthError as n, SocialConfigError as r,
3
3
  import { Effect as o } from "effect";
4
4
  import { timingSafeStringEqual as s } from "@voltro/protocol/session";
5
5
  import { createHash as c } from "node:crypto";
6
- //#region src/steam.ts
6
+ // src/steam.ts
7
7
  var l = "http://specs.openid.net/auth/2.0", u = "https://steamcommunity.com/openid/", d = `${l}/identifier_select`, f = (e) => typeof e == "string" && /^[0-9]{17,20}$/.test(e) && BigInt(e) > 0n && BigInt(e) <= 18446744073709551615n, p = 65536, m = 5e3, h = async (e) => {
8
8
  let t = e.body?.getReader();
9
9
  if (!t) return "";
@@ -148,5 +148,4 @@ var l = "http://specs.openid.net/auth/2.0", u = "https://steamcommunity.com/open
148
148
  if (u.publisherbanned === !0 && e.allowPublisherBanned !== !0) throw new n(403, "guard_rejected", "steam: the publisher banned this account");
149
149
  return g(u.steamid);
150
150
  };
151
- //#endregion
152
151
  export { v as steamBeginOpenId, y as steamCompleteOpenId, b as verifySteamWebApiTicket };
@@ -1,6 +1,6 @@
1
1
  import { isSocialProviderId as e } from "../providers.js";
2
2
  import { parseGuestCredential as t } from "@voltro/plugin-auth/guest";
3
- //#region src/web/guestUpgradeClient.ts
3
+ // src/web/guestUpgradeClient.ts
4
4
  var n = class extends Error {
5
5
  code;
6
6
  status;
@@ -105,5 +105,4 @@ var n = class extends Error {
105
105
  }))
106
106
  };
107
107
  };
108
- //#endregion
109
108
  export { n as GuestUpgradeClientError, i as createGuestUpgradeClient };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltro/plugin-auth-social",
3
- "version": "0.87.0",
3
+ "version": "0.88.0",
4
4
  "description": "First-party social login with state, S256, provider identity verification, explicit account linking and shared Auth sessions.",
5
5
  "keywords": [
6
6
  "voltro",
@@ -38,13 +38,13 @@
38
38
  "node": ">=24.0.0"
39
39
  },
40
40
  "dependencies": {
41
- "@voltro/database": "0.87.0",
42
- "@voltro/plugin-auth": "0.87.0",
43
- "@voltro/protocol": "0.87.0",
44
- "@voltro/kv": "0.87.0"
41
+ "@voltro/database": "0.88.0",
42
+ "@voltro/plugin-auth": "0.88.0",
43
+ "@voltro/protocol": "0.88.0",
44
+ "@voltro/kv": "0.88.0"
45
45
  },
46
46
  "peerDependencies": {
47
- "effect": "4.0.1"
47
+ "effect": "4.1.0"
48
48
  },
49
49
  "publishConfig": {
50
50
  "access": "public"