Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: s2 on June 21, 2019, 12:59:35 PM



Title: Any recommendations for a simple javascript file for signing messages?
Post by: s2 on June 21, 2019, 12:59:35 PM
I'm looking for a self contained JS module that will take a key in hex string form such as

Code:
var k = create_private_key_hex_string(); // Gives hex string of "a01045825b3459874345987234";

and allow creating a public key via EC to give

Code:
var pubkey = derive_public_key_hex_string( k ); // gives { x : "deadbeef983457903845", y:"ab348989745609456" }

and create a signature via ECDSA such that I can do...

Code:
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


Code:
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.


Title: Re: Any recommendations for a simple javascript file for signing messages?
Post by: celestio on June 22, 2019, 10:11:54 AM
You need a simpler version of this script: https://blog.kherwa.com/2018/01/08/create-bitcoin-transaction-using-javascript/


Title: Re: Any recommendations for a simple javascript file for signing messages?
Post by: s2 on July 09, 2019, 11:16:58 AM
Would anyone be interested in writing this?  I am happy to pay (in bitcoin).  PM a quote and I will select someone.  Happy to use escrow if that gives reassurance.
Thanks


Title: Re: Any recommendations for a simple javascript file for signing messages?
Post by: DaCryptoRaccoon on July 09, 2019, 11:33:48 AM
https://github.com/coinbin/coinbin

This should be what your needing.
Should have all the parts to create what your looking for.


Title: Re: Any recommendations for a simple javascript file for signing messages?
Post by: s2 on July 09, 2019, 12:17:22 PM
Thanks, you might be right!  I will have a gander... 
Thank you again!!


Title: Re: Any recommendations for a simple javascript file for signing messages?
Post by: DaCryptoRaccoon on July 09, 2019, 12:31:38 PM
Thanks, you might be right!  I will have a gander... 
Thank you again!!

Most welcome.

 ;)