Account Management

Account management methods for the Nimiq Hub

Restricted Access

These methods are currently only accessible from the Nimiq Safe application, not from third-party apps. This documentation is provided for completeness and for developers experimenting with their own Hub servers.

Overview

The Hub API provides several methods for managing Nimiq accounts:

Core Methods

Signup

Creates a new account with an Identicon and optional password.

const accounts = await hubApi.signup({
    appName: 'My App',
});
 
interface Account {
    accountId: string;       // Generated account ID
    label: string;          // Account name
    type: WalletType;       // 1: browser wallet, 2: Ledger
    fileExported: boolean;  // Login File status
    wordsExported: boolean; // Recovery Words status
    addresses: Array<{      // Initial address
        address: string;    // Nimiq address
        label: string;      // Address label
    }>;
}

Login

Imports existing accounts via Login File, Recovery Words, or Account Access File.

const accounts = await hubApi.login({
    appName: 'My App',
});
 
// Returns Account[] (same as signup)
// Automatically detects active addresses using BIP44

Onboard

Unified onboarding flow combining Signup, Login, and Ledger connection.

const accounts = await hubApi.onboard({
    appName: 'My App',
});
 
// Returns Account[] (same as signup)
// Presents choice menu to users

Logout

Removes an account with optional export of credentials.

const result = await hubApi.logout({
    appName: 'My App',
    accountId: 'xxxxxxxx',
});
 
// Returns { success: true }

Export

Retrieves Login File or Recovery Words.

const result = await hubApi.export({
    appName: 'My App',
    accountId: 'xxxxxxxx',
    fileOnly?: boolean,    // Optional: limit to Login File
    wordsOnly?: boolean,   // Optional: limit to Recovery Words
});
 
interface ExportResult {
    fileExported: boolean;
    wordsExported: boolean;
}

Change Password

Updates account password.

const result = await hubApi.changePassword({
    appName: 'My App',
    accountId: 'xxxxxxxx',
});
 
// Returns { success: true }

Add Address

Derives and adds a new address to an account.

const address = await hubApi.addAddress({
    appName: 'My App',
    accountId: 'xxxxxxxx',
});
 
interface Address {
    address: string;  // Nimiq address
    label: string;    // Address label
}

Rename

Updates account or address labels.

const account = await hubApi.rename({
    appName: 'My App',
    accountId: 'xxxxxxxx',
    address?: string,  // Optional: pre-select address
});
 
// Returns Account (same as signup)

Request Types Reference

All available account management request types:

enum HubApi.RequestType {
    SIGNUP = 'signup',
    LOGIN = 'login',
    ONBOARD = 'onboard',
    LOGOUT = 'logout',
    EXPORT = 'export',
    CHANGE_PASSWORD = 'change-password',
    ADD_ADDRESS = 'add-address',
    RENAME = 'rename',
}

Implementation Notes

  • All methods return promises and are asynchronous
  • Each method requires at minimum an appName parameter
  • Account operations require a valid accountId
  • Methods with UI components handle their own interface flow
  • Follow BIP44 for address detection

Warning: These methods are restricted to Nimiq Safe. Third-party applications should use the public API methods instead.

On this page