# @infinex/wallet

> iframe hosted web wallet for ethereum

Latest version **0.0.1** (published 2023-08-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @infinex/wallet
pnpm add @infinex/wallet
yarn add @infinex/wallet
bun add @infinex/wallet
```

Provides the command `wallet`.

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2023-08-14 |
| First published | 2023-08-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=18 |
| Dependencies | 8 |
| Unpacked size | 17.6 KB |
| Known vulnerabilities | 0 (+19 in 2 direct dependencies) |
| Install scripts | no |
| Maintainers | kyelewis, exogee-kevin |

## Links

- npm: https://www.npmjs.com/package/@infinex/wallet
- npm.io page: https://npm.io/package/@infinex/wallet

## Dependencies (8)

- [arg](https://npm.io/package/arg.md) 5.0.2
- [vite](https://npm.io/package/vite.md) 4.4.7
- [ethers](https://npm.io/package/ethers.md) 6.6.5
- [esbuild](https://npm.io/package/esbuild.md) 0.18.16
- [typescript](https://npm.io/package/typescript.md) 5.1.6
- [detectincognitojs](https://npm.io/package/detectincognitojs.md) 1.3.0
- [@infinex/iframe-ipc](https://npm.io/package/@infinex/iframe-ipc.md) 0.0.1
- [@infinex/wallet-identifier-strategy-jwt](https://npm.io/package/@infinex/wallet-identifier-strategy-jwt.md) 0.0.1

## Recent versions

- 0.0.1 (latest) — 2023-08-14

## README

# @infinex/wallet - Wallet App

iframe-hosted web wallet for ethereum

## Usage

```
npx @infinex/wallet [serve|build] \
  --output-directory=dist-wallet \
  --identifier-strategy=jwt \
  --identifier-strategy-jwt-claim=id \
  --identifier-strategy-jwt-jwks={} \
  --redirect-url=http://localhost
```

- Run `build` and upload the resulting HTML/JS output to a static web host.
- Use `@infinex/wallet-sdk` to communicate with the wallet.
- For security, both the wallet and the parent app must be on separate origins.
- These can be different ports and/or different domains or subdomains.

## postMessage API

### Unlock Wallet

```json
// Send 'unlock' method to iframe
{ "id": 1234, "method": "unlock", "args": { "identifier": "jwt_or_other_identifier..." } }

// Return message - Unlock was successful
{ "id": 1234, "result": { "address": "0xabc123bef987" } }

// Return message - Error while unlocking
{ "id": 1234, "error": { "message": "No wallet with the provided identifier" } }
```

### Sign Message

```json
// Send 'signmessage' method to iframe
{ "id": 5678, "method": "signMessage", "args": { "message": "my message" } }<

// Return message - Message signing was successful
{ "id": 5678, "result": { "signature": "abc123bef987" } }

// Return message - Error while signing message
{ "id": 5678, "error": { "message": "Wallet is locked" } }
```

### Sign Transaction

```json
// Send 'signTransaction' method to iframe - `transaction` should be a raw transaction string.
// for ethers, use `transaction.unsignedSerialized`
{
  "id": 9012,
  "method": "signTransaction",
  "args": { "transaction": "raw-transaction" }
}
```

### Lock Wallet

```json
// Send 'lock' method to iframe
{ "id": 3456, "method": "lock" }

// Return message - Wallet lock was successful
{ "id": 3456, "result": {} }

// Return message - Error while locking wallet
{ "id": 3456, "error": { "message": "Wallet is already locked" } }
```

### Clear Wallet Storage

```json
// Send 'clearStorage' method to iframe
{ "id": 7890, "method": "clearStorage" }

// Return mesage - wallet lock was successful
{ "id": 7890, "result": {} }

// Return message - Error while clearing storage
{ "id": 7890, "error": { "message": "Wallet app is not initialised" } }
```

---
_Source: https://npm.io/package/@infinex/wallet · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
