Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
deps: update libp2p to 0.39.0 (#4203)
Browse files Browse the repository at this point in the history
The update removes the need to load the keychain manually.
  • Loading branch information
achingbrain committed Sep 7, 2022
1 parent bb78ebf commit 051da16
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
4 changes: 2 additions & 2 deletions packages/ipfs-core/package.json
Expand Up @@ -90,7 +90,7 @@
"@libp2p/interfaces": "^3.0.3",
"@libp2p/kad-dht": "^3.0.0",
"@libp2p/logger": "^2.0.0",
"@libp2p/mplex": "^5.0.0",
"@libp2p/mplex": "^5.2.0",
"@libp2p/peer-id": "^1.1.10",
"@libp2p/peer-id-factory": "^1.0.10",
"@libp2p/record": "^2.0.0",
Expand Down Expand Up @@ -137,7 +137,7 @@
"it-tar": "^6.0.0",
"it-to-buffer": "^2.0.0",
"just-safe-set": "^4.0.2",
"libp2p": "^0.38.0",
"libp2p": "^0.39.0",
"merge-options": "^3.0.4",
"mortice": "^3.0.0",
"multiformats": "^9.5.1",
Expand Down
4 changes: 0 additions & 4 deletions packages/ipfs-core/src/components/network.js
Expand Up @@ -64,10 +64,6 @@ export class Network {
keychainConfig: undefined
})

if (libp2p.keychain) {
await libp2p.loadKeychain()
}

await libp2p.start()

for (const ma of libp2p.getMultiaddrs()) {
Expand Down
19 changes: 8 additions & 11 deletions packages/ipfs-core/src/components/storage.js
Expand Up @@ -13,6 +13,7 @@ import { ERR_REPO_NOT_INITIALIZED } from 'ipfs-repo/errors'
import { createEd25519PeerId, createRSAPeerId } from '@libp2p/peer-id-factory'
import errCode from 'err-code'
import { unmarshalPrivateKey } from '@libp2p/crypto/keys'
import { Key } from 'interface-datastore/key'

const mergeOptions = mergeOpts.bind({ ignoreUndefined: true })
const log = logger('ipfs:components:peer:storage')
Expand Down Expand Up @@ -158,15 +159,15 @@ const initRepo = async (print, repo, options) => {
keychainConfig
})

if (libp2p.keychain) {
await libp2p.loadKeychain()

await repo.config.set('Keychain', {
// @ts-expect-error private field
DEK: libp2p.keychain.init.dek
})
if (!(await repo.datastore.has(new Key('/info/self')))) {
await libp2p.keychain.importPeer('self', peerId)
}

await repo.config.set('Keychain', {
// @ts-expect-error private field
DEK: libp2p.keychain.init.dek
})

return { peerId, keychain: libp2p.keychain }
}

Expand Down Expand Up @@ -264,10 +265,6 @@ const configureRepo = async (repo, options) => {
}
})

if (libp2p.keychain) {
await libp2p.loadKeychain()
}

return { peerId, keychain: libp2p.keychain }
}

Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-daemon/package.json
Expand Up @@ -72,7 +72,7 @@
"ipfs-http-gateway": "^0.10.0",
"ipfs-http-server": "^0.12.0",
"ipfs-utils": "^9.0.6",
"libp2p": "^0.38.0"
"libp2p": "^0.39.0"
},
"devDependencies": {
"aegir": "^37.0.11",
Expand Down

0 comments on commit 051da16

Please sign in to comment.