-
-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: move MFA sub types to internal file (#964)
## What kind of change does this PR introduce? Follow up to #956, hides the MFA sub-types (e.g. MFA Phone, MFA TOTP) needed to fix type errors before we release to public so that we can remove them as and when we like. The sub-types are now stored in an `internal-types` file which, unlike the `types` file is not exposed to public. The types mentioned here have not been released yet so fine to hide them
- Loading branch information
Showing
3 changed files
with
91 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { AuthError } from './errors' | ||
|
||
export type MFAEnrollTOTPParams = { | ||
/** The type of factor being enrolled. */ | ||
factorType: 'totp' | ||
/** Domain which the user is enrolled with. */ | ||
issuer?: string | ||
/** Human readable name assigned to the factor. */ | ||
friendlyName?: string | ||
} | ||
export type MFAEnrollPhoneParams = { | ||
/** The type of factor being enrolled. */ | ||
factorType: 'phone' | ||
/** Human readable name assigned to the factor. */ | ||
friendlyName?: string | ||
/** Phone number associated with a factor. Number should conform to E.164 format */ | ||
phone: string | ||
} | ||
|
||
export type AuthMFAEnrollTOTPResponse = | ||
| { | ||
data: { | ||
/** ID of the factor that was just enrolled (in an unverified state). */ | ||
id: string | ||
|
||
/** Type of MFA factor.*/ | ||
type: 'totp' | ||
|
||
/** TOTP enrollment information. */ | ||
totp: { | ||
/** Contains a QR code encoding the authenticator URI. You can | ||
* convert it to a URL by prepending `data:image/svg+xml;utf-8,` to | ||
* the value. Avoid logging this value to the console. */ | ||
qr_code: string | ||
|
||
/** The TOTP secret (also encoded in the QR code). Show this secret | ||
* in a password-style field to the user, in case they are unable to | ||
* scan the QR code. Avoid logging this value to the console. */ | ||
secret: string | ||
|
||
/** The authenticator URI encoded within the QR code, should you need | ||
* to use it. Avoid loggin this value to the console. */ | ||
uri: string | ||
} | ||
/** Friendly name of the factor, useful for distinguishing between factors **/ | ||
friendly_name?: string | ||
} | ||
error: null | ||
} | ||
| { | ||
data: null | ||
error: AuthError | ||
} | ||
|
||
export type AuthMFAEnrollPhoneResponse = | ||
| { | ||
data: { | ||
/** ID of the factor that was just enrolled (in an unverified state). */ | ||
id: string | ||
|
||
/** Type of MFA factor. */ | ||
type: 'phone' | ||
|
||
/** Friendly name of the factor, useful for distinguishing between factors **/ | ||
friendly_name?: string | ||
|
||
/** Phone number of the MFA factor in E.164 format. Used to send messages */ | ||
phone: string | ||
} | ||
error: null | ||
} | ||
| { | ||
data: null | ||
error: AuthError | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters