Digital Signature

The Digital Signature module in the Neucron JavaScript SDK allows you to create and verify digital signatures.

Create Digital Signature

To create a digital signature, use the following code:

import NeucronSDK from 'neucron-sdk/src/neucron-sdk.js';

const neucronSDK = new NeucronSDK();
await neucronSDK.authentication.login({
  email: 'nikhilmatta10@gmail.com',
  password: '#Nikku478'
});

const options = {
  message: 'm-sign'
};
const response = await neucronSDK.digitalsignature.signature(options);
console.log(response);

Response:

{
  data: {
    signature_b64: 'MEQCIAO9q7Lvte+oU2Feq8x/9u0zhBGzeF+Q/41qPjLQRScrAiBxEklb76AGvMN0hoJsiGVnejlqmZaWkWwPvRBH1e/s1g==',
    public_Key: '0358351ba1fe1af1cd0d0c0a17bd45153023cdad3cb4370ca67071d03b40992d57',
    message_hash: '7c5797d5c6533f5a83351f96389ce48932182b4cc51fb801c980106dcc8b88b8',
    signature_hex: '3044022003bdabb2efb5efa853615eabcc7ff6ed338411b3785f90ff8d6a3e32d045272b02207112495befa006bcc37486826c8865677a396a999696916c0fbd1047d5efecd6'
  },
  status_code: 200
}

Verify Digital Signature

To verify a digital signature, use the following code:

import NeucronSDK from 'neucron-sdk/src/neucron-sdk.js';

const neucronSDK = new NeucronSDK();
await neucronSDK.authentication.login({
  email: 'nikhilmatta10@gmail.com',
  password: '#Nikku478'
});

const options = {
  message: 'Hello Rohan & Shubh, Santhosh , Rajapal , Raghu',
  public_Key: '02be604deaf4aa14950eb1ffd6100fa5b45c4b173a21c7e1afce95a9a3b2e85bea',
  signature_hex: '30450221009ba07c68ba5c58fa49bd2bf3f272a0f52226cabd90e23647b7409dae778992ad022077fc62cc5e4afe59e281b75125fd1e30f1cc1bc95e7ff089ac058aad99ebe184'
};

const response = await neucronSDK.digitalsignature.verify(options);
console.log(response);

Response:

{
  data: {
    message_verified: true,
    tx_id: '71f201f99a992f55ebb4ce90767646a5eef0468a7bc7abec9bc7841e1852924e'
  },
  status_code: 200
}

This concludes the documentation for the Digital Signature module in the Neucron JavaScript SDK. For more details or additional functionalities, please refer to the official Neucron SDK documentation.

Last updated