open-index/open-npm huggingface dataset:
npm package: @nearform/trail-fastify-plugin
Description: Fastify plugin for the audit trail logging service
Author: nearForm Ltd
Latest version: 6.0.0

# @nearform/trail-fastify-plugin

[![npm][npm-badge]][npm-url]

trail-fastify-plugin is a plugin to add the trail REST API to a [Fastify][fastify] server.

## Install

To install via npm:

    npm install @nearform/trail-fastify-plugin

## Usage

```javascript
const Fastify = require('fastify')

const main = async function() {
  const fastify = Fastify()

  fastify.register(require('@nearform/trail-fastify-plugin'))

  await fastify.listen(3000, console.log)
}

main().catch(console.error)
```

Trails route will be then accessible on the `/trails` path.

For more information on the REST API, you can check the generated OpenAPI / Swagger JSON file, which will available at the `/trails/swagger.json` path.

## Configuration

The plugin takes the following configuration options:

-   `logger`: A logger to be passed to the trails manager.
-   `db`: Database settings for the trails manager.
-   `pool`: A pre-configured database pool to be used by the trails manager; used in preference to any specified database settings.
-   `trailsManager`: A pre-configured trails manager instance; used in preference to any of the previous settings.

## License

Copyright nearForm Ltd 2020. Licensed under [MIT][license].

[npm-url]: https://npmjs.org/package/@nearform/trail-fastify-plugin

[npm-badge]: https://img.shields.io/npm/v/@nearform/trail-fastify-plugin.svg

[fastify]: https://www.fastify.io/

[license]: ./LICENSE.md
npm package: @nearform/trail-fastify-server
Description: Server running Fastify plugin for the audit trail logging service
Author: nearForm Ltd
Latest version: 6.0.0

# @nearform/trail-fastify-server

[![npm][npm-badge]][npm-url]

trail-fastify-server is a ready to use [Fastify][fastify] server with the trail-fastify-plugin registered.

It also provides a local instance of [Swagger UI][swagger-ui] to easily check the REST API documentation.

## Install

To install via npm:

    npm install @nearform/trail-fastify-server

## Usage

    npx run trail-fastify-server

This will start a server on `localhost:8080`. Swagger UI documentation is accessible at `http://localhost:8080/documentation/`.

## Configuration

The server looks for the following environment variables:

-   `TRAIL_DB_HOST`: The hostname for the trail database.
-   `TRAIL_DB_PORT`: The port number for the trail database.
-   `TRAIL_DB_NAME`: The name of the trail database.
-   `TRAIL_DB_USERNAME`: The username for the trail database.
-   `TRAIL_DB_PASSWORD`: The password for the trail database.
-   `TRAIL_DB_POOL_SIZE`: The size of the trail DB pool.
-   `TRAIL_DB_TIMEOUT`: The trail database idle timeout, in milliseconds.
-   `TRAIL_HTTP_HOST`: The hostname the HTTP server is bound to.
-   `TRAIL_HTTP_PORT`: The port the HTTP server is bound to.
-   `TRAIL_CORS_ORIGIN`: The value for Access-Control-Allow-Origin header as per fastify-cors plugin.
-   `TRAIL_USE_REST_API`: Flag indicating whether to mount the REST API.
-   `TRAIL_USE_GRAPHQL`: Flag indicating whether to mount the graphql endpoint.

These can also be defined using a `.env` file.

The server also takes the following command line options:

-   `--dbHost <host>`: The hostname for the trail database. Defaults to `localhost`.
-   `--dbPort <port>`: The port number for the trail database. Defaults to `5432`.
-   `--dbName <name>`: The name of the trail database. Defaults to `trails`.
-   `--dbUsername <user>`: The username for the trail database. Defaults to `postgres`.
-   `--dbPassword <password>`: The password for the trail database. Defaults to `postgres`.
-   `--dbPoolsize <size>`: The size of the trail DB pool. Defaults to `10`.
-   `--dbTimeout <ms>`: The trail database idle timeout, in milliseconds. Defaults to `30000`.
-   `--httpHost <host>`: The hostname the HTTP server is bound to. Defaults to `localhost`.
-   `--httpPort <port>`: The port the HTTP server is bound to. Defaults to `8080`.
-   `--corsOrigin <origin>`: set value for `Access-Control-Allow-Origin` header. Defaults to ``.
-   `--useRESTAPI`: Flag indicating whether to start with the Trail's REST API. Defaults to `true`.
-   `--useGraphql`: Flag indicating whether to start with the graphql query endpoint. Defaults to `true`.

