Skip to content

Commit

Permalink
Rename "Size" method to "SizeUp"
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Sanches committed Mar 1, 2019
1 parent 9f162d8 commit 9dc1d76
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions ecdsa.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ func (e *ECDSA) Sign(payload []byte) ([]byte, error) {
return e.sign(payload)
}

// Size returns the signature byte size.
func (e *ECDSA) Size() (int, error) {
// SizeUp returns the signature byte size.
func (e *ECDSA) SizeUp() (int, error) {
pub := e.pub
if pub == nil {
priv := e.priv
Expand Down
2 changes: 1 addition & 1 deletion ed25519.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (e *Ed25519) Sign(payload []byte) ([]byte, error) {
}

// Size returns the signature byte size.
func (e *Ed25519) Size() (int, error) {
func (e *Ed25519) SizeUp() (int, error) {
return ed25519.SignatureSize, nil
}

Expand Down
4 changes: 2 additions & 2 deletions hmac.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ func (h *HMAC) Sign(hp []byte) ([]byte, error) {
return h.pool.sign(hp)
}

// Size returns the signature byte size.
func (h *HMAC) Size() (int, error) {
// SizeUp returns the signature byte size.
func (h *HMAC) SizeUp() (int, error) {
return h.hash.Size(), nil
}

Expand Down
2 changes: 1 addition & 1 deletion none.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func (n *None) Sign(_ []byte) ([]byte, error) {
return nil, nil
}

func (n *None) Size() (int, error) {
func (n *None) SizeUp() (int, error) {
return 0, nil
}

Expand Down
4 changes: 2 additions & 2 deletions rsa.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ func (r *RSA) Sign(payload []byte) ([]byte, error) {
return r.sign(payload)
}

// Size returns the signature byte size.
func (r *RSA) Size() (int, error) {
// SizeUp returns the signature byte size.
func (r *RSA) SizeUp() (int, error) {
pub := r.pub
if pub == nil {
priv := r.priv
Expand Down
2 changes: 1 addition & 1 deletion sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func Sign(h Header, payload interface{}, s Signer) ([]byte, error) {
return nil, err
}

sigSize, err := s.Size()
sigSize, err := s.SizeUp()
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package jwt

// Signer is a JWT signer.
type Signer interface {
// Sign signs a JWT payload and returns a complete JWT (payload + signature).
// Sign signs a JWT's header and payload.
Sign([]byte) ([]byte, error)
// Size is the signature size of a signer.
Size() (int, error)
// SizeUp tries to return a signer's signature size.
SizeUp() (int, error)
// String returns the string representation of the signing method.
String() string
}

0 comments on commit 9dc1d76

Please sign in to comment.