Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Challenges

When a user logs in with their username & password, they may have to respond to a challenge in order to finish the auth loop. This is a collection of data types and helper functions related those ChallengeResponse interactions.

Index

Enumerations

Interfaces

Type aliases

Functions

Enumerations

Types

Types:

Our internal key of possible challenges from Cognito. ForgotPassword and Default are constants we made up to control the client-side interface -- the former means we've begun a PassReset flow, the latter means there is no challenge at all. NewPasswordRequired and MFA-related challenges, however, are proper Cognito challenges. You can view the whole list of them at:

https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_InitiateAuth.html#API_InitiateAuth_ResponseSyntax

AppMfa

AppMfa: = "SOFTWARE_TOKEN_MFA"

BeginForgotPassword

BeginForgotPassword: = "BEGIN_FORGOT_PASSWORD"

Default

Default: = "DEFAULT"

ForgotPassword

ForgotPassword: = "FORGOT_PASSWORD"

MfaSetup

MfaSetup: = "MFA_SETUP"

NewPasswordRequired

NewPasswordRequired: = "NEW_PASSWORD_REQUIRED"

SelectMfaType

SelectMfaType: = "SELECT_MFA_TYPE"

SmsMfa

SmsMfa: = "SMS_MFA"

Interfaces

Data

Data:

General response shape for all Challenges. They will always have a ChallengeName, and the Session key is a special value which must be passed back and forth throughout the Challenge-Response flow.

ChallengeName

ChallengeName: Types

ChallengeParameters

ChallengeParameters: object

Type declaration

  • [key: string]: string

Session

Session: string

Type aliases

MfaTypes

MfaTypes: SmsMfa | AppMfa

Functions

isData

  • isData(val: any): boolean
  • Type guard; only returns true if maybe fully satisfies Challenges.Data. Validates that the name is a valid value from Challenges.Types, that the session is a string, and that Data.ChallengeParameters has only string keys & string values.

    Parameters

    • val: any

    Returns boolean

isMfaTypes

  • isMfaTypes(val: any): boolean
  • Type guard; only valid values for the MfaTypes type will return true.

    Parameters

    • val: any

    Returns boolean

isTypes

  • isTypes(val: any): boolean
  • Type guard; only valid enum values within the Types enum will return true.

    Parameters

    • val: any

    Returns boolean

newData

  • Factory function to produce an empty ChallengeData object. Session is an empty string, the name is Types.Default, and ChallengeParameters is an empty object.

    Returns Data

Generated using TypeDoc