@authhero/saml 0.5.4 → 0.5.5

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/saml.mjs CHANGED
@@ -6488,21 +6488,32 @@ e.object({
6488
6488
  cohorts: e.array(La)
6489
6489
  });
6490
6490
  var Ra = e.object({
6491
+ cohort: e.string(),
6492
+ tokens: e.number(),
6493
+ active: e.array(e.number())
6494
+ });
6495
+ e.object({
6496
+ interval: e.literal("week"),
6497
+ from: e.string(),
6498
+ to: e.string(),
6499
+ cohorts: e.array(Ra)
6500
+ });
6501
+ var za = e.object({
6491
6502
  name: e.string(),
6492
6503
  type: e.string()
6493
- }), za = e.object({
6504
+ }), Ba = e.object({
6494
6505
  elapsed: e.number(),
6495
6506
  rows_read: e.number().optional(),
6496
6507
  bytes_read: e.number().optional()
6497
6508
  });
6498
6509
  e.object({
6499
- meta: e.array(Ra),
6510
+ meta: e.array(za),
6500
6511
  data: e.array(e.record(e.string(), e.any())),
6501
6512
  rows: e.number(),
6502
6513
  rows_before_limit_at_least: e.number().optional(),
6503
- statistics: za.optional()
6514
+ statistics: Ba.optional()
6504
6515
  });
