File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -498,7 +498,7 @@ export function encodeTx (txData) {
498498 * @return {Boolean } Valid?
499499 */
500500export function isValidKeypair ( privateKey , publicKey ) {
501- const message = 'TheMessage'
501+ const message = Buffer . from ( 'TheMessage' )
502502 const signature = sign ( message , privateKey )
503503 return verify ( message , signature , publicKey )
504504}
Original file line number Diff line number Diff line change @@ -48,7 +48,16 @@ describe('crypto', () => {
4848 assert . isAtMost ( keyPair . publicKey . length , 53 )
4949 } )
5050 } )
51-
51+
52+ describe ( 'isValidKeypair' , ( ) => {
53+ it ( 'verify the generated key pair' , ( ) => {
54+ const keyPair = Crypto . generateKeyPair ( true )
55+ assert . ok ( keyPair )
56+ const verifyResult = Crypto . isValidKeypair ( keyPair . secretKey , keyPair . publicKey )
57+ assert . isTrue ( verifyResult )
58+ } )
59+ } )
60+
5261 describe ( 'encryptPassword' , ( ) => {
5362 describe ( 'generate a password encrypted key pair' , ( ) => {
5463 const keyPair = Crypto . generateKeyPair ( true )
You can’t perform that action at this time.
0 commit comments