From 6202a4924552a7afe3ccaa34851fc652c3deccee Mon Sep 17 00:00:00 2001 From: elizabeth Date: Thu, 5 Oct 2023 14:45:36 -0400 Subject: [PATCH] update cli to take ed25519 seed (32 bytes) --- cmd/server.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/server.go b/cmd/server.go index a1538a6..20389a5 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -70,6 +70,10 @@ func getPrivateKeyFromFlag() (*ed25519.PrivateKey, error) { return nil, err } - privateKey := ed25519.PrivateKey(privateKeyBytes) + if len(privateKeyBytes) != ed25519.SeedSize { + return nil, fmt.Errorf("invalid private key length, expected 32: %d", len(privateKeyBytes)) + } + + privateKey := ed25519.NewKeyFromSeed(privateKeyBytes) return &privateKey, nil }