Comparing version 9.0.0-rc.0 to 9.0.0-rc.1
@@ -7,29 +7,15 @@ "use strict"; | ||
exports.B2BClient = void 0; | ||
var jose = _interopRequireWildcard(require("jose")); | ||
var _client = require("../shared/client"); | ||
var _discovery = require("./discovery"); | ||
var _m2m = require("../b2c/m2m"); | ||
var _magic_links = require("./magic_links"); | ||
var _oauth = require("./oauth"); | ||
var _organizations = require("./organizations"); | ||
var _otp = require("./otp"); | ||
var _passwords = require("./passwords"); | ||
var _sessions = require("./sessions"); | ||
var _sso = require("./sso"); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
class B2BClient extends _client.BaseClient { | ||
@@ -54,5 +40,3 @@ constructor(config) { | ||
} | ||
} | ||
exports.B2BClient = B2BClient; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.IntermediateSessions = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,7 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `discovery.intermediateSessions.exchange`. | ||
// Response type for `discovery.intermediateSessions.exchange`. | ||
class IntermediateSessions { | ||
@@ -21,2 +24,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -47,4 +51,2 @@ * Exchange an Intermediate Session for a fully realized | ||
*/ | ||
exchange(data) { | ||
@@ -57,5 +59,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.IntermediateSessions = IntermediateSessions; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.Organizations = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,11 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `discovery.organizations.create`. | ||
// Response type for `discovery.organizations.create`. | ||
// Request type for `discovery.organizations.list`. | ||
// Response type for `discovery.organizations.list`. | ||
class Organizations { | ||
@@ -21,2 +28,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -49,4 +57,2 @@ * If an end user does not want to join any already-existing organization, or has no possible organizations | ||
*/ | ||
create(data) { | ||
@@ -59,2 +65,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -86,4 +93,2 @@ * List all possible organization relationships connected to a | ||
*/ | ||
list(data) { | ||
@@ -96,5 +101,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.Organizations = Organizations; |
@@ -7,7 +7,4 @@ "use strict"; | ||
exports.Discovery = void 0; | ||
var _discovery_intermediate_sessions = require("./discovery_intermediate_sessions"); | ||
var _discovery_organizations = require("./discovery_organizations"); | ||
// !!! | ||
@@ -18,2 +15,3 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
class Discovery { | ||
@@ -25,5 +23,3 @@ constructor(fetchConfig) { | ||
} | ||
} | ||
exports.Discovery = Discovery; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.Discovery = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,7 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `magicLinks.discovery.authenticate`. | ||
// Response type for `magicLinks.discovery.authenticate`. | ||
class Discovery { | ||
@@ -21,2 +24,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -31,4 +35,2 @@ * Authenticates the Discovery Magic Link token and exchanges it for an Intermediate Session Token. | ||
*/ | ||
authenticate(data) { | ||
@@ -41,5 +43,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.Discovery = Discovery; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.Discovery = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,7 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `magicLinks.email.discovery.send`. | ||
// Response type for `magicLinks.email.discovery.send`. | ||
class Discovery { | ||
@@ -21,2 +24,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -30,4 +34,2 @@ * Send a discovery magic link to an email address. | ||
*/ | ||
send(data) { | ||
@@ -40,5 +42,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.Discovery = Discovery; |
@@ -7,7 +7,4 @@ "use strict"; | ||
exports.Email = void 0; | ||
var _magic_links_email_discovery = require("./magic_links_email_discovery"); | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -18,2 +15,11 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `magicLinks.email.invite`. | ||
// Response type for `magicLinks.email.invite`. | ||
// Request type for `magicLinks.email.loginOrSignup`. | ||
// Response type for `magicLinks.email.loginOrSignup`. | ||
class Email { | ||
@@ -24,2 +30,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -35,4 +42,2 @@ * Send either a login or signup magic link to a Member. A new, pending, or invited Member will receive a | ||
*/ | ||
loginOrSignup(data) { | ||
@@ -45,2 +50,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -56,4 +62,2 @@ * Send an invite email to a new Member to join an Organization. The Member will be created with an | ||
*/ | ||
invite(data) { | ||
@@ -66,5 +70,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.Email = Email; |
@@ -7,9 +7,5 @@ "use strict"; | ||
exports.MagicLinks = void 0; | ||
var _magic_links_discovery = require("./magic_links_discovery"); | ||
var _magic_links_email = require("./magic_links_email"); | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -20,2 +16,7 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `magicLinks.authenticate`. | ||
// Response type for `magicLinks.authenticate`. | ||
class MagicLinks { | ||
@@ -27,2 +28,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -54,4 +56,2 @@ * Authenticate a Member with a Magic Link. This endpoint requires a Magic Link token that is not expired | ||
*/ | ||
authenticate(data) { | ||
@@ -64,5 +64,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.MagicLinks = MagicLinks; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.Discovery = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,7 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `oauth.discovery.authenticate`. | ||
// Response type for `oauth.discovery.authenticate`. | ||
class Discovery { | ||
@@ -21,2 +24,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -31,4 +35,2 @@ * Authenticates the Discovery OAuth token and exchanges it for an Intermediate Session Token. Intermediate | ||
*/ | ||
authenticate(data) { | ||
@@ -41,5 +43,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.Discovery = Discovery; |
@@ -7,7 +7,4 @@ "use strict"; | ||
exports.OAuth = void 0; | ||
var _oauth_discovery = require("./oauth_discovery"); | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -18,2 +15,7 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `oauth.authenticate`. | ||
// Response type for `oauth.authenticate`. | ||
class OAuth { | ||
@@ -24,2 +26,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -50,4 +53,2 @@ * Authenticate a Member given a `token`. This endpoint verifies that the member completed the OAuth flow | ||
*/ | ||
authenticate(data) { | ||
@@ -60,5 +61,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.OAuth = OAuth; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.Members = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,35 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `organizations.members.create`. | ||
// Response type for `organizations.members.create`. | ||
// Request type for `organizations.members.deleteMFAPhoneNumber`. | ||
// Response type for `organizations.members.deleteMFAPhoneNumber`. | ||
// Request type for `organizations.members.deletePassword`. | ||
// Response type for `organizations.members.deletePassword`. | ||
// Request type for `organizations.members.delete`. | ||
// Response type for `organizations.members.delete`. | ||
// Request type for `organizations.members.get`. | ||
// Response type for `organizations.members.get`. | ||
// Request type for `organizations.members.reactivate`. | ||
// Response type for `organizations.members.reactivate`. | ||
// Request type for `organizations.members.search`. | ||
// Response type for `organizations.members.search`. | ||
// Request type for `organizations.members.update`. | ||
// Response type for `organizations.members.update`. | ||
class Members { | ||
@@ -21,2 +52,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -30,4 +62,2 @@ * Updates a Member specified by `organization_id` and `member_id`. | ||
*/ | ||
update(data) { | ||
@@ -47,2 +77,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -56,4 +87,2 @@ * Deletes a Member specified by `organization_id` and `member_id`. | ||
*/ | ||
delete(data) { | ||
@@ -66,2 +95,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -76,4 +106,2 @@ * Reactivates a deleted Member's status and its associated email status (if applicable) to active, | ||
*/ | ||
reactivate(data) { | ||
@@ -86,2 +114,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -104,4 +133,2 @@ * Delete a Member's MFA phone number. | ||
*/ | ||
deleteMFAPhoneNumber(data) { | ||
@@ -114,2 +141,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -126,4 +154,2 @@ * Search for Members within specified Organizations. An array with at least one `organization_id` is | ||
*/ | ||
search(data) { | ||
@@ -136,2 +162,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -145,4 +172,2 @@ * Delete a Member's password. | ||
*/ | ||
deletePassword(data) { | ||
@@ -155,2 +180,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -164,4 +190,2 @@ * Creates a Member. An `organization_id` and `email_address` are required. | ||
*/ | ||
create(data) { | ||
@@ -183,2 +207,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -192,4 +217,2 @@ * Get a Member by `member_id` or `email_address`. | ||
*/ | ||
get(params) { | ||
@@ -199,9 +222,8 @@ return (0, _shared.request)(this.fetchConfig, { | ||
url: `/v1/b2b/organizations/${params.organization_id}/member`, | ||
params: { ...params | ||
params: { | ||
...params | ||
} | ||
}); | ||
} | ||
} | ||
exports.Members = Members; |
@@ -7,7 +7,4 @@ "use strict"; | ||
exports.Organizations = void 0; | ||
var _organizations_members = require("./organizations_members"); | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -18,3 +15,27 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `organizations.create`. | ||
// Response type for `organizations.create`. | ||
// Request type for `organizations.delete`. | ||
// Response type for `organizations.delete`. | ||
// Request type for `organizations.get`. | ||
// Response type for `organizations.get`. | ||
// Request type for `organizations.search`. | ||
// Response type for `organizations.search`. | ||
// Request type for `organizations.update`. | ||
// Response type for `organizations.update`. | ||
// MANUAL(SearchQueryOperand)(TYPES) | ||
// ENDMANUAL(SearchQueryOperand) | ||
class Organizations { | ||
@@ -25,2 +46,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -42,4 +64,2 @@ * Creates an Organization. An `organization_name` and a unique `organization_slug` are required. | ||
*/ | ||
create(data) { | ||
@@ -52,2 +72,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -61,4 +82,2 @@ * Returns an Organization specified by `organization_id`. | ||
*/ | ||
get(params) { | ||
@@ -71,2 +90,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -85,4 +105,2 @@ * Updates an Organization specified by `organization_id`. An Organization must always have at least one | ||
*/ | ||
update(data) { | ||
@@ -109,2 +127,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -119,4 +138,2 @@ * Deletes an Organization specified by `organization_id`. All Members of the Organization will also be | ||
*/ | ||
delete(data) { | ||
@@ -129,2 +146,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -140,4 +158,2 @@ * Search for Organizations. If you send a request with no body params, no filtering will be applied and | ||
*/ | ||
search(data) { | ||
@@ -150,5 +166,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.Organizations = Organizations; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.Sms = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,11 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `otps.sms.authenticate`. | ||
// Response type for `otps.sms.authenticate`. | ||
// Request type for `otps.sms.send`. | ||
// Response type for `otps.sms.send`. | ||
class Sms { | ||
@@ -21,2 +28,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -52,4 +60,2 @@ * Send a One-Time Passcode (OTP) to a Member's phone number. | ||
*/ | ||
send(data) { | ||
@@ -62,2 +68,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -97,4 +104,2 @@ * SMS OTPs may not be used as a primary authentication mechanism. They can be used to complete an MFA | ||
*/ | ||
authenticate(data) { | ||
@@ -107,5 +112,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.Sms = Sms; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.OTPs = void 0; | ||
var _otp_sms = require("./otp_sms"); | ||
// !!! | ||
@@ -16,2 +14,3 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
class OTPs { | ||
@@ -22,5 +21,3 @@ constructor(fetchConfig) { | ||
} | ||
} | ||
exports.OTPs = OTPs; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.Email = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,11 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `passwords.email.reset`. | ||
// Response type for `passwords.email.reset`. | ||
// Request type for `passwords.email.resetStart`. | ||
// Response type for `passwords.email.resetStart`. | ||
class Email { | ||
@@ -21,2 +28,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -40,4 +48,2 @@ * Initiates a password reset for the email address provided. This will trigger an email to be sent to the | ||
*/ | ||
resetStart(data) { | ||
@@ -50,2 +56,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -74,4 +81,2 @@ * Reset the member's password and authenticate them. This endpoint checks that the password reset token is | ||
*/ | ||
reset(data) { | ||
@@ -84,5 +89,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.Email = Email; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.ExistingPassword = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,7 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `passwords.existingPassword.reset`. | ||
// Response type for `passwords.existingPassword.reset`. | ||
class ExistingPassword { | ||
@@ -21,2 +24,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -49,4 +53,2 @@ * Reset the member’s password using their existing password. | ||
*/ | ||
reset(data) { | ||
@@ -59,5 +61,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.ExistingPassword = ExistingPassword; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.Sessions = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,7 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `passwords.sessions.reset`. | ||
// Response type for `passwords.sessions.reset`. | ||
class Sessions { | ||
@@ -21,2 +24,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -32,4 +36,2 @@ * Reset the Member's password using their existing session. The endpoint will error if the session does | ||
*/ | ||
reset(data) { | ||
@@ -42,5 +44,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.Sessions = Sessions; |
@@ -7,11 +7,6 @@ "use strict"; | ||
exports.Passwords = void 0; | ||
var _passwords_email = require("./passwords_email"); | ||
var _passwords_existing_password = require("./passwords_existing_password"); | ||
var _shared = require("../shared"); | ||
var _passwords_session = require("./passwords_session"); | ||
// !!! | ||
@@ -22,2 +17,15 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `passwords.authenticate`. | ||
// Response type for `passwords.authenticate`. | ||
// Request type for `passwords.migrate`. | ||
// Response type for `passwords.migrate`. | ||
// Request type for `passwords.strengthCheck`. | ||
// Response type for `passwords.strengthCheck`. | ||
class Passwords { | ||
@@ -30,2 +38,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -60,4 +69,2 @@ * This API allows you to check whether the user’s provided password is valid, and to provide feedback to | ||
*/ | ||
strengthCheck(data) { | ||
@@ -70,2 +77,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -81,4 +89,2 @@ * Adds an existing password to a member's email that doesn't have a password yet. We support migrating | ||
*/ | ||
migrate(data) { | ||
@@ -91,2 +97,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -125,4 +132,2 @@ * Authenticate a member with their email address and password. This endpoint verifies that the member has | ||
*/ | ||
authenticate(data) { | ||
@@ -135,5 +140,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.Passwords = Passwords; |
@@ -7,7 +7,4 @@ "use strict"; | ||
exports.Sessions = void 0; | ||
var _shared = require("../shared"); | ||
var _sessions = require("../shared/sessions"); | ||
// !!! | ||
@@ -18,2 +15,23 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `sessions.authenticate`. | ||
// Response type for `sessions.authenticate`. | ||
// Request type for `sessions.exchange`. | ||
// Response type for `sessions.exchange`. | ||
// Request type for `sessions.getJWKS`. | ||
// Response type for `sessions.getJWKS`. | ||
// Request type for `sessions.get`. | ||
// Response type for `sessions.get`. | ||
// Request type for `sessions.revoke`. | ||
// Response type for `sessions.revoke`. | ||
class Sessions { | ||
@@ -29,2 +47,3 @@ constructor(fetchConfig, jwtConfig) { | ||
} | ||
/** | ||
@@ -38,4 +57,2 @@ * Retrieves all active Sessions for a Member. | ||
*/ | ||
get(params) { | ||
@@ -45,6 +62,8 @@ return (0, _shared.request)(this.fetchConfig, { | ||
url: `/v1/b2b/sessions`, | ||
params: { ...params | ||
params: { | ||
...params | ||
} | ||
}); | ||
} | ||
/** | ||
@@ -64,4 +83,2 @@ * Authenticates a Session and updates its lifetime by the specified `session_duration_minutes`. If the | ||
*/ | ||
authenticate(data) { | ||
@@ -74,2 +91,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -85,4 +103,2 @@ * Revoke a Session and immediately invalidate all its tokens. To revoke a specific Session, pass either | ||
*/ | ||
revoke(data) { | ||
@@ -95,2 +111,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -125,4 +142,2 @@ * Use this endpoint to exchange a Member's existing session for another session in a different | ||
*/ | ||
exchange(data) { | ||
@@ -135,2 +150,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -144,4 +160,2 @@ * Get the JSON Web Key Set (JWKS) for a project. | ||
*/ | ||
getJWKS(params) { | ||
@@ -153,6 +167,7 @@ return (0, _shared.request)(this.fetchConfig, { | ||
}); | ||
} // MANUAL(authenticateJwt)(SERVICE_METHOD) | ||
} | ||
// MANUAL(authenticateJwt)(SERVICE_METHOD) | ||
// ADDIMPORT: import * as jose from "jose"; | ||
// ADDIMPORT: import { JwtConfig, authenticateSessionJwtLocal } from "../shared/sessions"; | ||
/** Parse a JWT and verify the signature, preferring local verification over remote. | ||
@@ -166,4 +181,2 @@ * | ||
*/ | ||
async authenticateJwt(jwt, options) { | ||
@@ -183,2 +196,3 @@ try { | ||
} | ||
/** Parse a JWT and verify the signature locally (without calling /authenticate in the API). | ||
@@ -198,4 +212,2 @@ * | ||
*/ | ||
async authenticateJwtLocal(jwt, options) { | ||
@@ -219,7 +231,5 @@ const sess = await (0, _sessions.authenticateSessionJwtLocal)(this.jwksClient, this.jwtOptions, jwt, options); | ||
}; | ||
} // ENDMANUAL(authenticateJwt) | ||
} | ||
// ENDMANUAL(authenticateJwt) | ||
} | ||
exports.Sessions = Sessions; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.OIDC = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,11 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `sso.oidc.createConnection`. | ||
// Response type for `sso.oidc.createConnection`. | ||
// Request type for `sso.oidc.updateConnection`. | ||
// Response type for `sso.oidc.updateConnection`. | ||
class OIDC { | ||
@@ -21,2 +28,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -30,4 +38,2 @@ * Create a new OIDC Connection. | ||
*/ | ||
createConnection(data) { | ||
@@ -42,2 +48,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -76,4 +83,2 @@ * Updates an existing OIDC connection. | ||
*/ | ||
updateConnection(data) { | ||
@@ -95,5 +100,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.OIDC = OIDC; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.SAML = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,15 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `sso.saml.createConnection`. | ||
// Response type for `sso.saml.createConnection`. | ||
// Request type for `sso.saml.deleteVerificationCertificate`. | ||
// Response type for `sso.saml.deleteVerificationCertificate`. | ||
// Request type for `sso.saml.updateConnection`. | ||
// Response type for `sso.saml.updateConnection`. | ||
class SAML { | ||
@@ -21,2 +32,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -30,4 +42,2 @@ * Create a new SAML Connection. | ||
*/ | ||
createConnection(data) { | ||
@@ -42,2 +52,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -57,4 +68,2 @@ * Updates an existing SAML connection. | ||
*/ | ||
updateConnection(data) { | ||
@@ -73,2 +82,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -85,4 +95,2 @@ * Delete a SAML verification certificate. | ||
*/ | ||
deleteVerificationCertificate(data) { | ||
@@ -95,5 +103,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.SAML = SAML; |
@@ -7,9 +7,5 @@ "use strict"; | ||
exports.SSO = void 0; | ||
var _sso_oidc = require("./sso_oidc"); | ||
var _shared = require("../shared"); | ||
var _sso_saml = require("./sso_saml"); | ||
// !!! | ||
@@ -20,2 +16,15 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `sso.authenticate`. | ||
// Response type for `sso.authenticate`. | ||
// Request type for `sso.deleteConnection`. | ||
// Response type for `sso.deleteConnection`. | ||
// Request type for `sso.getConnections`. | ||
// Response type for `sso.getConnections`. | ||
class SSO { | ||
@@ -27,2 +36,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -36,4 +46,2 @@ * Get all SSO Connections owned by the organization. | ||
*/ | ||
getConnections(params) { | ||
@@ -46,2 +54,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -55,4 +64,2 @@ * Delete an existing SSO connection. | ||
*/ | ||
deleteConnection(data) { | ||
@@ -65,2 +72,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -91,4 +99,2 @@ * Authenticate a user given a token. | ||
*/ | ||
authenticate(data) { | ||
@@ -101,5 +107,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.SSO = SSO; |
@@ -7,31 +7,16 @@ "use strict"; | ||
exports.Client = void 0; | ||
var jose = _interopRequireWildcard(require("jose")); | ||
var _client = require("../shared/client"); | ||
var _crypto_wallets = require("./crypto_wallets"); | ||
var _m2m = require("./m2m"); | ||
var _magic_links = require("./magic_links"); | ||
var _oauth = require("./oauth"); | ||
var _otps = require("./otps"); | ||
var _passwords = require("./passwords"); | ||
var _sessions = require("./sessions"); | ||
var _totps = require("./totps"); | ||
var _users = require("./users"); | ||
var _webauthn = require("./webauthn"); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
class Client extends _client.BaseClient { | ||
@@ -57,5 +42,3 @@ constructor(config) { | ||
} | ||
} | ||
exports.Client = Client; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.CryptoWallets = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,11 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `cryptoWallets.authenticate`. | ||
// Response type for `cryptoWallets.authenticate`. | ||
// Request type for `cryptoWallets.authenticateStart`. | ||
// Response type for `cryptoWallets.authenticateStart`. | ||
class CryptoWallets { | ||
@@ -21,2 +28,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -31,4 +39,2 @@ * Initiate the authentication of a crypto wallet. After calling this endpoint, the user will need to sign | ||
*/ | ||
authenticateStart(data) { | ||
@@ -41,2 +47,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -50,4 +57,2 @@ * Complete the authentication of a crypto wallet by passing the signature. | ||
*/ | ||
authenticate(data) { | ||
@@ -60,5 +65,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.CryptoWallets = CryptoWallets; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.Secrets = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,15 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `m2m.clients.secrets.rotateCancel`. | ||
// Response type for `m2m.clients.secrets.rotateCancel`. | ||
// Request type for `m2m.clients.secrets.rotate`. | ||
// Response type for `m2m.clients.secrets.rotate`. | ||
// Request type for `m2m.clients.secrets.rotateStart`. | ||
// Response type for `m2m.clients.secrets.rotateStart`. | ||
class Secrets { | ||
@@ -21,2 +32,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -40,4 +52,2 @@ * Initiate the rotation of an M2M client secret. After this endpoint is called, both the client's | ||
*/ | ||
rotateStart(data) { | ||
@@ -50,2 +60,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -63,4 +74,2 @@ * Cancel the rotation of an M2M client secret started with the | ||
*/ | ||
rotateCancel(data) { | ||
@@ -73,2 +82,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -86,4 +96,2 @@ * Complete the rotation of an M2M client secret started with the | ||
*/ | ||
rotate(data) { | ||
@@ -96,5 +104,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.Secrets = Secrets; |
@@ -7,7 +7,4 @@ "use strict"; | ||
exports.Clients = void 0; | ||
var _shared = require("../shared"); | ||
var _m2m_clients_secrets = require("./m2m_clients_secrets"); | ||
// !!! | ||
@@ -18,2 +15,23 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `m2m.clients.create`. | ||
// Response type for `m2m.clients.create`. | ||
// Request type for `m2m.clients.delete`. | ||
// Response type for `m2m.clients.delete`. | ||
// Request type for `m2m.clients.get`. | ||
// Response type for `m2m.clients.get`. | ||
// Request type for `m2m.clients.search`. | ||
// Response type for `m2m.clients.search`. | ||
// Request type for `m2m.clients.update`. | ||
// Response type for `m2m.clients.update`. | ||
class Clients { | ||
@@ -24,2 +42,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -33,4 +52,2 @@ * Gets information about an existing M2M Client. | ||
*/ | ||
get(params) { | ||
@@ -43,2 +60,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -58,4 +76,2 @@ * Search for M2M Clients within your Stytch Project. Submit an empty `query` in the request to return all | ||
*/ | ||
search(data) { | ||
@@ -68,2 +84,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -84,4 +101,2 @@ * Updates an existing M2M Client. You can use this endpoint to activate or deactivate a M2M Client by | ||
*/ | ||
update(data) { | ||
@@ -100,2 +115,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -114,4 +130,2 @@ * Deletes the M2M Client. | ||
*/ | ||
delete(data) { | ||
@@ -124,2 +138,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -141,4 +156,2 @@ * Creates a new M2M Client. On initial client creation, you may pass in a custom `client_id` or | ||
*/ | ||
create(data) { | ||
@@ -151,5 +164,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.Clients = Clients; |
@@ -7,11 +7,6 @@ "use strict"; | ||
exports.M2M = void 0; | ||
var _m2m_clients = require("./m2m_clients"); | ||
var _sessions = require("../shared/sessions"); | ||
var _errors = require("../shared/errors"); | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -22,3 +17,15 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// MANUAL(M2MSearchQueryOperand)(TYPES) | ||
// ENDMANUAL(M2MSearchQueryOperand) | ||
// MANUAL(AuthenticateToken)(TYPES) | ||
// ENDMANUAL(AuthenticateToken) | ||
// MANUAL(Token)(TYPES) | ||
// ENDMANUAL(Token) | ||
class M2M { | ||
@@ -34,4 +41,5 @@ constructor(fetchConfig, jwtConfig) { | ||
}; | ||
} // MANUAL(token)(SERVICE_METHOD) | ||
} | ||
// MANUAL(token)(SERVICE_METHOD) | ||
/** | ||
@@ -63,6 +71,5 @@ * Retrieve an access token for the given M2M Client. | ||
*/ | ||
async token(data) { | ||
const fetchConfig = { ...this.fetchConfig, | ||
const fetchConfig = { | ||
...this.fetchConfig, | ||
headers: { | ||
@@ -78,9 +85,5 @@ ["User-Agent"]: this.fetchConfig.headers["User-Agent"], | ||
}; | ||
if (data.scopes && data.scopes.length > 0) { | ||
var _data$scopes; | ||
params.scope = (_data$scopes = data.scopes) === null || _data$scopes === void 0 ? void 0 : _data$scopes.join(" "); | ||
params.scope = data.scopes?.join(" "); | ||
} | ||
return (0, _shared.request)(fetchConfig, { | ||
@@ -91,3 +94,5 @@ method: "POST", | ||
}); | ||
} // ENDMANUAL(token) | ||
} | ||
// ENDMANUAL(token) | ||
// MANUAL(authenticateToken)(SERVICE_METHOD) | ||
@@ -99,3 +104,2 @@ // ADDIMPORT: import * as jose from "jose"; | ||
// I do not know why, but it only works if we add the ADDIMPORT here, not on the ^ manual section | ||
/** | ||
@@ -111,4 +115,2 @@ * Authenticate an access token issued by Stytch from the Token endpoint. | ||
*/ | ||
async authenticateToken(data) { | ||
@@ -123,6 +125,4 @@ const { | ||
const scopes = scope.split(" "); | ||
if (data.required_scopes && data.required_scopes.length > 0) { | ||
const missingScopes = data.required_scopes.filter(scope => !scopes.includes(scope)); | ||
if (missingScopes.length > 0) { | ||
@@ -132,3 +132,2 @@ throw new _errors.ClientError("missing_scopes", "Missing required scopes", missingScopes); | ||
} | ||
return { | ||
@@ -139,7 +138,5 @@ client_id: sub, | ||
}; | ||
} // ENDMANUAL(authenticateToken) | ||
} | ||
// ENDMANUAL(authenticateToken) | ||
} | ||
exports.M2M = M2M; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.Email = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,19 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `magicLinks.email.invite`. | ||
// Response type for `magicLinks.email.invite`. | ||
// Request type for `magicLinks.email.loginOrCreate`. | ||
// Response type for `magicLinks.email.loginOrCreate`. | ||
// Request type for `magicLinks.email.revokeInvite`. | ||
// Response type for `magicLinks.email.revokeInvite`. | ||
// Request type for `magicLinks.email.send`. | ||
// Response type for `magicLinks.email.send`. | ||
class Email { | ||
@@ -21,2 +36,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -45,4 +61,2 @@ * Send a magic link to an existing Stytch user using their email address. If you'd like to create a user | ||
*/ | ||
send(data) { | ||
@@ -55,2 +69,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -74,4 +89,2 @@ * Send either a login or signup Magic Link to the User based on if the email is associated with a User | ||
*/ | ||
loginOrCreate(data) { | ||
@@ -84,2 +97,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -101,4 +115,2 @@ * Create a User and send an invite Magic Link to the provided `email`. The User will be created with a | ||
*/ | ||
invite(data) { | ||
@@ -111,2 +123,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -120,4 +133,2 @@ * Revoke a pending invite based on the `email` provided. | ||
*/ | ||
revokeInvite(data) { | ||
@@ -130,5 +141,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.Email = Email; |
@@ -7,7 +7,4 @@ "use strict"; | ||
exports.MagicLinks = void 0; | ||
var _magic_links_email = require("./magic_links_email"); | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -18,2 +15,11 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `magicLinks.authenticate`. | ||
// Response type for `magicLinks.authenticate`. | ||
// Request type for `magicLinks.create`. | ||
// Response type for `magicLinks.create`. | ||
class MagicLinks { | ||
@@ -24,2 +30,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -35,4 +42,2 @@ * Authenticate a User given a Magic Link. This endpoint verifies that the Magic Link token is valid, | ||
*/ | ||
authenticate(data) { | ||
@@ -45,2 +50,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -61,4 +67,2 @@ * Create an embeddable Magic Link token for a User. Access to this endpoint is restricted. To enable it, | ||
*/ | ||
create(data) { | ||
@@ -71,5 +75,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.MagicLinks = MagicLinks; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.OAuth = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,11 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `oauth.attach`. | ||
// Response type for `oauth.attach`. | ||
// Request type for `oauth.authenticate`. | ||
// Response type for `oauth.authenticate`. | ||
class OAuth { | ||
@@ -21,2 +28,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -39,4 +47,2 @@ * Generate an OAuth Attach Token to pre-associate an OAuth flow with an existing Stytch User. Pass the | ||
*/ | ||
attach(data) { | ||
@@ -49,2 +55,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -61,4 +68,2 @@ * Authenticate a User given a `token`. This endpoint verifies that the user completed the OAuth flow by | ||
*/ | ||
authenticate(data) { | ||
@@ -71,5 +76,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.OAuth = OAuth; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.Email = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,11 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `otps.email.loginOrCreate`. | ||
// Response type for `otps.email.loginOrCreate`. | ||
// Request type for `otps.email.send`. | ||
// Response type for `otps.email.send`. | ||
class Email { | ||
@@ -21,2 +28,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -43,4 +51,2 @@ * Send a One-Time Passcode (OTP) to a User using their email. If you'd like to create a user and send them | ||
*/ | ||
send(data) { | ||
@@ -53,2 +59,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -69,4 +76,2 @@ * Send a one-time passcode (OTP) to a User using their email. If the email is not associated with a User | ||
*/ | ||
loginOrCreate(data) { | ||
@@ -79,5 +84,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.Email = Email; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.Sms = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,11 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `otps.sms.loginOrCreate`. | ||
// Response type for `otps.sms.loginOrCreate`. | ||
// Request type for `otps.sms.send`. | ||
// Response type for `otps.sms.send`. | ||
class Sms { | ||
@@ -21,2 +28,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -52,4 +60,2 @@ * Send a one-time passcode (OTP) to a user's phone number. If you'd like to create a user and send them a | ||
*/ | ||
send(data) { | ||
@@ -62,2 +68,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -82,4 +89,2 @@ * Send a One-Time Passcode (OTP) to a User using their phone number. If the phone number is not associated | ||
*/ | ||
loginOrCreate(data) { | ||
@@ -92,5 +97,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.Sms = Sms; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.Whatsapp = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,11 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `otps.whatsapp.loginOrCreate`. | ||
// Response type for `otps.whatsapp.loginOrCreate`. | ||
// Request type for `otps.whatsapp.send`. | ||
// Response type for `otps.whatsapp.send`. | ||
class Whatsapp { | ||
@@ -21,2 +28,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -52,4 +60,2 @@ * Send a One-Time Passcode (OTP) to a User's WhatsApp. If you'd like to create a user and send them a | ||
*/ | ||
send(data) { | ||
@@ -62,2 +68,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -83,4 +90,2 @@ * Send a one-time passcode (OTP) to a User's WhatsApp using their phone number. If the phone number is not | ||
*/ | ||
loginOrCreate(data) { | ||
@@ -93,5 +98,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.Whatsapp = Whatsapp; |
@@ -7,11 +7,6 @@ "use strict"; | ||
exports.OTPs = void 0; | ||
var _otps_email = require("./otps_email"); | ||
var _shared = require("../shared"); | ||
var _otps_sms = require("./otps_sms"); | ||
var _otps_whatsapp = require("./otps_whatsapp"); | ||
// !!! | ||
@@ -22,2 +17,7 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `otps.authenticate`. | ||
// Response type for `otps.authenticate`. | ||
class OTPs { | ||
@@ -30,2 +30,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -43,4 +44,2 @@ * Authenticate a User given a `method_id` (the associated `email_id` or `phone_id`) and a `code`. This | ||
*/ | ||
authenticate(data) { | ||
@@ -53,5 +52,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.OTPs = OTPs; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.Email = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,11 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `passwords.email.reset`. | ||
// Response type for `passwords.email.reset`. | ||
// Request type for `passwords.email.resetStart`. | ||
// Response type for `passwords.email.resetStart`. | ||
class Email { | ||
@@ -21,2 +28,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -31,4 +39,2 @@ * Initiates a password reset for the email address provided. This will trigger an email to be sent to the | ||
*/ | ||
resetStart(data) { | ||
@@ -41,2 +47,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -56,4 +63,2 @@ * Reset the user’s password and authenticate them. This endpoint checks that the magic link `token` is | ||
*/ | ||
reset(data) { | ||
@@ -66,5 +71,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.Email = Email; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.ExistingPassword = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,7 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `passwords.existingPassword.reset`. | ||
// Response type for `passwords.existingPassword.reset`. | ||
class ExistingPassword { | ||
@@ -21,2 +24,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -30,4 +34,2 @@ * Reset the User’s password using their existing password. | ||
*/ | ||
reset(data) { | ||
@@ -40,5 +42,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.ExistingPassword = ExistingPassword; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.Sessions = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,7 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `passwords.sessions.reset`. | ||
// Response type for `passwords.sessions.reset`. | ||
class Sessions { | ||
@@ -21,2 +24,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -33,4 +37,2 @@ * Reset the user’s password using their existing session. The endpoint will error if the session does not | ||
*/ | ||
reset(data) { | ||
@@ -43,5 +45,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.Sessions = Sessions; |
@@ -7,11 +7,6 @@ "use strict"; | ||
exports.Passwords = void 0; | ||
var _passwords_email = require("./passwords_email"); | ||
var _passwords_existing_password = require("./passwords_existing_password"); | ||
var _shared = require("../shared"); | ||
var _passwords_session = require("./passwords_session"); | ||
// !!! | ||
@@ -22,2 +17,19 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `passwords.authenticate`. | ||
// Response type for `passwords.authenticate`. | ||
// Request type for `passwords.create`. | ||
// Response type for `passwords.create`. | ||
// Request type for `passwords.migrate`. | ||
// Response type for `passwords.migrate`. | ||
// Request type for `passwords.strengthCheck`. | ||
// Response type for `passwords.strengthCheck`. | ||
class Passwords { | ||
@@ -30,2 +42,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -54,4 +67,2 @@ * Create a new user with a password. If `session_duration_minutes` is specified, a new session will be | ||
*/ | ||
create(data) { | ||
@@ -64,2 +75,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -91,4 +103,2 @@ * Authenticate a user with their email address and password. This endpoint verifies that the user has a | ||
*/ | ||
authenticate(data) { | ||
@@ -101,2 +111,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -132,4 +143,2 @@ * This API allows you to check whether or not the user’s provided password is valid, and to provide | ||
*/ | ||
strengthCheck(data) { | ||
@@ -142,2 +151,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -153,4 +163,2 @@ * Adds an existing password to a User's email that doesn't have a password yet. We support migrating users | ||
*/ | ||
migrate(data) { | ||
@@ -163,5 +171,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.Passwords = Passwords; |
@@ -7,7 +7,4 @@ "use strict"; | ||
exports.Sessions = void 0; | ||
var _shared = require("../shared"); | ||
var _sessions = require("../shared/sessions"); | ||
// !!! | ||
@@ -18,2 +15,19 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `sessions.authenticate`. | ||
// Response type for `sessions.authenticate`. | ||
// Request type for `sessions.getJWKS`. | ||
// Response type for `sessions.getJWKS`. | ||
// Request type for `sessions.get`. | ||
// Response type for `sessions.get`. | ||
// Request type for `sessions.revoke`. | ||
// Response type for `sessions.revoke`. | ||
class Sessions { | ||
@@ -29,2 +43,3 @@ constructor(fetchConfig, jwtConfig) { | ||
} | ||
/** | ||
@@ -39,4 +54,2 @@ * List all active Sessions for a given `user_id`. All timestamps are formatted according to the RFC 3339 | ||
*/ | ||
get(params) { | ||
@@ -46,6 +59,8 @@ return (0, _shared.request)(this.fetchConfig, { | ||
url: `/v1/sessions`, | ||
params: { ...params | ||
params: { | ||
...params | ||
} | ||
}); | ||
} | ||
/** | ||
@@ -63,4 +78,2 @@ * Authenticate a session token and retrieve associated session data. If `session_duration_minutes` is | ||
*/ | ||
authenticate(data) { | ||
@@ -73,2 +86,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -84,4 +98,2 @@ * Revoke a Session, immediately invalidating all of its session tokens. You can revoke a session in three | ||
*/ | ||
revoke(data) { | ||
@@ -94,2 +106,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -103,4 +116,2 @@ * Get the JSON Web Key Set (JWKS) for a Stytch Project. | ||
*/ | ||
getJWKS(params) { | ||
@@ -112,6 +123,7 @@ return (0, _shared.request)(this.fetchConfig, { | ||
}); | ||
} // MANUAL(authenticateJwt)(SERVICE_METHOD) | ||
} | ||
// MANUAL(authenticateJwt)(SERVICE_METHOD) | ||
// ADDIMPORT: import * as jose from "jose"; | ||
// ADDIMPORT: import { JwtConfig, authenticateSessionJwtLocal } from "../shared/sessions"; | ||
/** Parse a JWT and verify the signature, preferring local verification over remote. | ||
@@ -125,4 +137,2 @@ * | ||
*/ | ||
async authenticateJwt(jwt, options) { | ||
@@ -142,2 +152,3 @@ try { | ||
} | ||
/** Parse a JWT and verify the signature locally (without calling /authenticate in the API). | ||
@@ -157,4 +168,2 @@ * | ||
*/ | ||
async authenticateJwtLocal(jwt, options) { | ||
@@ -172,7 +181,5 @@ const sess = await (0, _sessions.authenticateSessionJwtLocal)(this.jwksClient, this.jwtOptions, jwt, options); | ||
}; | ||
} // ENDMANUAL(authenticateJwt) | ||
} | ||
// ENDMANUAL(authenticateJwt) | ||
} | ||
exports.Sessions = Sessions; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.TOTPs = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,19 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `totps.authenticate`. | ||
// Response type for `totps.authenticate`. | ||
// Request type for `totps.create`. | ||
// Response type for `totps.create`. | ||
// Request type for `totps.recover`. | ||
// Response type for `totps.recover`. | ||
// Request type for `totps.recoveryCodes`. | ||
// Response type for `totps.recoveryCodes`. | ||
class TOTPs { | ||
@@ -21,2 +36,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -31,4 +47,2 @@ * Create a new TOTP instance for a user. The user can use the authenticator application of their choice to | ||
*/ | ||
create(data) { | ||
@@ -41,2 +55,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -50,4 +65,2 @@ * Authenticate a TOTP code entered by a user. | ||
*/ | ||
authenticate(data) { | ||
@@ -60,2 +73,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -69,4 +83,2 @@ * Retrieve the recovery codes for a TOTP instance tied to a User. | ||
*/ | ||
recoveryCodes(data) { | ||
@@ -79,2 +91,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -88,4 +101,2 @@ * Authenticate a recovery code for a TOTP instance. | ||
*/ | ||
recover(data) { | ||
@@ -98,5 +109,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.TOTPs = TOTPs; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.Users = exports.UserSearchIterator = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,12 +14,39 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `users.create`. | ||
// Response type for `users.create`. | ||
// Request type for `users.deleteBiometricRegistration`. | ||
// Response type for `users.deleteBiometricRegistration`. | ||
// Request type for `users.deleteCryptoWallet`. | ||
// Response type for `users.deleteCryptoWallet`. | ||
// Request type for `users.deleteEmail`. | ||
// Response type for `users.deleteEmail`. | ||
// Request type for `users.deleteOAuthRegistration`. | ||
// Response type for `users.deleteOAuthRegistration`. | ||
// Request type for `users.deletePassword`. | ||
// Response type for `users.deletePassword`. | ||
// Request type for `users.deletePhoneNumber`. | ||
// Response type for `users.deletePhoneNumber`. | ||
// Request type for `users.delete`. | ||
// Response type for `users.delete`. | ||
// Request type for `users.deleteTOTP`. | ||
// Response type for `users.deleteTOTP`. | ||
// Request type for `users.deleteWebAuthnRegistration`. | ||
// Response type for `users.deleteWebAuthnRegistration`. | ||
// Request type for `users.exchangePrimaryFactor`. | ||
// Response type for `users.exchangePrimaryFactor`. | ||
// Request type for `users.get`. | ||
// Response type for `users.get`. | ||
// Request type for `users.search`. | ||
// Response type for `users.search`. | ||
// Request type for `users.update`. | ||
// Response type for `users.update`. | ||
// MANUAL(SearchUsersQueryOperand)(TYPES) | ||
// ENDMANUAL(SearchUsersQueryOperand) | ||
// MANUAL(UserSearchIterator)(FREE_FUNCTION) | ||
var mode; | ||
(function (mode) { | ||
var mode = /*#__PURE__*/function (mode) { | ||
mode[mode["pending"] = 0] = "pending"; | ||
mode[mode["inProgress"] = 1] = "inProgress"; | ||
mode[mode["complete"] = 2] = "complete"; | ||
})(mode || (mode = {})); | ||
return mode; | ||
}(mode || {}); | ||
class UserSearchIterator { | ||
@@ -33,9 +58,8 @@ constructor(client, data) { | ||
} | ||
async next() { | ||
const res = await this.client.search(this.data); | ||
this.data = { ...this.data, | ||
this.data = { | ||
...this.data, | ||
cursor: res.results_metadata.next_cursor | ||
}; | ||
if (!this.data.cursor) { | ||
@@ -46,10 +70,7 @@ this.mode = mode.complete; | ||
} | ||
return res.results; | ||
} | ||
hasNext() { | ||
return this.mode !== mode.complete; | ||
} | ||
async *[Symbol.asyncIterator]() { | ||
@@ -60,8 +81,5 @@ while (this.hasNext()) { | ||
} | ||
} // ENDMANUAL(UserSearchIterator) | ||
} | ||
// ENDMANUAL(UserSearchIterator) | ||
exports.UserSearchIterator = UserSearchIterator; | ||
class Users { | ||
@@ -71,2 +89,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -81,4 +100,2 @@ * Add a User to Stytch. A `user_id` is returned in the response that can then be used to perform other | ||
*/ | ||
create(data) { | ||
@@ -91,2 +108,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -100,4 +118,2 @@ * Get information about a specific User. | ||
*/ | ||
get(params) { | ||
@@ -110,2 +126,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -119,4 +136,2 @@ * Search for Users within your Stytch Project. Submit an empty `query` in the request to return all Users. | ||
*/ | ||
search(data) { | ||
@@ -129,2 +144,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -145,4 +161,2 @@ * Update a User's attributes. | ||
*/ | ||
update(data) { | ||
@@ -160,2 +174,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -176,4 +191,2 @@ * Exchange a user's email address or phone number for another. | ||
*/ | ||
exchangePrimaryFactor(data) { | ||
@@ -189,2 +202,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -198,4 +212,2 @@ * Delete a User from Stytch. | ||
*/ | ||
delete(data) { | ||
@@ -208,2 +220,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -217,4 +230,2 @@ * Delete an email from a User. | ||
*/ | ||
deleteEmail(data) { | ||
@@ -227,2 +238,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -236,4 +248,2 @@ * Delete a phone number from a User. | ||
*/ | ||
deletePhoneNumber(data) { | ||
@@ -246,2 +256,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -255,4 +266,2 @@ * Delete a WebAuthn registration from a User. | ||
*/ | ||
deleteWebAuthnRegistration(data) { | ||
@@ -265,2 +274,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -274,4 +284,2 @@ * Delete a biometric registration from a User. | ||
*/ | ||
deleteBiometricRegistration(data) { | ||
@@ -284,2 +292,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -293,4 +302,2 @@ * Delete a TOTP from a User. | ||
*/ | ||
deleteTOTP(data) { | ||
@@ -303,2 +310,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -312,4 +320,2 @@ * Delete a crypto wallet from a User. | ||
*/ | ||
deleteCryptoWallet(data) { | ||
@@ -322,2 +328,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -331,4 +338,2 @@ * Delete a password from a User. | ||
*/ | ||
deletePassword(data) { | ||
@@ -341,2 +346,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -350,4 +356,2 @@ * Delete an OAuth registration from a User. | ||
*/ | ||
deleteOAuthRegistration(data) { | ||
@@ -359,13 +363,11 @@ return (0, _shared.request)(this.fetchConfig, { | ||
}); | ||
} // MANUAL(searchAll)(SERVICE_METHOD) | ||
} | ||
// MANUAL(searchAll)(SERVICE_METHOD) | ||
// Return an iterator over all search results. Submit an empty `query` in the request to return all Users. | ||
searchAll(data) { | ||
return new UserSearchIterator(this, data); | ||
} // ENDMANUAL(searchAll) | ||
} | ||
// ENDMANUAL(searchAll) | ||
} | ||
exports.Users = Users; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.WebAuthn = void 0; | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -16,2 +14,19 @@ // WARNING: This file is autogenerated | ||
// !!! | ||
// Request type for `webauthn.authenticate`. | ||
// Response type for `webauthn.authenticate`. | ||
// Request type for `webauthn.authenticateStart`. | ||
// Response type for `webauthn.authenticateStart`. | ||
// Request type for `webauthn.register`. | ||
// Response type for `webauthn.register`. | ||
// Request type for `webauthn.registerStart`. | ||
// Response type for `webauthn.registerStart`. | ||
class WebAuthn { | ||
@@ -21,2 +36,3 @@ constructor(fetchConfig) { | ||
} | ||
/** | ||
@@ -42,4 +58,2 @@ * Initiate the process of creating a new WebAuthn registration. After calling this endpoint, the browser | ||
*/ | ||
registerStart(data) { | ||
@@ -52,2 +66,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -70,4 +85,2 @@ * Complete the creation of a WebAuthn registration by passing the response from the | ||
*/ | ||
register(data) { | ||
@@ -80,2 +93,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -97,4 +111,2 @@ * Initiate the authentication of a WebAuthn registration. After calling this endpoint, the browser will | ||
*/ | ||
authenticateStart(data) { | ||
@@ -107,2 +119,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
/** | ||
@@ -124,4 +137,2 @@ * Complete the authentication of a WebAuthn registration by passing the response from the | ||
*/ | ||
authenticate(data) { | ||
@@ -134,5 +145,3 @@ return (0, _shared.request)(this.fetchConfig, { | ||
} | ||
} | ||
exports.WebAuthn = WebAuthn; |
@@ -11,20 +11,18 @@ "use strict"; | ||
}; | ||
Object.defineProperty(exports, "Client", { | ||
Object.defineProperty(exports, "B2BClient", { | ||
enumerable: true, | ||
get: function () { | ||
return _client.Client; | ||
return _client2.B2BClient; | ||
} | ||
}); | ||
Object.defineProperty(exports, "B2BClient", { | ||
Object.defineProperty(exports, "Client", { | ||
enumerable: true, | ||
get: function () { | ||
return _client2.B2BClient; | ||
return _client.Client; | ||
} | ||
}); | ||
exports.envs = void 0; | ||
exports.envs = exports.default = void 0; | ||
var _client = require("./b2c/client"); | ||
var _client2 = require("./b2b/client"); | ||
var _index = require("./b2c/index"); | ||
Object.keys(_index).forEach(function (key) { | ||
@@ -41,7 +39,3 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _client2 = require("./b2b/client"); | ||
var _index2 = require("./b2b/index"); | ||
Object.keys(_index2).forEach(function (key) { | ||
@@ -58,9 +52,5 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _envs = _interopRequireWildcard(require("./shared/envs")); | ||
exports.envs = _envs; | ||
var _errors = require("./shared/errors"); | ||
Object.keys(_errors).forEach(function (key) { | ||
@@ -77,5 +67,7 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
var _default = exports.default = { | ||
Client: _client.Client, | ||
B2BClient: _client2.B2BClient | ||
}; |
@@ -8,2 +8,3 @@ "use strict"; | ||
const LOOKUP_TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; | ||
/** | ||
@@ -22,6 +23,6 @@ * base64Encode is a vanilla-javascript implementation of base64 encoding | ||
*/ | ||
function base64Encode(input) { | ||
let output = ""; // Unicode sanity check | ||
let output = ""; | ||
// Unicode sanity check | ||
for (let i = 0; i < input.length; i++) { | ||
@@ -32,12 +33,10 @@ if (input.charCodeAt(i) > 128) { | ||
} | ||
let char1 = 0, | ||
char2 = 0, | ||
char3 = 0; | ||
char2 = 0, | ||
char3 = 0; | ||
let enc1 = 0, | ||
enc2 = 0, | ||
enc3 = 0, | ||
enc4 = 0; | ||
enc2 = 0, | ||
enc3 = 0, | ||
enc4 = 0; | ||
let i = 0; | ||
while (i < input.length) { | ||
@@ -51,3 +50,2 @@ char1 = input.charCodeAt(i++); | ||
enc4 = char3 & 63; | ||
if (isNaN(char2)) { | ||
@@ -58,7 +56,5 @@ enc3 = enc4 = 64; | ||
} | ||
output = output + LOOKUP_TABLE.charAt(enc1) + LOOKUP_TABLE.charAt(enc2) + LOOKUP_TABLE.charAt(enc3) + LOOKUP_TABLE.charAt(enc4); | ||
} | ||
return output; | ||
} |
@@ -7,13 +7,7 @@ "use strict"; | ||
exports.BaseClient = void 0; | ||
var envs = _interopRequireWildcard(require("./envs")); | ||
var _package = require("../../package.json"); | ||
var _base = require("./base64"); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
const DEFAULT_TIMEOUT = 10 * 60 * 1000; // Ten minutes | ||
@@ -26,11 +20,8 @@ | ||
} | ||
if (!config.project_id) { | ||
throw new Error('Missing "project_id" in config'); | ||
} | ||
if (!config.secret) { | ||
throw new Error('Missing "secret" in config'); | ||
} | ||
if (!config.env) { | ||
@@ -43,6 +34,5 @@ if (config.project_id.startsWith("project-live-")) { | ||
} | ||
if (config.env != envs.test && config.env != envs.live) {// TODO: warn about non-production configuration | ||
if (config.env != envs.test && config.env != envs.live) { | ||
// TODO: warn about non-production configuration | ||
} | ||
const headers = { | ||
@@ -57,7 +47,7 @@ "Content-Type": "application/json", | ||
timeout: config.timeout || DEFAULT_TIMEOUT, | ||
agent: config.agent | ||
}; // Get a baseURL that ends with a slash to make building route URLs easier. | ||
dispatcher: config.dispatcher | ||
}; | ||
// Get a baseURL that ends with a slash to make building route URLs easier. | ||
this.baseURL = config.env; | ||
if (!this.baseURL.endsWith("/")) { | ||
@@ -67,5 +57,3 @@ this.baseURL += "/"; | ||
} | ||
} | ||
exports.BaseClient = BaseClient; |
@@ -6,6 +6,4 @@ "use strict"; | ||
}); | ||
exports.live = exports.test = void 0; | ||
const test = "https://test.stytch.com/"; | ||
exports.test = test; | ||
const live = "https://api.stytch.com/"; | ||
exports.live = live; | ||
exports.test = exports.live = void 0; | ||
const test = exports.test = "https://test.stytch.com/"; | ||
const live = exports.live = "https://api.stytch.com/"; |
@@ -6,4 +6,3 @@ "use strict"; | ||
}); | ||
exports.ClientError = exports.RequestError = exports.StytchError = void 0; | ||
exports.StytchError = exports.RequestError = exports.ClientError = void 0; | ||
class StytchError extends Error { | ||
@@ -18,7 +17,4 @@ constructor(data) { | ||
} | ||
} | ||
exports.StytchError = StytchError; | ||
class RequestError extends Error { | ||
@@ -29,15 +25,10 @@ constructor(message, request) { | ||
} | ||
} | ||
exports.RequestError = RequestError; | ||
class ClientError extends Error { | ||
constructor(code, message, cause) { | ||
let msg = `${code}: ${message}`; | ||
if (cause) { | ||
msg += `: ${cause}`; | ||
} | ||
super(msg); | ||
@@ -47,5 +38,3 @@ this.code = code; | ||
} | ||
} | ||
exports.ClientError = ClientError; |
@@ -7,14 +7,9 @@ "use strict"; | ||
exports.request = request; | ||
var _errors = require("./errors"); | ||
async function request(fetchConfig, requestConfig) { | ||
const url = new URL(requestConfig.url, fetchConfig.baseURL); | ||
if (requestConfig.params) { | ||
Object.entries(requestConfig.params).forEach(([key, value]) => url.searchParams.append(key, String(value))); | ||
} | ||
let response; | ||
try { | ||
@@ -31,5 +26,3 @@ const body = requestConfig.data ? JSON.stringify(requestConfig.data) : requestConfig.dataRaw; | ||
} | ||
let responseJSON; | ||
try { | ||
@@ -41,8 +34,6 @@ responseJSON = await response.json(); | ||
} | ||
if (response.status >= 400) { | ||
throw new _errors.StytchError(responseJSON); | ||
} | ||
return responseJSON; | ||
} |
@@ -9,24 +9,22 @@ "use strict"; | ||
exports.authenticateSessionJwtLocal = authenticateSessionJwtLocal; | ||
var jose = _interopRequireWildcard(require("jose")); | ||
var _errors = require("./errors"); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
const sessionClaim = "https://stytch.com/session"; | ||
// An IntermediateSession can be either a MemberSession or a UserSession | ||
async function authenticateJwtLocal(jwksClient, jwtOptions, jwt, options) { | ||
const now = (options === null || options === void 0 ? void 0 : options.current_date) || new Date(); | ||
const now = options?.current_date || new Date(); | ||
let payload; | ||
try { | ||
const token = await jose.jwtVerify(jwt, jwksClient, { ...jwtOptions, | ||
clockTolerance: options === null || options === void 0 ? void 0 : options.clock_tolerance_seconds, | ||
currentDate: now // Don't pass maxTokenAge directly to jwtVerify because it interprets zero as "infinity". | ||
const token = await jose.jwtVerify(jwt, jwksClient, { | ||
...jwtOptions, | ||
clockTolerance: options?.clock_tolerance_seconds, | ||
currentDate: now | ||
// Don't pass maxTokenAge directly to jwtVerify because it interprets zero as "infinity". | ||
// We want zero to mean "every token is stale" and force remote verification. | ||
}); | ||
}); | ||
payload = token.payload; | ||
@@ -36,22 +34,17 @@ } catch (err) { | ||
} | ||
const maxTokenAge = options === null || options === void 0 ? void 0 : options.max_token_age_seconds; | ||
const maxTokenAge = options?.max_token_age_seconds; | ||
if (maxTokenAge != null) { | ||
const iat = payload.iat; | ||
if (!iat) { | ||
throw new _errors.ClientError("jwt_invalid", "JWT was missing iat claim"); | ||
} | ||
const nowEpoch = +now / 1000; // Epoch seconds from milliseconds | ||
if (nowEpoch - iat >= maxTokenAge) { | ||
throw new _errors.ClientError("jwt_too_old", `JWT was issued at ${iat}, more than ${maxTokenAge} seconds ago`); | ||
} | ||
} // The custom claim set is all the claims in the payload except for the standard claims and | ||
} | ||
// The custom claim set is all the claims in the payload except for the standard claims and | ||
// the Stytch session claim. The cleanest way to collect those seems to be naming what we want | ||
// to omit and using ...rest for to collect the custom claims. | ||
const { | ||
@@ -66,3 +59,2 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ | ||
sub: _sub, | ||
/* eslint-enable @typescript-eslint/no-unused-vars */ | ||
@@ -76,3 +68,2 @@ ...customClaims | ||
} | ||
async function authenticateM2MJwtLocal(jwksClient, jwtOptions, jwt, options) { | ||
@@ -94,3 +85,2 @@ const { | ||
} | ||
async function authenticateSessionJwtLocal(jwksClient, jwtOptions, jwt, options) { | ||
@@ -100,6 +90,7 @@ const { | ||
customClaims: untypedClaims | ||
} = await authenticateJwtLocal(jwksClient, jwtOptions, jwt, options); // The custom claim set is all the claims in the payload except for the standard claims and | ||
} = await authenticateJwtLocal(jwksClient, jwtOptions, jwt, options); | ||
// The custom claim set is all the claims in the payload except for the standard claims and | ||
// the Stytch session claim. The cleanest way to collect those seems to be naming what we want | ||
// to omit and using ...rest for to collect the custom claims. | ||
const { | ||
@@ -106,0 +97,0 @@ [sessionClaim]: stytchClaim, |
{ | ||
"name": "stytch", | ||
"version": "9.0.0-rc.0", | ||
"version": "9.0.0-rc.1", | ||
"description": "A wrapper for the Stytch API", | ||
@@ -22,3 +22,3 @@ "types": "./types/lib/index.d.ts", | ||
"engines": { | ||
"node": ">= 16.0.0" | ||
"node": ">= 18.0.0" | ||
}, | ||
@@ -39,19 +39,19 @@ "scripts": { | ||
"devDependencies": { | ||
"@babel/cli": "^7.15.7", | ||
"@babel/core": "^7.15.5", | ||
"@babel/preset-env": "^7.15.6", | ||
"@babel/preset-typescript": "^7.15.0", | ||
"@types/jest": "^27.0.2", | ||
"@types/node": "^15.14.9", | ||
"@types/node-fetch": "^2.6.1", | ||
"@babel/cli": "^7.23.0", | ||
"@babel/core": "^7.23.0", | ||
"@babel/preset-env": "^7.22.20", | ||
"@babel/preset-typescript": "^7.23.0", | ||
"@types/jest": "^29.5.5", | ||
"@types/node": "^18.18.3", | ||
"@typescript-eslint/eslint-plugin": "^4.33.0", | ||
"@typescript-eslint/parser": "^4.33.0", | ||
"eslint": "^7.32.0", | ||
"jest": "^27.2.4", | ||
"jest": "^29.7.0", | ||
"prettier": "2.4.1", | ||
"ts-jest": "^27.0.5", | ||
"ts-jest": "^29.1.1", | ||
"typescript": "^4.4.3" | ||
}, | ||
"dependencies": { | ||
"jose": "^4.13.2" | ||
"jose": "^4.14.6", | ||
"undici": "^5.25.4" | ||
}, | ||
@@ -58,0 +58,0 @@ "eslintConfig": { |
@@ -7,3 +7,3 @@ # Stytch Node.js Library | ||
This library is tested with all current LTS versions of Node - **16**, **18**, and **20**. | ||
This library is tested with all current LTS versions of Node - **18**, and **20**. | ||
@@ -158,8 +158,9 @@ ## Install | ||
The Stytch client can be customized to use your own HTTPS agent. | ||
The Stytch client uses [undici](https://github.com/nodejs/undici), the Node fetch implementation. You can pass a custom undici `Dispatcher` to the client for use in requests. | ||
For example, you can enable HTTPS Keep-Alive to avoid the cost of establishing a new connection with the Stytch servers on every request. | ||
```javascript | ||
const agent = new https.Agent({ | ||
keepAlive: true, | ||
const dispatcher = new undici.Agent({ | ||
keepAliveTimeout: 6e6, // 10 minutes in MS | ||
keepAliveMaxTimeout: 6e6, // 10 minutes in MS | ||
}); | ||
@@ -170,3 +171,3 @@ | ||
secret: "secret-live-80JASucyk7z_G8Z-7dVwZVGXL5NT_qGAQ2I=", | ||
agent, | ||
dispatcher, | ||
}); | ||
@@ -173,0 +174,0 @@ ``` |
@@ -1,6 +0,12 @@ | ||
export { Client } from "./b2c/client"; | ||
import { Client } from "./b2c/client"; | ||
import { B2BClient } from "./b2b/client"; | ||
export { Client, B2BClient }; | ||
export * from "./b2c/index"; | ||
export { B2BClient } from "./b2b/client"; | ||
export * from "./b2b/index"; | ||
export * as envs from "./shared/envs"; | ||
export * from "./shared/errors"; | ||
declare const _default: { | ||
Client: typeof Client; | ||
B2BClient: typeof B2BClient; | ||
}; | ||
export default _default; |
@@ -1,3 +0,2 @@ | ||
/// <reference types="node" /> | ||
import * as http from "http"; | ||
import type { Dispatcher } from "undici"; | ||
import { fetchConfig } from "."; | ||
@@ -9,3 +8,3 @@ export interface ClientConfig { | ||
timeout?: number; | ||
agent?: http.Agent; | ||
dispatcher?: Dispatcher; | ||
} | ||
@@ -12,0 +11,0 @@ export declare class BaseClient { |
@@ -1,3 +0,2 @@ | ||
/// <reference types="node" /> | ||
import * as http from "http"; | ||
import type { Dispatcher } from "undici"; | ||
export interface fetchConfig { | ||
@@ -7,3 +6,3 @@ baseURL: string; | ||
timeout: number; | ||
agent?: http.Agent; | ||
dispatcher?: Dispatcher; | ||
} | ||
@@ -10,0 +9,0 @@ export declare type requestConfig = { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
564966
13
12188
194
2
+ Addedundici@^5.25.4
+ Added@fastify/busboy@2.1.1(transitive)
+ Addedundici@5.28.4(transitive)
Updatedjose@^4.14.6