Skip to content

Commit

Permalink
Merge pull request #12 from nmiyake/exportEnvelopeVerifier
Browse files Browse the repository at this point in the history
Export the EnvelopeVerifier type
  • Loading branch information
adityasaky authored Feb 25, 2022
2 parents 9e1a44e + b126739 commit e5b9b0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dsse/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ type SignVerifier interface {
// EnvelopeSigner creates signed Envelopes.
type EnvelopeSigner struct {
providers []SignVerifier
ev *envelopeVerifier
ev *EnvelopeVerifier
}

/*
Expand Down
10 changes: 5 additions & 5 deletions dsse/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Verifier interface {
Public() crypto.PublicKey
}

type envelopeVerifier struct {
type EnvelopeVerifier struct {
providers []Verifier
threshold int
}
Expand All @@ -31,7 +31,7 @@ type AcceptedKey struct {
Sig Signature
}

func (ev *envelopeVerifier) Verify(e *Envelope) ([]AcceptedKey, error) {
func (ev *EnvelopeVerifier) Verify(e *Envelope) ([]AcceptedKey, error) {
if len(e.Signatures) == 0 {
return nil, ErrNoSignature
}
Expand Down Expand Up @@ -110,17 +110,17 @@ func (ev *envelopeVerifier) Verify(e *Envelope) ([]AcceptedKey, error) {
return acceptedKeys, nil
}

func NewEnvelopeVerifier(v ...Verifier) (*envelopeVerifier, error) {
func NewEnvelopeVerifier(v ...Verifier) (*EnvelopeVerifier, error) {
return NewMultiEnvelopeVerifier(1, v...)
}

func NewMultiEnvelopeVerifier(threshold int, p ...Verifier) (*envelopeVerifier, error) {
func NewMultiEnvelopeVerifier(threshold int, p ...Verifier) (*EnvelopeVerifier, error) {

if threshold <= 0 || threshold > len(p) {
return nil, errors.New("Invalid threshold")
}

ev := envelopeVerifier{
ev := EnvelopeVerifier{
providers: p,
threshold: threshold,
}
Expand Down

0 comments on commit e5b9b0e

Please sign in to comment.