2024-11-12 15:16:43 -05:00
|
|
|
package invocation
|
|
|
|
|
|
|
|
|
|
import "errors"
|
|
|
|
|
|
2024-11-13 16:58:48 +01:00
|
|
|
// Loading errors
|
2024-11-12 15:16:43 -05:00
|
|
|
var (
|
|
|
|
|
// ErrMissingDelegation
|
|
|
|
|
ErrMissingDelegation = errors.New("loader missing delegation for proof chain")
|
2024-11-13 16:58:48 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Time bound errors
|
|
|
|
|
var (
|
|
|
|
|
// ErrTokenExpired is returned if a token is invalid at execution time
|
|
|
|
|
ErrTokenInvalidNow = errors.New("token has expired")
|
|
|
|
|
)
|
2024-11-12 15:16:43 -05:00
|
|
|
|
2024-11-13 16:58:48 +01:00
|
|
|
// Principal alignment errors
|
|
|
|
|
var (
|
2024-11-12 15:16:43 -05:00
|
|
|
// ErrNoProof is returned when no delegations were provided to prove
|
|
|
|
|
// that the invocation should be executed.
|
|
|
|
|
ErrNoProof = errors.New("at least one delegation must be provided to validate the invocation")
|
|
|
|
|
|
2024-11-13 16:58:48 +01:00
|
|
|
// ErrLastNotRoot is returned if the last delegation token in the proof
|
|
|
|
|
// chain is not a root delegation token.
|
|
|
|
|
ErrLastNotRoot = errors.New("the last delegation token in proof chain must be a root token")
|
2024-11-12 15:16:43 -05:00
|
|
|
|
2024-11-13 16:58:48 +01:00
|
|
|
// ErrBrokenChain is returned when the Audience of a delegation is
|
2024-11-12 15:16:43 -05:00
|
|
|
// not the Issuer of the previous one.
|
2024-11-13 16:58:48 +01:00
|
|
|
ErrBrokenChain = errors.New("delegation proof chain doesn't connect the invocation to the subject")
|
|
|
|
|
|
|
|
|
|
// ErrWrongSub is returned when the Subject of a delegation is not the invocation audience.
|
|
|
|
|
ErrWrongSub = errors.New("delegation subject need to match the invocation audience")
|
|
|
|
|
|
|
|
|
|
// ErrCommandNotCovered is returned when a delegation command doesn't cover (identical or parent of) the
|
|
|
|
|
// next delegation or invocation's command.
|
|
|
|
|
ErrCommandNotCovered = errors.New("allowed command doesn't cover the next delegation or invocation")
|
2024-11-12 15:16:43 -05:00
|
|
|
)
|