Command line options take precedence over environment settings.

## License

Copyright nearForm Ltd 2020. Licensed under [MIT][license].

[npm-url]: https://npmjs.org/package/@nearform/trail-fastify-server

[npm-badge]: https://img.shields.io/npm/v/@nearform/trail-fastify-server.svg

[fastify]: https://www.fastify.io/

[swagger-ui]: https://swagger.io/swagger-ui/

[license]: ./LICENSE.md
npm package: @nearform/trail-hapi-plugin
Description: Hapi plugin for the audit trail logging service
Author: nearForm Ltd
Latest version: 6.0.0

# @nearform/trail-hapi-plugin

[![npm][npm-badge]][npm-url]

trail-hapi-plugin is a plugin to add the trail REST API to a [Hapi][hapi] server.

## Install

To install via npm:

    npm install @nearform/trail-hapi-plugin

## Usage

```javascript
const main = async function() {
  const server = require('hapi').Server({host: 'localhost', port: 80})

  await server.register([
    {
      plugin: require('@nearform/trail-hapi-plugin'),
    }
  ])

  await server.start()
  logMessage(`Server running at: ${server.info.uri}`)
}

main().catch(console.error)
```

Trails route will be then accessible on the `/trails` path.

For more information on the REST API, you can check the generated OpenAPI / Swagger JSON file, which will available at the `/trails/swagger.json` path.

## Configuration

The plugin takes the following configuration options:

-   `logger`: A logger to be passed to the trails manager.
-   `db`: Database settings for the trails manager.
-   `pool`: A pre-configured database pool to be used by the trails manager; used in preference to any specified database settings.
-   `trailsManager`: A pre-configured trails manager instance; used in preference to any of the previous settings.

## License

Copyright nearForm Ltd 2018. Licensed under [MIT][license].

[npm-url]: https://npmjs.org/package/@nearform/trail-hapi-plugin

[npm-badge]: https://img.shields.io/npm/v/@nearform/trail-hapi-plugin.svg

[hapi]: https://hapijs.com/

[license]: ./LICENSE.md
npm package: @nearform/trail-hapi-server
Description: Server running Hapi plugin for the audit trail logging service
Author: nearForm Ltd
Latest version: 6.0.0

# @nearform/trail-hapi-server

[![npm][npm-badge]][npm-url]

trail-hapi-server is a ready to use [Hapi][hapi] server with the trail-hapi-plugin registered.

It also provides a local instance of [Swagger UI][swagger-ui] to easily check the REST API documentation.

## Install

To install via npm:

    npm install @nearform/trail-hapi-server

## Usage

    npx run trail-hapi-server

This will start a server on `localhost:8080`. Swagger UI documentation is accessible at `http://localhost:8080/documentation/`.

## Configuration

The server looks for the following environment variables:

-   `TRAIL_DB_HOST`: The hostname for the trail database.
-   `TRAIL_DB_PORT`: The port number for the trail database.
-   `TRAIL_DB_NAME`: The name of the trail database.
-   `TRAIL_DB_USERNAME`: The username for the trail database.
-   `TRAIL_DB_PASSWORD`: The password for the trail database.
-   `TRAIL_DB_POOL_SIZE`: The size of the trail DB pool.
-   `TRAIL_DB_TIMEOUT`: The trail database idle timeout, in milliseconds.
-   `TRAIL_HTTP_HOST`: The hostname the HTTP server is bound to.
-   `TRAIL_HTTP_PORT`: The port the HTTP server is bound to.
-   `TRAIL_LOG_LEVEL`: The logging level; defaults to `warn`.
-   `TRAIL_DISABLE_REST_API`: Switch indicating whether to disable the REST API.
-   `TRAIL_DISABLE_GRAPHQL`: Switch indicating whether to disable the graphql endpoint.

These can also be defined using a `.env` file.

The server also takes the following command line options:

