Skip to main content

Scute / Exports

Scute

Table of contents

Classes

  • ScuteAdminApi
  • ScuteClient
  • ScuteBrowserCookieStorage
  • ScuteSession
  • ScuteCookieStorage
  • ScuteError
  • BaseHttpError
  • TechnicalError
  • WebAuthnError
  • CustomScuteError
  • IdentifierNotRecognizedError
  • IdentifierAlreadyExistsError
  • NewDeviceError
  • LoginRequiredError
  • InvalidAuthTokenError
  • UnknownSignInError
  • InvalidMagicLinkError

Interfaces

Type Aliases

Variables

Functions

Type Aliases

WebAuthnErrorCode

Ƭ WebAuthnErrorCode: "ERROR_CEREMONY_ABORTED" | "ERROR_INVALID_DOMAIN" | "ERROR_INVALID_RP_ID" | "ERROR_INVALID_USER_ID_LENGTH" | "ERROR_MALFORMED_PUBKEYCREDPARAMS" | "ERROR_AUTHENTICATOR_GENERAL_ERROR" | "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT" | "ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT" | "ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED" | "ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG" | "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY"

Defined in

lib/errors.ts:155


CustomScuteErrorCode

Ƭ CustomScuteErrorCode: "identifier-not-recognized" | "identifier-already-exists" | "new-device" | "login-required" | "invalid-auth-token" | "unknown-sign-in" | "invalid-magic-link"

Defined in

lib/errors.ts:364


ErrorReport

Ƭ ErrorReport: Object

Type declaration

NameType
locationstring
name?string
message?string
stack?string
code?string | number
cause?Error

Defined in

lib/errors.ts:441


ScuteClientConfig

Ƭ ScuteClientConfig: Object

Type declaration

NameTypeDescription
appIdUniqueIdentifier-
baseUrl?string-
secretKey?stringIMPORTANT: Do not expose to the browser
preferences?ScuteClientPreferences-
debug?boolean-
errorReporting?boolean-

Defined in

lib/types/config.ts:4


ScuteSessionConfig

Ƭ ScuteSessionConfig: Object

Type declaration

NameType
storageScuteStorage

Defined in

lib/types/config.ts:14


ScuteClientPreferences

Ƭ ScuteClientPreferences: Object

Type declaration

NameTypeDescription
persistSession?booleanDefault ts true
sessionStorageAdapter?ScuteStorage-
refetchOnWindowFocus?booleanDefault ts true
refetchInverval?numberRefetch interval in seconds Default ts 300

Defined in

lib/types/config.ts:18


ScuteAdminApiConfig

Ƭ ScuteAdminApiConfig: Object

Type declaration

NameType
appIdUniqueIdentifier
baseUrl?string
secretKey?string
errorReporting?boolean

Defined in

lib/types/config.ts:30


UniqueIdentifier

Ƭ UniqueIdentifier: string | number

Defined in

lib/types/general.ts:3


ScuteActivity

Ƭ ScuteActivity: { id: UniqueIdentifier ; email: string ; user_id: string ; event_type: string ; timestamp: string ; ip_address: string ; user_agent: string } & Record<string, unknown>

Defined in

lib/types/scute.ts:3


ScuteOAuthProviderConfig

Ƭ ScuteOAuthProviderConfig: Object

Type declaration

NameType
providerstring
namestring
iconstring
color?string

Defined in

lib/types/scute.ts:13


ScuteAppData

Ƭ ScuteAppData: Object

Type declaration

NameType
idUniqueIdentifier
namestring
created_atstring
updated_atstring
originstring
callback_urlstring
login_urlstring
logostring
logo_darkstring
public_keyany
profile_managementboolean
public_signupboolean
access_expirationnumber
refresh_expirationnumber
refresh_payloadboolean
auto_refreshboolean
magic_link_expirationnumber
session_timeoutnumber
scute_brandingboolean
allowed_identifiersScuteIdentifierType[]
required_identifiersScuteIdentifierType[]
email_auth_type"magic" | "otp"
default_languagestring
user_meta_data_schemaScuteUserMetaDataSchema[]
oauth_providers?ScuteOAuthProviderConfig[]
base_urlstring

