npm package: @secrez/courier
Description: A listener for Secrez.
Author: Francesco Sullo
Latest version: 0.2.3

# @secrez/courier

A courier component for Secrez.

Secrez-courier activates a local server which publish itself on a remote hub and allows communications between local secrez accounts.

## Install

To install

```
npm i -g @secrez/courier
```

## Usage

You can just run

```
secrez-courier
```

Install your own hub and pass it like

```
secrez-courier -H https://my-secrez-hub.com
```

When you launch the courier for the first time you can define the owner of the courier. You can do it explicitly, like

```
secrez-courier -o BJwJ57ZEyE7DSJDj9BMb785TqbSXTCUu1zEGmaPQgbr2076BhxWxf8j3sMDDK311GTQVGBrfMqUepiWV7HL56FbeL
```

specifying your public key. Alternatively, if you don't set it, the first secrez account that will try to use the courier will become its owner.

If you want to activate two courier on your localhost, you must specify the data root. By default, the courier saves its data in `~/.secrez-courier`. You can set a different root with, for example:

```
secrez-courier -r ~/.some-other-root
```

In any case, the courier will produce a message showing the port where it is listening to.

## How to use it is Secrez

After entering in Secrez, to see your public key, you can run `whoami`.

To activate the connection to the courier, run `courier`. It will ask for the port where the courier is listening to. Type it and it will take ownership of the courier and will publish it to the hub.

## Notes

The courier just work as a post office. It is able to send and receive messages but it has no idea what a message contains. It just verifies that any message has a payload and a signature. If they are correct and the public key of the signer is in your trusted circle, the courier accepts the message, if not it produces an error. The data are saved in an SQLite3 database.

The connected Secrez account will then be able to receive message in real time or to get the history specifying the interval.

## History

**0.2.0**

- Align to @secrez/hub 0.2.0

## Test coverage

```
  12 passing (5s)

------------|---------|----------|---------|---------|----------------------------------------------
File        | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                            
------------|---------|----------|---------|---------|----------------------------------------------
All files   |    79.2 |    64.71 |   79.55 |   79.12 |                                              
 App.js     |   78.49 |    63.41 |   69.23 |   78.49 | ...0,156,186,191-193,197-198,207-209,221,231 
 Config.js  |     100 |      100 |     100 |     100 |                                              
 Courier.js |   83.33 |        0 |      50 |   83.33 | 11                                           
 Db.js      |   91.49 |    74.19 |     100 |   91.49 | 84-87                                        
 Server.js  |   69.66 |     56.1 |   71.43 |   69.32 | 15,54-61,90,95,111,135-150,155-158,162-173   
------------|---------|----------|---------|---------|----------------------------------------------
```

## Copyright

(c) 2020-present [Francesco Sullo](https://francesco.sullo.co) (<francesco@sullo.co>)

## Licence

MIT