-   `--dbHost <host>`: Set the database host name; defaults to `localhost`.
-   `--dbPort <port>`: Set the database port; defaults to `5432`.
-   `--dbName <name>`: Set the database name; defaults to `trails`.
-   `--dbUsername <user>`: Set the database username; defaults to `postgres`.
-   `--dbPassword <password>`: Set the database password; defaults to `postgres`.
-   `--dbPoolsize <size>`: Set the database pool size; defaults to `10`.
-   `--dbTimeout <ms>`: Set the database pool timeout, in milliseconds; defaults to `30000`.
-   `--httpHost <host>`: Set the HTTP hostname; defaults to `localhost`.
-   `--httpPort <port>`: Set the HTTP port; defaults to `8080`.
-   `--logLevel <level>: Set the logger level; defaults to `warn\`.
-   `--noRESTAPI`: Switch to disable the REST API.
-   `--noGraphQL`: Switch to disable the graphQL endpoint.

Command line options take precedence over environment variable settings.

## License

Copyright nearForm Ltd 2018. Licensed under [MIT][license].

[npm-url]: https://npmjs.org/package/@nearform/trail-hapi-server

[npm-badge]: https://img.shields.io/npm/v/@nearform/trail-hapi-server.svg

[hapi]: https://hapijs.com/

[swagger-ui]: https://swagger.io/swagger-ui/

[license]: ./LICENSE.md
npm package: @nearform/udaru-core
Description: A policy based authorization module
Author: nearForm Ltd
Latest version: 5.2.5

# Udaru
[![npm][npm-badge]][npm-url]
[![travis][travis-badge]][travis-url]
[![coveralls][coveralls-badge]][coveralls-url]
[![snyk][snyk-badge]][snyk-url]

<img src="https://github.com/nearform/udaru/raw/master/docs/logo.jpg">

Udaru is a Policy Based Access Control (PBAC) authorization module. It supports Organizations, Teams and User entities that are used to build the access model. The policies attached to these entities define the 'Actions' that can be performed by an entity on various 'Resources'.

See the Udaru [website](https://nearform.github.io/udaru/) for complete documentation on Udaru.

`udaru-core` is a lower level library that's primarily used by `udaru-hapi-plugin` and `udaru-hapi-16-plugin`, but can also be used directly for other purposes.

## Install
To install via npm:

```
npm install @nearform/udaru-core
```

## Usage

Simple example taken from [examples/list-orgs.js](examples/list-orgs.js):

```
const udaru = require('@nearform/udaru')()
udaru.organizations.list({}, (err, orgs) => {
  if (err) {
    console.error(err)
  } else {
    console.log(orgs)
  }

  udaru.db.close()
})

```

## Hooks

Hooks are registered using the `udaru.hooks.add` method and allow you to listen to specific events in udaru.

Each udaru method exposes a namespaced hook (e.g.: the `udaru.authorize.isUserAuthorized` method exposes the `authorize:isUserAuthorized` hook).

The hook is a node-style callback with three arguments: the method arguments, the method result values and a callback to invoke once done.

If the hook returns a promise, the execution will await its completion.

Hooks errors or rejections are ignored unless the `hooks.propagateErrors` configuration variable is set to `true`.

Simple example taken from [examples/hooks.js](examples/hooks.js):

```
const udaru = require('@nearform/udaru')()

udaru.hooks.add('authorize:isUserAuthorized', function (error, args, result, done) {
  if (error) {
    console.error(`Authorization errored: ${error}`)
    return done(error)
  }

  console.log(`Access to ${args[0]} got access: ${result[0].access}`)
  done()
})

udaru.authorize.isUserAuthorized('resource', 'action', 'uid', 'oid', cb) {
  console.log(err, cb.access)
  udaru.db.close()
})
```

## License

Copyright nearForm Ltd 2017. Licensed under [MIT][license].

[license]: ./LICENSE.md
[travis-badge]: https://travis-ci.org/nearform/udaru.svg?branch=master
[travis-url]: https://travis-ci.org/nearform/udaru
[npm-badge]: https://badge.fury.io/js/%40nearform%2Fudaru-core.svg
[npm-url]: https://www.npmjs.com/package/@nearform/udaru-core
[coveralls-badge]: https://coveralls.io/repos/nearform/udaru/badge.svg?branch=master&service=github
[coveralls-url]: https://coveralls.io/github/nearform/udaru?branch=master
[snyk-badge]: https://snyk.io/test/github/nearform/udaru/badge.svg
[snyk-url]: https://snyk.io/test/github/nearform/udaru
npm package: @nearform/udaru-hapi-16-plugin
Description: Hapi plugin that allows using udaru for policy based authorization
Author: nearForm Ltd
Latest version: 5.3.2

# Udaru Hapi Plugin
[![npm][npm-badge]][npm-url]
[![travis][travis-badge]][travis-url]
[![coveralls][coveralls-badge]][coveralls-url]
[![snyk][snyk-badge]][snyk-url]

<img src="https://github.com/nearform/udaru/raw/master/docs/logo.jpg">
Udaru is a Policy Based Access Control (PBAC) authorization module. It supports Organizations, Teams and User entities that are used to build the access model. The policies attached to these entities define the 'Actions' that can be performed by an entity on various 'Resources'.

See the Udaru [website](https://nearform.github.io/udaru/) for complete documentation on Udaru.

## Install
To install via npm:

```
npm install @nearform/udaru-hapi-16-plugin
```

## Usage

```js
const Hapi = require('hapi')
const UdaruPlugin = require('@nearform/udaru-hapi-16-plugin')

