|
1 | 1 | import { AuthError } from './errors'
|
2 | 2 | import { Fetch } from './fetch'
|
3 |
| -import { |
4 |
| - MFAEnrollTOTPParams, |
5 |
| - MFAEnrollPhoneParams, |
6 |
| - AuthMFAEnrollTOTPResponse, |
7 |
| - AuthMFAEnrollPhoneResponse, |
8 |
| -} from './internal-types' |
9 | 3 |
|
10 | 4 | /** One of the providers supported by GoTrue. */
|
11 | 5 | export type Provider =
|
@@ -1131,3 +1125,77 @@ export type SignOut = {
|
1131 | 1125 | */
|
1132 | 1126 | scope?: 'global' | 'local' | 'others'
|
1133 | 1127 | }
|
| 1128 | + |
| 1129 | +export type MFAEnrollTOTPParams = { |
| 1130 | + /** The type of factor being enrolled. */ |
| 1131 | + factorType: 'totp' |
| 1132 | + /** Domain which the user is enrolled with. */ |
| 1133 | + issuer?: string |
| 1134 | + /** Human readable name assigned to the factor. */ |
| 1135 | + friendlyName?: string |
| 1136 | +} |
| 1137 | +export type MFAEnrollPhoneParams = { |
| 1138 | + /** The type of factor being enrolled. */ |
| 1139 | + factorType: 'phone' |
| 1140 | + /** Human readable name assigned to the factor. */ |
| 1141 | + friendlyName?: string |
| 1142 | + /** Phone number associated with a factor. Number should conform to E.164 format */ |
| 1143 | + phone: string |
| 1144 | +} |
| 1145 | + |
| 1146 | +export type AuthMFAEnrollTOTPResponse = |
| 1147 | + | { |
| 1148 | + data: { |
| 1149 | + /** ID of the factor that was just enrolled (in an unverified state). */ |
| 1150 | + id: string |
| 1151 | + |
| 1152 | + /** Type of MFA factor.*/ |
| 1153 | + type: 'totp' |
| 1154 | + |
| 1155 | + /** TOTP enrollment information. */ |
| 1156 | + totp: { |
| 1157 | + /** Contains a QR code encoding the authenticator URI. You can |
| 1158 | + * convert it to a URL by prepending `data:image/svg+xml;utf-8,` to |
| 1159 | + * the value. Avoid logging this value to the console. */ |
| 1160 | + qr_code: string |
| 1161 | + |
| 1162 | + /** The TOTP secret (also encoded in the QR code). Show this secret |
| 1163 | + * in a password-style field to the user, in case they are unable to |
| 1164 | + * scan the QR code. Avoid logging this value to the console. */ |
| 1165 | + secret: string |
| 1166 | + |
| 1167 | + /** The authenticator URI encoded within the QR code, should you need |
| 1168 | + * to use it. Avoid loggin this value to the console. */ |
| 1169 | + uri: string |
| 1170 | + } |
| 1171 | + /** Friendly name of the factor, useful for distinguishing between factors **/ |
| 1172 | + friendly_name?: string |
| 1173 | + } |
| 1174 | + error: null |
| 1175 | + } |
| 1176 | + | { |
| 1177 | + data: null |
| 1178 | + error: AuthError |
| 1179 | + } |
| 1180 | + |
| 1181 | +export type AuthMFAEnrollPhoneResponse = |
| 1182 | + | { |
| 1183 | + data: { |
| 1184 | + /** ID of the factor that was just enrolled (in an unverified state). */ |
| 1185 | + id: string |
| 1186 | + |
| 1187 | + /** Type of MFA factor. */ |
| 1188 | + type: 'phone' |
| 1189 | + |
| 1190 | + /** Friendly name of the factor, useful for distinguishing between factors **/ |
| 1191 | + friendly_name?: string |
| 1192 | + |
| 1193 | + /** Phone number of the MFA factor in E.164 format. Used to send messages */ |
| 1194 | + phone: string |
| 1195 | + } |
| 1196 | + error: null |
| 1197 | + } |
| 1198 | + | { |
| 1199 | + data: null |
| 1200 | + error: AuthError |
| 1201 | + } |
0 commit comments