This repository was archived by the owner on Jun 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +8
-6
lines changed Expand file tree Collapse file tree 5 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 5252 "sinon" : " ^9.0.0"
5353 },
5454 "dependencies" : {
55- "bs58" : " ^4.0.1" ,
5655 "debug" : " ^4.1.1" ,
5756 "err-code" : " ^2.0.0" ,
5857 "it-length-prefixed" : " ^3.0.0" ,
5958 "it-pipe" : " ^1.0.1" ,
6059 "it-pushable" : " ^1.3.2" ,
6160 "libp2p-crypto" : " ~0.17.0" ,
6261 "libp2p-interfaces" : " ^0.3.0" ,
62+ "multibase" : " ^0.7.0" ,
6363 "peer-id" : " ~0.13.3" ,
6464 "protons" : " ^1.0.1"
6565 },
Original file line number Diff line number Diff line change 11'use strict'
2-
2+ const { Buffer } = require ( 'buffer' )
33const PeerId = require ( 'peer-id' )
44const { Message } = require ( './index' )
55const SignPrefix = Buffer . from ( 'libp2p-pubsub:' )
Original file line number Diff line number Diff line change 11'use strict'
22
3+ const { Buffer } = require ( 'buffer' )
34const crypto = require ( 'libp2p-crypto' )
4- const bs58 = require ( 'bs58 ' )
5+ const multibase = require ( 'multibase ' )
56
67exports = module . exports
78
@@ -77,7 +78,7 @@ exports.ensureArray = (maybeArray) => {
7778exports . normalizeInRpcMessage = ( message ) => {
7879 const m = Object . assign ( { } , message )
7980 if ( Buffer . isBuffer ( message . from ) ) {
80- m . from = bs58 . encode ( message . from )
81+ m . from = multibase . encode ( 'base58btc' , message . from ) . toString ( ) . slice ( 1 )
8182 }
8283 return m
8384}
@@ -97,7 +98,7 @@ exports.normalizeInRpcMessages = (messages) => {
9798exports . normalizeOutRpcMessage = ( message ) => {
9899 const m = Object . assign ( { } , message )
99100 if ( typeof message . from === 'string' || message . from instanceof String ) {
100- m . from = bs58 . decode ( message . from )
101+ m . from = multibase . decode ( 'z' + message . from )
101102 }
102103 return m
103104}
Original file line number Diff line number Diff line change 22/* eslint max-nested-callbacks: ["error", 5] */
33'use strict'
44
5+ const { Buffer } = require ( 'buffer' )
56const chai = require ( 'chai' )
67chai . use ( require ( 'dirty-chai' ) )
78const expect = chai . expect
Original file line number Diff line number Diff line change 22'use strict'
33
44const { expect } = require ( 'chai' )
5-
5+ const { Buffer } = require ( 'buffer' )
66const utils = require ( '../src/utils' )
77
88describe ( 'utils' , ( ) => {
You can’t perform that action at this time.
0 commit comments