#ifndef NET_DEVICE_BOUND_SESSIONS_SESSION_ERROR_H_
#define NET_DEVICE_BOUND_SESSIONS_SESSION_ERROR_H_
#include "net/base/schemeful_site.h"
#include "net/device_bound_sessions/deletion_reason.h"
namespace net::device_bound_sessions {
struct NET_EXPORT SessionError {
enum class ErrorType {
kSuccess = 0,
kKeyError = 1,
kSigningError = 2,
kServerRequestedTermination = 5,
kInvalidSessionId = 7,
kInvalidChallenge = 9,
kTooManyChallenges = 10,
kInvalidFetcherUrl = 11,
kInvalidRefreshUrl = 12,
kTransientHttpError = 13,
kScopeOriginSameSiteMismatch = 15,
kRefreshUrlSameSiteMismatch = 16,
kMismatchedSessionId = 18,
kMissingScope = 21,
kNoCredentials = 22,
kSubdomainRegistrationWellKnownUnavailable = 24,
kSubdomainRegistrationUnauthorized = 25,
kSubdomainRegistrationWellKnownMalformed = 26,
kSessionProviderWellKnownUnavailable = 28,
kRelyingPartyWellKnownUnavailable = 30,
kFederatedKeyThumbprintMismatch = 32,
kInvalidFederatedSessionUrl = 33,
kInvalidFederatedKey = 35,
kTooManyRelyingOriginLabels = 36,
kBoundCookieSetForbidden = 37,
kNetError = 38,
kProxyError = 39,
kEmptySessionConfig = 41,
kInvalidCredentialsConfig = 42,
kInvalidCredentialsType = 43,
kInvalidCredentialsEmptyName = 44,
kInvalidCredentialsCookie = 45,
kPersistentHttpError = 46,
kRegistrationAttemptedChallenge = 47,
kInvalidScopeOrigin = 48,
kScopeOriginContainsPath = 49,
kRefreshInitiatorNotString = 50,
kRefreshInitiatorInvalidHostPattern = 51,
kInvalidScopeSpecification = 52,
kMissingScopeSpecificationType = 53,
kEmptyScopeSpecificationDomain = 54,
kEmptyScopeSpecificationPath = 55,
kInvalidScopeSpecificationType = 56,
kInvalidScopeIncludeSite = 57,
kMissingScopeIncludeSite = 58,
kFederatedNotAuthorizedByProvider = 59,
kFederatedNotAuthorizedByRelyingParty = 60,
kSessionProviderWellKnownMalformed = 61,
kSessionProviderWellKnownHasProviderOrigin = 62,
kRelyingPartyWellKnownMalformed = 63,
kRelyingPartyWellKnownHasRelyingOrigins = 64,
kInvalidFederatedSessionProviderSessionMissing = 65,
kInvalidFederatedSessionWrongProviderOrigin = 66,
kInvalidCredentialsCookieCreationTime = 67,
kInvalidCredentialsCookieName = 68,
kInvalidCredentialsCookieParsing = 69,
kInvalidCredentialsCookieUnpermittedAttribute = 70,
kInvalidCredentialsCookieInvalidDomain = 71,
kInvalidCredentialsCookiePrefix = 72,
kInvalidScopeRulePath = 73,
kInvalidScopeRuleHostPattern = 74,
kScopeRuleOriginScopedHostPatternMismatch = 75,
kScopeRuleSiteScopedHostPatternMismatch = 76,
kSigningQuotaExceeded = 77,
kInvalidConfigJson = 78,
kInvalidFederatedSessionProviderFailedToRestoreKey = 79,
kFailedToUnwrapKey = 80,
kMaxValue = kFailedToUnwrapKey,
};
using enum ErrorType;
explicit SessionError(ErrorType type);
~SessionError();
SessionError(const SessionError&) = delete;
SessionError& operator=(const SessionError&) = delete;
SessionError(SessionError&&) noexcept;
SessionError& operator=(SessionError&&) noexcept;
std::optional<DeletionReason> GetDeletionReason() const;
bool IsServerError() const;
ErrorType type;
};
}
#endif