module Data.Conduit.OpenPGP.Keyring.Instances (
) where
import Data.IxSet (Proxy(..), Indexable(..), ixSet, ixGen, ixFun)
import Codec.Encryption.OpenPGP.Fingerprint (eightOctetKeyID, fingerprint)
import Codec.Encryption.OpenPGP.Types
import Control.Lens ((^..))
import Data.Data.Lens (biplate)
instance Indexable TK where
empty = ixSet
[ ixGen (Proxy :: Proxy PKPayload)
, ixFun getEOKIs
, ixFun getTOFs
]
getEOKIs :: TK -> [EightOctetKeyId]
getEOKIs tk = map eightOctetKeyID (tk ^.. biplate :: [PKPayload])
getTOFs :: TK -> [TwentyOctetFingerprint]
getTOFs tk = map fingerprint (tk ^.. biplate :: [PKPayload])