Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tiagolr/bchandshake


https://github.com/tiagolr/bchandshake

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# bcevents

Establish a shared secret between two parties over the blockchain using ECDH (Elliptic-curve Diffie–Hellman).

## Install

```
npm install bchandshake datapay bsv
```

## Get Started

```js
// client
var Handshake = require('bchandshake')
var handshake = new Handshake({ pkey: 'privkey for tx fees' })
const res = await handshake.request()
console.log(res.sharedKey) // e4f56533a941d809.....

// oracle
var handshake = new Handshake({ pkey: 'privkey for tx fees' })
handshake.onRequest(req => {
req.accept() // completes the handshake
console.log(req.sharedKey) // 'e4f56533a941d809.....
})
```

## Protocol

## Examples

### Encrypted ping-pong
// complete ping-pong example (use custom genKey, regenerate keys after each message)