Repository navigation
Expand file tree
/
Copy patherrors.go
More file actions
76 lines (74 loc) · 3.92 KB
/
Copy patherrors.go
File metadata and controls
76 lines (74 loc) · 3.92 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package gocap
import "errors"
// Sentinel errors for challenge validation and token verification.
// Use errors.Is(result, ErrXXX) to check the failure reason.
var (
// ErrMissingToken is returned when the challenge token is empty.
ErrMissingToken = errors.New("missing_token")
// ErrMissingSolutions is returned when the solutions array is nil.
ErrMissingSolutions = errors.New("missing_solutions")
// ErrInvalidToken is returned when the JWT is malformed, tampered, or
// has an invalid signature.
ErrInvalidToken = errors.New("invalid_token")
// ErrScopeMismatch is returned when the requested scope doesn't match
// the scope embedded in the challenge token.
ErrScopeMismatch = errors.New("scope_mismatch")
// ErrExpired is returned when the challenge or validation token has
// exceeded its time-to-live.
ErrExpired = errors.New("expired")
// ErrInvalidSolutions is returned when the solutions array is missing or
// its length doesn't match the challenge count.
ErrInvalidSolutions = errors.New("invalid_solutions")
// ErrInvalidSolution is returned when a PoW solution doesn't produce
// a hash with the required target prefix.
ErrInvalidSolution = errors.New("invalid_solution")
// ErrAlreadyRedeemed is returned by the ConsumeNonce callback when the
// challenge token signature has already been used.
ErrAlreadyRedeemed = errors.New("already_redeemed")
// ErrNonceStoreError is returned when the ConsumeNonce callback itself
// fails (e.g. a storage backend error).
ErrNonceStoreError = errors.New("nonce_store_error")
// ErrStorageNotConfigured is returned by ValidateToken when no Storage
// was provided to the Cap instance.
ErrStorageNotConfigured = errors.New("storage_not_configured")
// ErrCleanupError is returned when the storage's CleanupExpired call fails.
ErrCleanupError = errors.New("cleanup_error")
// ErrStorageError is returned when a storage Get/Set operation fails.
ErrStorageError = errors.New("storage_error")
// ErrTokenNotFound is returned when the validation token is not found
// in storage.
ErrTokenNotFound = errors.New("token_not_found")
// ErrTokenExpired is returned when the validation token exists but has
// passed its expiration time.
ErrTokenExpired = errors.New("token_expired")
// ErrInstrCorrupted is returned when the instrumentation metadata
// cannot be decrypted or parsed.
ErrInstrCorrupted = errors.New("instr_corrupted")
// ErrInstrExpired is returned when the instrumentation metadata has
// exceeded its expiration time.
ErrInstrExpired = errors.New("instr_expired")
// ErrInstrAutomatedBrowser is returned when the instrumentation
// detected an automated browser and BlockAutomatedBrowsers is enabled.
ErrInstrAutomatedBrowser = errors.New("instr_automated_browser")
// ErrInstrTimeout is returned when the instrumentation timed out.
ErrInstrTimeout = errors.New("instr_timeout")
// ErrInstrFailed is returned when the instrumentation result
// verification fails unexpectedly.
ErrInstrFailed = errors.New("instr_failed")
// ErrInstrMissing is returned when instrumentation is required but
// no instrumentation result was provided.
ErrInstrMissing = errors.New("instr_missing")
// ErrInstrProbeMissing is returned when blockAutomatedBrowsers is enabled
// but the client did not send a browser probe vector.
ErrInstrProbeMissing = errors.New("instr_probe_missing")
// ErrShortSecret is returned by NewCap when Secret is shorter than 16 bytes.
ErrShortSecret = errors.New("secret must be at least 16 bytes")
// ErrRSWBitsMustBeEven is returned by GenerateRswKeypair when bits is odd.
ErrRSWBitsMustBeEven = errors.New("rsw bits must be even")
// ErrRSWKeypairRequired is returned when format-2 rsw protocol is used
// without providing a keypair.
ErrRSWKeypairRequired = errors.New("format-2 rsw requires opts.Keypair")
// ErrHashwxUnavailable is returned when the embedded HashWX module cannot
// be initialized or executed.
ErrHashwxUnavailable = errors.New("hashwx_unavailable")
)