Skip to content

Commit

Permalink
Add missing Variant() method to ed25519.Parameters
Browse files Browse the repository at this point in the history
#tinkApiChange

PiperOrigin-RevId: 672897691
Change-Id: Iba5ac1802c6a38b8e4416c2a7a97d5e849c0500e
  • Loading branch information
morambro authored and copybara-github committed Sep 10, 2024
1 parent 34fa914 commit 7e7f5c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions signature/ed25519/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down
5 changes: 4 additions & 1 deletion signature/ed25519/key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7e7f5c8

Please sign in to comment.