6505
- var Ba = e.enum(/* @__PURE__ */ "login.login-id.login-password.signup.signup-id.signup-password.reset-password.consent.mfa.mfa-push.mfa-otp.mfa-voice.mfa-phone.mfa-webauthn.mfa-email.mfa-recovery-code.status.device-flow.email-verification.email-otp-challenge.organizations.invitation.common.passkeys.captcha.custom-form.login-passwordless.mfa-login-options".split(".")), Va = e.record(e.string(), e.record(e.string(), e.string())).openapi({
6516
+ var Va = e.enum(/* @__PURE__ */ "login.login-id.login-password.signup.signup-id.signup-password.reset-password.consent.mfa.mfa-push.mfa-otp.mfa-voice.mfa-phone.mfa-webauthn.mfa-email.mfa-recovery-code.status.device-flow.email-verification.email-otp-challenge.organizations.invitation.common.passkeys.captcha.custom-form.login-passwordless.mfa-login-options".split(".")), Ha = e.record(e.string(), e.record(e.string(), e.string())).openapi({
6506
6517
  type: "object",
6507
6518
  additionalProperties: {
6508
6519
  type: "object",
@@ -6510,11 +6521,11 @@ var Ba = e.enum(/* @__PURE__ */ "login.login-id.login-password.signup.signup-id.
6510
6521
  }
6511
6522
  });
6512
6523
  e.object({
6513
- prompt: Ba,
6524
+ prompt: Va,
6514
6525
  language: e.string(),
6515
- custom_text: Va
6526
+ custom_text: Ha
6516
6527
  });
6517
- var Ha = e.enum([
6528
+ var Ua = e.enum([
6518
6529
  "phone",
6519
6530
  "totp",
6520
6531
  "email",
@@ -6522,9 +6533,9 @@ var Ha = e.enum([
6522
6533
  "webauthn-roaming",
6523
6534
  "webauthn-platform",
6524
6535
  "passkey"
6525
- ]), Ua = e.object({
6536
+ ]), Wa = e.object({
6526
6537
  user_id: e.string(),
6527
- type: Ha,
6538
+ type: Ua,
6528
6539
  phone_number: e.string().optional(),
6529
6540
  totp_secret: e.string().optional(),
6530
6541
  credential_id: e.string().optional(),
@@ -6535,7 +6546,7 @@ var Ha = e.enum([
6535
6546
  friendly_name: e.string().optional(),
6536
6547
  confirmed: e.boolean().default(!1)
6537
6548
  });
6538
- function Wa(t, n) {
6549
+ function Ga(t, n) {
6539
6550
  t.type === "phone" && !t.phone_number && n.addIssue({
6540
6551
  code: e.ZodIssueCode.custom,
6541
6552
  message: "phone_number is required when type is 'phone'",
@@ -6558,51 +6569,51 @@ function Wa(t, n) {
6558
6569
  path: ["public_key"]
6559
6570
  }));
6560
6571
  }
6561
- Ua.superRefine(Wa), Ua.extend({
6572
+ Wa.superRefine(Ga), Wa.extend({
6562
6573
  id: e.string(),
6563
6574
  created_at: e.string(),
6564
6575
  updated_at: e.string()
6565
- }).superRefine(Wa), e.object({
6576
+ }).superRefine(Ga), e.object({
6566
6577
  id: e.string().optional(),
6567
6578
  created_at: e.string().datetime({ offset: !0 }).optional(),
6568
6579
  updated_at: e.string().datetime({ offset: !0 }).optional()
6569
6580
  });
6570
- function Ga(e) {
6581
+ function Ka(e) {
6571
6582
  let t = atob(e), n = new Uint8Array(t.length);
6572
6583
  for (let e = 0; e < t.length; e++) n[e] = t.charCodeAt(e);
6573
6584
  return n;
6574
6585
  }
6575
6586
  //#endregion
6576
6587
  //#region ../../node_modules/.pnpm/nanoid@5.1.11/node_modules/nanoid/url-alphabet/index.js
6577
- var Ka = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", qa = (e = 21) => {
6588
+ var qa = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", Ja = (e = 21) => {
6578
6589
  let t = "", n = crypto.getRandomValues(new Uint8Array(e |= 0));
6579
- for (; e--;) t += Ka[n[e] & 63];
6590
+ for (; e--;) t += qa[n[e] & 63];
6580
6591
  return t;
6581
6592
  };
6582
6593
  //#endregion
6583
6594
  //#region src/helpers.ts
6584
- async function Ja(e) {
6595
+ async function Ya(e) {
6585
6596
  let t = new DecompressionStream("deflate-raw"), n = new Uint8Array(e), r = new Blob([n]).stream().pipeThrough(t);
6586
6597
  return new Uint8Array(await new Response(r).arrayBuffer());
6587
6598
  }
6588
- async function Ya(e) {
6589
- let t = Ga(e.replace(/ /g, "+"));
6599
+ async function Xa(e) {
6600
+ let t = Ka(e.replace(/ /g, "+"));
6590
6601
  try {
6591
- let e = await Ja(t);
6602
+ let e = await Ya(t);
6592
6603
  return new TextDecoder().decode(e);
6593
6604
  } catch (e) {
6594
6605
  return console.warn("Decompression failed, assuming data is not compressed:", e), new TextDecoder().decode(t);
6595
6606
  }
6596
6607
  }
6597
- async function Xa(e) {
6598
- let t = await Ya(e), n = new an({
6608
+ async function Za(e) {
6609
+ let t = await Xa(e), n = new an({
6599
6610
  attributeNamePrefix: "@_",
6600
6611
  alwaysCreateTextNode: !0,
6601
6612
  ignoreAttributes: !1
6602
6613
  }).parse(t);
6603
6614
  return r.parse(n);
6604
6615
  }
6605
- function Za(e) {
6616
+ function Qa(e) {
6606
6617
  let t = e.certificates.map((e) => ({
6607
6618
  "@_use": "signing",
6608
6619
  KeyInfo: {
@@ -6676,8 +6687,8 @@ function Za(e) {
6676
6687
  attributeNamePrefix: "@_"
6677
6688
  }).build(n);
6678
6689
  }
6679
- async function Qa(e, t) {
6680
- let n = e.notBefore || (/* @__PURE__ */ new Date()).toISOString(), r = e.notAfter || new Date(new Date(n).getTime() + 600 * 1e3).toISOString(), i = e.issueInstant || n, a = e.sessionNotOnOrAfter || r, o = e.responseId || `_${qa()}`, s = e.assertionId || `_${qa()}`, c = [{
6690
+ async function $a(e, t) {
6691
+ let n = e.notBefore || (/* @__PURE__ */ new Date()).toISOString(), r = e.notAfter || new Date(new Date(n).getTime() + 600 * 1e3).toISOString(), i = e.issueInstant || n, a = e.sessionNotOnOrAfter || r, o = e.responseId || `_${Ja()}`, s = e.assertionId || `_${Ja()}`, c = [{
6681
6692
  "samlp:Response": [
6682
6693
  { "saml:Issuer": [{ "#text": e.issuer }] },
6683
6694
  { "samlp:Status": [{
@@ -6858,7 +6869,7 @@ async function Qa(e, t) {
6858
6869
  }
6859
6870
  //#endregion
6860
6871
  //#region src/signers/local.ts
6861
- var $a = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", eo = "http://www.w3.org/2001/04/xmlenc#sha256", to = "http://www.w3.org/2001/10/xml-exc-c14n#", no = class {
6872
+ var eo = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", to = "http://www.w3.org/2001/04/xmlenc#sha256", no = "http://www.w3.org/2001/10/xml-exc-c14n#", ro = class {
6862
6873
  async signSAML(e, t, n) {
6863
6874
  try {
6864
6875
  let r = await import("xml-crypto"), i = r.SignedXml || r.default?.SignedXml;
@@ -6867,11 +6878,11 @@ var $a = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", eo = "http://www.w
6867
6878
  privateKey: t,
6868
6879
  publicCert: n
6869
6880
  });
6870
- a.canonicalizationAlgorithm = to, a.addReference({
6881
+ a.canonicalizationAlgorithm = no, a.addReference({
6871
6882
  xpath: "(/*[local-name()='Response']/*[local-name()='Assertion'])[1]",
6872
- digestAlgorithm: eo,
6873
- transforms: ["http://www.w3.org/2000/09/xmldsig#enveloped-signature", to]
6874
- }), a.signatureAlgorithm = $a;
6883
+ digestAlgorithm: to,
6884
+ transforms: ["http://www.w3.org/2000/09/xmldsig#enveloped-signature", no]
6885
+ }), a.signatureAlgorithm = eo;
6875
6886
  let o = n.replace(/-----BEGIN CERTIFICATE-----|-----END CERTIFICATE-----/g, "").replace(/\s/g, "");
6876
6887
  return a.keyInfoProvider = { getKeyInfo: () => `<X509Data><X509Certificate>${o}</X509Certificate></X509Data>` }, a.computeSignature(e, { location: {
6877
6888
  reference: "/*[local-name()='Response']/*[local-name()='Assertion']/*[local-name()='Issuer']",
@@ -6881,7 +6892,7 @@ var $a = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", eo = "http://www.w
6881
6892
  throw Error(`Failed to sign SAML locally. Make sure xml-crypto is installed. Error: ${e}`);
6882
6893
  }
6883
6894
  }
6884
- }, ro = class {
6895
+ }, io = class {
6885
6896
  signUrl;
6886
6897
  constructor(e) {
6887
6898
  this.signUrl = e;
@@ -6901,4 +6912,4 @@ var $a = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", eo = "http://www.w
6901
6912
  }
6902
6913
  };
6903
6914
  //#endregion
6904
- export { ro as HttpSamlSigner, no as LocalSamlSigner, Za as createSamlMetadata, Qa as createSamlResponse, s as dsSignatureSchema, Ya as inflateDecompress, Ja as inflateRaw, Xa as parseSamlRequestQuery, n as samlIssuerSchema, i as samlMetadataResponseSchema, r as samlRequestSchema, c as samlResponseJsonSchema };
6915
+ export { io as HttpSamlSigner, ro as LocalSamlSigner, Qa as createSamlMetadata, $a as createSamlResponse, s as dsSignatureSchema, Xa as inflateDecompress, Ya as inflateRaw, Za as parseSamlRequestQuery, n as samlIssuerSchema, i as samlMetadataResponseSchema, r as samlRequestSchema, c as samlResponseJsonSchema };