| Safe Haskell | Safe-Inferred |
|---|---|
| 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 {}
- resolveVerify :: HasCallStack => Manager -> Handle -> IO (Maybe Did)
Documentation
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 either the handle has an invalid TLD or
something goes wrong with DNS resolution.
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 or there's no HTTP server at the expected domain at all.
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 #
Also fetches the DID document and checks that the handle is listed there. Raises an error if not.