...

const server = new Hapi.server()
server.register({register: UdaruPlugin})
```

## Hooks
In order to register udaru hooks, just provide a `hooks` key in the plugin options where keys are the names and values are handler functions (or array of functions).

```js
const Hapi = require('hapi')
const UdaruPlugin = require('@nearform/udaru-hapi-16-plugin')

...

const server = new Hapi.server()
server.register({
  register: UdaruPlugin,
  options: {
    // Other options here
    hooks: {
      'authorize:isUserAuthorized': [
        function (error, args, result, done) {
          if (error) {
            console.error(`Authorization errored: ${error}`)
          } else {
            console.log(`Access to ${args[0]} got access: ${result[0].access}`)
          }

          done()
        }
      ]
    }
  }
})
```

## License

Copyright nearForm Ltd 2017. Licensed under [MIT][license].

[license]: ./LICENSE.md
[travis-badge]: https://travis-ci.org/nearform/udaru.svg?branch=master
[travis-url]: https://travis-ci.org/nearform/udaru
[npm-badge]: https://badge.fury.io/js/%40nearform%2Fudaru-hapi-16-plugin.svg
[npm-url]: https://npmjs.org/package/%40nearform%2Fudaru-hapi-16-plugin
[coveralls-badge]: https://coveralls.io/repos/nearform/udaru/badge.svg?branch=master&service=github
[coveralls-url]: https://coveralls.io/github/nearform/udaru?branch=master
[snyk-badge]: https://snyk.io/test/github/nearform/udaru/badge.svg
[snyk-url]: https://snyk.io/test/github/nearform/udaru
npm package: @nearform/udaru-hapi-plugin
Description: Hapi authentication plugin that allows using udaru for policy based authorization
Author: nearForm Ltd
Latest version: 5.3.2

# Hapi Udaru Authentication Plugin
[![npm][npm-badge]][npm-url]
[![travis][travis-badge]][travis-url]
[![coveralls][coveralls-badge]][coveralls-url]
[![snyk][snyk-badge]][snyk-url]

<img src="https://github.com/nearform/udaru/raw/master/docs/logo.jpg">

Udaru is a Policy Based Access Control (PBAC) authorization module. It supports Organizations, Teams and User entities that are used to build the access model. The policies attached to these entities define the 'Actions' that can be performed by an entity on various 'Resources'.

See the Udaru [website](https://nearform.github.io/udaru/) for complete documentation on Udaru.

## Install
To install via npm:

```
npm install @nearform/udaru-hapi-plugin
```

## Usage
```js
const Hapi = require('hapi')
const UdaruPlugin = require('@nearform/udaru-hapi-plugin')

...

const server = Hapi.server()

await server.register({register: UdaruPlugin})
```

## Hooks

In order to register udaru hooks, just provide a `hooks` key in the plugin options where keys are the names and values are handler functions (or array of functions).

```js
const Hapi = require('hapi')
const UdaruPlugin = require('@nearform/udaru-hapi-plugin')

...

const server = new Hapi.server()

