ebceu4 / waves-crypto

Waves platform crypto primitives and binary serialization.
MIT License
0 stars 0 forks source link

get publicKey from privateKey #5

Closed roccomuso closed 5 years ago

roccomuso commented 5 years ago

How to do that? I saw there isn't a method exposed for that. Any hints using other npm modules?

siemarell commented 5 years ago

There is only generate keyPair method since WAVES uses Curve25519-ED25519 signature with X25519 keys. You can read about it here. Could you please explain what are trying to achieve and why can't you just use seed? I will try to help you

roccomuso commented 5 years ago

I read that documentation. I'm trying to keep it atomic and avoid exposing a seed. It should be possible though to get public from private in X25519 or ed25519, isn't it? Feel free to reach me on wavesplatform discord.

siemarell commented 5 years ago

Ok. So, first of all use [@waves/waves-crypto]() package. All new versions will be published there. In the latest version there are internal libraries exposed. You need 'axlsign', it has generateKeyPair method.

import {libs} from '@waves/waves-crypto'
const {axlsign} = libs

const keyPair = axlsign.generateKeyPair(privateKey:Uint8Array)

Here you can find its code. Although in code param is called 'seed', it is not seed but ed25519 key.

roccomuso commented 5 years ago

I saw that method but decided not to used it when I saw that "seed" param name. Trying it in a bit.

siemarell commented 5 years ago

Yes, it is misleading. You pass ed25519 key and get X25519 keypair in return

roccomuso commented 5 years ago

Thanks! :+1: