package value_objects // AccountStatus represents the status of an account type AccountStatus string const ( AccountStatusActive AccountStatus = "active" AccountStatusSuspended AccountStatus = "suspended" AccountStatusLocked AccountStatus = "locked" AccountStatusRecovering AccountStatus = "recovering" ) // String returns the string representation func (s AccountStatus) String() string { return string(s) } // IsValid checks if the status is valid func (s AccountStatus) IsValid() bool { switch s { case AccountStatusActive, AccountStatusSuspended, AccountStatusLocked, AccountStatusRecovering: return true default: return false } } // CanLogin checks if the account can login with this status func (s AccountStatus) CanLogin() bool { return s == AccountStatusActive } // CanInitiateRecovery checks if recovery can be initiated func (s AccountStatus) CanInitiateRecovery() bool { return s == AccountStatusActive || s == AccountStatusLocked } // ShareType represents the type of key share type ShareType string const ( ShareTypeUserDevice ShareType = "user_device" // Share stored on user's device ShareTypeServer ShareType = "server" // Share stored by persistent server party (in DB) ShareTypeRecovery ShareType = "recovery" // Share stored for recovery ShareTypeDelegate ShareType = "delegate" // Share returned to user via delegate party (not stored in party DB) ) // String returns the string representation func (st ShareType) String() string { return string(st) } // IsValid checks if the share type is valid func (st ShareType) IsValid() bool { switch st { case ShareTypeUserDevice, ShareTypeServer, ShareTypeRecovery, ShareTypeDelegate: return true default: return false } } // RequiresUserShare checks if this share type requires user to provide share for signing func (st ShareType) RequiresUserShare() bool { return st == ShareTypeDelegate || st == ShareTypeUserDevice } // RecoveryType represents the type of account recovery type RecoveryType string const ( RecoveryTypeDeviceLost RecoveryType = "device_lost" RecoveryTypeShareRotation RecoveryType = "share_rotation" ) // String returns the string representation func (rt RecoveryType) String() string { return string(rt) } // IsValid checks if the recovery type is valid func (rt RecoveryType) IsValid() bool { switch rt { case RecoveryTypeDeviceLost, RecoveryTypeShareRotation: return true default: return false } } // RecoveryStatus represents the status of a recovery session type RecoveryStatus string const ( RecoveryStatusRequested RecoveryStatus = "requested" RecoveryStatusInProgress RecoveryStatus = "in_progress" RecoveryStatusCompleted RecoveryStatus = "completed" RecoveryStatusFailed RecoveryStatus = "failed" ) // String returns the string representation func (rs RecoveryStatus) String() string { return string(rs) } // IsValid checks if the recovery status is valid func (rs RecoveryStatus) IsValid() bool { switch rs { case RecoveryStatusRequested, RecoveryStatusInProgress, RecoveryStatusCompleted, RecoveryStatusFailed: return true default: return false } }