await server.register({
  register: UdaruPlugin,
  options: {
    // Other options here
    hooks: {
      'authorize:isUserAuthorized': [
        async function (error, args, result) {
          if (error) {
            console.error(`Authorization errored: ${error}`)
          } else {
            console.log(`Access to ${args[0]} got access: ${result[0].access}`)
          }
        }
      ]
    }
  }
})
```

## License

Copyright nearForm Ltd 2017. Licensed under [MIT][license].

[license]: ./LICENSE.md
[travis-badge]: https://travis-ci.org/nearform/udaru.svg?branch=master
[travis-url]: https://travis-ci.org/nearform/udaru
[npm-badge]: https://badge.fury.io/js/%40nearform%2Fudaru-hapi-plugin.svg
[npm-url]: https://npmjs.org/package/%40nearform%2Fudaru-hapi-plugin
[coveralls-badge]: https://coveralls.io/repos/nearform/udaru/badge.svg?branch=master&service=github
[coveralls-url]: https://coveralls.io/github/nearform/udaru?branch=master
[snyk-badge]: https://snyk.io/test/github/nearform/udaru/badge.svg
[snyk-url]: https://snyk.io/test/github/nearform/udaru
npm package: @nearform/udaru-hapi-server
Description: Hapi server that uses udaru for policy based authorization
Author: nearForm Ltd
Latest version: 5.3.2

# Hapi Udaru Server
[![npm][npm-badge]][npm-url]
[![travis][travis-badge]][travis-url]
[![coveralls][coveralls-badge]][coveralls-url]
[![snyk][snyk-badge]][snyk-url]

<img src="https://github.com/nearform/udaru/raw/master/docs/logo.jpg">

Udaru is a Policy Based Access Control (PBAC) authorization module. It supports Organizations, Teams and User entities that are used to build the access model. The policies attached to these entities define the 'Actions' that can be performed by an entity on various 'Resources'.

See the Udaru [website](https://nearform.github.io/udaru/) for complete documentation on Udaru.

## Install
To install via npm:

```
npm install @nearform/udaru-hapi-server
```

## Usage

```
npm run start
```

## Documentation

The Udaru documentation site can be found at [nearform.github.io/udaru][docs-site].

### Swagger API Documentation

The Swagger API documentation gives explanations on the exposed API. The documentation can be found at [nearform.github.io/udaru/swagger/][swagger-docs-url].

It is also possible to access the Swagger documentation from Udaru itself. Simply start the server:

```
npm run start
```

and then go to [`http://localhost:8080/documentation`][swagger-link]

The Swagger documentation also gives the ability to execute calls to the API and see their results. If you're using the test database, you can use 'ROOTid' as the required authorization parameter and 'WONKA' as the organisation.

## License

Copyright nearForm Ltd 2017. Licensed under [MIT][license].

[license]: ./LICENSE.md
[travis-badge]: https://travis-ci.org/nearform/udaru.svg?branch=master
[travis-url]: https://travis-ci.org/nearform/udaru
[npm-badge]: https://badge.fury.io/js/%40nearform%2Fudaru-hapi-server.svg
[npm-url]: https://npmjs.org/package/%40nearform%2Fudaru-hapi-server
[coveralls-badge]: https://coveralls.io/repos/nearform/udaru/badge.svg?branch=master&service=github
[coveralls-url]: https://coveralls.io/github/nearform/udaru?branch=master
[snyk-badge]: https://snyk.io/test/github/nearform/udaru/badge.svg
[snyk-url]: https://snyk.io/test/github/nearform/udaru
[swagger-link]: http://localhost:8080/documentation
[docs-site]: https://nearform.github.io/udaru
[swagger-docs-url]: https://nearform.github.io/udaru/swagger/
npm package: @nearform/udaru-trail
Description: udaru-trail integration service
Author: nearForm Ltd
Latest version: 1.0.0

# @nearform/udaru-trail

[![npm][npm-badge]][npm-url]
[![travis][travis-badge]][travis-url]
[![coveralls][coveralls-badge]][coveralls-url]

udaru-trail is a small package which adds [trail][trail] auditing capabilities to [udaru][udaru] via its hooks.

## Integrating into udaru

Once you have udaru and trail instantiated, simply call the register function:

```javascript
const udaru = require('@nearform/udaru-core')
const { TrailsManager } = require('@nearform/trail-core')
const { register } = require('@nearform/udaru-trail')

const udaruInstance = udaru()
const trailInstance = new TrailsManager()

// The third argument is option and is a list of udaru hooks you want to log. If omitted, all supported udaru hooks will be logged.
register(udaruInstance, trailInstance, ['authorize:isUserAuthorized'])
```

## Integrating into udaru and HAPI

Integration is supported via [udaru-hapi-plugin][udaru-hapi-plugin].

Register the `UdaruTrailHapiPlugin` after `UdaruPlugin` and after `TrailPlugin` and **BEFORE** starting the server:

