This commit is contained in:
Michael Yang 2024-08-01 14:52:15 -07:00
parent 558a54b098
commit b732beba6a
68 changed files with 199 additions and 149 deletions

View file

@ -5,6 +5,7 @@ import (
"context"
"crypto/rand"
"encoding/base64"
"errors"
"fmt"
"io"
"log/slog"
@ -78,7 +79,7 @@ func Sign(ctx context.Context, bts []byte) (string, error) {
publicKey := ssh.MarshalAuthorizedKey(privateKey.PublicKey())
parts := bytes.Split(publicKey, []byte(" "))
if len(parts) < 2 {
return "", fmt.Errorf("malformed public key")
return "", errors.New("malformed public key")
}
signedData, err := privateKey.Sign(rand.Reader, bts)