A community based topic aggregation platform built on atproto
1package verification 2 3import "fmt" 4 5// InvalidPhoneNumberError indicates phone number format is invalid 6type InvalidPhoneNumberError struct { 7 Phone string 8} 9 10func (e *InvalidPhoneNumberError) Error() string { 11 return fmt.Sprintf("invalid phone number format: %s", e.Phone) 12} 13 14// PhoneAlreadyVerifiedError indicates phone is already verified by another account 15type PhoneAlreadyVerifiedError struct { 16 PhoneHash string 17} 18 19func (e *PhoneAlreadyVerifiedError) Error() string { 20 return "this phone number is already verified by another account" 21} 22 23// RateLimitExceededError indicates too many verification requests 24type RateLimitExceededError struct { 25 Identifier string 26 RetryAfter int // seconds 27} 28 29func (e *RateLimitExceededError) Error() string { 30 return fmt.Sprintf("rate limit exceeded, retry after %d seconds", e.RetryAfter) 31} 32 33// SMSDeliveryFailedError indicates SMS failed to send 34type SMSDeliveryFailedError struct { 35 Reason string 36} 37 38func (e *SMSDeliveryFailedError) Error() string { 39 return fmt.Sprintf("failed to send SMS: %s", e.Reason) 40} 41 42// InvalidCodeError indicates OTP code is incorrect 43type InvalidCodeError struct{} 44 45func (e *InvalidCodeError) Error() string { 46 return "invalid verification code" 47} 48 49// CodeExpiredError indicates OTP code has expired 50type CodeExpiredError struct{} 51 52func (e *CodeExpiredError) Error() string { 53 return "verification code has expired" 54} 55 56// RequestNotFoundError indicates request ID not found 57type RequestNotFoundError struct { 58 RequestID string 59} 60 61func (e *RequestNotFoundError) Error() string { 62 return fmt.Sprintf("verification request not found: %s", e.RequestID) 63} 64 65// TooManyAttemptsError indicates too many failed verification attempts 66type TooManyAttemptsError struct{} 67 68func (e *TooManyAttemptsError) Error() string { 69 return "too many failed attempts, please request a new code" 70} 71 72// PDSWriteFailedError indicates failure to write to PDS 73type PDSWriteFailedError struct { 74 DID string 75 Reason string 76} 77 78func (e *PDSWriteFailedError) Error() string { 79 return fmt.Sprintf("failed to write verification to PDS for %s: %s", e.DID, e.Reason) 80}