Skip to content

Commit

Permalink
fix: remove internal-types.ts (#1014)
Browse files Browse the repository at this point in the history
No such thing as internal type.
  • Loading branch information
hf authored Dec 26, 2024
1 parent 14eb711 commit 28ead89
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 84 deletions.
4 changes: 1 addition & 3 deletions src/GoTrueClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,11 @@ import type {
LockFunc,
UserIdentity,
SignInAnonymouslyCredentials,
} from './lib/types'
import {
MFAEnrollTOTPParams,
MFAEnrollPhoneParams,
AuthMFAEnrollTOTPResponse,
AuthMFAEnrollPhoneResponse,
} from './lib/internal-types'
} from './lib/types'

polyfillGlobalThis() // Make "globalThis" available

Expand Down
75 changes: 0 additions & 75 deletions src/lib/internal-types.ts

This file was deleted.

80 changes: 74 additions & 6 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import { AuthError } from './errors'
import { Fetch } from './fetch'
import {
MFAEnrollTOTPParams,
MFAEnrollPhoneParams,
AuthMFAEnrollTOTPResponse,
AuthMFAEnrollPhoneResponse,
} from './internal-types'

/** One of the providers supported by GoTrue. */
export type Provider =
Expand Down Expand Up @@ -1131,3 +1125,77 @@ export type SignOut = {
*/
scope?: 'global' | 'local' | 'others'
}

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
}

0 comments on commit 28ead89

Please sign in to comment.