supranational / blst

Multilingual BLS12-381 signature library
Apache License 2.0
454 stars 171 forks source link

How Derive keys by path? #204

Closed vincentiss closed 4 months ago

vincentiss commented 4 months ago

Dear all,

I need to get Withdrawal keys and Signing keys, the corresponding paths are "m/12381/i/0" and "m/12381/i/0/0" respectively. But I can only pass an int32 type parameter to this function.

func (master *SecretKey) DeriveChildEip2333(child_index uint32) *SecretKey {

How do I pass parameters? Or is there any way to pass string type path? Could you give me some help? Thank you very much.

dot-asm commented 4 months ago

DeriveChildEip2333 follows corresponding spec according to which it accepts a 32-bit unsigned integer index. While the spec uses "m/i" notation to describe a tree, it doesn't assign specific meaning to it and doesn't say anything about accepting them as arguments. In other words it's up to application to assign the meaning, parse the strings and pass suitable values to the key derivation methods.

vincentiss commented 4 months ago

Yes, you are right.