public/subjects/blockchain/signer
nprimo 4fa5c876a7 docs: run prettify and move h1 to h2 2023-06-09 09:17:48 +01:00
..
README.md docs: run prettify and move h1 to h2 2023-06-09 09:17:48 +01:00

README.md

Signer

Elliptic curve cryptography is used in most blockchain projects to sign transactions. Using Node.js base library we will practise simple signatures.

Instructions

  • Create a function init() that generates a cryptographic key pair on any elliptic curve and returns the public key in any format.

  • Create a function signer(message) that takes as arguments a message and returns the signature of the message (using the sha256 algorithm and the keys generated with init).

  • create a function verifier(message, pubKey, signature) that takes as arguments a message, a public key and a signature and returns a boolean if the signature is valid.

Usage

const message = 'This is a message to sign'
const pubKey = init()
const signature = signer(message)
console.log(verifier(message, pubKey, signature))
// expected result :
// true

Notions