Nurama Developers
Namespaces

auth

Methods and types of the `auth` namespace (`client.auth` / `bot.auth`).

Interfaces

ChangePasswordData

Properties

PropertyType
currentPasswordstring
mfaToken?string
newPasswordstring

DisableMFAData

Properties

PropertyType
mfaTokenstring

LoginCredentials

Properties

PropertyTypeDescription
inviteId?stringOptional. When signing in to accept an invite, pass the invite id: it only reaches the user through the message sent to that address, so quoting it proves control of the inbox and lifts the email-verification grace block for this login. Credentials are still required.
loginstring-
passwordstring-

LoginRegisterResponse

Properties

PropertyType
tokensAuthTokens
userUser

RefreshResponse

Extends

  • AuthTokens

Properties

PropertyTypeInherited from
accessTokenAuthTokens.access
refreshTokenAuthTokens.refresh
verifyMfa?TokenAuthTokens.verifyMfa

RegisterUserData

Extends

  • Pick<User, "firstName" | "lastName" | "email">

Properties

PropertyTypeDescriptionInherited from
emailstringThe email address of the user. Format emailPick.email
firstNamestringThe first name of the user. Min Length 3 Max Length 35Pick.firstName
lastNamestringThe last name of the user. Max Length 35Pick.lastName
passwordstring--

ResetPasswordData

Properties

PropertyType
passwordstring
tokenstring

VerifyBackupCodeData

Properties

PropertyType
backupCodestring

VerifyMFAData

Properties

PropertyType
mfaTokenstring

Functions

default()

function default(client): {
  changePassword: Promise<void>;
  disableMfa: Promise<void>;
  enableMfa: Promise<MFAEnableResponse>;
  exchangeOAuthCode: Promise<OAuthExchangeResponse>;
  forgotPassword: Promise<void>;
  getLinkedOAuthProviders: Promise<LinkedAuthProvider[]>;
  linkOAuthProvider: Promise<LoginRegisterResponse>;
  lockAccount: Promise<void>;
  login: Promise<LoginRegisterResponse>;
  logout: Promise<void>;
  refreshTokens: Promise<RefreshResponse>;
  register: Promise<LoginRegisterResponse>;
  registerGuest: Promise<void>;
  resendVerification: Promise<void>;
  resetPassword: Promise<void>;
  sendVerificationEmail: Promise<void>;
  setPassword: Promise<void>;
  unlinkOAuthProvider: Promise<void>;
  upgradeGuest: Promise<{
     user: User;
  }>;
  verifyBackupCode: Promise<MFAVerifyResponse>;
  verifyEmail: Promise<void>;
  verifyGuest: Promise<LoginRegisterResponse>;
  verifyMfa: Promise<MFAVerifyResponse>;
};

Defines authentication-related methods for the NuramaClient.

Parameters

ParameterTypeDescription
clientdefaultThe NuramaClient instance.

Returns

An object containing the authentication methods.

NameTypeDescription
changePassword()( currentPassword, newPassword, mfaToken? ) => Promise<void>Changes the authenticated user's password. Requires current password verification and MFA token if MFA is enabled. All refresh tokens will be invalidated after password change.
disableMfa()(mfaToken) => Promise<void>Disables multi-factor authentication for the authenticated user. Requires a current valid MFA token for confirmation.
enableMfa()() => Promise<MFAEnableResponse>Enables multi-factor authentication for the authenticated user.
exchangeOAuthCode()(code) => Promise<OAuthExchangeResponse>-
forgotPassword()(email) => Promise<void>Forgets a user's password.
getLinkedOAuthProviders()() => Promise<LinkedAuthProvider[]>Gets all OAuth providers linked to the authenticated user's account.
linkOAuthProvider()(provider) => Promise<LoginRegisterResponse>Links an OAuth provider to the authenticated user's account. This allows users to sign in with multiple OAuth providers.
lockAccount()(token) => Promise<void>Locks a user account using a lock account token. This is used when a user receives a password changed notification for a change they did not initiate, allowing them to immediately secure their account.
login()(credentials) => Promise<LoginRegisterResponse>Logs in a user.
logout()(refreshToken) => Promise<void>Logs out a user.
refreshTokens()(refreshToken?) => Promise<RefreshResponse>Refreshes user tokens.
register()(userData) => Promise<LoginRegisterResponse>Registers a new user.
registerGuest()(data) => Promise<void>Registers a guest account for public chat participation. Always returns void (204) regardless of outcome for anti-enumeration.
resendVerification()(email) => Promise<void>Public, unauthenticated resend of the verification email keyed by address. For users past the verification grace window who can't log in or call the authed sendVerificationEmail. Always resolves (the server returns 204 regardless of whether the email exists).
resetPassword()(params) => Promise<void>Resets a user's password.
sendVerificationEmail()() => Promise<void>Sends a verification email to the authenticated user.
setPassword()(password, mfaToken?) => Promise<void>Sets a password for an OAuth-only user account. This allows OAuth users to add local authentication as a backup.
unlinkOAuthProvider()(provider) => Promise<void>Unlinks an OAuth provider from the authenticated user's account. User must have at least one authentication method remaining (password or another OAuth provider).
upgradeGuest()(data) => Promise<{ user: User; }>Upgrades a guest account to a standard account with a password. Requires the user to be authenticated as a guest.
verifyBackupCode()(backupCode) => Promise<MFAVerifyResponse>Verifies an MFA backup code. This is used during login when a user has lost access to their authenticator app.
verifyEmail()(token) => Promise<void>Verifies a user's email using the provided token.
verifyGuest()(token) => Promise<LoginRegisterResponse>Verifies a guest account using the token from the verification email. Stores auth tokens on success and returns user data.
verifyMfa()(mfaToken) => Promise<MFAVerifyResponse>Verifies an MFA token (e.g., TOTP code). This is used both during initial MFA setup and during login challenges.

On this page