Go ValidateHashFormat was still validating the old -00 format (algorithm:base64url with sha-256/sha-384/sha-512 prefix). Updated to validate plain base64url without prefix per -01 spec and RFC 9449. Python was already updated but uncommitted. Both refimpls now match.
28 lines
1.5 KiB
Go
28 lines
1.5 KiB
Go
package ect
|
|
|
|
import "errors"
|
|
|
|
// Sentinel errors for programmatic handling and logging.
|
|
var (
|
|
ErrPayloadRequired = errors.New("ect: payload and privateKey required")
|
|
ErrKeyIDRequired = errors.New("ect: KeyID required")
|
|
ErrInvalidTyp = errors.New("ect: invalid typ parameter")
|
|
ErrProhibitedAlg = errors.New("ect: prohibited algorithm")
|
|
ErrMissingKid = errors.New("ect: missing kid")
|
|
ErrUnknownKey = errors.New("ect: unknown key identifier")
|
|
ErrWITSubjectMismatch = errors.New("ect: issuer does not match WIT subject")
|
|
ErrAudienceMismatch = errors.New("ect: audience does not include verifier")
|
|
ErrExpired = errors.New("ect: token expired")
|
|
ErrIATTooOld = errors.New("ect: iat too far in the past")
|
|
ErrIATInFuture = errors.New("ect: iat in the future")
|
|
ErrMissingClaims = errors.New("ect: missing required claims (jti, exec_act, pred)")
|
|
ErrReplay = errors.New("ect: jti already seen (replay)")
|
|
ErrResolveKeyRequired = errors.New("ect: ResolveKey required")
|
|
ErrExtSize = errors.New("ect: ext exceeds max size (4096 bytes)")
|
|
ErrExtDepth = errors.New("ect: ext exceeds max nesting depth (5)")
|
|
ErrInvalidJTI = errors.New("ect: jti must be UUID format")
|
|
ErrInvalidWID = errors.New("ect: wid must be UUID format when set")
|
|
ErrPredLength = errors.New("ect: pred exceeds max length")
|
|
ErrHashFormat = errors.New("ect: inp_hash/out_hash must be plain base64url (no prefix)")
|
|
)
|