Gathering detailed insights and metrics for libp2p-keychain
Gathering detailed insights and metrics for libp2p-keychain
Gathering detailed insights and metrics for libp2p-keychain
Gathering detailed insights and metrics for libp2p-keychain
Key management and cryptographically protected messages
npm install libp2p-keychain
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
NOASSERTION License
19 Stars
119 Commits
8 Forks
18 Watchers
4 Branches
49 Contributors
Updated on Jul 17, 2024
Latest Version
0.6.1
Package Id
libp2p-keychain@0.6.1
Size
41.91 kB
NPM Version
6.14.4
Node Version
12.16.3
Published on
Jun 09, 2020
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
A secure key chain for libp2p in JavaScript
1npm install --save libp2p-keychain
1const Keychain = require('libp2p-keychain') 2const FsStore = require('datastore-fs') 3 4const datastore = new FsStore('./a-keystore') 5const opts = { 6 passPhrase: 'some long easily remembered phrase' 7} 8const keychain = new Keychain(datastore, opts)
Managing a key
async createKey (name, type, size)
async renameKey (oldName, newName)
async removeKey (name)
async exportKey (name, password)
async importKey (name, pem, password)
async importPeer (name, peer)
A naming service for a key
async listKeys ()
async findKeyById (id)
async findKeyByName (name)
Cryptographically protected messages
async cms.encrypt (name, plain)
async cms.decrypt (cmsData)
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.
1{ 2 name: 'rsa-key', 3 id: 'QmYWYSUZ4PV6MRFYpdtEDJBiGs4UrmE6g8wmAWSePekXVW' 4}
The key id is the SHA-256 multihash of its public key. The public key is a protobuf encoding containing a type and the DER encoding of the PKCS SubjectPublicKeyInfo.
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.
The default options for generating the derived encryption key are in the dek
object. This, along with the passPhrase, is the input to a PBKDF2
function.
1const defaultOptions = { 2 //See https://cryptosense.com/parameter-choice-for-pbkdf2/ 3 dek: { 4 keyLength: 512 / 8, 5 iterationCount: 1000, 6 salt: 'at least 16 characters long', 7 hash: 'sha2-512' 8 } 9}
The actual physical storage of an encrypted key is left to implementations of interface-datastore. A key benifit is that now the key chain can be used in browser with the js-datastore-level implementation.
CMS, aka PKCS #7 and RFC 5652, describes an encapsulation syntax for data protection. It is used to digitally sign, digest, authenticate, or encrypt arbitrary message content. Basically, cms.encrypt
creates a DER message that can be only be read by someone holding the private key.
Feel free to join in. All welcome. Open an issue!
This repository falls under the IPFS Code of Conduct.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 8/25 approved changesets -- score normalized to 3
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
project is archived
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More