|
1 | 1 | /* eslint max-nested-callbacks: ["error", 5] */ |
2 | 2 |
|
| 3 | +import { pbkdf2, randomBytes } from '@libp2p/crypto' |
| 4 | +import { generateKeyPair, importKey, unmarshalPrivateKey } from '@libp2p/crypto/keys' |
| 5 | +import { CodeError } from '@libp2p/interfaces/errors' |
3 | 6 | import { logger } from '@libp2p/logger' |
4 | | -import sanitize from 'sanitize-filename' |
5 | | -import mergeOptions from 'merge-options' |
| 7 | +import { peerIdFromKeys } from '@libp2p/peer-id' |
6 | 8 | import { Key } from 'interface-datastore/key' |
7 | | -import { CodeError } from '@libp2p/interfaces/errors' |
8 | | -import { codes } from './errors.js' |
9 | | -import { toString as uint8ArrayToString } from 'uint8arrays/to-string' |
| 9 | +import mergeOptions from 'merge-options' |
| 10 | +import sanitize from 'sanitize-filename' |
10 | 11 | import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' |
11 | | -import { generateKeyPair, importKey, unmarshalPrivateKey } from '@libp2p/crypto/keys' |
| 12 | +import { toString as uint8ArrayToString } from 'uint8arrays/to-string' |
| 13 | +import { codes } from './errors.js' |
| 14 | +import type { KeyChain, KeyInfo, KeyType } from '@libp2p/interface-keychain' |
12 | 15 | import type { PeerId } from '@libp2p/interface-peer-id' |
13 | | -import { pbkdf2, randomBytes } from '@libp2p/crypto' |
14 | 16 | import type { Datastore } from 'interface-datastore' |
15 | | -import { peerIdFromKeys } from '@libp2p/peer-id' |
16 | | -import type { KeyChain, KeyInfo, KeyType } from '@libp2p/interface-keychain' |
17 | 17 |
|
18 | 18 | const log = logger('libp2p:keychain') |
19 | 19 |
|
@@ -390,7 +390,7 @@ export class DefaultKeyChain implements KeyChain { |
390 | 390 | const pem = await this.exportKey(name, password) |
391 | 391 | const privateKey = await importKey(pem, password) |
392 | 392 |
|
393 | | - return await peerIdFromKeys(privateKey.public.bytes, privateKey.bytes) |
| 393 | + return peerIdFromKeys(privateKey.public.bytes, privateKey.bytes) |
394 | 394 | } |
395 | 395 |
|
396 | 396 | /** |
|
0 commit comments