-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontracts.go
39 lines (32 loc) · 1007 Bytes
/
contracts.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package jwt
import (
"errors"
"time"
)
type Algorithm interface {
Name() string
ComputeHash(value, secret []byte) []byte
}
type Validator interface {
Validate(claims interface{}) error
}
type TokenExpiration interface {
TokenExpiration() time.Time
}
type TokenAudience interface {
TokenAudience() string
}
type headers struct {
Algorithm string `json:"alg,omitempty"`
KeyID string `json:"kid,omitempty"`
Type string `json:"typ,omitempty"`
}
var (
SegmentCountErr = errors.New("a JWT must have three segments separated by period characters")
MalformedHeaderErr = errors.New("the header is malformed")
MalformedHeaderContentErr = errors.New("the header content is malformed")
MalformedPayloadContentErr = errors.New("the payload content is malformed")
MalformedSignatureErr = errors.New("the signature is malformed")
UnrecognizedSignatureErr = errors.New("unrecognized signature")
UnrecognizedAlgorithmErr = errors.New("unrecognized algorithm")
)