I'm looking for a self contained JS module that will take a key in hex string form such as
var k = create_private_key_hex_string(); // Gives hex string of "a01045825b3459874345987234";
and allow creating a public key via EC to give
var pubkey = derive_public_key_hex_string( k ); // gives { x : "deadbeef983457903845", y:"ab348989745609456" }
and create a signature via ECDSA such that I can do...
var msg = "hello world"
var msg_hash = create_sha256_hex_string( msg ) // gives hex string "b309234654234986094609486.."
var signature = sign_hash( msg_hash, k ); // gives another hex string "54907567b309234986094609486.."
and finally allow verify
var is_valid = verify( signature, msg_hash, pubkey );
Basically a really easy JS module that has these simple methods all taking hex strings as input
- create_private_key_hex_string();
- derive_public_key_hex_string( k );
- create_sha256_hex_string( message );
- sign_hash( msg_hash, k );
- verify_hash( signature, msg_hash, pubkey );
Ideally so it works in all browsers and in node.js.
Any suggestions or anyone willing to make it?
It just needs to work easily in all browsers and in node.js and not require babel or dependencies.