···88import gleam/result
99import gleam/string
10101111+/// Available on: https://atproto.com/specs/handle#additional-non-syntax-restrictions#handle-identifier-syntax
1112const pattern = "^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$"
12131314pub type ParseError {
1515+ /// Regex failed to compile
1416 InvalidRegexPattern(pattern: String)
1717+ /// String does not have a valid handle format
1518 InvalidFormat(value: String)
1619 /// "Reserved" top-level domains should not fail syntax validation,
1717- /// but they must immediately fail any attempt at registration,
1818- /// resolution, etc.
2020+ /// but they must immediately fail any attempt at registration.
2121+ ///
2222+ /// The following TLD are not allowed:
2323+ ///
2424+ /// - .alt
2525+ /// - .arpa
2626+ /// - .internal
2727+ /// - .invalid
2828+ /// - .local
2929+ /// - .localhost
3030+ /// - .onion
3131+ ///
3232+ /// Documentation: [Non-syntax Retrictions](https://atproto.com/specs/handle#additional-non-syntax-restrictions)
1933 DisallowedTopLevelDomain(domain: String)
2034}
2135