Comparing version 8.0.0 to 8.1.0
@@ -14,2 +14,4 @@ "use strict"; | ||
var _m2m = require("../b2c/m2m"); | ||
var _magic_links = require("./magic_links"); | ||
@@ -43,2 +45,3 @@ | ||
this.discovery = new _discovery.Discovery(this.fetchConfig); | ||
this.m2m = new _m2m.M2M(this.fetchConfig, this.jwtConfig); | ||
this.magicLinks = new _magic_links.MagicLinks(this.fetchConfig); | ||
@@ -45,0 +48,0 @@ this.oauth = new _oauth.OAuth(this.fetchConfig); |
@@ -61,2 +61,3 @@ "use strict"; | ||
/** | ||
* Delete a Member's MFA phone number. | ||
* @param data {@link B2BOrganizationsMembersDeleteMFAPhoneNumberRequest} | ||
@@ -63,0 +64,0 @@ * @returns {@link B2BOrganizationsMembersDeleteMFAPhoneNumberResponse} |
@@ -22,5 +22,5 @@ "use strict"; | ||
* this will send an OTP to the number associated with their `member_id`. If not, then this will send an | ||
* OTP to the `phone_number` provided and link the `phone_number` with the Member. | ||
* An error will be thrown if the Member already has a phone number and the provided `phone_number` does | ||
* not match the existing one. | ||
* OTP to the `mfa_phone_number` provided and link the `mfa_phone_number` with the Member. | ||
* An error will be thrown if the Member already has a phone number and the provided `mfa_phone_number` | ||
* does not match the existing one. | ||
* | ||
@@ -27,0 +27,0 @@ * Note that sending another OTP code before the first has expired will invalidate the first code. |
@@ -8,6 +8,6 @@ "use strict"; | ||
var _shared = require("../shared"); | ||
var _sessions = require("../shared/sessions"); | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -143,2 +143,4 @@ // WARNING: This file is autogenerated | ||
} // MANUAL(authenticateJwt)(SERVICE_METHOD) | ||
// ADDIMPORT: import * as jose from "jose"; | ||
// ADDIMPORT: import { JwtConfig, authenticateSessionJwtLocal } from "../shared/sessions"; | ||
@@ -186,3 +188,3 @@ /** Parse a JWT and verify the signature, preferring local verification over remote. | ||
async authenticateJwtLocal(jwt, options) { | ||
const sess = await (0, _sessions.authenticateJwtLocal)(this.jwksClient, this.jwtOptions, jwt, options); | ||
const sess = await (0, _sessions.authenticateSessionJwtLocal)(this.jwksClient, this.jwtOptions, jwt, options); | ||
const organizationClaim = "https://stytch.com/organization"; | ||
@@ -189,0 +191,0 @@ const { |
@@ -14,2 +14,4 @@ "use strict"; | ||
var _m2m = require("./m2m"); | ||
var _magic_links = require("./magic_links"); | ||
@@ -45,2 +47,3 @@ | ||
this.cryptoWallets = new _crypto_wallets.CryptoWallets(this.fetchConfig); | ||
this.m2m = new _m2m.M2M(this.fetchConfig, this.jwtConfig); | ||
this.magicLinks = new _magic_links.MagicLinks(this.fetchConfig); | ||
@@ -47,0 +50,0 @@ this.oauth = new _oauth.OAuth(this.fetchConfig); |
@@ -8,6 +8,6 @@ "use strict"; | ||
var _shared = require("../shared"); | ||
var _sessions = require("../shared/sessions"); | ||
var _shared = require("../shared"); | ||
// !!! | ||
@@ -104,2 +104,4 @@ // WARNING: This file is autogenerated | ||
} // MANUAL(authenticateJwt)(SERVICE_METHOD) | ||
// ADDIMPORT: import * as jose from "jose"; | ||
// ADDIMPORT: import { JwtConfig, authenticateSessionJwtLocal } from "../shared/sessions"; | ||
@@ -147,3 +149,3 @@ /** Parse a JWT and verify the signature, preferring local verification over remote. | ||
async authenticateJwtLocal(jwt, options) { | ||
const sess = await (0, _sessions.authenticateJwtLocal)(this.jwksClient, this.jwtOptions, jwt, options); | ||
const sess = await (0, _sessions.authenticateSessionJwtLocal)(this.jwksClient, this.jwtOptions, jwt, options); | ||
return { | ||
@@ -150,0 +152,0 @@ session_id: sess.session_id, |
@@ -29,5 +29,6 @@ "use strict"; | ||
try { | ||
const body = requestConfig.data ? JSON.stringify(requestConfig.data) : requestConfig.dataRaw; | ||
response = await fetch(url.toString(), { | ||
method: requestConfig.method, | ||
body: JSON.stringify(requestConfig.data), | ||
body: body, | ||
...fetchConfig | ||
@@ -34,0 +35,0 @@ }); |
@@ -7,2 +7,4 @@ "use strict"; | ||
exports.authenticateJwtLocal = authenticateJwtLocal; | ||
exports.authenticateM2MJwtLocal = authenticateM2MJwtLocal; | ||
exports.authenticateSessionJwtLocal = authenticateSessionJwtLocal; | ||
@@ -65,5 +67,39 @@ var jose = _interopRequireWildcard(require("jose")); | ||
/* eslint-enable @typescript-eslint/no-unused-vars */ | ||
...customClaims | ||
} = payload; | ||
return { | ||
payload, | ||
customClaims | ||
}; | ||
} | ||
async function authenticateM2MJwtLocal(jwksClient, jwtOptions, jwt, options) { | ||
const { | ||
payload, | ||
customClaims: untypedClaims | ||
} = await authenticateJwtLocal(jwksClient, jwtOptions, jwt, options); | ||
const { | ||
scope: scopeClaim, | ||
...customClaims | ||
} = untypedClaims; | ||
const scope = scopeClaim; | ||
return { | ||
sub: payload.sub ?? "", | ||
scope: scope, | ||
custom_claims: customClaims | ||
}; | ||
} | ||
async function authenticateSessionJwtLocal(jwksClient, jwtOptions, jwt, options) { | ||
const { | ||
payload, | ||
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 | ||
// 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 { | ||
[sessionClaim]: stytchClaim, | ||
...customClaims | ||
} = payload; | ||
} = untypedClaims; | ||
const claim = stytchClaim; | ||
@@ -70,0 +106,0 @@ return { |
{ | ||
"name": "stytch", | ||
"version": "8.0.0", | ||
"version": "8.1.0", | ||
"description": "A wrapper for the Stytch API", | ||
@@ -5,0 +5,0 @@ "types": "./types/lib/index.d.ts", |
@@ -49,2 +49,6 @@ # Stytch Node.js Library | ||
**Shared** | ||
- [x] [M2M](https://stytch.com/docs/api/m2m-client) | ||
### Example B2C usage | ||
@@ -51,0 +55,0 @@ |
import { BaseClient, ClientConfig } from "../shared/client"; | ||
import { Discovery } from "./discovery"; | ||
import { JwtConfig } from "../shared/sessions"; | ||
import { M2M } from "../b2c/m2m"; | ||
import { MagicLinks } from "./magic_links"; | ||
@@ -14,2 +15,3 @@ import { OAuth } from "./oauth"; | ||
discovery: Discovery; | ||
m2m: M2M; | ||
magicLinks: MagicLinks; | ||
@@ -16,0 +18,0 @@ oauth: OAuth; |
@@ -58,6 +58,18 @@ import { B2BOrganizationsResultsMetadata, Member, Organization, SearchQuery } from "./organizations"; | ||
export interface B2BOrganizationsMembersDeleteMFAPhoneNumberRequest { | ||
/** | ||
* Globally unique UUID that identifies a specific Organization. The `organization_id` is critical to | ||
* perform operations on an Organization, so be sure to preserve this value. | ||
*/ | ||
organization_id: string; | ||
/** | ||
* Globally unique UUID that identifies a specific Member. The `member_id` is critical to perform | ||
* operations on a Member, so be sure to preserve this value. | ||
*/ | ||
member_id: string; | ||
} | ||
export interface B2BOrganizationsMembersDeleteMFAPhoneNumberResponse { | ||
/** | ||
* Globally unique UUID that is returned with every API call. This value is important to log for debugging | ||
* purposes; we may ask for this value to help identify a specific API call when helping you debug an issue. | ||
*/ | ||
request_id: string; | ||
@@ -67,2 +79,6 @@ member_id: string; | ||
organization: Organization; | ||
/** | ||
* The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. | ||
* 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors. | ||
*/ | ||
status_code: number; | ||
@@ -221,2 +237,8 @@ } | ||
is_breakglass?: boolean; | ||
/** | ||
* (Coming Soon) Sets the Member's phone number. Throws an error if the Member already has a phone number. | ||
* To change the Member's phone number, use the | ||
* [Delete member phone number endpoint](https://stytch.com/docs/b2b/api/delete-member-mfa-phone-number) to | ||
* delete the Member's existing phone number first. | ||
*/ | ||
mfa_phone_number?: string; | ||
@@ -267,2 +289,3 @@ /** | ||
/** | ||
* Delete a Member's MFA phone number. | ||
* @param data {@link B2BOrganizationsMembersDeleteMFAPhoneNumberRequest} | ||
@@ -269,0 +292,0 @@ * @returns {@link B2BOrganizationsMembersDeleteMFAPhoneNumberResponse} |
@@ -101,2 +101,6 @@ import { fetchConfig } from "../shared"; | ||
member_id: string; | ||
/** | ||
* The phone number to send the OTP to. If the Member already has a phone number, this argument is not | ||
* needed. | ||
*/ | ||
mfa_phone_number?: string; | ||
@@ -137,5 +141,5 @@ /** | ||
* this will send an OTP to the number associated with their `member_id`. If not, then this will send an | ||
* OTP to the `phone_number` provided and link the `phone_number` with the Member. | ||
* An error will be thrown if the Member already has a phone number and the provided `phone_number` does | ||
* not match the existing one. | ||
* OTP to the `mfa_phone_number` provided and link the `mfa_phone_number` with the Member. | ||
* An error will be thrown if the Member already has a phone number and the provided `mfa_phone_number` | ||
* does not match the existing one. | ||
* | ||
@@ -142,0 +146,0 @@ * Note that sending another OTP code before the first has expired will invalidate the first code. |
@@ -1,2 +0,1 @@ | ||
import { JwtConfig } from "../shared/sessions"; | ||
import { AuthenticationFactor, JWK } from "../b2c/sessions"; | ||
@@ -6,2 +5,3 @@ import { fetchConfig } from "../shared"; | ||
import { MfaRequired } from "./mfa"; | ||
import { JwtConfig } from "../shared/sessions"; | ||
export interface MemberSession { | ||
@@ -8,0 +8,0 @@ member_session_id: string; |
import { BaseClient, ClientConfig } from "../shared/client"; | ||
import { CryptoWallets } from "./crypto_wallets"; | ||
import { JwtConfig } from "../shared/sessions"; | ||
import { M2M } from "./m2m"; | ||
import { MagicLinks } from "./magic_links"; | ||
@@ -15,2 +16,3 @@ import { OAuth } from "./oauth"; | ||
cryptoWallets: CryptoWallets; | ||
m2m: M2M; | ||
magicLinks: MagicLinks; | ||
@@ -17,0 +19,0 @@ oauth: OAuth; |
export type { SearchUsersQueryOperand } from "./users"; | ||
export type { AuthenticateTokenRequest, AuthenticateTokenResponse, TokenRequest, TokenResponse, M2MSearchQueryOperand, } from "./m2m"; | ||
export type { Attributes } from "./attribute"; | ||
@@ -6,2 +7,5 @@ export type { BiometricRegistration, CryptoWallet, Email, Name, OAuthProvider, Password, PhoneNumber, UsersResultsMetadata, SearchUsersQuery, TOTP, User, WebAuthnRegistration, UsersCreateRequest, UsersCreateResponse, UsersDeleteBiometricRegistrationRequest, UsersDeleteBiometricRegistrationResponse, UsersDeleteCryptoWalletRequest, UsersDeleteCryptoWalletResponse, UsersDeleteEmailRequest, UsersDeleteEmailResponse, UsersDeleteOAuthRegistrationRequest, UsersDeleteOAuthRegistrationResponse, UsersDeletePasswordRequest, UsersDeletePasswordResponse, UsersDeletePhoneNumberRequest, UsersDeletePhoneNumberResponse, UsersDeleteRequest, UsersDeleteResponse, UsersDeleteTOTPRequest, UsersDeleteTOTPResponse, UsersDeleteWebAuthnRegistrationRequest, UsersDeleteWebAuthnRegistrationResponse, UsersGetRequest, UsersGetResponse, UsersSearchRequest, UsersSearchResponse, UsersUpdateRequest, UsersUpdateResponse, } from "./users"; | ||
export type { CryptoWalletsAuthenticateRequest, CryptoWalletsAuthenticateResponse, CryptoWalletsAuthenticateStartRequest, CryptoWalletsAuthenticateStartResponse, } from "./crypto_wallets"; | ||
export type { M2MClient, M2MClientWithClientSecret, M2MClientWithNextClientSecret, M2MSearchQuery, M2MResultsMetadata, } from "./m2m"; | ||
export type { M2MClientsCreateRequest, M2MClientsCreateResponse, M2MClientsDeleteRequest, M2MClientsDeleteResponse, M2MClientsGetRequest, M2MClientsGetResponse, M2MClientsSearchRequest, M2MClientsSearchResponse, M2MClientsUpdateRequest, M2MClientsUpdateResponse, } from "./m2m_clients"; | ||
export type { M2MClientsSecretsRotateCancelRequest, M2MClientsSecretsRotateCancelResponse, M2MClientsSecretsRotateRequest, M2MClientsSecretsRotateResponse, M2MClientsSecretsRotateStartRequest, M2MClientsSecretsRotateStartResponse, } from "./m2m_clients_secrets"; | ||
export type { Options, MagicLinksAuthenticateRequest, MagicLinksAuthenticateResponse, MagicLinksCreateRequest, MagicLinksCreateResponse, } from "./magic_links"; | ||
@@ -8,0 +12,0 @@ export type { MagicLinksEmailInviteRequest, MagicLinksEmailInviteResponse, MagicLinksEmailLoginOrCreateRequest, MagicLinksEmailLoginOrCreateResponse, MagicLinksEmailRevokeInviteRequest, MagicLinksEmailRevokeInviteResponse, MagicLinksEmailSendRequest, MagicLinksEmailSendResponse, } from "./magic_links_email"; |
@@ -1,5 +0,5 @@ | ||
import { JwtConfig } from "../shared/sessions"; | ||
import { Attributes } from "./attribute"; | ||
import { fetchConfig } from "../shared"; | ||
import { User } from "./users"; | ||
import { JwtConfig } from "../shared/sessions"; | ||
export interface AmazonOAuthFactor { | ||
@@ -6,0 +6,0 @@ id: string; |
@@ -14,3 +14,4 @@ /// <reference types="node" /> | ||
data?: unknown; | ||
dataRaw?: BodyInit; | ||
}; | ||
export declare function request<T>(fetchConfig: fetchConfig, requestConfig: requestConfig): Promise<T>; |
@@ -20,3 +20,20 @@ import * as jose from "jose"; | ||
current_date?: Date; | ||
}): Promise<{ | ||
payload: jose.JWTPayload; | ||
customClaims: Record<string, unknown>; | ||
}>; | ||
export declare function authenticateM2MJwtLocal(jwksClient: jose.JWTVerifyGetKey, jwtOptions: jose.JWTVerifyOptions, jwt: string, options?: { | ||
clock_tolerance_seconds?: number; | ||
max_token_age_seconds?: number; | ||
current_date?: Date; | ||
}): Promise<{ | ||
sub: string; | ||
scope: string; | ||
custom_claims: Record<string, unknown>; | ||
}>; | ||
export declare function authenticateSessionJwtLocal(jwksClient: jose.JWTVerifyGetKey, jwtOptions: jose.JWTVerifyOptions, jwt: string, options?: { | ||
clock_tolerance_seconds?: number; | ||
max_token_age_seconds?: number; | ||
current_date?: Date; | ||
}): Promise<IntermediateSession>; | ||
export {}; |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
543777
112
11714
196
1