diff --git a/signature/ed25519/key.go b/signature/ed25519/key.go index 0fd2f8b..8f61cac 100644 --- a/signature/ed25519/key.go +++ b/signature/ed25519/key.go @@ -76,6 +76,9 @@ func NewParameters(variant Variant) (Parameters, error) { return Parameters{variant: variant}, nil } +// Variant returns the prefix variant of the parameters. +func (p *Parameters) Variant() Variant { return p.variant } + // HasIDRequirement returns true if the key has an ID requirement. func (p *Parameters) HasIDRequirement() bool { return p.variant != VariantNoPrefix } diff --git a/signature/ed25519/key_test.go b/signature/ed25519/key_test.go index a18f6b0..72a7ab9 100644 --- a/signature/ed25519/key_test.go +++ b/signature/ed25519/key_test.go @@ -43,10 +43,13 @@ func TestNewParameters(t *testing.T) { }, } { t.Run(tc.name, func(t *testing.T) { - _, err := ed25519.NewParameters(tc.variant) + params, err := ed25519.NewParameters(tc.variant) if err != nil { t.Errorf("ed25519.NewParameters(%v) err = %v, want nil", tc.variant, err) } + if got := params.Variant(); got != tc.variant { + t.Errorf("params.Variant() = %v, want %v", got, tc.variant) + } }) } t.Run("unknown", func(t *testing.T) {