cryptocoinjs / coinkey

JavaScript component for private keys, public keys, and addresess for crypto currencies such as Bitcoin, Litecoin, and Dogecoin
149 stars 58 forks source link

Import public key only? #18

Open benzmuircroft opened 1 year ago

benzmuircroft commented 1 year ago

How do I verify a signature If I only have the signature, hash and public key (the public key is in string address format)

one side of my application does not have access to the private key so it needs to get the Unit8Array of the public key

Buffer.from('17ZXnSJTJunbJ4XZqCyk2nQEQbyEmVvVea') Uint8Array(34) [49, 55, 90, 88, 110, 83, 74, 84, 74, 117, 110, 98, 74, 52, 88, 90, 113, 67, 121, 107, 50, 110, 81, 69, 81, 98, 121, 69, 109, 86, 118, 86, 101, 97, buffer: ArrayBuffer(34), byteLength: 34, byteOffset: 0, length: 34, Symbol(Symbol.toStringTag): 'Uint8Array']

ck.publicKey Uint8Array(33) [2, 67, 106, 27, 171, 24, 15, 34, 172, 146, 167, 238, 143, 236, 169, 237, 77, 253, 171, 50, 221, 43, 152, 38, 25, 47, 232, 78, 206, 254, 78, 100, 86, buffer: ArrayBuffer(33), byteLength: 33, byteOffset: 0, length: 33, Symbol(Symbol.toStringTag): 'Uint8Array']

ck.publicAddress == '17ZXnSJTJunbJ4XZqCyk2nQEQbyEmVvVea' true

is there a method to get the correct imported public key somewhere in these libraries?

NOTE: the address is empty