bluesky-tools-0.6.0.4: Tools for interacting with Bluesky / AT Protocol
Safe HaskellNone
LanguageGHC2021

Bluesky.Handle

Synopsis

Documentation

data Handle Source #

Instances

Instances details
FromJSON Handle Source # 
Instance details

Defined in Bluesky.Handle

ToJSON Handle Source # 
Instance details

Defined in Bluesky.Handle

Generic Handle Source # 
Instance details

Defined in Bluesky.Handle

Associated Types

type Rep Handle 
Instance details

Defined in Bluesky.Handle

type Rep Handle = D1 ('MetaData "Handle" "Bluesky.Handle" "bluesky-tools-0.6.0.4-Db7HTt71EwNAiAHF6s8WSN" 'True) (C1 ('MetaCons "Handle" 'PrefixI 'True) (S1 ('MetaSel ('Just "rawHandle") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

Methods

from :: Handle -> Rep Handle x #

to :: Rep Handle x -> Handle #

Show Handle Source # 
Instance details

Defined in Bluesky.Handle

Eq Handle Source # 
Instance details

Defined in Bluesky.Handle

Methods

(==) :: Handle -> Handle -> Bool #

(/=) :: Handle -> Handle -> Bool #

Ord Handle Source # 
Instance details

Defined in Bluesky.Handle

FromHttpApiData Handle Source # 
Instance details

Defined in Bluesky.Handle

type Rep Handle Source # 
Instance details

Defined in Bluesky.Handle

type Rep Handle = D1 ('MetaData "Handle" "Bluesky.Handle" "bluesky-tools-0.6.0.4-Db7HTt71EwNAiAHF6s8WSN" 'True) (C1 ('MetaCons "Handle" 'PrefixI 'True) (S1 ('MetaSel ('Just "rawHandle") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)))

validTld :: Handle -> Bool Source #

See "Additonal Non-Syntax Restrictions" in the spec

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.

verifyHandle :: Manager -> Handle -> Did -> IO (Maybe Bool) Source #

Just True if this Handle appears in the DID Document for the Did. Just False if the document is available and doesn't affirm the handle. Nothing if the document can't be fetched.

resolveVerify :: HasCallStack => Manager -> Handle -> IO (Maybe Did) Source #

Combines resolveViaBoth and verifyHandle. Raises an error if verification fails.