supertokens-node
    Preparing search index...
    Index

    Constructors

    Properties

    Error: typeof default = SuperTokensError
    init: (config?: TypeInput) => RecipeListFunction = Recipe.init

    Methods

    • Parameters

      • input: { tenantId: string; token: string; userContext?: Record<string, any> }

      Returns Promise<
          | ConsumeRecoverAccountTokenErrorResponse
          | { email: string; status: "OK"; userId: string },
      >

    • Parameters

      • __namedParameters: {
            email: string;
            tenantId: string;
            userContext?: Record<string, any>;
            userId: string;
        }

      Returns Promise<
          | GenerateRecoverAccountTokenErrorResponse
          | { link: string; status: string },
      >

    • We do not make email optional here because we want to allow passing in primaryUserId. If we make email optional, and if the user provides a primaryUserId, then it may result in two problems:

      • there is no recipeUserId = input primaryUserId, in this case, this function will throw an error
      • There is a recipe userId = input primaryUserId, but that recipe has no email, or has wrong email compared to what the user wanted to generate a reset token for.

      And we want to allow primaryUserId being passed in.

      Parameters

      • input: {
            email: string;
            tenantId: string;
            userContext?: Record<string, any>;
            userId: string;
        }

      Returns Promise<
          | GenerateRecoverAccountTokenErrorResponse
          | { status: "OK"; token: string },
      >

    • Parameters

      • input: {
            recipeUserId: string;
            userContext?: Record<string, any>;
            webauthnCredentialId: string;
        }

      Returns Promise<
          | GetCredentialErrorResponse
          | {
              createdAt: number;
              recipeUserId: RecipeUserId;
              relyingPartyId: string;
              status: "OK";
              webauthnCredentialId: string;
          },
      >

    • Parameters

      • input: {
            tenantId: string;
            userContext?: Record<string, any>;
            webauthnGeneratedOptionsId: string;
        }

      Returns Promise<
          | GetGeneratedOptionsErrorResponse
          | {
              challenge: string;
              createdAt: number;
              email?: string;
              expiresAt: number;
              origin: string;
              relyingPartyId: string;
              relyingPartyName: string;
              status: "OK";
              timeout: number;
              userPresence: boolean;
              userVerification: UserVerification;
              webauthnGeneratedOptionsId: string;
          },
      >

    • Parameters

      • input: { tenantId: string; token: string; userContext?: Record<string, any> }

      Returns Promise<
          | GetUserFromRecoverAccountTokenErrorResponse
          | { recipeUserId?: RecipeUserId; status: "OK"; user: User },
      >

    • Parameters

      • input: { recipeUserId: string; userContext?: Record<string, any> }

      Returns Promise<
          {
              credentials: {
                  createdAt: number;
                  recipeUserId: string;
                  relyingPartyId: string;
                  webauthnCredentialId: string;
              }[];
              status: "OK";
          },
      >

    • Parameters

      • __namedParameters: {
            credential: RegistrationPayload;
            tenantId?: string;
            token: string;
            userContext?: Record<string, any>;
            webauthnGeneratedOptionsId: string;
        }

      Returns Promise<
          | ConsumeRecoverAccountTokenErrorResponse
          | RegisterCredentialErrorResponse
          | { status: "OK" },
      >

    • Parameters

      • input: {
            credential: RegistrationPayload;
            recipeUserId: string;
            userContext?: Record<string, any>;
            webauthnGeneratedOptionsId: string;
        }

      Returns Promise<RegisterCredentialErrorResponse | { status: "OK" }>

    • Parameters

      • input: {
            attestation: Attestation | undefined;
            origin: string;
            relyingPartyId: string;
            relyingPartyName: string;
            residentKey: ResidentKey | undefined;
            supportedAlgorithmIds: undefined | number[];
            tenantId: string;
            timeout: undefined | number;
            userContext?: Record<string, any>;
            userPresence: undefined | boolean;
            userVerification: UserVerification | undefined;
        } & (
            | { recoverAccountToken: string }
            | { displayName: undefined | string; email: string }
        )

      Returns Promise<
          | RegisterOptionsErrorResponse
          | {
              attestation: Attestation;
              authenticatorSelection: {
                  requireResidentKey: boolean;
                  residentKey: ResidentKey;
                  userVerification: UserVerification;
              };
              challenge: string;
              createdAt: number;
              excludeCredentials: {
                  id: string;
                  transports: ("ble" | "hybrid" | "internal" | "nfc" | "usb")[];
                  type: "public-key";
              }[];
              expiresAt: number;
              pubKeyCredParams: { alg: number; type: "public-key" }[];
              rp: { id: string; name: string };
              status: "OK";
              timeout: number;
              user: { displayName: string; id: string; name: string };
              webauthnGeneratedOptionsId: string;
          },
      >

    • Parameters

      • input: {
            recipeUserId: string;
            userContext?: Record<string, any>;
            webauthnCredentialId: string;
        }

      Returns Promise<RemoveCredentialErrorResponse | { status: "OK" }>

    • Parameters

      • input: {
            tenantId: string;
            userContext?: Record<string, any>;
            webauthnGeneratedOptionsId: string;
        }

      Returns Promise<RemoveGeneratedOptionsErrorResponse | { status: "OK" }>

    • Parameters

      • input: TypeWebauthnRecoverAccountEmailDeliveryInput & {
            userContext?: Record<string, any>;
        }

      Returns Promise<void>

    • Parameters

      • __namedParameters: {
            email: string;
            tenantId: string;
            userContext?: Record<string, any>;
            userId: string;
        }

      Returns Promise<{ link: string; status: string } | { status: string }>

    • Parameters

      • input: {
            credential: AuthenticationPayload;
            session: undefined | SessionContainer;
            shouldTryLinkingWithSessionUser: undefined | boolean;
            tenantId: string;
            userContext?: Record<string, any>;
            webauthnGeneratedOptionsId: string;
        }

      Returns Promise<
          | SignInErrorResponse
          | { recipeUserId: RecipeUserId; status: "OK"; user: User },
      >

    • Parameters

      • input: {
            origin: string;
            relyingPartyId: string;
            relyingPartyName: string;
            tenantId: string;
            timeout: undefined | number;
            userContext?: Record<string, any>;
            userPresence: undefined | boolean;
            userVerification: undefined | UserVerification;
        }

      Returns Promise<
          | SignInOptionsErrorResponse
          | {
              challenge: string;
              createdAt: number;
              expiresAt: number;
              status: "OK";
              timeout: number;
              userVerification: UserVerification;
              webauthnGeneratedOptionsId: string;
          },
      >

    • Parameters

      • input: {
            credential: RegistrationPayload;
            session: undefined | SessionContainer;
            shouldTryLinkingWithSessionUser: undefined | boolean;
            tenantId: string;
            userContext?: Record<string, any>;
            webauthnGeneratedOptionsId: string;
        }

      Returns Promise<
          | SignUpErrorResponse
          | { recipeUserId: RecipeUserId; status: "OK"; user: User },
      >

    • Parameters

      • input: {
            email: string;
            recipeUserId: string;
            tenantId: string;
            userContext?: Record<string, any>;
        }

      Returns Promise<UpdateUserEmailErrorResponse | { status: "OK" }>

    • Parameters

      • input: {
            credential: AuthenticationPayload;
            tenantId: string;
            userContext?: Record<string, any>;
            webauthnGeneratedOptionsId: string;
        }

      Returns Promise<
          {
              status: | "OK"
              | "UNKNOWN_USER_ID_ERROR"
              | "INVALID_OPTIONS_ERROR"
              | "OPTIONS_NOT_FOUND_ERROR"
              | "INVALID_CREDENTIALS_ERROR"
              | "INVALID_AUTHENTICATOR_ERROR"
              | "CREDENTIAL_NOT_FOUND_ERROR";
          },
      >