```javascript
const TrailPlugin = require('@nearform/trail-hapi-plugin')
const UdaruPlugin = require('@nearform/udaru-hapi-plugin')
const { UdaruTrailHapiPlugin } = require('@nearform/udaru-trail')
const Hapi = require('hapi')

const server = Hapi.Server({port: 3000})

await this.server.register({plugin: UdaruPlugin})
await this.server.register({plugin: TrailPlugin})
await this.server.register({plugin: UdaruTrailHapiPlugin})

await this.server.start()
```

## Testing, benching & linting

Before running tests, make sure you have a working test environment for both udaru-core and trail-core packages.

To run tests:

```
npm run test
```

**Note:** running the tests will output duplicate keys errors in Postgres logs, this is expected, as the error handling of those cases is part of what is tested.

To lint the repository:

```
npm run lint
```

To fix (most) linting issues:

```
npm run lint -- --fix
```

To create coverage reports:

```
npm run coverage
```

## License

Copyright nearForm Ltd 2018. Licensed under [MIT][license].

[npm-url]: https://npmjs.org/package/@nearform/udaru-trail
[npm-badge]: https://img.shields.io/npm/v/@nearform/udaru-trail.svg
[travis-badge]: https://travis-ci.org/nearform/udaru-trail.svg?branch=master
[travis-url]: https://travis-ci.org/nearform/udaru-trail
[coveralls-badge]: https://coveralls.io/repos/nearform/udaru-trail/badge.svg?branch=master&service=github
[coveralls-url]: https://coveralls.io/github/nearform/udaru-trail?branch=master
[trail]: https://github.com/nearform/trail
[udaru]: https://github.com/nearform/udaru
[udaru-hapi-plugin]: https://github.com/nearform/udaru/tree/master/packages/udaru-hapi-plugin
[license]: ./LICENSE.md
npm package: @nearfoundation/near-js-encryption-box
Description: > An experimental library to encrypt and decrypt data using the NEAR account's ed25519 keypairs; you can use it to store encrypted data on-chain, off-chain, or in any decentralized storage (IPFS, Arweave).
Author: Sandoche Adittane
Latest version: 0.1.2

# near-js-encryption-box [![NEAR](https://img.shields.io/badge/NEAR-%E2%8B%88-111111.svg)](https://near.org/) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)

> An experimental library to encrypt and decrypt data using the NEAR account's ed25519 keypairs; you can use it to store encrypted data on-chain, off-chain, or in any decentralized storage (IPFS, Arweave).

⚠️ This is an experimental library. We do not recommend to use it to store confidential information publically.

## Installation

```bash
npm install @nearfoundation/near-js-encryption-box
```

## Usage

You can find below an example where Alice encrypt data with her private key and Bob's public key.
Then Bob can decrypt the message with his private key, Alice's public key and a nonce.

```js
import { create, open } from 'near-js-encryption-box';
import { utils } from 'near-api-js';

// Randomly generating key pairs for the example
const keyPairAlice = utils.key_pair.KeyPairEd25519.fromRandom();
const keyPairBob = utils.key_pair.KeyPairEd25519.fromRandom();

// Encrypting a message
const message = 'Hello Bob';
const publicKeyBob = keyPairBob.getPublicKey().toString();
const privateKeyAlice = keyPairAlice.secretKey;
const { secret, nonce } = create(message, publicKeyBob, privateKeyAlice); // you can also pass your own custom nonce as a 4th parameter

// Decrypting the message
const publicKeyAlice = keyPairAlice.getPublicKey().toString();
const privateKeyBob = keyPairBob.secretKey;
const messageReceived = open(secret, publicKeyAlice, privateKeyBob, nonce);
console.log(messageReceived); // will return 'Hello Bob'
```

Find more examples in the [near-js-encryption-box-test.ts](test/near-js-encryption-box.test.ts)

## Encryption

- Convert NEAR Ed25519 signing key pair into Curve25519 key pair suitable for Diffie-Hellman key; using [ed2curve.js](https://github.com/dchest/ed2curve-js)
  - "Note that there's currently no proof that this is safe to do. It is safer to share both Ed25519 and Curve25519 public keys (their concatenation is 64 bytes long)."
- Then uses Curve25519-XSalsa20-Poly1305 implemented by [TweetNaCl.js](https://tweetnacl.js.org)

## Authors

- [Sandoche](https://github.com/sandoche)

## License

MIT License