> For the complete documentation index, see [llms.txt](https://toroforges-organization.gitbook.io/toroforge-collective/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://toroforges-organization.gitbook.io/toroforge-collective/getting-started/sdks/javascript/wallet-management.md).

# Wallet Management

### 🔐 Wallet Management

The ToroForge Node.js SDK offers complete tools for managing user wallets on the **Toronet blockchain** — including creation, import, name registration (TNS), password verification, and key access.

***

#### 📘 What You Can Do

* Create a new Toronet wallet
* Assign a Toronet Naming System (TNS) name
* Import an existing wallet using a private key
* Verify wallet password integrity
* Retrieve wallet keys securely

***

### 🧱 Features & Usage

***

#### ✅ Create a New Wallet

Generate a new wallet address by providing a secure password.

```ts
import { createWallet } from 'torosdk';

const walletAddress = await createWallet({
  password: 'securePassword123',
});
```

Returns a Toronet-compatible wallet address.

***

#### 🧠 Assign a TNS (Toronet Name)

Once a wallet is created, you can register a human-readable name for the address.

```ts
import { setTNSName } from 'torosdk';

await setTNSName({
  address: '0xWalletAddress',
  password: 'securePassword123',
  username: 'exampleName',
});
```

Names are unique and can be used across the Toronet ecosystem.

***

#### 🔁 Import Wallet From Private Key

If a user already has a private key, import it into the SDK with a new password.

```ts
import { importWalletFromPrivateKeyAndPassword } from 'torosdk';

const address = await importWalletFromPrivateKeyAndPassword({
  pvkey: 'yourPrivateKeyHere',
  password: 'newWalletPassword',
});
```

***

#### 🔒 Verify Wallet Password

Check whether a given password is valid for a Toronet address.

```ts
import { verifyWalletPassword } from 'torosdk';

const isValid = await verifyWalletPassword({
  address: '0xWalletAddress',
  password: 'testPassword',
});
```

Returns `true` or `false`.

***

#### 🔑 Retrieve Wallet Key

Use this only when absolutely necessary (e.g. for backup or migrations):

```ts
import { getWalletKey } from 'torosdk';

const keyInfo = await getWalletKey({
  address: '0xWalletAddress',
});
console.log(keyInfo); // { pubkey, privkey }
```

⚠️ **Always store keys securely. Never expose them on the frontend.**

***

### 🧩 Best Practices

* Always **encrypt passwords** in transit and storage.
* Use environment variables for admin credentials when working with wallet APIs that require authorization.
* Avoid calling `getWalletKey()` on the client side.

***

### 📎 Related Sections

* [Token & Balance Queries](https://chatgpt.com/c/balances.md)
* [KYC Verification](https://chatgpt.com/c/kyc.md)
* [Fiat Deposits](https://chatgpt.com/c/deposits.md)

***
