This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree 5 files changed +10
-7
lines changed
5 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
- const callbackify = require ( 'callbackify' )
4
3
const pkgversion = require ( '../../../package.json' ) . version
5
4
6
- module . exports = function id ( self ) {
7
- return callbackify ( async ( ) => { // eslint-disable-line require-await
5
+ module . exports = ( { peerInfo } ) => {
6
+ return async function id ( ) { // eslint-disable-line require-await
8
7
return {
9
- id : self . _peerInfo . id . toB58String ( ) ,
10
- publicKey : self . _peerInfo . id . pubKey . bytes . toString ( 'base64' ) ,
11
- addresses : self . _peerInfo . multiaddrs
8
+ id : peerInfo . id . toB58String ( ) ,
9
+ publicKey : peerInfo . id . pubKey . bytes . toString ( 'base64' ) ,
10
+ addresses : peerInfo . multiaddrs
12
11
. toArray ( )
13
12
. map ( ( ma ) => ma . toString ( ) )
14
13
. filter ( ( ma ) => ma . indexOf ( 'ipfs' ) >= 0 )
15
14
. sort ( ) ,
16
15
agentVersion : `js-ipfs/${ pkgversion } ` ,
17
16
protocolVersion : '9000'
18
17
}
19
- } )
18
+ }
20
19
}
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ exports.bitswap = {
7
7
wantlist : require ( './bitswap/wantlist' )
8
8
}
9
9
exports . config = require ( './config' )
10
+ exports . id = require ( './id' )
10
11
exports . init = require ( './init' )
11
12
exports . ping = require ( './ping' )
12
13
exports . start = require ( './start' )
Original file line number Diff line number Diff line change @@ -300,6 +300,7 @@ function createApi ({
300
300
const api = {
301
301
add,
302
302
config : Commands . config ( { repo } ) ,
303
+ id : Commands . id ( { peerInfo } ) ,
303
304
init : ( ) => { throw new AlreadyInitializedError ( ) } ,
304
305
start
305
306
}
Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ function createApi ({
137
137
wantlist : Commands . bitswap . wantlist ( { bitswap } )
138
138
} ,
139
139
config : Commands . config ( { repo } ) ,
140
+ id : Commands . id ( { peerInfo } ) ,
140
141
init : ( ) => { throw new AlreadyInitializedError ( ) } ,
141
142
ping : Commands . ping ( { libp2p } ) ,
142
143
pubsub : libp2p . pubsub
Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ function createApi ({
99
99
const api = {
100
100
add,
101
101
config : Commands . config ( { repo } ) ,
102
+ id : Commands . id ( { peerInfo } ) ,
102
103
init : ( ) => { throw new AlreadyInitializedError ( ) } ,
103
104
start,
104
105
stop : ( ) => apiManager . api
You can’t perform that action at this time.
0 commit comments