Skip to content

Commit 28ead89

Browse files
authored
fix: remove internal-types.ts (#1014)
No such thing as internal type.
1 parent 14eb711 commit 28ead89

File tree

3 files changed

+75
-84
lines changed

3 files changed

+75
-84
lines changed

src/GoTrueClient.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,11 @@ import type {
8989
LockFunc,
9090
UserIdentity,
9191
SignInAnonymouslyCredentials,
92-
} from './lib/types'
93-
import {
9492
MFAEnrollTOTPParams,
9593
MFAEnrollPhoneParams,
9694
AuthMFAEnrollTOTPResponse,
9795
AuthMFAEnrollPhoneResponse,
98-
} from './lib/internal-types'
96+
} from './lib/types'
9997

10098
polyfillGlobalThis() // Make "globalThis" available
10199

src/lib/internal-types.ts

-75
This file was deleted.

src/lib/types.ts

+74-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
import { AuthError } from './errors'
22
import { Fetch } from './fetch'
3-
import {
4-
MFAEnrollTOTPParams,
5-
MFAEnrollPhoneParams,
6-
AuthMFAEnrollTOTPResponse,
7-
AuthMFAEnrollPhoneResponse,
8-
} from './internal-types'
93

104
/** One of the providers supported by GoTrue. */
115
export type Provider =
@@ -1131,3 +1125,77 @@ export type SignOut = {
11311125
*/
11321126
scope?: 'global' | 'local' | 'others'
11331127
}
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

Comments
 (0)