Channel operations.
Device management methods.
Emoji operations.
File upload/download methods.
This is true if the client has ever been initialized. You can only initialize a client once.
This is true if the client has ever logged in before. You can only login a client once.
Invite-management methods.
Helpers for information/actions related to the currently authenticated account.
Message operations (direct and group).
Server moderation helper methods.
Permission-management methods for the current user.
Server operations.
Encryption-session helpers.
User operations.
StaticdecryptDecrypts a secret key from encrypted data produced by encryptKeyData().
Pass-through utility from @vex-chat/crypto.
Decrypts a secret key from the binary format produced by encryptKeyData(). No I/O — the caller handles reading the data.
The encrypted key data as a Uint8Array.
The password used to encrypt.
The hex-encoded secret key.
StaticencryptEncrypts a secret key with a password.
Pass-through utility from @vex-chat/crypto.
Encrypts a secret key with a password and saves it as a file.
The password to derive the encryption key from.
The hex-encoded secret key to encrypt.
OptionaliterationOverride: numberOptional PBKDF2 iteration count (random if omitted).
The encrypted key data as a Uint8Array.
Manually closes the client. Emits the closed event on successful shutdown.
Connects your device to the chat. You must have a valid Bearer token. You can check whoami() to see before calling connect().
Gets the hex string representations of the public and private keys.
Authenticates with username/password and stores the Bearer auth token.
Account username.
Account password.
null on success, or the thrown error object on failure.
Authenticates using the device's Ed25519 signing key. No password needed — proves possession of the private key via challenge-response. Issues a short-lived (1-hour) JWT.
Used by auto-login when stored credentials have a deviceKey but no valid session.
OptionaldeviceID: stringLogs out the current authenticated session from the server.
Registers a new account on the server.
The username to register. Must be unique.
The error, or the user object.
Returns a compact <username><deviceID> debug label.
Returns details about the currently authenticated session.
The authenticated user, token expiry, and active token.
StaticcreateCreates and initializes a client in one step.
OptionalprivateKey: stringOptional hex secret key. When omitted, a fresh key is generated.
Optionaloptions: IClientOptionsRuntime options.
Optionalstorage: IStorageOptional custom storage backend implementing IStorage.
StaticgenerateGenerates an ed25519 secret key as a hex string.
StaticrandomGenerates a random username using bip39.
This is emitted for file progress events.
Example:
client.on("ready", () => {
await client.register()
});
This is emitted whenever the keyring is done initializing after an init() call. You must wait to login or register until after this event.
Example:
client.on("ready", () => {
await client.register()
});
Emitted before the first inbox fetch/decrypt cycle after connect.
Use this to show temporary loading UI while historical messages are decrypted from server payloads.
This is emitted when you are connected to the chat.
Example:
client.on("connected", (user) => {
// do something
});
This is emitted for every sent and received message.
Example:
client.on("message", (msg: IMessage) => {
console.log(message);
});
This is emitted when the user is granted a new permission.
Example:
client.on("permission", (perm: IPermission) => {
console.log(perm);
});
This is emitted whenever the connection is closed. You must discard the client and connect again with a fresh one.
Example:
client.on("disconnect", () => {
// do something
});
This is emitted whenever the close() event is called and completed successfully. Note this is not fired for an unintentional disconnect, see the disconnect event.
Example:
client.on("closed", () => {
process.exit(0);
});
Client provides an interface for you to use a vex chat server and send end to end encrypted messages to other users.
Example