diff --git a/bindings/rpc.go b/bindings/rpc.go index a61a583e79625aebed965f890ffa54a61a88ab22..0022f313adef37273acfbea5bba2753ab583e86c 100644 --- a/bindings/rpc.go +++ b/bindings/rpc.go @@ -163,6 +163,16 @@ func GenerateRandomRPCKey(cMixID int) ([]byte, error) { return prk.Bytes(), nil } +// DeriveRPCPublicKey derives the public key from the given private key +func DeriveRPCPublicKey(privateKey []byte) ([]byte, error) { + prk := ecdh.ECDHNIKE.NewEmptyPrivateKey() + err := prk.FromBytes(privateKey) + if err != nil { + return nil, err + } + return ecdh.ECDHNIKE.DerivePublicKey(prk).Bytes(), nil +} + // LoadRPCServer load key and id from disk and return an RPC server func LoadRPCServer(cMixID int, callback RPCServerCallback) ( RPCServer, error) {