Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #4 from libp2p/mkg20001-patch-1
Browse files Browse the repository at this point in the history
Add syntax highlighting to README
  • Loading branch information
richardschneider authored Dec 6, 2017
2 parents cfdd2f4 + 643bcd4 commit 506e1d7
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,22 @@

## Install

npm install --save libp2p-keychain
```sh
npm install --save libp2p-keychain
```

### Usage

const Keychain = require('libp2p-keychain')
const FsStore = require('datastore-fs')
```js
const Keychain = require('libp2p-keychain')
const FsStore = require('datastore-fs')

const datastore = new FsStore('./a-keystore')
const opts = {
passPhrase: 'some long easily remembered phrase'
}
const keychain = new Keychain(datastore, opts)
const datastore = new FsStore('./a-keystore')
const opts = {
passPhrase: 'some long easily remembered phrase'
}
const keychain = new Keychain(datastore, opts)
```

## API

Expand Down Expand Up @@ -68,7 +72,7 @@ Cryptographically protected messages

The key management and naming service API all return a `KeyInfo` object. The `id` is a universally unique identifier for the key. The `name` is local to the key chain.

```
```js
{
name: 'rsa-key',
id: 'QmYWYSUZ4PV6MRFYpdtEDJBiGs4UrmE6g8wmAWSePekXVW'
Expand All @@ -82,7 +86,7 @@ The **key id** is the SHA-256 [multihash](https://github.com/multiformats/multih
A private key is stored as an encrypted PKCS 8 structure in the PEM format. It is protected by a key generated from the key chain's *passPhrase* using **PBKDF2**. Its file extension is `.p8`.

The default options for generating the derived encryption key are in the `dek` object
```
```js
const defaultOptions = {
createIfNeeded: true,

Expand Down

0 comments on commit 506e1d7

Please sign in to comment.