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

Commit

Permalink
fix: add importPeer method to keychain interface (#333)
Browse files Browse the repository at this point in the history
This was missed in an earlier iteration.
  • Loading branch information
achingbrain committed Jan 7, 2023
1 parent 82e6c6d commit 51de73c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/interface-keychain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
"release": "aegir release"
},
"dependencies": {
"@libp2p/interface-peer-id": "^2.0.0",
"multiformats": "^11.0.0"
},
"devDependencies": {
Expand Down
10 changes: 10 additions & 0 deletions packages/interface-keychain/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Multibase } from 'multiformats/bases/interface'
import type { PeerId } from '@libp2p/interface-peer-id'

export interface KeyInfo {
/**
Expand Down Expand Up @@ -36,6 +37,15 @@ export interface KeyChain {
*/
importKey: (name: string, pem: string, password: string) => Promise<KeyInfo>

/**
* Import a new key from a PeerId with a private key component
*
* ```js
* const keyInfo = await libp2p.keychain.importPeer('keyTestImport', peerIdFromString('12D3Foo...'))
* ```
*/
importPeer: (name: string, peerId: PeerId) => Promise<KeyInfo>

/**
* Create a key in the keychain.
*
Expand Down

0 comments on commit 51de73c

Please sign in to comment.