Defined in

lib/types/scute.ts:20


ScuteTokenPayload

Ƭ ScuteTokenPayload: Object

Type declaration

NameType
refresh?string | null
refresh_expires_at?string | null
access_expires_atstring
accessstring

Defined in

lib/types/scute.ts:66


ScuteSendMagicLinkResponse

Ƭ ScuteSendMagicLinkResponse: Object

Type declaration

NameType
type"magic_link"
idUniqueIdentifier

Defined in

lib/types/scute.ts:73


ScuteUser

Ƭ ScuteUser: Object

Type declaration

NameType
idUniqueIdentifier
status"active" | "pending" | "inactive"
emailstring | null
email_verifiedboolean
phonestring | null
phone_verifiedboolean
webauthn_enabledboolean

Defined in

lib/types/scute.ts:78


ScuteUserData

Ƭ ScuteUserData: Object

Type declaration

NameType
idUniqueIdentifier
statusScuteUser["status"]
emailstring | null
email_verifiedboolean
phonestring | null
phone_verifiedboolean
webauthn_enabledboolean
metaMetadata | null
last_used_atstring
signup_datestring
webauthn_typesstring[]
sessionsScuteUserSession[]

Defined in

lib/types/scute.ts:88


UserMeta

Ƭ UserMeta: Metadata

Defined in

lib/types/scute.ts:105


ScuteIdentifier

Ƭ ScuteIdentifier: string

Identifier that is an email or phone number.

Defined in

lib/types/scute.ts:110


ScuteIdentifierType

Ƭ ScuteIdentifierType: "email" | "phone"

Defined in

lib/types/scute.ts:112


ScuteWebauthnOption

Ƭ ScuteWebauthnOption: "strict" | "optional" | "disabled"

Defined in

lib/types/scute.ts:114


ScuteSignInOptions

Ƭ ScuteSignInOptions: { webauthn?: ScuteWebauthnOption } & Record<string, unknown>

Defined in

lib/types/scute.ts:116


ScuteSignUpOptions

Ƭ ScuteSignUpOptions: { webauthn?: ScuteWebauthnOption ; userMeta?: Metadata } & Record<string, unknown>

Defined in

lib/types/scute.ts:120


ScuteSignInOrUpOptions

Ƭ ScuteSignInOrUpOptions: { webauthn?: ScuteWebauthnOption } & Record<string, unknown>

Defined in

lib/types/scute.ts:125


ScuteMagicLinkIdResponse

Ƭ ScuteMagicLinkIdResponse: Object

Type declaration

NameType
magic_link{ id: UniqueIdentifier }
magic_link.idUniqueIdentifier

Defined in

lib/types/scute.ts:129


ScuteUserSession

Ƭ ScuteUserSession: Object

Type declaration

NameType
idUniqueIdentifier
display_namestring
created_atstring
updated_atstring
credential_idUniqueIdentifier | null
last_used_atstring
last_used_at_ipstring
user_agentstring
typeScuteSessionType
platformstring
browserstring
user_agent_shortnamestring
nicknamestring

Defined in

lib/types/scute.ts:133


ScuteSessionType

Ƭ ScuteSessionType: "webauthn" | "magic" | "xlogin" | "oauth" | "misc"

Defined in

lib/types/scute.ts:150


ScutePaginationMeta

Ƭ ScutePaginationMeta: Object

Type declaration

NameType
total_pagesnumber
current_pagenumber
next_pagenumber | null
prev_pagenumber | null
per_pagenumber

Defined in

lib/types/scute.ts:157


ListUsersRequestParams

Ƭ ListUsersRequestParams: Object

Type declaration

NameType
id?UniqueIdentifier
email?string
phone?string
created_before?string
status?string
page?number
limit?number

Defined in

lib/types/scute.ts:165


Session

Ƭ Session: AuthenticatedSession | { access: null ; accessExpiresAt: null ; refresh?: string | null ; refreshExpiresAt?: Date | null ; status: "unauthenticated" | "loading" }

Defined in

lib/types/session.ts:17

Variables

