import BaseAPI from "./BaseAPI" ; import Client from "../Client" ; export type GetTwoStepVerificationMetaDataOptions = { userId : number ; challengeId : string ; actionType : string ; } ; export type GetTwoStepVerificationMetaData = { twoStepVerificationEnabled : boolean ; authenticatorEnabled : boolean ; authenticatorQrCodeSize : string ; emailCodeLength : number ; authenticatorCodeLength : number ; } ; export type GetTwoStepConfigurationOptions = GetTwoStepVerificationMetaDataOptions ; export type GetTwoStepConfiguration = { primaryMediaType : "Email" | string ; methods : { mediaType : "Email" | string ; enabled : boolean ; updated : string ; } [ ] ; } ; export type AuthenticatorVerifyOptions = { challengeId : string ; actionType : string ; code : string ; } ; export type AuthenticatorVerify = { verificationToken : string ; } ; export type AuthenticatorDisableOptions = { password : string ; } ; export type AuthenticatorDisable = unknown ; export type AuthenticatorEnableOptions = { userId : number ; } ; export type AuthenticatorEnable = { setupToken : string ; qrCodeImageUrl : string ; manualEntryKey : string ; } ; export type AuthenticatorVerifySetupOptions = { setupToken : string ; code : string ; } ; export type AuthenticatorVerifySetup = unknown ; export type EmailSendCodeOptions = { challengeId : string ; actionType : string ; } ; export type EmailSendCode = { challengeId : string ; actionType : string ; } ; export type EmailVerifyOptions = { challengeId : string ; actionType : string ; code : string ; } ; export type EmailVerify = { verificationToken : string ; } ; export type EmailDisableOptions = { password : string ; } ; export type EmailDisable = unknown ; export type EmailEnableOptions = { userId : number ; } ; export type EmailEnable = unknown ; export default class TwoStepVerificationAPI extends BaseAPI { constructor ( client ) { super ( { client , baseUrl : "https://twostepverification.roblox.com/" } ) ; } getMetaData ( options ) { return this . request ( { requiresAuth : true , request : { path : `v1/metadata` , qs : options } , json : true } ) . then ( response => response . body ) ; } getConfiguration ( options ? ) { return this . request ( { requiresAuth : true , request : { path : `v1/users/${ this . client . user ! . id }/configuration` , qs : options } , json : true } ) . then ( response => response . body ) ; } verifyWithAuthenticator ( options ) { return this . request ( { requiresAuth : true , request : { path : `v1/users/${ this . client . user ! . id }/challenges/authenticator/verify` , method : "POST" , json : options } , json : true } ) . then ( response => response . body ) ; } disableAuthenticator ( options ) { return this . request ( { requiresAuth : true , request : { path : `v1/users/${ this . client . user ! . id }/configuration/authenticator/disable` , method : "POST" , json : options } , json : true } ) . then ( response => response . body ) ; } enableAuthenticator ( options ) { return this . request ( { requiresAuth : true , request : { path : `v1/users/${ this . client . user ! . id }/configuration/authenticator/enable` , method : "POST" , json : options } , json : true } ) . then ( response => response . body ) ; } verifyAuthenticatorSetup ( options ) { return this . request ( { requiresAuth : true , request : { path : `v1/users/${ this . client . user ! . id }/configuration/authenticator/disable` , method : "POST" , json : options } , json : true } ) . then ( response => response . body ) ; } sendEmailCode ( options ) { return this . request ( { requiresAuth : true , request : { path : `v1/users/${ this . client . user ! . id }/challenges/email/send-code` , json : options } , json : true } ) . then ( response => response . body ) ; } verifyEmail ( options ) { return this . request ( { requiresAuth : true , request : { path : `v1/users/${ this . client . user ! . id }/challenges/email/verify` , method : "POST" , json : options } , json : true } ) . then ( response => response . body ) ; } disableEmail ( options ) { return this . request ( { requiresAuth : true , request : { path : `v1/users/${ this . client . user ! . id }/configuration/email/disable` , method : "POST" , json : options } , json : true } ) . then ( response => response . body ) ; } enableEmail ( options ) { return this . request ( { requiresAuth : true , request : { path : `v1/users/${ this . client . user ! . id }/configuration/email/enable` , method : "POST" , json : options } , json : true } ) . then ( response => response . body ) ; } }