GithubHelp home page GithubHelp logo

relaycorp / awala-keystore-vault-js Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.78 MB

Vault-based Private Key Store extension for relaynet-core-js. Superseded by @relaycorp/awala-keystore-cloud

Home Page: https://github.com/relaycorp/awala-keystore-cloud-js

License: MIT License

JavaScript 21.49% TypeScript 78.51%
hashicorp-vault awala

awala-keystore-vault-js's Introduction

keystore-vault-js

Superseded by https://github.com/relaycorp/awala-keystore-cloud-js

Vault-based Private Key Store extension for server-side, Node.js-based applications implementing Relaynet -- For example, public endpoints.

Install

This library is available on NPM and the latest version can be installed as follows:

npm i @relaycorp/keystore-vault

Usage

Initialisation

Once you've configured Vault, you need to initialise VaultPrivateKeyStore with the following arguments:

  • vaultUrl: The URL to Vault. For example, https://vault.local:8200.
  • vaultToken: The auth token.
  • kvPath: The path to the KV Secrets Engine. Only Version 2 of the engine is supported.

Adding an identity key

To add an identity key for your own node, use VaultPrivateKeyStore.saveNodeKey();. For example:

await keyStore.saveNodeKey(identityKeyPair.privateKey, identityCertificate);

Make sure to store the output of identityCertificate.getSerialNumber() because you'll need that identifier to retrieve the private key later.

Adding an initial session key

To add an initial session key for your own node, use VaultPrivateKeyStore.saveInitialSessionKey();. For example:

await keyStore.saveInitialSessionKey(sessionKeyPair.privateKey, sessionKeyId);

Signing a RAMF message

To sign a RAMF message, such as a parcel, retrieve the identity key and pass it to the RAMFMessage.serialize() method. For example:

const privateKey = await keyStore.fetchNodeKey(IDENTITY_KEY_ID);
const parcelSerialized = await parcel.serialize(privateKey);

Decrypting a RAMF message payload

To decrypt the payload of a RAMF message -- for example, to extract the service message from a parcel -- you should simply pass the key store instance to RAMFMessage.unwrapPayload(). For example:

const serviceMessage = await parcel.unwrapPayload(keyStore);

API documentation

The API documentation can be found on docs.relaycorp.tech.

awala-keystore-vault-js's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar gnarea avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.