AUTH_CHANGE_EVENTS

Const AUTH_CHANGE_EVENTS: Object

Type declaration

NameType
SIGNED_IN"signed_in"
SIGNED_OUT"signed_out"
INITIAL_SESSION"initial_session"
SESSION_REFETCH"session_refetch"
SESSION_EXPIRED"session_expired"
TOKEN_REFRESHED"token_refreshed"
MAGIC_PENDING"magic_pending"
MAGIC_NEW_DEVICE_PENDING"magic_new_device_pending"
MAGIC_VERIFIED"magic_verified"
MAGIC_VERIFIED_OAUTH"magic_verified_oauth"
WEBAUTHN_REGISTER_START"webauthn_register_start"
WEBAUTHN_REGISTER_SUCCESS"webauthn_register_success"
WEBAUTHN_VERIFY_START"webauthn_verify_start"
WEBAUTHN_VERIFY_SUCCESS"webauthn_verify_success"

Defined in

lib/constants.ts:6


SCUTE_MAGIC_PARAM

Const SCUTE_MAGIC_PARAM: "sct_magic"

Defined in

lib/constants.ts:41


SCUTE_SKIP_PARAM

Const SCUTE_SKIP_PARAM: "sct_sk"

Defined in

lib/constants.ts:42


SCUTE_ACCESS_STORAGE_KEY

Const SCUTE_ACCESS_STORAGE_KEY: "sc-access-token"

Defined in

lib/constants.ts:46


SCUTE_REFRESH_STORAGE_KEY

Const SCUTE_REFRESH_STORAGE_KEY: "sc-refresh-token"

Defined in

lib/constants.ts:47


SCUTE_REMEMBER_STORAGE_KEY

Const SCUTE_REMEMBER_STORAGE_KEY: "sc-remember-me"

Defined in

lib/constants.ts:48


NETWORK_ERROR_CODES

Const NETWORK_ERROR_CODES: number[]

Defined in

lib/errors.ts:110

Functions

createClient

createClient(...params): [ScuteClient]

Create a new ScuteClient.

Parameters

NameType
...params[config: ScuteClientConfig]

Returns

[ScuteClient]

Defined in

ScuteClient.ts:1418


sessionUnAuthenticatedState

sessionUnAuthenticatedState(): Session

Returns

Session

Defined in

lib/ScuteSession.ts:876


sessionLoadingState

sessionLoadingState(): Session

Returns

Session

Defined in

lib/ScuteSession.ts:877


getMeaningfulError

getMeaningfulError(error): Object

Parameters

NameType
error[ScuteError] | Error

Returns

Object

NameType
isFatalboolean
messagestring

Defined in

lib/errors.ts:4


identifyRegistrationError

identifyRegistrationError(«destructured»): [WebAuthnError] | Error

Attempt to intuit why an error was raised after calling navigator.credentials.create()

Parameters

NameType
«destructured»Object
› errorError
› optionsany

Returns

[WebAuthnError] | Error

Defined in

lib/errors.ts:172


identifyAuthenticationError

identifyAuthenticationError(«destructured»): [WebAuthnError] | Error

Attempt to intuit why an error was raised after calling navigator.credentials.get()

Parameters

NameType
«destructured»Object
› errorError
› optionsany

Returns

[WebAuthnError] | Error

Defined in

lib/errors.ts:301


isBrowser

isBrowser(): boolean

Returns

boolean

Defined in

lib/helpers.ts:11


decodeMagicLinkToken

decodeMagicLinkToken(token): null | _ScuteMagicLinkTokenPayload

Parameters

NameType
tokenstring

Returns

null | _ScuteMagicLinkTokenPayload

Defined in

lib/helpers.ts:82


accessTokenHeader

accessTokenHeader(jwt): HeadersInit

Get access token header object.

Parameters

NameType
jwtnull | string

Returns

HeadersInit

Defined in

lib/helpers.ts:104


refreshTokenHeaders

refreshTokenHeaders(jwt): HeadersInit

Get refresh token headers object.

Parameters

NameType
jwtnull | string

Returns

HeadersInit

Defined in

lib/helpers.ts:115