Comparing version 1.1.8 to 1.2.0
@@ -95,2 +95,9 @@ 'use strict'; | ||
Client.prototype.deleteUserPhoneNumber = | ||
function (phone_id, cb) { | ||
return this._authenticatedRequest({ | ||
path: `users/phone_numbers/${phone_id}`, | ||
}, 'DELETE', cb); | ||
}; | ||
// MAGIC LINKS | ||
@@ -145,3 +152,27 @@ Client.prototype.sendMagicLink = | ||
// OTP | ||
Client.prototype.sendOTPBySMS = | ||
function (request, cb) { | ||
return this._authenticatedRequest({ | ||
path: 'otp/send_by_sms', | ||
body: request, | ||
},'POST', cb); | ||
}; | ||
Client.prototype.loginOrCreateUserBySMS = | ||
function (request, cb) { | ||
return this._authenticatedRequest({ | ||
path: 'otp/login_or_create', | ||
body: request, | ||
},'POST', cb); | ||
}; | ||
Client.prototype.authenticateOTP = | ||
function (request, cb) { | ||
return this._authenticatedRequest({ | ||
path: 'otp/authenticate', | ||
body: request, | ||
},'POST', cb); | ||
}; | ||
module.exports = Client; |
{ | ||
"name": "stytch", | ||
"version": "1.1.8", | ||
"version": "1.2.0", | ||
"description": "A wrapper for the Stytch API", | ||
@@ -5,0 +5,0 @@ "main": "lib/stytch.js", |
@@ -39,3 +39,3 @@ # stytch-node | ||
const authenticateMagicLink = async (token) => { | ||
const response = Stytch.authenticateMagicLinkResponse = await stytchClient.authenticateMagicLink(token); | ||
const response: Stytch.authenticateMagicLinkResponse = await stytchClient.authenticateMagicLink(token); | ||
@@ -42,0 +42,0 @@ console.log(response); |
@@ -11,3 +11,3 @@ declare module 'stytch' { | ||
export class StytchError extends Error { | ||
status_code: string; | ||
status_code: bigint; | ||
request_id?: string; | ||
@@ -42,2 +42,8 @@ error_message?: string; | ||
interface PhoneNumber { | ||
phone_id: string; | ||
phone_number: string; | ||
verified: boolean; | ||
} | ||
interface PendingUser { | ||
@@ -47,2 +53,3 @@ user_id: string; | ||
emails: Email[]; | ||
phone_numbers: PhoneNumber[]; | ||
status: string; | ||
@@ -55,2 +62,3 @@ invited_at: string; | ||
email: string; | ||
phone_number?: string; | ||
name?: Name; | ||
@@ -63,2 +71,3 @@ attributes?: Attributes; | ||
email_id: string; | ||
phone_id: string; | ||
status: string; | ||
@@ -71,2 +80,3 @@ } | ||
emails: Email[]; | ||
phone_numbers: PhoneNumber[]; | ||
status: string; | ||
@@ -78,2 +88,3 @@ } | ||
emails?: string[]; | ||
phone_numbers?: string[]; | ||
attributes?: Attributes; | ||
@@ -85,2 +96,3 @@ } | ||
emails: Email[]; | ||
phone_numbers: PhoneNumber[]; | ||
} | ||
@@ -109,2 +121,6 @@ | ||
interface DeleteUserPhoneNumberResponse extends BaseResponse { | ||
user_id: string; | ||
} | ||
// MAGIC LINKS | ||
@@ -147,2 +163,4 @@ interface SendMagicLinkRequest { | ||
user_id: string; | ||
email_id: string; | ||
user_created: boolean; | ||
} | ||
@@ -182,2 +200,42 @@ | ||
// OTP | ||
interface SendOTPBySMSRequest { | ||
phone_number: string; | ||
expiration_minutes?: bigint; | ||
attributes?: Attributes; | ||
} | ||
interface SendOTPBySMSResponse extends BaseResponse { | ||
user_id: string; | ||
phone_id: string; | ||
} | ||
interface LoginOrCreateUserBySMSRequest { | ||
phone_number: string; | ||
expiration_minutes?: bigint; | ||
attributes?: Attributes; | ||
create_user_as_pending?: boolean; | ||
} | ||
interface LoginOrCreateUserBySMSResponse extends BaseResponse { | ||
user_id: string; | ||
phone_id: string; | ||
user_created: boolean; | ||
} | ||
interface AuthenticateOTPRequest { | ||
method_id: string; | ||
code: string; | ||
attributes?: Attributes; | ||
options?: { | ||
ip_match_required?: boolean; | ||
user_agent_match_required?: boolean; | ||
}; | ||
} | ||
interface AuthenticateOTPResponse extends BaseResponse { | ||
user_id: string; | ||
method_id: string; | ||
} | ||
class Client { | ||
@@ -242,2 +300,10 @@ constructor(config: Config); | ||
deleteUserPhoneNumber( | ||
phone_number: string | ||
): Promise<DeleteUserPhoneNumberResponse>; | ||
deleteUserPhoneNumber( | ||
phone_number: string, | ||
cb: Callback<DeleteUserPhoneNumberResponse> | ||
): void; | ||
// MAGIC LINKS | ||
@@ -297,3 +363,28 @@ sendMagicLink( | ||
): void; | ||
// OTP | ||
sendOTPBySMS( | ||
request: SendOTPBySMSRequest | ||
): Promise<SendOTPBySMSResponse>; | ||
sendOTPBySMS( | ||
request: SendOTPBySMSRequest, | ||
cb: Callback<SendOTPBySMSResponse> | ||
): void; | ||
loginOrCreateUserBySMS( | ||
request: LoginOrCreateUserBySMSRequest | ||
): Promise<LoginOrCreateUserBySMSResponse>; | ||
loginOrCreateUserBySMS( | ||
request: LoginOrCreateUserBySMSRequest, | ||
cb: Callback<LoginOrCreateUserBySMSResponse> | ||
): void; | ||
authenticateOTP( | ||
request: AuthenticateOTPRequest | ||
): Promise<AuthenticateOTPResponse>; | ||
authenticateOTP( | ||
request: AuthenticateOTPRequest, | ||
cb: Callback<AuthenticateOTPResponse> | ||
): void; | ||
} | ||
} |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
22754
16
599
0