checkCode
checkCode: (
input:
| {
deviceId: string;
preAuthSessionId: string;
tenantId: string;
userContext: UserContext;
userInputCode: string;
}
| {
linkCode: string;
preAuthSessionId: string;
tenantId: string;
userContext: UserContext;
},
) => Promise<
| {
consumedDevice: {
email?: string;
failedCodeInputAttemptCount: number;
phoneNumber?: string;
preAuthSessionId: string;
};
status: "OK";
}
| {
failedCodeInputAttemptCount: number;
maximumCodeInputAttempts: number;
status: | "INCORRECT_USER_INPUT_CODE_ERROR"
| "EXPIRED_USER_INPUT_CODE_ERROR";
}
| { status: "RESTART_FLOW_ERROR" },
>
consumeCode
consumeCode: ( input: | { deviceId: string; preAuthSessionId: string; session: SessionContainer | undefined; shouldTryLinkingWithSessionUser: boolean | undefined; tenantId: string; userContext: UserContext; userInputCode: string; } | { linkCode: string; preAuthSessionId: string; session: SessionContainer | undefined; shouldTryLinkingWithSessionUser: boolean | undefined; tenantId: string; userContext: UserContext; },) => Promise< | { consumedDevice: { email?: string; failedCodeInputAttemptCount: number; phoneNumber?: string; preAuthSessionId: string; }; createdNewRecipeUser: boolean; recipeUserId: RecipeUserId; status: "OK"; user: User; } | { failedCodeInputAttemptCount: number; maximumCodeInputAttempts: number; status: | "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR"; } | { status: "RESTART_FLOW_ERROR" } | { reason: | "EMAIL_VERIFICATION_REQUIRED" | "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR" | "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR" | "SESSION_USER_ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"; status: "LINKING_TO_SESSION_USER_FAILED"; },> createCode
createCode: ( input: (
{ email: string } | { phoneNumber: string })
& { session: SessionContainer | undefined; shouldTryLinkingWithSessionUser: boolean | undefined; tenantId: string; userContext: UserContext; userInputCode?: string; },) => Promise< { codeId: string; codeLifetime: number; deviceId: string; linkCode: string; preAuthSessionId: string; status: "OK"; timeCreated: number; userInputCode: string; },> createNewCodeForDevice
createNewCodeForDevice: (
input: {
deviceId: string;
tenantId: string;
userContext: UserContext;
userInputCode?: string;
},
) => Promise<
| {
codeId: string;
codeLifetime: number;
deviceId: string;
linkCode: string;
preAuthSessionId: string;
status: "OK";
timeCreated: number;
userInputCode: string;
}
| { status: "RESTART_FLOW_ERROR"
| "USER_INPUT_CODE_ALREADY_USED_ERROR" },
>
listCodesByDeviceId
listCodesByDeviceId: (
input: { deviceId: string; tenantId: string; userContext: UserContext },
) => Promise<DeviceType | undefined>
listCodesByEmail
listCodesByEmail: (
input: { email: string; tenantId: string; userContext: UserContext },
) => Promise<DeviceType[]>
listCodesByPhoneNumber
listCodesByPhoneNumber: (
input: {
phoneNumber: string;
tenantId: string;
userContext: UserContext;
},
) => Promise<DeviceType[]>
listCodesByPreAuthSessionId
listCodesByPreAuthSessionId: (
input: {
preAuthSessionId: string;
tenantId: string;
userContext: UserContext;
},
) => Promise<DeviceType | undefined>
revokeAllCodes
revokeAllCodes: (
input:
| { email: string; tenantId: string; userContext: UserContext }
| { phoneNumber: string; tenantId: string; userContext: UserContext },
) => Promise<{ status: "OK" }>
revokeCode
revokeCode: (
input:
| { codeId: string; tenantId: string; userContext: UserContext }
| { preAuthSessionId: string; tenantId: string; userContext: UserContext },
) => Promise<{ status: "OK" }>
updateUser
updateUser: ( input: { email?: string | null; phoneNumber?: string | null; recipeUserId: RecipeUserId; userContext: UserContext; },) => Promise< | { status: | "OK" | "UNKNOWN_USER_ID_ERROR" | "EMAIL_ALREADY_EXISTS_ERROR" | "PHONE_NUMBER_ALREADY_EXISTS_ERROR"; } | { reason: string; status: | "EMAIL_CHANGE_NOT_ALLOWED_ERROR" | "PHONE_NUMBER_CHANGE_NOT_ALLOWED_ERROR"; },>