Faroe
Represents a Faroe server client.
Server errors are thrown as FaroeError
. The error code is available from FaroeError.code
. See each method for a list of possible error codes.
import { Faroe, FaroeError } from "@faroe/sdk"
const faroe = new Faroe(url, secret);
try {
await faroe.createUser(password, clientIP);
} catch (e) {
if (e instanceof FaroeError) {
const errorCode = e.code;
}
}
Errors caused by fetch()
are wrapped as FaroeFetchError
.
Constructor
function constructor(url: string, credential: string | null): this
Parameters
url
: The base URL of the Faroe server (e.g.https://your-domain.com
).credential
: The server credential.
Methods
createUser()
createUserEmailUpdateRequest()
createUserEmailVerificationRequest()
createUserPasswordResetRequest()
deleteEmailUpdateRequest()
deletePasswordResetRequest()
deleteUser()
deleteUserEmailUpdateRequests()
deleteUserEmailVerificationRequest()
deleteUserPasswordResetRequests()
deleteUserTOTPCredential()
getEmailUpdateRequest()
getPasswordResetRequest()
getUser()
getUserEmailUpdateRequests()
getUserEmailVerificationRequest()
getUserPasswordResetRequests()
getUsers()
getUserTOTPCredential()
regenerateUserRecoveryCode()
registerUserTOTPCredential()
resetUser2FA()
resetUserPassword()
updateUserPassword()
verifyNewUserEmail()
verifyPasswordResetRequestEmail()
verifyUser2FAWithTOTP()
verifyUserEmail()
verifyUserPassword()
Example
import { Faroe } from "@faroe/sdk"
const faroe = new Faroe("https://your-domain.com", process.env.FAROE_CREDENTIAL);