File tree 5 files changed +8
-6
lines changed
5 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 52
52
"sinon" : " ^9.0.0"
53
53
},
54
54
"dependencies" : {
55
- "bs58" : " ^4.0.1" ,
56
55
"debug" : " ^4.1.1" ,
57
56
"err-code" : " ^2.0.0" ,
58
57
"it-length-prefixed" : " ^3.0.0" ,
59
58
"it-pipe" : " ^1.0.1" ,
60
59
"it-pushable" : " ^1.3.2" ,
61
60
"libp2p-crypto" : " ~0.17.0" ,
62
61
"libp2p-interfaces" : " ^0.3.0" ,
62
+ "multibase" : " ^0.7.0" ,
63
63
"peer-id" : " ~0.13.3" ,
64
64
"protons" : " ^1.0.1"
65
65
},
Original file line number Diff line number Diff line change 1
1
'use strict'
2
-
2
+ const { Buffer } = require ( 'buffer' )
3
3
const PeerId = require ( 'peer-id' )
4
4
const { Message } = require ( './index' )
5
5
const SignPrefix = Buffer . from ( 'libp2p-pubsub:' )
Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
+ const { Buffer } = require ( 'buffer' )
3
4
const crypto = require ( 'libp2p-crypto' )
4
- const bs58 = require ( 'bs58 ' )
5
+ const multibase = require ( 'multibase ' )
5
6
6
7
exports = module . exports
7
8
@@ -77,7 +78,7 @@ exports.ensureArray = (maybeArray) => {
77
78
exports . normalizeInRpcMessage = ( message ) => {
78
79
const m = Object . assign ( { } , message )
79
80
if ( Buffer . isBuffer ( message . from ) ) {
80
- m . from = bs58 . encode ( message . from )
81
+ m . from = multibase . encode ( 'base58btc' , message . from ) . toString ( ) . slice ( 1 )
81
82
}
82
83
return m
83
84
}
@@ -97,7 +98,7 @@ exports.normalizeInRpcMessages = (messages) => {
97
98
exports . normalizeOutRpcMessage = ( message ) => {
98
99
const m = Object . assign ( { } , message )
99
100
if ( typeof message . from === 'string' || message . from instanceof String ) {
100
- m . from = bs58 . decode ( message . from )
101
+ m . from = multibase . decode ( 'z' + message . from )
101
102
}
102
103
return m
103
104
}
Original file line number Diff line number Diff line change 2
2
/* eslint max-nested-callbacks: ["error", 5] */
3
3
'use strict'
4
4
5
+ const { Buffer } = require ( 'buffer' )
5
6
const chai = require ( 'chai' )
6
7
chai . use ( require ( 'dirty-chai' ) )
7
8
const expect = chai . expect
Original file line number Diff line number Diff line change 2
2
'use strict'
3
3
4
4
const { expect } = require ( 'chai' )
5
-
5
+ const { Buffer } = require ( 'buffer' )
6
6
const utils = require ( '../src/utils' )
7
7
8
8
describe ( 'utils' , ( ) => {
You can’t perform that action at this time.
0 commit comments