Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rclink

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rclink - npm Package Compare versions

Comparing version 1.0.27 to 1.0.28

2

package.json
{
"name": "rclink",
"main": "./src/index.js",
"version": "1.0.27",
"version": "1.0.28",
"repository": "https://gitee.com/BTAJL/RCNode.git",

@@ -6,0 +6,0 @@ "author": "c4w <“chen4w@sina.com”>",

@@ -24,3 +24,3 @@ const protobuf = require('protobufjs')

throw new Error("Can not be called before setTxMsgType function completed")
// 根据参数类型构造属性txMsg

@@ -77,2 +77,4 @@ if(Buffer.isBuffer(consArgsObj)){ // Buffer类型的已签名交易

this.pubKeyPEM = consArgsObj.pubKeyPEM;
txMsgCollection.set(this, msg)

@@ -115,9 +117,11 @@ }

let txBufferHash = Crypto.GetHashVal(txBuffer)
if(typeof prvKey === 'string')
if(typeof prvKey === 'string'){
prvKey = Crypto.ImportKey(prvKey, pass);
// 当使用从pem格式转object格式的私钥签名时,需在该object中补充pubKeyHex
prvKey.pubKeyHex = Crypto.ImportKey(this.pubKeyPEM).pubKeyHex;
}
let signature = Crypto.Sign(prvKey, txBufferHash, alg)
msg.signature = signature
//txMsgCollection.set(this, msg)
txBuffer = txMsgType.encode(msg).finish()
return txBuffer
txBuffer = txMsgType.encode(msg).finish();
return txBuffer;
}

@@ -124,0 +128,0 @@

@@ -50,2 +50,12 @@ const {Transaction} = require('../src/transaction');

});
test('使用pem格式密钥对生成签名交易', () => {
const prvkpem = "-----BEGIN PRIVATE KEY-----\nMIGNAgEAMBAGByqGSM49AgEGBSuBBAAKBHYwdAIBAQQgOUm2PF8apyaK1bXjKH5j\njCld/I6ExpefemRGsS0C4+WgBwYFK4EEAAqhRANCAAT6VLE/eF9+sK1ROn8n6x7h\nKsBxehW42qf1IB8quBn5OrQD3x2H4yZVDwPgcEUCjH8PcFgswdtbo8JL/7f66yEC\n-----END PRIVATE KEY-----"
let tra = new Transaction({type: 2, pubKeyPEM: `-----BEGIN PUBLIC KEY-----
MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE+lSxP3hffrCtUTp/J+se4SrAcXoVuNqn
9SAfKrgZ+Tq0A98dh+MmVQ8D4HBFAox/D3BYLMHbW6PCS/+3+ushAg==
-----END PUBLIC KEY-----`,
name: "xxxxx", function: "sd", args: ["123", "456"]});
tra.createSignedTransaction(prvkpem, 'ecdsa-with-SHA1');
console.log("");
});
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc