@libp2p/keychain
Advanced tools
Comparing version 2.0.0 to 2.0.1-05abd49f
@@ -1,4 +0,5 @@ | ||
import type { PeerId } from '@libp2p/interface-peer-id'; | ||
import type { KeyChain, KeyInfo } from '@libp2p/interface/keychain'; | ||
import type { KeyType } from '@libp2p/interface/keys'; | ||
import type { PeerId } from '@libp2p/interface/peer-id'; | ||
import type { Datastore } from 'interface-datastore'; | ||
import type { KeyChain, KeyInfo, KeyType } from '@libp2p/interface-keychain'; | ||
export interface DEKConfig { | ||
@@ -5,0 +6,0 @@ hash: string; |
/* eslint max-nested-callbacks: ["error", 5] */ | ||
import { pbkdf2, randomBytes } from '@libp2p/crypto'; | ||
import { generateKeyPair, importKey, unmarshalPrivateKey } from '@libp2p/crypto/keys'; | ||
import { CodeError } from '@libp2p/interface/errors'; | ||
import { logger } from '@libp2p/logger'; | ||
import { peerIdFromKeys } from '@libp2p/peer-id'; | ||
import { Key } from 'interface-datastore/key'; | ||
import mergeOptions from 'merge-options'; | ||
import sanitize from 'sanitize-filename'; | ||
import mergeOptions from 'merge-options'; | ||
import { Key } from 'interface-datastore/key'; | ||
import { CodeError } from '@libp2p/interfaces/errors'; | ||
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'; | ||
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'; | ||
import { codes } from './errors.js'; | ||
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'; | ||
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'; | ||
import { generateKeyPair, importKey, unmarshalPrivateKey } from '@libp2p/crypto/keys'; | ||
import { pbkdf2, randomBytes } from '@libp2p/crypto'; | ||
import { peerIdFromKeys } from '@libp2p/peer-id'; | ||
const log = logger('libp2p:keychain'); | ||
@@ -74,2 +74,4 @@ const keyPrefix = '/pkcs8/'; | ||
export class DefaultKeyChain { | ||
components; | ||
init; | ||
/** | ||
@@ -314,3 +316,4 @@ * Creates a new instance of a key chain | ||
const privateKey = await importKey(pem, dek); | ||
return await privateKey.export(password); | ||
const keyString = await privateKey.export(password); | ||
return keyString; | ||
} | ||
@@ -329,3 +332,3 @@ catch (err) { | ||
const privateKey = await importKey(pem, password); | ||
return await peerIdFromKeys(privateKey.public.bytes, privateKey.bytes); | ||
return peerIdFromKeys(privateKey.public.bytes, privateKey.bytes); | ||
} | ||
@@ -332,0 +335,0 @@ /** |
124
package.json
{ | ||
"name": "@libp2p/keychain", | ||
"version": "2.0.0", | ||
"version": "2.0.1-05abd49f", | ||
"description": "Key management and cryptographically protected messages", | ||
"license": "Apache-2.0 OR MIT", | ||
"homepage": "https://github.com/libp2p/js-libp2p-keychain#readme", | ||
"homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/keychain#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/libp2p/js-libp2p-keychain.git" | ||
"url": "git+https://github.com/libp2p/js-libp2p.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/libp2p/js-libp2p-keychain/issues" | ||
"url": "https://github.com/libp2p/js-libp2p/issues" | ||
}, | ||
@@ -22,6 +22,2 @@ "keywords": [ | ||
], | ||
"engines": { | ||
"node": ">=16.0.0", | ||
"npm": ">=7.0.0" | ||
}, | ||
"type": "module", | ||
@@ -47,87 +43,2 @@ "types": "./dist/src/index.d.ts", | ||
}, | ||
"release": { | ||
"branches": [ | ||
"master" | ||
], | ||
"plugins": [ | ||
[ | ||
"@semantic-release/commit-analyzer", | ||
{ | ||
"preset": "conventionalcommits", | ||
"releaseRules": [ | ||
{ | ||
"breaking": true, | ||
"release": "major" | ||
}, | ||
{ | ||
"revert": true, | ||
"release": "patch" | ||
}, | ||
{ | ||
"type": "feat", | ||
"release": "minor" | ||
}, | ||
{ | ||
"type": "fix", | ||
"release": "patch" | ||
}, | ||
{ | ||
"type": "docs", | ||
"release": "patch" | ||
}, | ||
{ | ||
"type": "test", | ||
"release": "patch" | ||
}, | ||
{ | ||
"type": "deps", | ||
"release": "patch" | ||
}, | ||
{ | ||
"scope": "no-release", | ||
"release": false | ||
} | ||
] | ||
} | ||
], | ||
[ | ||
"@semantic-release/release-notes-generator", | ||
{ | ||
"preset": "conventionalcommits", | ||
"presetConfig": { | ||
"types": [ | ||
{ | ||
"type": "feat", | ||
"section": "Features" | ||
}, | ||
{ | ||
"type": "fix", | ||
"section": "Bug Fixes" | ||
}, | ||
{ | ||
"type": "chore", | ||
"section": "Trivial Changes" | ||
}, | ||
{ | ||
"type": "docs", | ||
"section": "Documentation" | ||
}, | ||
{ | ||
"type": "deps", | ||
"section": "Dependencies" | ||
}, | ||
{ | ||
"type": "test", | ||
"section": "Tests" | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"@semantic-release/changelog", | ||
"@semantic-release/npm", | ||
"@semantic-release/github", | ||
"@semantic-release/git" | ||
] | ||
}, | ||
"scripts": { | ||
@@ -144,24 +55,23 @@ "clean": "aegir clean", | ||
"test:node": "aegir test -t node --cov", | ||
"test:electron-main": "aegir test -t electron-main", | ||
"release": "aegir release", | ||
"docs": "aegir docs" | ||
"test:electron-main": "aegir test -t electron-main" | ||
}, | ||
"dependencies": { | ||
"@libp2p/crypto": "^1.0.11", | ||
"@libp2p/interface-keychain": "^2.0.3", | ||
"@libp2p/interface-peer-id": "^2.0.1", | ||
"@libp2p/interfaces": "^3.3.1", | ||
"@libp2p/logger": "^2.0.5", | ||
"@libp2p/peer-id": "^2.0.1", | ||
"interface-datastore": "^8.0.0", | ||
"@libp2p/crypto": "1.0.17-05abd49f", | ||
"@libp2p/interface": "0.0.1-05abd49f", | ||
"@libp2p/logger": "2.1.1-05abd49f", | ||
"@libp2p/peer-id": "2.0.3-05abd49f", | ||
"interface-datastore": "^8.2.0", | ||
"merge-options": "^3.0.4", | ||
"sanitize-filename": "^1.6.3", | ||
"uint8arrays": "^4.0.3" | ||
"uint8arrays": "^4.0.4" | ||
}, | ||
"devDependencies": { | ||
"@libp2p/peer-id-factory": "^2.0.1", | ||
"aegir": "^38.1.0", | ||
"@libp2p/peer-id-factory": "2.0.3-05abd49f", | ||
"aegir": "^39.0.10", | ||
"datastore-core": "^9.0.1", | ||
"multiformats": "^11.0.1" | ||
"multiformats": "^12.0.1" | ||
}, | ||
"typedoc": { | ||
"entryPoint": "./src/index.ts" | ||
} | ||
} |
@@ -5,4 +5,4 @@ # @libp2p/keychain <!-- omit in toc --> | ||
[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io) | ||
[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p-keychain.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-keychain) | ||
[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-keychain/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p-keychain/actions/workflows/js-test-and-release.yml?query=branch%3Amaster) | ||
[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p) | ||
[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/main.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p/actions/workflows/main.yml?query=branch%3Amaster) | ||
@@ -86,3 +86,3 @@ > Key management and cryptographically protected messages | ||
- <https://libp2p.github.io/js-libp2p-keychain> | ||
- <https://libp2p.github.io/js-libp2p/modules/_libp2p_keychain.html> | ||
@@ -89,0 +89,0 @@ ## License |
/* eslint max-nested-callbacks: ["error", 5] */ | ||
import { pbkdf2, randomBytes } from '@libp2p/crypto' | ||
import { generateKeyPair, importKey, unmarshalPrivateKey } from '@libp2p/crypto/keys' | ||
import { CodeError } from '@libp2p/interface/errors' | ||
import { logger } from '@libp2p/logger' | ||
import { peerIdFromKeys } from '@libp2p/peer-id' | ||
import { Key } from 'interface-datastore/key' | ||
import mergeOptions from 'merge-options' | ||
import sanitize from 'sanitize-filename' | ||
import mergeOptions from 'merge-options' | ||
import { Key } from 'interface-datastore/key' | ||
import { CodeError } from '@libp2p/interfaces/errors' | ||
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' | ||
import { toString as uint8ArrayToString } from 'uint8arrays/to-string' | ||
import { codes } from './errors.js' | ||
import { toString as uint8ArrayToString } from 'uint8arrays/to-string' | ||
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' | ||
import { generateKeyPair, importKey, unmarshalPrivateKey } from '@libp2p/crypto/keys' | ||
import type { PeerId } from '@libp2p/interface-peer-id' | ||
import { pbkdf2, randomBytes } from '@libp2p/crypto' | ||
import type { KeyChain, KeyInfo } from '@libp2p/interface/keychain' | ||
import type { KeyType } from '@libp2p/interface/keys' | ||
import type { PeerId } from '@libp2p/interface/peer-id' | ||
import type { Datastore } from 'interface-datastore' | ||
import { peerIdFromKeys } from '@libp2p/peer-id' | ||
import type { KeyChain, KeyInfo, KeyType } from '@libp2p/interface-keychain' | ||
@@ -378,3 +379,5 @@ const log = logger('libp2p:keychain') | ||
const privateKey = await importKey(pem, dek) | ||
return await privateKey.export(password) | ||
const keyString = await privateKey.export(password) | ||
return keyString | ||
} catch (err: any) { | ||
@@ -394,3 +397,3 @@ await randomDelay() | ||
return await peerIdFromKeys(privateKey.public.bytes, privateKey.bytes) | ||
return peerIdFromKeys(privateKey.public.bytes, privateKey.bytes) | ||
} | ||
@@ -397,0 +400,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
340624
8
2278
38
67
19
1
+ Added@libp2p/crypto@1.0.17-05abd49f(transitive)
+ Added@libp2p/interface@0.0.1-05abd49f(transitive)
+ Added@libp2p/logger@2.1.1-05abd49f(transitive)
+ Added@libp2p/peer-id@2.0.3-05abd49f(transitive)
+ Added@types/node@22.10.0(transitive)
+ Addedabortable-iterator@5.1.0(transitive)
+ Addedany-signal@4.1.1(transitive)
+ Addedget-iterator@2.0.1(transitive)
+ Addedit-pushable@3.2.3(transitive)
+ Addedit-stream-types@2.0.2(transitive)
+ Addedp-defer@4.0.1(transitive)
- Removed@libp2p/interface-keychain@^2.0.3
- Removed@libp2p/interface-peer-id@^2.0.1
- Removed@libp2p/interfaces@^3.3.1
- Removed@libp2p/crypto@1.0.17(transitive)
- Removed@libp2p/interface-keychain@2.0.5(transitive)
- Removed@libp2p/interface-keys@1.0.8(transitive)
- Removed@libp2p/interface-peer-id@2.0.2(transitive)
- Removed@libp2p/interfaces@3.3.2(transitive)
- Removed@libp2p/logger@2.1.1(transitive)
- Removed@libp2p/peer-id@2.0.4(transitive)
- Removed@types/node@22.10.1(transitive)
- Removedmultiformats@11.0.2(transitive)
Updatedinterface-datastore@^8.2.0
Updateduint8arrays@^4.0.4