Tougee / curve25519

Dart port of x25519 from Go Cryptography curve25519
https://pub.dev/packages/x25519
Apache License 2.0
7 stars 1 forks source link

ConvertPublicKey + SharedKey #1

Closed redDwarf03 closed 3 years ago

redDwarf03 commented 3 years ago

Hello thanks for your work

I would like to use your library to translate this js code:

const { public: ephemeralPublicKey, private: ephemeralPrivateKey} = curve25519.generateKeyPair(randomBytes(32))  
const curve25519pub = ed2curve.convertPublicKey(pubBuf)

var sharedKey = curve25519.sharedKey(ephemeralPrivateKey, curve25519pub)

But I don't know how. Is it possible with your library ?

Best

Tougee commented 3 years ago

This library provides these 2 APIs you can use, generateKeyPair() and X25519() as shareKey(). Not sure of const curve25519pub = ed2curve.convertPublicKey(pubBuf), any full implementation codes of this?

redDwarf03 commented 3 years ago

here's: https://github.com/archethic-foundation/libjs/blob/b2b22f79d91bd88d7afd9828c536af930f4c7f19/lib/crypto.js#L286

ed2curve documentation: https://www.npmjs.com/package/ed2curve

Tougee commented 3 years ago

Not have these APIs yet.

redDwarf03 commented 3 years ago

ok. thank you for your answer Best

Tougee commented 3 years ago

If you're using Ed25519, you can get codes here.