# @chris.troutner/encrypt-msg

> A command-line app for sending and receiving e2e encrypted messages over the BCH blockchain.

Latest version **1.0.3** (published 2020-10-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @chris.troutner/encrypt-msg
pnpm add @chris.troutner/encrypt-msg
yarn add @chris.troutner/encrypt-msg
bun add @chris.troutner/encrypt-msg
```

Provides the command `encrypt-msg`.

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2020-10-09 |
| First published | 2020-05-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.0.0 |
| Dependencies | 12 |
| Unpacked size | 186.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Chris Troutner @christroutner |
| Maintainers | chris.troutner |
| Keywords | oclif |

## Links

- npm: https://www.npmjs.com/package/@chris.troutner/encrypt-msg
- Repository: https://github.com/Permissionless-Software-Foundation/encrypt-msg
- Issues: https://github.com/Permissionless-Software-Foundation/encrypt-msg/issues
- npm.io page: https://npm.io/package/@chris.troutner/encrypt-msg

## Dependencies (12)

- [wif](https://npm.io/package/wif.md) ^2.0.6
- [shelljs](https://npm.io/package/shelljs.md) ^0.8.2
- [cli-table](https://npm.io/package/cli-table.md) ^0.3.1
- [collect.js](https://npm.io/package/collect.js.md) ^4.16.6
- [zip-folder](https://npm.io/package/zip-folder.md) ^1.0.0
- [eccrypto-js](https://npm.io/package/eccrypto-js.md) ^5.2.0
- [bignumber.js](https://npm.io/package/bignumber.js.md) ^9.0.0
- [@oclif/config](https://npm.io/package/@oclif/config.md) ^1.9.0
- [@oclif/command](https://npm.io/package/@oclif/command.md) ^1.5.4
- [qrcode-terminal](https://npm.io/package/qrcode-terminal.md) ^0.12.0
- [@oclif/plugin-help](https://npm.io/package/@oclif/plugin-help.md) ^2.1.3
- [@chris.troutner/bch-js](https://npm.io/package/@chris.troutner/bch-js.md) ^2.5.3

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2020-10-09
- 1.0.2 — 2020-05-30
- 1.0.1 — 2020-05-30
- 1.0.0 — 2020-05-30

## README

# encrypt-msg
This is a command-line application for sending and receiving end-to-end (e2e)
encrypted messages over the Bitcoin Cash (BCH) blockchain. [IPFS](https://ipfs.io) is
used for passing encrypted content, but the BCH blockchain is used for signaling
messages.

- See the [Documentation](docs/README.md) for a list of media and the specification this application aspires implement.

- [This YouTube video demos this software](https://youtu.be/garL1s-NsPY)

- This app is also a fully-fledged HD wallet. It was forked from
[slp-cli-wallet](https://github.com/christroutner/slp-cli-wallet).

## Table of Contents
<!-- toc -->
* [encrypt-msg](#encrypt-msg)
* [Install Dev Environment](#install-dev-environment)
* [How to Use](#how-to-use)
* [Releases](#releases)
* [Command Line Usage](#command-line-usage)
* [Commands](#commands)
<!-- tocstop -->


# Install Dev Environment
While this npm library can be used globally, the intended audience is developers
familiar with the usage of `npm` and `git`. Here is how to set up your own
developer environment:

- Clone this repo with `git clone`.
- Install npm dependencies with `npm install`
- Execute the commands like this: `./bin/run help`

Running the wallet this way, you can edit the behavior of the wallet
by making changes to the code in the [src/commands](src/commands) directory.

# How to Use
There are a few main commands for sending and receiving message.
- create-wallet - to create a wallet.
- set-key - to generate a private/public key pair for encrypting messages.
- packag-file - zip up files and messages into a single file.
- encrypt-send - encrypt the zip file, upload it to IPFS, and signal the BCH address that they have a message.
- check-messages - see if there are any messages for your address.
- decrypt-messages - download file from IPFS and decrypt it.

# Releases

- v1.0.2 via IPFS (code only): https://cloudflare-ipfs.com/ipfs/QmRT3WYi79j1Np7nRwv1U4VKnU2dtS2cc5goNmxEJsxwAx
- v1.0.2 via IPFS (code and dependencies): https://cloudflare-ipfs.com/ipfs/QmXgvqN1HY3qxaCGnVVhda9jHGrAbUyh7oTkwjxxRXnVps

# Command Line Usage
<!-- usage -->
```sh-session
$ npm install -g @chris.troutner/encrypt-msg
$ encrypt-msg COMMAND
running command...
$ encrypt-msg (-v|--version|version)
@chris.troutner/encrypt-msg/1.0.3 linux-x64 node-v10.22.1
$ encrypt-msg --help [COMMAND]
USAGE
  $ encrypt-msg COMMAND
...
```
<!-- usagestop -->
# Commands
<!-- commands -->
* [`encrypt-msg burn-tokens`](#encrypt-msg-burn-tokens)
* [`encrypt-msg check-messages`](#encrypt-msg-check-messages)
* [`encrypt-msg create-wallet`](#encrypt-msg-create-wallet)
* [`encrypt-msg decrypt-messages`](#encrypt-msg-decrypt-messages)
* [`encrypt-msg derivation`](#encrypt-msg-derivation)
* [`encrypt-msg encrypt-send`](#encrypt-msg-encrypt-send)
* [`encrypt-msg get-address`](#encrypt-msg-get-address)
* [`encrypt-msg get-key`](#encrypt-msg-get-key)
* [`encrypt-msg get-private-key`](#encrypt-msg-get-private-key)
* [`encrypt-msg get-pubkey`](#encrypt-msg-get-pubkey)
* [`encrypt-msg hello`](#encrypt-msg-hello)
* [`encrypt-msg help [COMMAND]`](#encrypt-msg-help-command)
* [`encrypt-msg list-wallets`](#encrypt-msg-list-wallets)
* [`encrypt-msg package-file`](#encrypt-msg-package-file)
* [`encrypt-msg remove-wallet`](#encrypt-msg-remove-wallet)
* [`encrypt-msg send`](#encrypt-msg-send)
* [`encrypt-msg send-all`](#encrypt-msg-send-all)
* [`encrypt-msg send-tokens`](#encrypt-msg-send-tokens)
* [`encrypt-msg set-key`](#encrypt-msg-set-key)
* [`encrypt-msg sign-message`](#encrypt-msg-sign-message)
* [`encrypt-msg sweep`](#encrypt-msg-sweep)
* [`encrypt-msg update-balances`](#encrypt-msg-update-balances)

## `encrypt-msg burn-tokens`

Burn SLP tokens.

```
USAGE
  $ encrypt-msg burn-tokens

OPTIONS
  -n, --name=name        Name of wallet
  -q, --qty=qty
  -t, --tokenId=tokenId  Token ID
```

_See code: [src/commands/burn-tokens.js](https://github.com/Permissionless-Software-Foundation/encrypt-msg/blob/v1.0.3/src/commands/burn-tokens.js)_

## `encrypt-msg check-messages`

Check for messages on the blockchain

```
USAGE
  $ encrypt-msg check-messages

OPTIONS
  -c, --check=check  Number of messages to check (default is 2)
  -n, --name=name    Name of wallet

DESCRIPTION
  This command walks the BCH blockchain for the address set with the set-key command.
  If it finds transactions that match the protocol, it will display the subject.

  This command does the following:

  1. Get encryption data from the wallet.
  2. Get transaction history for the messaging address.
  3. Walk through the transactions, looking for an OP_RETURN in the TX.
  4. If OP_RETURN matches the MSG format, display the subject


  It only does this for the first message found, then exists.

  This is just a prototype.
```

_See code: [src/commands/check-messages.js](https://github.com/Permissionless-Software-Foundation/encrypt-msg/blob/v1.0.3/src/commands/check-messages.js)_

## `encrypt-msg create-wallet`

Generate a new HD Wallet.

```
USAGE
  $ encrypt-msg create-wallet

OPTIONS
  -n, --name=name  Name of wallet
  -t, --testnet    Create a testnet wallet
```

_See code: [src/commands/create-wallet.js](https://github.com/Permissionless-Software-Foundation/encrypt-msg/blob/v1.0.3/src/commands/create-wallet.js)_

## `encrypt-msg decrypt-messages`

Retrieve and display the encrypted message sent to this wallet.

```
USAGE
  $ encrypt-msg decrypt-messages

OPTIONS
  -n, --name=name  Name of wallet

DESCRIPTION
  Prototype command for retrieving, decrypting, and displaying a message using
  the Bitcoin Cash blockchain and IPFS. This command does the following:

  1. Get encryption data from the wallet.
  2. Get transaction history for the messaging address.
  3. Walk through the transactions, looking for an OP_RETURN in the TX.
  4. If OP_RETURN matches the MSG format, download the message from IPFS.
  5. Download, decrypt, and display the message.

  It only does this for the first message found, then exists.

  This is just a prototype.
```

_See code: [src/commands/decrypt-messages.js](https://github.com/Permissionless-Software-Foundation/encrypt-msg/blob/v1.0.3/src/commands/decrypt-messages.js)_

## `encrypt-msg derivation`

Display or set the derivation path used by the wallet.

```
USAGE
  $ encrypt-msg derivation

OPTIONS
  -n, --name=name  name to print
  -s, --save=save  save a new derivation path

DESCRIPTION
  This command is used to display the derivation path used by the wallet. The -s
  flag can be used to save a new derivation path.

  Common derivation paths used:
  145 - BIP44 standard path for Bitcoin Cash
  245 - BIP44 standard path for SLP tokens
  0 - Used by common software like the Bitcoin.com wallet and Honest.cash

  Wallets use the 245 derivation path by default.
```

_See code: [src/commands/derivation.js](https://github.com/Permissionless-Software-Foundation/encrypt-msg/blob/v1.0.3/src/commands/derivation.js)_

## `encrypt-msg encrypt-send`

Encrypt a message for another BCH address.

```
USAGE
  $ encrypt-msg encrypt-send

OPTIONS
  -a, --address=address  BCH address to find public key for

  -f, --file=file        The file you want to encrypt and send. The file should be placed in the 'packaged-files'
                         directory.

  -n, --name=name        Name of wallet to pay for BCH fees

  -s, --subject=subject  The 'subject' of the message. Can't be too long, and will not be encrypted. Wrap in double
                         quotes.

DESCRIPTION
  Given a BCH address, this command will do the following:
  1. It will search the blockchain for the public key associated with the address.
  2. It will encrypt the message with the public key.
  3. It will upload the encrypted message to IPFS.
  4. It will signal the address with an on-chain message.
  5. It will pay for the IPFS and BCH messages with the address set using set-key.
```

_See code: [src/commands/encrypt-send.js](https://github.com/Permissionless-Software-Foundation/encrypt-msg/blob/v1.0.3/src/commands/encrypt-send.js)_

## `encrypt-msg get-address`

Generate a new address to recieve BCH.

```
USAGE
  $ encrypt-msg get-address

OPTIONS
  -n, --name=name  Name of wallet
  -t, --token      Generate a simpledger: token address
```

_See code: [src/commands/get-address.js](https://github.com/Permissionless-Software-Foundation/encrypt-msg/blob/v1.0.3/src/commands/get-address.js)_

## `encrypt-msg get-key`

Get the encryption key info for the keypair set with set-key

```
USAGE
  $ encrypt-msg get-key

OPTIONS
  -n, --name=name  Name of wallet
```

_See code: [src/commands/get-key.js](https://github.com/Permissionless-Software-Foundation/encrypt-msg/blob/v1.0.3/src/commands/get-key.js)_

## `encrypt-msg get-private-key`

Generate a new private/public key pair.

```
USAGE
  $ encrypt-msg get-private-key

OPTIONS
  -n, --name=name  Name of wallet
```

_See code: [src/commands/get-private-key.js](https://github.com/Permissionless-Software-Foundation/encrypt-msg/blob/v1.0.3/src/commands/get-private-key.js)_

## `encrypt-msg get-pubkey`

Search the blockchain for a public key associated with an address.

```
USAGE
  $ encrypt-msg get-pubkey

OPTIONS
  -a, --address=address  BCH address to find public key for

DESCRIPTION
  Bitcoin Cash addresses are derived from a public key. If an address has made a
  transaction, then the public key can be retrieved from the blockchain. This
  public key is required in order to encrypt messages and files for that address.
```

_See code: [src/commands/get-pubkey.js](https://github.com/Permissionless-Software-Foundation/encrypt-msg/blob/v1.0.3/src/commands/get-pubkey.js)_

## `encrypt-msg hello`

Example command from oclif

```
USAGE
  $ encrypt-msg hello

OPTIONS
  -n, --name=name  name to print

DESCRIPTION
  ...
  Leaving it here for future reference in development.
```

_See code: [src/commands/hello.js](https://github.com/Permissionless-Software-Foundation/encrypt-msg/blob/v1.0.3/src/commands/hello.js)_

## `encrypt-msg help [COMMAND]`

display help for encrypt-msg

```
USAGE
  $ encrypt-msg help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI
```

_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v2.2.1/src/commands/help.ts)_

## `encrypt-msg list-wallets`

List existing wallets.

```
USAGE
  $ encrypt-msg list-wallets
```

_See code: [src/commands/list-wallets.js](https://github.com/Permissionless-Software-Foundation/encrypt-msg/blob/v1.0.3/src/commands/list-wallets.js)_

## `encrypt-msg package-file`

Zips file or directory.

```
USAGE
  $ encrypt-msg package-file

OPTIONS
  -f, --file=file        Path of the file or directory
  -m, --message=message  The message you want to encrypt and send. Wrap in double quotes.

DESCRIPTION
  1-Copies the file or the specified directory
  2-Exports the message in a JSON file
  3-Creates a ZIP file with both contents
```

_See code: [src/commands/package-file.js](https://github.com/Permissionless-Software-Foundation/encrypt-msg/blob/v1.0.3/src/commands/package-file.js)_

## `encrypt-msg remove-wallet`

Remove an existing wallet.

```
USAGE
  $ encrypt-msg remove-wallet

OPTIONS
  -n, --name=name  Name of wallet
```

_See code: [src/commands/remove-wallet.js](https://github.com/Permissionless-Software-Foundation/encrypt-msg/blob/v1.0.3/src/commands/remove-wallet.js)_

## `encrypt-msg send`

Send an amount of BCH

```
USAGE
  $ encrypt-msg send

OPTIONS
  -a, --sendAddr=sendAddr  Cash address to send to
  -b, --bch=bch            Quantity in BCH
  -n, --name=name          Name of wallet
```

_See code: [src/commands/send.js](https://github.com/Permissionless-Software-Foundation/encrypt-msg/blob/v1.0.3/src/commands/send.js)_

## `encrypt-msg send-all`

Send all BCH in a wallet to another address. **Degrades Privacy**

```
USAGE
  $ encrypt-msg send-all

OPTIONS
  -a, --sendAddr=sendAddr  Cash address to send to
  -i, --ignoreTokens       Ignore and burn tokens
  -n, --name=name          Name of wallet

DESCRIPTION
  Send all BCH in a wallet to another address.

  This method has a negative impact on privacy by linking all addresses in a
  wallet. If privacy of a concern, CoinJoin should be used.
  This is a good article describing the privacy concerns:
  https://bit.ly/2TnhdVc
```

_See code: [src/commands/send-all.js](https://github.com/Permissionless-Software-Foundation/encrypt-msg/blob/v1.0.3/src/commands/send-all.js)_

## `encrypt-msg send-tokens`

Send SLP tokens.

```
USAGE
  $ encrypt-msg send-tokens

OPTIONS
  -a, --sendAddr=sendAddr  Cash or SimpleLedger address to send to
  -n, --name=name          Name of wallet
  -q, --qty=qty
  -t, --tokenId=tokenId    Token ID
```

_See code: [src/commands/send-tokens.js](https://github.com/Permissionless-Software-Foundation/encrypt-msg/blob/v1.0.3/src/commands/send-tokens.js)_

## `encrypt-msg set-key`

Generate a new private/public key pair, to use for encryption.

```
USAGE
  $ encrypt-msg set-key

OPTIONS
  -n, --name=name  Name of wallet
```

_See code: [src/commands/set-key.js](https://github.com/Permissionless-Software-Foundation/encrypt-msg/blob/v1.0.3/src/commands/set-key.js)_

## `encrypt-msg sign-message`

Sign message

```
USAGE
  $ encrypt-msg sign-message

OPTIONS
  -i, --sendAddrIndex=sendAddrIndex    Adress index
  -n, --name=name                      Name of wallet
  -s, --signTheMessage=signTheMessage  Sign message
```

_See code: [src/commands/sign-message.js](https://github.com/Permissionless-Software-Foundation/encrypt-msg/blob/v1.0.3/src/commands/sign-message.js)_

## `encrypt-msg sweep`

Sweep a private key

```
USAGE
  $ encrypt-msg sweep

OPTIONS
  -a, --address=address  Address to sweep funds to.
  -b, --balanceOnly      Balance only, no claim.
  -t, --testnet          Testnet
  -w, --wif=wif          WIF private key

DESCRIPTION
  ...
  Sweeps a private key in WIF format.
  Supports SLP token sweeping, but only one token class at a time. It will throw
  an error if a WIF contains more than one class of token.
```

_See code: [src/commands/sweep.js](https://github.com/Permissionless-Software-Foundation/encrypt-msg/blob/v1.0.3/src/commands/sweep.js)_

## `encrypt-msg update-balances`

Poll the network and update the balances of the wallet.

```
USAGE
  $ encrypt-msg update-balances

OPTIONS
  -i, --ignoreTokens  Ignore and burn tokens
  -n, --name=name     Name of wallet
```

_See code: [src/commands/update-balances.js](https://github.com/Permissionless-Software-Foundation/encrypt-msg/blob/v1.0.3/src/commands/update-balances.js)_
<!-- commandsstop -->

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