| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Bluesky.Handle
Synopsis
- data Handle
- rawHandle :: Handle -> Text
- makeHandle :: Text -> Either HandleError Handle
- data HandleError
- validTld :: Handle -> Bool
- resolveViaDns :: HasCallStack => Handle -> IO (Maybe Did)
- resolveViaHttp :: HasCallStack => Manager -> Handle -> IO (Maybe Did)
- resolveViaBoth :: HasCallStack => Manager -> Handle -> IO (Maybe Did)
- data BothFailed = BothFailed {}
- verifyHandle :: Manager -> Handle -> Did -> IO (Maybe Bool)
- resolveVerify :: HasCallStack => Manager -> Handle -> IO (Maybe Did)
Documentation
Instances
| FromJSON Handle Source # | |||||
Defined in Bluesky.Handle | |||||
| ToJSON Handle Source # | |||||
| Generic Handle Source # | |||||
Defined in Bluesky.Handle Associated Types
| |||||
| Show Handle Source # | |||||
| Eq Handle Source # | |||||
| Ord Handle Source # | |||||
| FromHttpApiData Handle Source # | |||||
Defined in Bluesky.Handle Methods parseUrlPiece :: Text -> Either Text Handle # parseHeader :: ByteString -> Either Text Handle # | |||||
| type Rep Handle Source # | |||||
Defined in Bluesky.Handle | |||||
makeHandle :: Text -> Either HandleError Handle Source #
data HandleError Source #
Constructors
| TooLong | |
| BadCharacters | |
| EmptySegment | |
| SegmentTooLong | |
| SegmentStartsWithHyphen | |
| SegmentEndsWithHyphen | |
| OnlyOneSegment | |
| LastSegmentStartsWithNumber |
Instances
| Show HandleError Source # | |
Defined in Bluesky.Handle Methods showsPrec :: Int -> HandleError -> ShowS # show :: HandleError -> String # showList :: [HandleError] -> ShowS # | |
| Eq HandleError Source # | |
Defined in Bluesky.Handle | |
| Ord HandleError Source # | |
Defined in Bluesky.Handle Methods compare :: HandleError -> HandleError -> Ordering # (<) :: HandleError -> HandleError -> Bool # (<=) :: HandleError -> HandleError -> Bool # (>) :: HandleError -> HandleError -> Bool # (>=) :: HandleError -> HandleError -> Bool # max :: HandleError -> HandleError -> HandleError # min :: HandleError -> HandleError -> HandleError # | |
resolveViaDns :: HasCallStack => Handle -> IO (Maybe Did) Source #
Returns Nothing in ordinary cases where this handle can't be resolved by
DNS. May raise an exception if:
- the handle has an invalid TLD,
- something goes wrong with DNS resolution,
- the DID returned is syntactically invalid.
Note that this handle shouldn't be considered valid for this DID until you've looked up the associated DID document and checked it appears there.
resolveViaHttp :: HasCallStack => Manager -> Handle -> IO (Maybe Did) Source #
Returns Nothing when the expected hostname reports 404 for the HTTP
resolution endpoint. May raise an exception if either the handle has an
invalid TLD, the HTTP server doesn't return 200 or 404, or there's no HTTP
server at the expected domain at all. (This is probably a bit too strict, and
should ignore more HTTP errors, but I'll see based on my real-world
experience.)
Note that this handle shouldn't be considered valid for this DID until you've looked up the associated DID document and checked it appears there.
resolveViaBoth :: HasCallStack => Manager -> Handle -> IO (Maybe Did) Source #
If either resolveViaDns or resolveViaHttp return a Did, return that
Did. Otherwise, if one or both of them raised an exception, reraise it (or
them, via BothFailed). (Otherwise, return Nothing).
data BothFailed Source #
Raised by resolveViaBoth when both methods raise exceptions.
Constructors
| BothFailed | |
Fields | |
Instances
| Exception BothFailed Source # | |
Defined in Bluesky.Handle Methods toException :: BothFailed -> SomeException # fromException :: SomeException -> Maybe BothFailed # displayException :: BothFailed -> String # | |
| Show BothFailed Source # | |
Defined in Bluesky.Handle Methods showsPrec :: Int -> BothFailed -> ShowS # show :: BothFailed -> String # showList :: [BothFailed] -> ShowS # | |
resolveVerify :: HasCallStack => Manager -> Handle -> IO (Maybe Did) Source #
Combines resolveViaBoth and verifyHandle. Raises an error if
verification fails.