-- TK.hs: OpenPGP (RFC9580) transferable key data type
-- Copyright © 2012-2026  Clint Adams
-- This software is released under the terms of the Expat license.
-- (See the LICENSE file).
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}

module Codec.Encryption.OpenPGP.Types.Internal.TK where

import Control.Arrow ((&&&))
import Control.Comonad (Comonad (..))
import Control.Lens
    ( folded
    , makeLenses
    , to
    , view
    , (^.)
    , (^..)
    , _1
    )
import qualified Data.Aeson.TH as ATH
import Data.Bifunctor (first)
import qualified Data.ByteString.Lazy as BL
import Data.Data (Data)
import Data.Function (on)
import qualified Data.HashMap.Lazy as HashMap
import Data.IxSet.Typed (IxSet)
import qualified Data.IxSet.Typed as IxSet
import Data.Kind (Type)
import Data.List (find, nub, sort, sortOn)
import qualified Data.List.NonEmpty as NE
import qualified Data.Map as Map
import Data.Ord (comparing)
import Data.Semigroup (Semigroup (..))
import Data.Text (Text)
import Data.Typeable (Typeable)
import Data.Word (Word8)
import GHC.Generics (Generic)

import Codec.Encryption.OpenPGP.Types.Internal.Base
import Codec.Encryption.OpenPGP.Types.Internal.PKITypes
import Codec.Encryption.OpenPGP.Types.Internal.Pkt

-- | Zipper for navigating a list of packets with position context
data PacketZipper a
    = PacketZipper
    { forall a. PacketZipper a -> [a]
_zpBefore :: [a] -- packets consumed before focus
    , forall a. PacketZipper a -> a
_zpCurrent :: a -- current packet under focus
    , forall a. PacketZipper a -> [a]
_zpAfter :: [a] -- packets remaining after focus
    }
    deriving (Typeable (PacketZipper a)
Typeable (PacketZipper a) =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> PacketZipper a -> c (PacketZipper a))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (PacketZipper a))
-> (PacketZipper a -> Constr)
-> (PacketZipper a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (PacketZipper a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (PacketZipper a)))
-> ((forall b. Data b => b -> b)
    -> PacketZipper a -> PacketZipper a)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> PacketZipper a -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> PacketZipper a -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> PacketZipper a -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> PacketZipper a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> PacketZipper a -> m (PacketZipper a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> PacketZipper a -> m (PacketZipper a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> PacketZipper a -> m (PacketZipper a))
-> Data (PacketZipper a)
PacketZipper a -> Constr
PacketZipper a -> DataType
(forall b. Data b => b -> b) -> PacketZipper a -> PacketZipper a
forall a. Data a => Typeable (PacketZipper a)
forall a. Data a => PacketZipper a -> Constr
forall a. Data a => PacketZipper a -> DataType
forall a.
Data a =>
(forall b. Data b => b -> b) -> PacketZipper a -> PacketZipper a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> PacketZipper a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> PacketZipper a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PacketZipper a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PacketZipper a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d)
-> PacketZipper a -> m (PacketZipper a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> PacketZipper a -> m (PacketZipper a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (PacketZipper a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PacketZipper a -> c (PacketZipper a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (PacketZipper a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (PacketZipper a))
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> PacketZipper a -> u
forall u. (forall d. Data d => d -> u) -> PacketZipper a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PacketZipper a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PacketZipper a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> PacketZipper a -> m (PacketZipper a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> PacketZipper a -> m (PacketZipper a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (PacketZipper a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PacketZipper a -> c (PacketZipper a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (PacketZipper a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (PacketZipper a))
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PacketZipper a -> c (PacketZipper a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PacketZipper a -> c (PacketZipper a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (PacketZipper a)
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (PacketZipper a)
$ctoConstr :: forall a. Data a => PacketZipper a -> Constr
toConstr :: PacketZipper a -> Constr
$cdataTypeOf :: forall a. Data a => PacketZipper a -> DataType
dataTypeOf :: PacketZipper a -> DataType
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (PacketZipper a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (PacketZipper a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (PacketZipper a))
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (PacketZipper a))
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> PacketZipper a -> PacketZipper a
gmapT :: (forall b. Data b => b -> b) -> PacketZipper a -> PacketZipper a
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PacketZipper a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PacketZipper a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PacketZipper a -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PacketZipper a -> r
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> PacketZipper a -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> PacketZipper a -> [u]
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> PacketZipper a -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> PacketZipper a -> u
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d)
-> PacketZipper a -> m (PacketZipper a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> PacketZipper a -> m (PacketZipper a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> PacketZipper a -> m (PacketZipper a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> PacketZipper a -> m (PacketZipper a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> PacketZipper a -> m (PacketZipper a)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> PacketZipper a -> m (PacketZipper a)
Data, PacketZipper a -> PacketZipper a -> Bool
(PacketZipper a -> PacketZipper a -> Bool)
-> (PacketZipper a -> PacketZipper a -> Bool)
-> Eq (PacketZipper a)
forall a. Eq a => PacketZipper a -> PacketZipper a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall a. Eq a => PacketZipper a -> PacketZipper a -> Bool
== :: PacketZipper a -> PacketZipper a -> Bool
$c/= :: forall a. Eq a => PacketZipper a -> PacketZipper a -> Bool
/= :: PacketZipper a -> PacketZipper a -> Bool
Eq, (forall a b. (a -> b) -> PacketZipper a -> PacketZipper b)
-> (forall a b. a -> PacketZipper b -> PacketZipper a)
-> Functor PacketZipper
forall a b. a -> PacketZipper b -> PacketZipper a
forall a b. (a -> b) -> PacketZipper a -> PacketZipper b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall a b. (a -> b) -> PacketZipper a -> PacketZipper b
fmap :: forall a b. (a -> b) -> PacketZipper a -> PacketZipper b
$c<$ :: forall a b. a -> PacketZipper b -> PacketZipper a
<$ :: forall a b. a -> PacketZipper b -> PacketZipper a
Functor, (forall x. PacketZipper a -> Rep (PacketZipper a) x)
-> (forall x. Rep (PacketZipper a) x -> PacketZipper a)
-> Generic (PacketZipper a)
forall x. Rep (PacketZipper a) x -> PacketZipper a
forall x. PacketZipper a -> Rep (PacketZipper a) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (PacketZipper a) x -> PacketZipper a
forall a x. PacketZipper a -> Rep (PacketZipper a) x
$cfrom :: forall a x. PacketZipper a -> Rep (PacketZipper a) x
from :: forall x. PacketZipper a -> Rep (PacketZipper a) x
$cto :: forall a x. Rep (PacketZipper a) x -> PacketZipper a
to :: forall x. Rep (PacketZipper a) x -> PacketZipper a
Generic, Int -> PacketZipper a -> ShowS
[PacketZipper a] -> ShowS
PacketZipper a -> String
(Int -> PacketZipper a -> ShowS)
-> (PacketZipper a -> String)
-> ([PacketZipper a] -> ShowS)
-> Show (PacketZipper a)
forall a. Show a => Int -> PacketZipper a -> ShowS
forall a. Show a => [PacketZipper a] -> ShowS
forall a. Show a => PacketZipper a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Show a => Int -> PacketZipper a -> ShowS
showsPrec :: Int -> PacketZipper a -> ShowS
$cshow :: forall a. Show a => PacketZipper a -> String
show :: PacketZipper a -> String
$cshowList :: forall a. Show a => [PacketZipper a] -> ShowS
showList :: [PacketZipper a] -> ShowS
Show, Typeable)

instance Comonad PacketZipper where
    -- Extract: read the packet currently under focus
    extract :: forall a. PacketZipper a -> a
extract (PacketZipper [a]
_ a
cur [a]
_) = a
cur

    -- Duplicate: produce a zipper-of-zippers,
    -- each focused on a different position in the original stream.
    duplicate :: forall a. PacketZipper a -> PacketZipper (PacketZipper a)
duplicate z :: PacketZipper a
z@(PacketZipper [a]
before a
cur [a]
after) =
        [PacketZipper a]
-> PacketZipper a
-> [PacketZipper a]
-> PacketZipper (PacketZipper a)
forall a. [a] -> a -> [a] -> PacketZipper a
PacketZipper
            [ [a] -> a -> [a] -> PacketZipper a
forall a. [a] -> a -> [a] -> PacketZipper a
PacketZipper
                (Int -> [a] -> [a]
forall a. Int -> [a] -> [a]
take Int
i [a]
before)
                ([a]
before [a] -> Int -> a
forall a. HasCallStack => [a] -> Int -> a
!! Int
i)
                (Int -> [a] -> [a]
forall a. Int -> [a] -> [a]
drop (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1) [a]
before [a] -> [a] -> [a]
forall a. [a] -> [a] -> [a]
++ [a
cur] [a] -> [a] -> [a]
forall a. [a] -> [a] -> [a]
++ [a]
after)
            | Int
i <- [Int
0 .. [a] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [a]
before Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1]
            ]
            PacketZipper a
z
            [ [a] -> a -> [a] -> PacketZipper a
forall a. [a] -> a -> [a] -> PacketZipper a
PacketZipper
                ([a]
before [a] -> [a] -> [a]
forall a. [a] -> [a] -> [a]
++ [a
cur] [a] -> [a] -> [a]
forall a. [a] -> [a] -> [a]
++ Int -> [a] -> [a]
forall a. Int -> [a] -> [a]
take Int
i [a]
after)
                ([a]
after [a] -> Int -> a
forall a. HasCallStack => [a] -> Int -> a
!! Int
i)
                (Int -> [a] -> [a]
forall a. Int -> [a] -> [a]
drop (Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1) [a]
after)
            | Int
i <- [Int
0 .. [a] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [a]
after Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1]
            ]

-- | Create a zipper from a list, starting at the first element
zFromList :: [a] -> Maybe (PacketZipper a)
zFromList :: forall a. [a] -> Maybe (PacketZipper a)
zFromList [] = Maybe (PacketZipper a)
forall a. Maybe a
Nothing
zFromList (a
x : [a]
xs) = PacketZipper a -> Maybe (PacketZipper a)
forall a. a -> Maybe a
Just ([a] -> a -> [a] -> PacketZipper a
forall a. [a] -> a -> [a] -> PacketZipper a
PacketZipper [] a
x [a]
xs)

-- | Extract position in packet sequence
zPosition :: PacketZipper a -> Int
zPosition :: forall a. PacketZipper a -> Int
zPosition (PacketZipper [a]
before a
_ [a]
_) = [a] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [a]
before

-- | Move to the next packet in the sequence
zMoveNext :: PacketZipper a -> Maybe (PacketZipper a)
zMoveNext :: forall a. PacketZipper a -> Maybe (PacketZipper a)
zMoveNext (PacketZipper [a]
before a
current []) = Maybe (PacketZipper a)
forall a. Maybe a
Nothing
zMoveNext (PacketZipper [a]
before a
current (a
x : [a]
xs)) =
    PacketZipper a -> Maybe (PacketZipper a)
forall a. a -> Maybe a
Just ([a] -> a -> [a] -> PacketZipper a
forall a. [a] -> a -> [a] -> PacketZipper a
PacketZipper ([a]
before [a] -> [a] -> [a]
forall a. [a] -> [a] -> [a]
++ [a
current]) a
x [a]
xs)

-- | Get the remaining packets (current + after)
zRemaining :: PacketZipper a -> [a]
zRemaining :: forall a. PacketZipper a -> [a]
zRemaining (PacketZipper [a]
_ a
current [a]
after) = a
current a -> [a] -> [a]
forall a. a -> [a] -> [a]
: [a]
after

-- | Reconstruct the full list from a zipper
zToList :: PacketZipper a -> [a]
zToList :: forall a. PacketZipper a -> [a]
zToList (PacketZipper [a]
before a
current [a]
after) = [a]
before [a] -> [a] -> [a]
forall a. [a] -> [a] -> [a]
++ [a
current] [a] -> [a] -> [a]
forall a. [a] -> [a] -> [a]
++ [a]
after

data TKUnknown
    = TKUnknown
    { TKUnknown -> (SomePKPayload, Maybe SKAddendum)
_tkuKey :: (SomePKPayload, Maybe SKAddendum)
    , TKUnknown -> [SignaturePayload]
_tkuRevs :: [SignaturePayload]
    , TKUnknown -> [(Text, [SignaturePayload])]
_tkuUIDs :: [(Text, [SignaturePayload])]
    , TKUnknown -> [([UserAttrSubPacket], [SignaturePayload])]
_tkuUAts :: [([UserAttrSubPacket], [SignaturePayload])]
    , TKUnknown -> [(Pkt, [SignaturePayload])]
_tkuSubs :: [(Pkt, [SignaturePayload])]
    }
    deriving (Typeable TKUnknown
Typeable TKUnknown =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> TKUnknown -> c TKUnknown)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c TKUnknown)
-> (TKUnknown -> Constr)
-> (TKUnknown -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c TKUnknown))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TKUnknown))
-> ((forall b. Data b => b -> b) -> TKUnknown -> TKUnknown)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> TKUnknown -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> TKUnknown -> r)
-> (forall u. (forall d. Data d => d -> u) -> TKUnknown -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> TKUnknown -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> TKUnknown -> m TKUnknown)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TKUnknown -> m TKUnknown)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TKUnknown -> m TKUnknown)
-> Data TKUnknown
TKUnknown -> Constr
TKUnknown -> DataType
(forall b. Data b => b -> b) -> TKUnknown -> TKUnknown
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> TKUnknown -> u
forall u. (forall d. Data d => d -> u) -> TKUnknown -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TKUnknown -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TKUnknown -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TKUnknown -> m TKUnknown
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TKUnknown -> m TKUnknown
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TKUnknown
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TKUnknown -> c TKUnknown
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TKUnknown)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TKUnknown)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TKUnknown -> c TKUnknown
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TKUnknown -> c TKUnknown
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TKUnknown
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TKUnknown
$ctoConstr :: TKUnknown -> Constr
toConstr :: TKUnknown -> Constr
$cdataTypeOf :: TKUnknown -> DataType
dataTypeOf :: TKUnknown -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TKUnknown)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TKUnknown)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TKUnknown)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TKUnknown)
$cgmapT :: (forall b. Data b => b -> b) -> TKUnknown -> TKUnknown
gmapT :: (forall b. Data b => b -> b) -> TKUnknown -> TKUnknown
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TKUnknown -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TKUnknown -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TKUnknown -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TKUnknown -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TKUnknown -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> TKUnknown -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TKUnknown -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TKUnknown -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TKUnknown -> m TKUnknown
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TKUnknown -> m TKUnknown
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TKUnknown -> m TKUnknown
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TKUnknown -> m TKUnknown
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TKUnknown -> m TKUnknown
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TKUnknown -> m TKUnknown
Data, TKUnknown -> TKUnknown -> Bool
(TKUnknown -> TKUnknown -> Bool)
-> (TKUnknown -> TKUnknown -> Bool) -> Eq TKUnknown
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TKUnknown -> TKUnknown -> Bool
== :: TKUnknown -> TKUnknown -> Bool
$c/= :: TKUnknown -> TKUnknown -> Bool
/= :: TKUnknown -> TKUnknown -> Bool
Eq, (forall x. TKUnknown -> Rep TKUnknown x)
-> (forall x. Rep TKUnknown x -> TKUnknown) -> Generic TKUnknown
forall x. Rep TKUnknown x -> TKUnknown
forall x. TKUnknown -> Rep TKUnknown x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TKUnknown -> Rep TKUnknown x
from :: forall x. TKUnknown -> Rep TKUnknown x
$cto :: forall x. Rep TKUnknown x -> TKUnknown
to :: forall x. Rep TKUnknown x -> TKUnknown
Generic, Int -> TKUnknown -> ShowS
[TKUnknown] -> ShowS
TKUnknown -> String
(Int -> TKUnknown -> ShowS)
-> (TKUnknown -> String)
-> ([TKUnknown] -> ShowS)
-> Show TKUnknown
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TKUnknown -> ShowS
showsPrec :: Int -> TKUnknown -> ShowS
$cshow :: TKUnknown -> String
show :: TKUnknown -> String
$cshowList :: [TKUnknown] -> ShowS
showList :: [TKUnknown] -> ShowS
Show, Typeable)

data TKKind
    = PublicTK
    | SecretTK
    deriving (Typeable TKKind
Typeable TKKind =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> TKKind -> c TKKind)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c TKKind)
-> (TKKind -> Constr)
-> (TKKind -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c TKKind))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TKKind))
-> ((forall b. Data b => b -> b) -> TKKind -> TKKind)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> TKKind -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> TKKind -> r)
-> (forall u. (forall d. Data d => d -> u) -> TKKind -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> TKKind -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> TKKind -> m TKKind)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TKKind -> m TKKind)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TKKind -> m TKKind)
-> Data TKKind
TKKind -> Constr
TKKind -> DataType
(forall b. Data b => b -> b) -> TKKind -> TKKind
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> TKKind -> u
forall u. (forall d. Data d => d -> u) -> TKKind -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TKKind -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TKKind -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TKKind -> m TKKind
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TKKind -> m TKKind
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TKKind
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TKKind -> c TKKind
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TKKind)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TKKind)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TKKind -> c TKKind
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TKKind -> c TKKind
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TKKind
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TKKind
$ctoConstr :: TKKind -> Constr
toConstr :: TKKind -> Constr
$cdataTypeOf :: TKKind -> DataType
dataTypeOf :: TKKind -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TKKind)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TKKind)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TKKind)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TKKind)
$cgmapT :: (forall b. Data b => b -> b) -> TKKind -> TKKind
gmapT :: (forall b. Data b => b -> b) -> TKKind -> TKKind
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TKKind -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TKKind -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TKKind -> r
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TKKind -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TKKind -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> TKKind -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TKKind -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TKKind -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TKKind -> m TKKind
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TKKind -> m TKKind
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TKKind -> m TKKind
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TKKind -> m TKKind
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TKKind -> m TKKind
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TKKind -> m TKKind
Data, TKKind -> TKKind -> Bool
(TKKind -> TKKind -> Bool)
-> (TKKind -> TKKind -> Bool) -> Eq TKKind
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TKKind -> TKKind -> Bool
== :: TKKind -> TKKind -> Bool
$c/= :: TKKind -> TKKind -> Bool
/= :: TKKind -> TKKind -> Bool
Eq, (forall x. TKKind -> Rep TKKind x)
-> (forall x. Rep TKKind x -> TKKind) -> Generic TKKind
forall x. Rep TKKind x -> TKKind
forall x. TKKind -> Rep TKKind x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TKKind -> Rep TKKind x
from :: forall x. TKKind -> Rep TKKind x
$cto :: forall x. Rep TKKind x -> TKKind
to :: forall x. Rep TKKind x -> TKKind
Generic, Eq TKKind
Eq TKKind =>
(TKKind -> TKKind -> Ordering)
-> (TKKind -> TKKind -> Bool)
-> (TKKind -> TKKind -> Bool)
-> (TKKind -> TKKind -> Bool)
-> (TKKind -> TKKind -> Bool)
-> (TKKind -> TKKind -> TKKind)
-> (TKKind -> TKKind -> TKKind)
-> Ord TKKind
TKKind -> TKKind -> Bool
TKKind -> TKKind -> Ordering
TKKind -> TKKind -> TKKind
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: TKKind -> TKKind -> Ordering
compare :: TKKind -> TKKind -> Ordering
$c< :: TKKind -> TKKind -> Bool
< :: TKKind -> TKKind -> Bool
$c<= :: TKKind -> TKKind -> Bool
<= :: TKKind -> TKKind -> Bool
$c> :: TKKind -> TKKind -> Bool
> :: TKKind -> TKKind -> Bool
$c>= :: TKKind -> TKKind -> Bool
>= :: TKKind -> TKKind -> Bool
$cmax :: TKKind -> TKKind -> TKKind
max :: TKKind -> TKKind -> TKKind
$cmin :: TKKind -> TKKind -> TKKind
min :: TKKind -> TKKind -> TKKind
Ord, Int -> TKKind -> ShowS
[TKKind] -> ShowS
TKKind -> String
(Int -> TKKind -> ShowS)
-> (TKKind -> String) -> ([TKKind] -> ShowS) -> Show TKKind
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TKKind -> ShowS
showsPrec :: Int -> TKKind -> ShowS
$cshow :: TKKind -> String
show :: TKKind -> String
$cshowList :: [TKKind] -> ShowS
showList :: [TKKind] -> ShowS
Show, Typeable)

type family TKKindToKeyPktKind (k :: TKKind) :: KeyPktKind where
    TKKindToKeyPktKind 'PublicTK = 'PublicPkt
    TKKindToKeyPktKind 'SecretTK = 'SecretPkt

data TK (k :: TKKind)
    = TK
    { forall (k :: TKKind). TK k -> KeyPkt (TKKindToKeyPktKind k)
_tkPrimaryKey :: KeyPkt (TKKindToKeyPktKind k)
    , forall (k :: TKKind). TK k -> [SignaturePayload]
_tkRevs :: [SignaturePayload]
    , forall (k :: TKKind). TK k -> [(Text, [SignaturePayload])]
_tkUIDs :: [(Text, [SignaturePayload])]
    , forall (k :: TKKind).
TK k -> [([UserAttrSubPacket], [SignaturePayload])]
_tkUAts :: [([UserAttrSubPacket], [SignaturePayload])]
    , forall (k :: TKKind).
TK k -> [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
_tkSubs :: [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
    }
    deriving (TK k -> TK k -> Bool
(TK k -> TK k -> Bool) -> (TK k -> TK k -> Bool) -> Eq (TK k)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (k :: TKKind). TK k -> TK k -> Bool
$c== :: forall (k :: TKKind). TK k -> TK k -> Bool
== :: TK k -> TK k -> Bool
$c/= :: forall (k :: TKKind). TK k -> TK k -> Bool
/= :: TK k -> TK k -> Bool
Eq, Int -> TK k -> ShowS
[TK k] -> ShowS
TK k -> String
(Int -> TK k -> ShowS)
-> (TK k -> String) -> ([TK k] -> ShowS) -> Show (TK k)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall (k :: TKKind). Int -> TK k -> ShowS
forall (k :: TKKind). [TK k] -> ShowS
forall (k :: TKKind). TK k -> String
$cshowsPrec :: forall (k :: TKKind). Int -> TK k -> ShowS
showsPrec :: Int -> TK k -> ShowS
$cshow :: forall (k :: TKKind). TK k -> String
show :: TK k -> String
$cshowList :: forall (k :: TKKind). [TK k] -> ShowS
showList :: [TK k] -> ShowS
Show)

deriving instance
    (Data (KeyPkt (TKKindToKeyPktKind k)), Typeable k) => Data (TK k)

instance Ord (TK k) where
    compare :: TK k -> TK k -> Ordering
compare = (TK k -> KeyPkt (TKKindToKeyPktKind k)) -> TK k -> TK k -> Ordering
forall a b. Ord a => (b -> a) -> b -> b -> Ordering
comparing TK k -> KeyPkt (TKKindToKeyPktKind k)
forall (k :: TKKind). TK k -> KeyPkt (TKKindToKeyPktKind k)
_tkPrimaryKey

data SomeTK where
    SomePublicTK :: TK 'PublicTK -> SomeTK
    SomeSecretTK :: TK 'SecretTK -> SomeTK

deriving instance Show SomeTK

instance Eq SomeTK where
    SomeTK
left == :: SomeTK -> SomeTK -> Bool
== SomeTK
right = SomeTK -> TKUnknown
someTKToUnknown SomeTK
left TKUnknown -> TKUnknown -> Bool
forall a. Eq a => a -> a -> Bool
== SomeTK -> TKUnknown
someTKToUnknown SomeTK
right

data TKConversionError
    = PublicSubkeyHasPrimaryRole
    | SecretSubkeyHasPrimaryRole
    | ExpectedPublicSubkeyPacket Word8
    | ExpectedSecretSubkeyPacket Word8
    deriving (TKConversionError -> TKConversionError -> Bool
(TKConversionError -> TKConversionError -> Bool)
-> (TKConversionError -> TKConversionError -> Bool)
-> Eq TKConversionError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TKConversionError -> TKConversionError -> Bool
== :: TKConversionError -> TKConversionError -> Bool
$c/= :: TKConversionError -> TKConversionError -> Bool
/= :: TKConversionError -> TKConversionError -> Bool
Eq, Int -> TKConversionError -> ShowS
[TKConversionError] -> ShowS
TKConversionError -> String
(Int -> TKConversionError -> ShowS)
-> (TKConversionError -> String)
-> ([TKConversionError] -> ShowS)
-> Show TKConversionError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TKConversionError -> ShowS
showsPrec :: Int -> TKConversionError -> ShowS
$cshow :: TKConversionError -> String
show :: TKConversionError -> String
$cshowList :: [TKConversionError] -> ShowS
showList :: [TKConversionError] -> ShowS
Show)

renderTKConversionError :: TKConversionError -> String
renderTKConversionError :: TKConversionError -> String
renderTKConversionError TKConversionError
PublicSubkeyHasPrimaryRole = String
"public subkey has primary-key role"
renderTKConversionError TKConversionError
SecretSubkeyHasPrimaryRole = String
"secret subkey has primary-key role"
renderTKConversionError (ExpectedPublicSubkeyPacket Word8
tagValue) =
    String
"expected public subkey, got packet tag " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Word8 -> String
forall a. Show a => a -> String
show Word8
tagValue
renderTKConversionError (ExpectedSecretSubkeyPacket Word8
tagValue) =
    String
"expected secret subkey, got packet tag " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Word8 -> String
forall a. Show a => a -> String
show Word8
tagValue

tkToUnknown :: TK k -> TKUnknown
tkToUnknown :: forall (k :: TKKind). TK k -> TKUnknown
tkToUnknown TK k
tk =
    TKUnknown
        { _tkuKey :: (SomePKPayload, Maybe SKAddendum)
_tkuKey = KeyPkt (TKKindToKeyPktKind k) -> (SomePKPayload, Maybe SKAddendum)
forall (k :: KeyPktKind).
KeyPkt k -> (SomePKPayload, Maybe SKAddendum)
keyPktTKKey (TK k -> KeyPkt (TKKindToKeyPktKind k)
forall (k :: TKKind). TK k -> KeyPkt (TKKindToKeyPktKind k)
_tkPrimaryKey TK k
tk)
        , _tkuRevs :: [SignaturePayload]
_tkuRevs = TK k -> [SignaturePayload]
forall (k :: TKKind). TK k -> [SignaturePayload]
_tkRevs TK k
tk
        , _tkuUIDs :: [(Text, [SignaturePayload])]
_tkuUIDs = TK k -> [(Text, [SignaturePayload])]
forall (k :: TKKind). TK k -> [(Text, [SignaturePayload])]
_tkUIDs TK k
tk
        , _tkuUAts :: [([UserAttrSubPacket], [SignaturePayload])]
_tkuUAts = TK k -> [([UserAttrSubPacket], [SignaturePayload])]
forall (k :: TKKind).
TK k -> [([UserAttrSubPacket], [SignaturePayload])]
_tkUAts TK k
tk
        , _tkuSubs :: [(Pkt, [SignaturePayload])]
_tkuSubs =
            ((KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])
 -> (Pkt, [SignaturePayload]))
-> [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
-> [(Pkt, [SignaturePayload])]
forall a b. (a -> b) -> [a] -> [b]
map (\(KeyPkt (TKKindToKeyPktKind k)
kp, [SignaturePayload]
sigs) -> (KeyPkt (TKKindToKeyPktKind k) -> Pkt
forall (k :: KeyPktKind). KeyPkt k -> Pkt
keyPktToPkt KeyPkt (TKKindToKeyPktKind k)
kp, [SignaturePayload]
sigs)) (TK k -> [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
forall (k :: TKKind).
TK k -> [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
_tkSubs TK k
tk)
        }

someTKToUnknown :: SomeTK -> TKUnknown
someTKToUnknown :: SomeTK -> TKUnknown
someTKToUnknown (SomePublicTK TK 'PublicTK
tk) = TK 'PublicTK -> TKUnknown
forall (k :: TKKind). TK k -> TKUnknown
tkToUnknown TK 'PublicTK
tk
someTKToUnknown (SomeSecretTK TK 'SecretTK
tk) = TK 'SecretTK -> TKUnknown
forall (k :: TKKind). TK k -> TKUnknown
tkToUnknown TK 'SecretTK
tk

mkTKUnknown :: SomePKPayload -> Maybe SKAddendum -> TKUnknown
mkTKUnknown :: SomePKPayload -> Maybe SKAddendum -> TKUnknown
mkTKUnknown SomePKPayload
pkp Maybe SKAddendum
maybeSka =
    TKUnknown
        { _tkuKey :: (SomePKPayload, Maybe SKAddendum)
_tkuKey = (SomePKPayload
pkp, Maybe SKAddendum
maybeSka)
        , _tkuRevs :: [SignaturePayload]
_tkuRevs = []
        , _tkuUIDs :: [(Text, [SignaturePayload])]
_tkuUIDs = []
        , _tkuUAts :: [([UserAttrSubPacket], [SignaturePayload])]
_tkuUAts = []
        , _tkuSubs :: [(Pkt, [SignaturePayload])]
_tkuSubs = []
        }

fromPrimaryKeyPktToSomeTK :: Pkt -> Either String SomeTK
fromPrimaryKeyPktToSomeTK :: Pkt -> Either String SomeTK
fromPrimaryKeyPktToSomeTK (PublicKeyPkt SomePKPayload
pkp) =
    SomeTK -> Either String SomeTK
forall a b. b -> Either a b
Right
        ( TK 'PublicTK -> SomeTK
SomePublicTK
            ( TK
                { _tkPrimaryKey :: KeyPkt (TKKindToKeyPktKind 'PublicTK)
_tkPrimaryKey = SomePKPayload -> KeyPkt 'PublicPkt
KeyPktPublicPrimary SomePKPayload
pkp
                , _tkRevs :: [SignaturePayload]
_tkRevs = []
                , _tkUIDs :: [(Text, [SignaturePayload])]
_tkUIDs = []
                , _tkUAts :: [([UserAttrSubPacket], [SignaturePayload])]
_tkUAts = []
                , _tkSubs :: [(KeyPkt (TKKindToKeyPktKind 'PublicTK), [SignaturePayload])]
_tkSubs = []
                }
            )
        )
fromPrimaryKeyPktToSomeTK (SecretKeyPkt SomePKPayload
pkp SKAddendum
ska) =
    SomeTK -> Either String SomeTK
forall a b. b -> Either a b
Right
        ( TK 'SecretTK -> SomeTK
SomeSecretTK
            ( TK
                { _tkPrimaryKey :: KeyPkt (TKKindToKeyPktKind 'SecretTK)
_tkPrimaryKey = SomePKPayload -> SKAddendum -> KeyPkt 'SecretPkt
KeyPktSecretPrimary SomePKPayload
pkp SKAddendum
ska
                , _tkRevs :: [SignaturePayload]
_tkRevs = []
                , _tkUIDs :: [(Text, [SignaturePayload])]
_tkUIDs = []
                , _tkUAts :: [([UserAttrSubPacket], [SignaturePayload])]
_tkUAts = []
                , _tkSubs :: [(KeyPkt (TKKindToKeyPktKind 'SecretTK), [SignaturePayload])]
_tkSubs = []
                }
            )
        )
fromPrimaryKeyPktToSomeTK Pkt
pkt =
    String -> Either String SomeTK
forall a b. a -> Either a b
Left
        ( String
"expected primary key packet, got packet tag "
            String -> ShowS
forall a. [a] -> [a] -> [a]
++ Word8 -> String
forall a. Show a => a -> String
show (Pkt -> Word8
pktTag Pkt
pkt)
        )

someTKToPublicTK :: SomeTK -> Maybe (TK 'PublicTK)
someTKToPublicTK :: SomeTK -> Maybe (TK 'PublicTK)
someTKToPublicTK (SomePublicTK TK 'PublicTK
tk) = TK 'PublicTK -> Maybe (TK 'PublicTK)
forall a. a -> Maybe a
Just TK 'PublicTK
tk
someTKToPublicTK (SomeSecretTK TK 'SecretTK
_) = Maybe (TK 'PublicTK)
forall a. Maybe a
Nothing

someTKToSecretTK :: SomeTK -> Maybe (TK 'SecretTK)
someTKToSecretTK :: SomeTK -> Maybe (TK 'SecretTK)
someTKToSecretTK (SomeSecretTK TK 'SecretTK
tk) = TK 'SecretTK -> Maybe (TK 'SecretTK)
forall a. a -> Maybe a
Just TK 'SecretTK
tk
someTKToSecretTK (SomePublicTK TK 'PublicTK
_) = Maybe (TK 'SecretTK)
forall a. Maybe a
Nothing

someTKToPublicViewTK :: SomeTK -> TK 'PublicTK
someTKToPublicViewTK :: SomeTK -> TK 'PublicTK
someTKToPublicViewTK (SomePublicTK TK 'PublicTK
tk) = TK 'PublicTK
tk
someTKToPublicViewTK (SomeSecretTK TK 'SecretTK
tk) = TK 'SecretTK -> TK 'PublicTK
publicViewTK TK 'SecretTK
tk

publicViewTK :: TK 'SecretTK -> TK 'PublicTK
publicViewTK :: TK 'SecretTK -> TK 'PublicTK
publicViewTK TK 'SecretTK
tk =
    TK
        { _tkPrimaryKey :: KeyPkt (TKKindToKeyPktKind 'PublicTK)
_tkPrimaryKey = KeyPkt 'SecretPkt -> KeyPkt 'PublicPkt
keyPktToPublicView (TK 'SecretTK -> KeyPkt (TKKindToKeyPktKind 'SecretTK)
forall (k :: TKKind). TK k -> KeyPkt (TKKindToKeyPktKind k)
_tkPrimaryKey TK 'SecretTK
tk)
        , _tkRevs :: [SignaturePayload]
_tkRevs = TK 'SecretTK -> [SignaturePayload]
forall (k :: TKKind). TK k -> [SignaturePayload]
_tkRevs TK 'SecretTK
tk
        , _tkUIDs :: [(Text, [SignaturePayload])]
_tkUIDs = TK 'SecretTK -> [(Text, [SignaturePayload])]
forall (k :: TKKind). TK k -> [(Text, [SignaturePayload])]
_tkUIDs TK 'SecretTK
tk
        , _tkUAts :: [([UserAttrSubPacket], [SignaturePayload])]
_tkUAts = TK 'SecretTK -> [([UserAttrSubPacket], [SignaturePayload])]
forall (k :: TKKind).
TK k -> [([UserAttrSubPacket], [SignaturePayload])]
_tkUAts TK 'SecretTK
tk
        , _tkSubs :: [(KeyPkt (TKKindToKeyPktKind 'PublicTK), [SignaturePayload])]
_tkSubs =
            ((KeyPkt 'SecretPkt, [SignaturePayload])
 -> (KeyPkt 'PublicPkt, [SignaturePayload]))
-> [(KeyPkt 'SecretPkt, [SignaturePayload])]
-> [(KeyPkt 'PublicPkt, [SignaturePayload])]
forall a b. (a -> b) -> [a] -> [b]
map (\(KeyPkt 'SecretPkt
kp, [SignaturePayload]
sigs) -> (KeyPkt 'SecretPkt -> KeyPkt 'PublicPkt
keyPktToPublicView KeyPkt 'SecretPkt
kp, [SignaturePayload]
sigs)) (TK 'SecretTK
-> [(KeyPkt (TKKindToKeyPktKind 'SecretTK), [SignaturePayload])]
forall (k :: TKKind).
TK k -> [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
_tkSubs TK 'SecretTK
tk)
        }

tkSomeSubs :: TK k -> [SomeKeyPkt]
tkSomeSubs :: forall (k :: TKKind). TK k -> [SomeKeyPkt]
tkSomeSubs TK k
tk =
    let xs :: [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
xs = Getting
  [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
  (TK k)
  [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
-> TK k -> [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view ((TK k -> [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])])
-> Getting
     [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
     (TK k)
     [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to TK k -> [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
forall (k :: TKKind).
TK k -> [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
_tkSubs) TK k
tk
     in [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
xs [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
-> Getting
     (Endo [SomeKeyPkt])
     [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
     SomeKeyPkt
-> [SomeKeyPkt]
forall s a. s -> Getting (Endo [a]) s a -> [a]
^.. (((KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])
 -> Const
      (Endo [SomeKeyPkt])
      (KeyPkt (TKKindToKeyPktKind k), [SignaturePayload]))
-> [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
-> Const
     (Endo [SomeKeyPkt])
     [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
forall (f :: * -> *) a. Foldable f => IndexedFold Int (f a) a
IndexedFold
  Int
  [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
  (KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])
folded (((KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])
  -> Const
       (Endo [SomeKeyPkt])
       (KeyPkt (TKKindToKeyPktKind k), [SignaturePayload]))
 -> [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
 -> Const
      (Endo [SomeKeyPkt])
      [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])])
-> ((SomeKeyPkt -> Const (Endo [SomeKeyPkt]) SomeKeyPkt)
    -> (KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])
    -> Const
         (Endo [SomeKeyPkt])
         (KeyPkt (TKKindToKeyPktKind k), [SignaturePayload]))
-> Getting
     (Endo [SomeKeyPkt])
     [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
     SomeKeyPkt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (KeyPkt (TKKindToKeyPktKind k)
 -> Const (Endo [SomeKeyPkt]) (KeyPkt (TKKindToKeyPktKind k)))
-> (KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])
-> Const
     (Endo [SomeKeyPkt])
     (KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])
forall s t a b. Field1 s t a b => Lens s t a b
Lens
  (KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])
  (KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])
  (KeyPkt (TKKindToKeyPktKind k))
  (KeyPkt (TKKindToKeyPktKind k))
_1 ((KeyPkt (TKKindToKeyPktKind k)
  -> Const (Endo [SomeKeyPkt]) (KeyPkt (TKKindToKeyPktKind k)))
 -> (KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])
 -> Const
      (Endo [SomeKeyPkt])
      (KeyPkt (TKKindToKeyPktKind k), [SignaturePayload]))
-> ((SomeKeyPkt -> Const (Endo [SomeKeyPkt]) SomeKeyPkt)
    -> KeyPkt (TKKindToKeyPktKind k)
    -> Const (Endo [SomeKeyPkt]) (KeyPkt (TKKindToKeyPktKind k)))
-> (SomeKeyPkt -> Const (Endo [SomeKeyPkt]) SomeKeyPkt)
-> (KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])
-> Const
     (Endo [SomeKeyPkt])
     (KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (KeyPkt (TKKindToKeyPktKind k) -> SomeKeyPkt)
-> (SomeKeyPkt -> Const (Endo [SomeKeyPkt]) SomeKeyPkt)
-> KeyPkt (TKKindToKeyPktKind k)
-> Const (Endo [SomeKeyPkt]) (KeyPkt (TKKindToKeyPktKind k))
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
to KeyPkt (TKKindToKeyPktKind k) -> SomeKeyPkt
forall (k :: KeyPktKind). KeyPkt k -> SomeKeyPkt
SomeKeyPkt)

fromUnknownToTKEither
    :: TKUnknown -> Either TKConversionError SomeTK
fromUnknownToTKEither :: TKUnknown -> Either TKConversionError SomeTK
fromUnknownToTKEither TKUnknown
tk =
    case TKUnknown -> (SomePKPayload, Maybe SKAddendum)
_tkuKey TKUnknown
tk of
        (SomePKPayload
pkp, Maybe SKAddendum
Nothing) -> do
            subs <- ((Pkt, [SignaturePayload])
 -> Either
      TKConversionError (KeyPkt 'PublicPkt, [SignaturePayload]))
-> [(Pkt, [SignaturePayload])]
-> Either
     TKConversionError [(KeyPkt 'PublicPkt, [SignaturePayload])]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse (Pkt, [SignaturePayload])
-> Either TKConversionError (KeyPkt 'PublicPkt, [SignaturePayload])
liftPublicSubkey (TKUnknown -> [(Pkt, [SignaturePayload])]
_tkuSubs TKUnknown
tk)
            let typed :: TK 'PublicTK
                typed =
                    TK
                        { _tkPrimaryKey :: KeyPkt (TKKindToKeyPktKind 'PublicTK)
_tkPrimaryKey = SomePKPayload -> KeyPkt 'PublicPkt
KeyPktPublicPrimary SomePKPayload
pkp
                        , _tkRevs :: [SignaturePayload]
_tkRevs = TKUnknown -> [SignaturePayload]
_tkuRevs TKUnknown
tk
                        , _tkUIDs :: [(Text, [SignaturePayload])]
_tkUIDs = TKUnknown -> [(Text, [SignaturePayload])]
_tkuUIDs TKUnknown
tk
                        , _tkUAts :: [([UserAttrSubPacket], [SignaturePayload])]
_tkUAts = TKUnknown -> [([UserAttrSubPacket], [SignaturePayload])]
_tkuUAts TKUnknown
tk
                        , _tkSubs :: [(KeyPkt (TKKindToKeyPktKind 'PublicTK), [SignaturePayload])]
_tkSubs = [(KeyPkt 'PublicPkt, [SignaturePayload])]
[(KeyPkt (TKKindToKeyPktKind 'PublicTK), [SignaturePayload])]
subs
                        }
            Right
                (SomePublicTK typed)
        (SomePKPayload
pkp, Just SKAddendum
ska) -> do
            subs <- ((Pkt, [SignaturePayload])
 -> Either
      TKConversionError (KeyPkt 'SecretPkt, [SignaturePayload]))
-> [(Pkt, [SignaturePayload])]
-> Either
     TKConversionError [(KeyPkt 'SecretPkt, [SignaturePayload])]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse (Pkt, [SignaturePayload])
-> Either TKConversionError (KeyPkt 'SecretPkt, [SignaturePayload])
liftSecretSubkey (TKUnknown -> [(Pkt, [SignaturePayload])]
_tkuSubs TKUnknown
tk)
            let typed :: TK 'SecretTK
                typed =
                    TK
                        { _tkPrimaryKey :: KeyPkt (TKKindToKeyPktKind 'SecretTK)
_tkPrimaryKey = SomePKPayload -> SKAddendum -> KeyPkt 'SecretPkt
KeyPktSecretPrimary SomePKPayload
pkp SKAddendum
ska
                        , _tkRevs :: [SignaturePayload]
_tkRevs = TKUnknown -> [SignaturePayload]
_tkuRevs TKUnknown
tk
                        , _tkUIDs :: [(Text, [SignaturePayload])]
_tkUIDs = TKUnknown -> [(Text, [SignaturePayload])]
_tkuUIDs TKUnknown
tk
                        , _tkUAts :: [([UserAttrSubPacket], [SignaturePayload])]
_tkUAts = TKUnknown -> [([UserAttrSubPacket], [SignaturePayload])]
_tkuUAts TKUnknown
tk
                        , _tkSubs :: [(KeyPkt (TKKindToKeyPktKind 'SecretTK), [SignaturePayload])]
_tkSubs = [(KeyPkt 'SecretPkt, [SignaturePayload])]
[(KeyPkt (TKKindToKeyPktKind 'SecretTK), [SignaturePayload])]
subs
                        }
            Right
                (SomeSecretTK typed)
  where
    liftPublicSubkey
        :: (Pkt, [SignaturePayload])
        -> Either TKConversionError (KeyPkt 'PublicPkt, [SignaturePayload])
    liftPublicSubkey :: (Pkt, [SignaturePayload])
-> Either TKConversionError (KeyPkt 'PublicPkt, [SignaturePayload])
liftPublicSubkey (Pkt
pkt, [SignaturePayload]
sigs) =
        case Pkt -> Maybe (KeyPkt 'PublicPkt)
pktToPublicKeyPkt Pkt
pkt of
            Just KeyPkt 'PublicPkt
keyPkt
                | KeyPkt 'PublicPkt -> KeyPktRole
forall (k :: KeyPktKind). KeyPkt k -> KeyPktRole
keyPktRole KeyPkt 'PublicPkt
keyPkt KeyPktRole -> KeyPktRole -> Bool
forall a. Eq a => a -> a -> Bool
== KeyPktRole
KeyPktSubkey ->
                    (KeyPkt 'PublicPkt, [SignaturePayload])
-> Either TKConversionError (KeyPkt 'PublicPkt, [SignaturePayload])
forall a b. b -> Either a b
Right (KeyPkt 'PublicPkt
keyPkt, [SignaturePayload]
sigs)
                | Bool
otherwise ->
                    TKConversionError
-> Either TKConversionError (KeyPkt 'PublicPkt, [SignaturePayload])
forall a b. a -> Either a b
Left TKConversionError
PublicSubkeyHasPrimaryRole
            Maybe (KeyPkt 'PublicPkt)
Nothing ->
                TKConversionError
-> Either TKConversionError (KeyPkt 'PublicPkt, [SignaturePayload])
forall a b. a -> Either a b
Left (Word8 -> TKConversionError
ExpectedPublicSubkeyPacket (Pkt -> Word8
pktTag Pkt
pkt))

    liftSecretSubkey
        :: (Pkt, [SignaturePayload])
        -> Either TKConversionError (KeyPkt 'SecretPkt, [SignaturePayload])
    liftSecretSubkey :: (Pkt, [SignaturePayload])
-> Either TKConversionError (KeyPkt 'SecretPkt, [SignaturePayload])
liftSecretSubkey (Pkt
pkt, [SignaturePayload]
sigs) =
        case Pkt -> Maybe (KeyPkt 'SecretPkt)
pktToSecretKeyPkt Pkt
pkt of
            Just KeyPkt 'SecretPkt
keyPkt
                | KeyPkt 'SecretPkt -> KeyPktRole
forall (k :: KeyPktKind). KeyPkt k -> KeyPktRole
keyPktRole KeyPkt 'SecretPkt
keyPkt KeyPktRole -> KeyPktRole -> Bool
forall a. Eq a => a -> a -> Bool
== KeyPktRole
KeyPktSubkey ->
                    (KeyPkt 'SecretPkt, [SignaturePayload])
-> Either TKConversionError (KeyPkt 'SecretPkt, [SignaturePayload])
forall a b. b -> Either a b
Right (KeyPkt 'SecretPkt
keyPkt, [SignaturePayload]
sigs)
                | Bool
otherwise ->
                    TKConversionError
-> Either TKConversionError (KeyPkt 'SecretPkt, [SignaturePayload])
forall a b. a -> Either a b
Left TKConversionError
SecretSubkeyHasPrimaryRole
            Maybe (KeyPkt 'SecretPkt)
Nothing ->
                TKConversionError
-> Either TKConversionError (KeyPkt 'SecretPkt, [SignaturePayload])
forall a b. a -> Either a b
Left (Word8 -> TKConversionError
ExpectedSecretSubkeyPacket (Pkt -> Word8
pktTag Pkt
pkt))

fromUnknownToTK :: TKUnknown -> Either String SomeTK
fromUnknownToTK :: TKUnknown -> Either String SomeTK
fromUnknownToTK = (TKConversionError -> String)
-> Either TKConversionError SomeTK -> Either String SomeTK
forall a b c. (a -> b) -> Either a c -> Either b c
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first TKConversionError -> String
renderTKConversionError (Either TKConversionError SomeTK -> Either String SomeTK)
-> (TKUnknown -> Either TKConversionError SomeTK)
-> TKUnknown
-> Either String SomeTK
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TKUnknown -> Either TKConversionError SomeTK
fromUnknownToTKEither

instance Semigroup TKUnknown where
    TKUnknown
a <> :: TKUnknown -> TKUnknown -> TKUnknown
<> TKUnknown
b =
        (SomePKPayload, Maybe SKAddendum)
-> [SignaturePayload]
-> [(Text, [SignaturePayload])]
-> [([UserAttrSubPacket], [SignaturePayload])]
-> [(Pkt, [SignaturePayload])]
-> TKUnknown
TKUnknown
            (TKUnknown -> (SomePKPayload, Maybe SKAddendum)
_tkuKey TKUnknown
a)
            ([SignaturePayload] -> [SignaturePayload]
forall a. Eq a => [a] -> [a]
nub ([SignaturePayload] -> [SignaturePayload])
-> ([SignaturePayload] -> [SignaturePayload])
-> [SignaturePayload]
-> [SignaturePayload]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [SignaturePayload] -> [SignaturePayload]
forall a. Ord a => [a] -> [a]
sort ([SignaturePayload] -> [SignaturePayload])
-> [SignaturePayload] -> [SignaturePayload]
forall a b. (a -> b) -> a -> b
$ TKUnknown -> [SignaturePayload]
_tkuRevs TKUnknown
a [SignaturePayload] -> [SignaturePayload] -> [SignaturePayload]
forall a. [a] -> [a] -> [a]
++ TKUnknown -> [SignaturePayload]
_tkuRevs TKUnknown
b)
            (([(Text, [SignaturePayload])]
-> [(Text, [SignaturePayload])] -> [(Text, [SignaturePayload])]
forall {k} {a}.
(Ord k, Ord a) =>
[(k, [a])] -> [(k, [a])] -> [(k, [a])]
kvmerge ([(Text, [SignaturePayload])]
 -> [(Text, [SignaturePayload])] -> [(Text, [SignaturePayload])])
-> (TKUnknown -> [(Text, [SignaturePayload])])
-> TKUnknown
-> TKUnknown
-> [(Text, [SignaturePayload])]
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` TKUnknown -> [(Text, [SignaturePayload])]
_tkuUIDs) TKUnknown
a TKUnknown
b)
            (([([UserAttrSubPacket], [SignaturePayload])]
-> [([UserAttrSubPacket], [SignaturePayload])]
-> [([UserAttrSubPacket], [SignaturePayload])]
forall {k} {a}.
(Ord k, Ord a) =>
[(k, [a])] -> [(k, [a])] -> [(k, [a])]
kvmerge ([([UserAttrSubPacket], [SignaturePayload])]
 -> [([UserAttrSubPacket], [SignaturePayload])]
 -> [([UserAttrSubPacket], [SignaturePayload])])
-> (TKUnknown -> [([UserAttrSubPacket], [SignaturePayload])])
-> TKUnknown
-> TKUnknown
-> [([UserAttrSubPacket], [SignaturePayload])]
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` TKUnknown -> [([UserAttrSubPacket], [SignaturePayload])]
_tkuUAts) TKUnknown
a TKUnknown
b)
            (([(Pkt, [SignaturePayload])]
-> [(Pkt, [SignaturePayload])] -> [(Pkt, [SignaturePayload])]
forall {a} {k}.
(Ord a, Hashable k) =>
[(k, [a])] -> [(k, [a])] -> [(k, [a])]
ukvmerge ([(Pkt, [SignaturePayload])]
 -> [(Pkt, [SignaturePayload])] -> [(Pkt, [SignaturePayload])])
-> (TKUnknown -> [(Pkt, [SignaturePayload])])
-> TKUnknown
-> TKUnknown
-> [(Pkt, [SignaturePayload])]
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` TKUnknown -> [(Pkt, [SignaturePayload])]
_tkuSubs) TKUnknown
a TKUnknown
b)
      where
        kvmerge :: [(k, [a])] -> [(k, [a])] -> [(k, [a])]
kvmerge [(k, [a])]
x [(k, [a])]
y =
            Map k [a] -> [(k, [a])]
forall k a. Map k a -> [(k, a)]
Map.toList (([a] -> [a] -> [a]) -> Map k [a] -> Map k [a] -> Map k [a]
forall k a. Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a
Map.unionWith [a] -> [a] -> [a]
forall {a}. Ord a => [a] -> [a] -> [a]
nsa ([(k, [a])] -> Map k [a]
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [(k, [a])]
x) ([(k, [a])] -> Map k [a]
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [(k, [a])]
y))
        ukvmerge :: [(k, [a])] -> [(k, [a])] -> [(k, [a])]
ukvmerge [(k, [a])]
x [(k, [a])]
y =
            HashMap k [a] -> [(k, [a])]
forall k v. HashMap k v -> [(k, v)]
HashMap.toList
                (([a] -> [a] -> [a])
-> HashMap k [a] -> HashMap k [a] -> HashMap k [a]
forall k v.
Eq k =>
(v -> v -> v) -> HashMap k v -> HashMap k v -> HashMap k v
HashMap.unionWith [a] -> [a] -> [a]
forall {a}. Ord a => [a] -> [a] -> [a]
nsa ([(k, [a])] -> HashMap k [a]
forall k v. (Eq k, Hashable k) => [(k, v)] -> HashMap k v
HashMap.fromList [(k, [a])]
x) ([(k, [a])] -> HashMap k [a]
forall k v. (Eq k, Hashable k) => [(k, v)] -> HashMap k v
HashMap.fromList [(k, [a])]
y))
        nsa :: [a] -> [a] -> [a]
nsa [a]
x [a]
y = [a] -> [a]
forall a. Eq a => [a] -> [a]
nub ([a] -> [a]) -> ([a] -> [a]) -> [a] -> [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [a] -> [a]
forall a. Ord a => [a] -> [a]
sort ([a] -> [a]) -> [a] -> [a]
forall a b. (a -> b) -> a -> b
$ [a]
x [a] -> [a] -> [a]
forall a. [a] -> [a] -> [a]
++ [a]
y

instance Semigroup (TK k) where
    TK k
a <> :: TK k -> TK k -> TK k
<> TK k
b =
        KeyPkt (TKKindToKeyPktKind k)
-> [SignaturePayload]
-> [(Text, [SignaturePayload])]
-> [([UserAttrSubPacket], [SignaturePayload])]
-> [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
-> TK k
forall (k :: TKKind).
KeyPkt (TKKindToKeyPktKind k)
-> [SignaturePayload]
-> [(Text, [SignaturePayload])]
-> [([UserAttrSubPacket], [SignaturePayload])]
-> [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
-> TK k
TK
            (TK k -> KeyPkt (TKKindToKeyPktKind k)
forall (k :: TKKind). TK k -> KeyPkt (TKKindToKeyPktKind k)
_tkPrimaryKey TK k
a)
            ([SignaturePayload] -> [SignaturePayload]
forall a. Eq a => [a] -> [a]
nub ([SignaturePayload] -> [SignaturePayload])
-> ([SignaturePayload] -> [SignaturePayload])
-> [SignaturePayload]
-> [SignaturePayload]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [SignaturePayload] -> [SignaturePayload]
forall a. Ord a => [a] -> [a]
sort ([SignaturePayload] -> [SignaturePayload])
-> [SignaturePayload] -> [SignaturePayload]
forall a b. (a -> b) -> a -> b
$ TK k -> [SignaturePayload]
forall (k :: TKKind). TK k -> [SignaturePayload]
_tkRevs TK k
a [SignaturePayload] -> [SignaturePayload] -> [SignaturePayload]
forall a. [a] -> [a] -> [a]
++ TK k -> [SignaturePayload]
forall (k :: TKKind). TK k -> [SignaturePayload]
_tkRevs TK k
b)
            (([(Text, [SignaturePayload])]
-> [(Text, [SignaturePayload])] -> [(Text, [SignaturePayload])]
forall {k} {a}.
(Ord k, Ord a) =>
[(k, [a])] -> [(k, [a])] -> [(k, [a])]
kvmerge ([(Text, [SignaturePayload])]
 -> [(Text, [SignaturePayload])] -> [(Text, [SignaturePayload])])
-> (TK k -> [(Text, [SignaturePayload])])
-> TK k
-> TK k
-> [(Text, [SignaturePayload])]
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` TK k -> [(Text, [SignaturePayload])]
forall (k :: TKKind). TK k -> [(Text, [SignaturePayload])]
_tkUIDs) TK k
a TK k
b)
            (([([UserAttrSubPacket], [SignaturePayload])]
-> [([UserAttrSubPacket], [SignaturePayload])]
-> [([UserAttrSubPacket], [SignaturePayload])]
forall {k} {a}.
(Ord k, Ord a) =>
[(k, [a])] -> [(k, [a])] -> [(k, [a])]
kvmerge ([([UserAttrSubPacket], [SignaturePayload])]
 -> [([UserAttrSubPacket], [SignaturePayload])]
 -> [([UserAttrSubPacket], [SignaturePayload])])
-> (TK k -> [([UserAttrSubPacket], [SignaturePayload])])
-> TK k
-> TK k
-> [([UserAttrSubPacket], [SignaturePayload])]
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` TK k -> [([UserAttrSubPacket], [SignaturePayload])]
forall (k :: TKKind).
TK k -> [([UserAttrSubPacket], [SignaturePayload])]
_tkUAts) TK k
a TK k
b)
            (([(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
-> [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
-> [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
forall {a} {k}.
(Ord a, Hashable k) =>
[(k, [a])] -> [(k, [a])] -> [(k, [a])]
ukvmerge ([(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
 -> [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
 -> [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])])
-> (TK k -> [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])])
-> TK k
-> TK k
-> [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` TK k -> [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
forall (k :: TKKind).
TK k -> [(KeyPkt (TKKindToKeyPktKind k), [SignaturePayload])]
_tkSubs) TK k
a TK k
b)
      where
        kvmerge :: [(k, [a])] -> [(k, [a])] -> [(k, [a])]
kvmerge [(k, [a])]
x [(k, [a])]
y =
            Map k [a] -> [(k, [a])]
forall k a. Map k a -> [(k, a)]
Map.toList (([a] -> [a] -> [a]) -> Map k [a] -> Map k [a] -> Map k [a]
forall k a. Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a
Map.unionWith [a] -> [a] -> [a]
forall {a}. Ord a => [a] -> [a] -> [a]
nsa ([(k, [a])] -> Map k [a]
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [(k, [a])]
x) ([(k, [a])] -> Map k [a]
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [(k, [a])]
y))
        ukvmerge :: [(k, [a])] -> [(k, [a])] -> [(k, [a])]
ukvmerge [(k, [a])]
x [(k, [a])]
y =
            HashMap k [a] -> [(k, [a])]
forall k v. HashMap k v -> [(k, v)]
HashMap.toList
                (([a] -> [a] -> [a])
-> HashMap k [a] -> HashMap k [a] -> HashMap k [a]
forall k v.
Eq k =>
(v -> v -> v) -> HashMap k v -> HashMap k v -> HashMap k v
HashMap.unionWith [a] -> [a] -> [a]
forall {a}. Ord a => [a] -> [a] -> [a]
nsa ([(k, [a])] -> HashMap k [a]
forall k v. (Eq k, Hashable k) => [(k, v)] -> HashMap k v
HashMap.fromList [(k, [a])]
x) ([(k, [a])] -> HashMap k [a]
forall k v. (Eq k, Hashable k) => [(k, v)] -> HashMap k v
HashMap.fromList [(k, [a])]
y))
        nsa :: [a] -> [a] -> [a]
nsa [a]
x [a]
y = [a] -> [a]
forall a. Eq a => [a] -> [a]
nub ([a] -> [a]) -> ([a] -> [a]) -> [a] -> [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [a] -> [a]
forall a. Ord a => [a] -> [a]
sort ([a] -> [a]) -> [a] -> [a]
forall a b. (a -> b) -> a -> b
$ [a]
x [a] -> [a] -> [a]
forall a. [a] -> [a] -> [a]
++ [a]
y

instance Semigroup SomeTK where
    SomePublicTK TK 'PublicTK
a <> :: SomeTK -> SomeTK -> SomeTK
<> SomePublicTK TK 'PublicTK
b = TK 'PublicTK -> SomeTK
SomePublicTK (TK 'PublicTK
a TK 'PublicTK -> TK 'PublicTK -> TK 'PublicTK
forall a. Semigroup a => a -> a -> a
<> TK 'PublicTK
b)
    SomeSecretTK TK 'SecretTK
a <> SomeSecretTK TK 'SecretTK
b = TK 'SecretTK -> SomeTK
SomeSecretTK (TK 'SecretTK
a TK 'SecretTK -> TK 'SecretTK -> TK 'SecretTK
forall a. Semigroup a => a -> a -> a
<> TK 'SecretTK
b)
    SomeTK
a <> SomeTK
b =
        String -> SomeTK
forall a. HasCallStack => String -> a
error
            ( String
"Semigroup SomeTK: cannot merge public and secret transferable keys"
                String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" ("
                String -> ShowS
forall a. [a] -> [a] -> [a]
++ SomeTK -> String
forall a. Show a => a -> String
show SomeTK
a
                String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" <> "
                String -> ShowS
forall a. [a] -> [a] -> [a]
++ SomeTK -> String
forall a. Show a => a -> String
show SomeTK
b
                String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
")"
            )

data TKWithWireRep
    = TKWithWireRep
    { TKWithWireRep -> WireRepRefs
_tkWireRepRefs :: WireRepRefs
    , TKWithWireRep -> Maybe ByteRange
_tkWireRepRange :: Maybe ByteRange
    , TKWithWireRep -> [PktWithWireRep]
_tkPackets :: [PktWithWireRep]
    , TKWithWireRep -> TKUnknown
_tkValue :: TKUnknown
    }
    deriving (Typeable TKWithWireRep
Typeable TKWithWireRep =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> TKWithWireRep -> c TKWithWireRep)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c TKWithWireRep)
-> (TKWithWireRep -> Constr)
-> (TKWithWireRep -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c TKWithWireRep))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c TKWithWireRep))
-> ((forall b. Data b => b -> b) -> TKWithWireRep -> TKWithWireRep)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> TKWithWireRep -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> TKWithWireRep -> r)
-> (forall u. (forall d. Data d => d -> u) -> TKWithWireRep -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> TKWithWireRep -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> TKWithWireRep -> m TKWithWireRep)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TKWithWireRep -> m TKWithWireRep)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> TKWithWireRep -> m TKWithWireRep)
-> Data TKWithWireRep
TKWithWireRep -> Constr
TKWithWireRep -> DataType
(forall b. Data b => b -> b) -> TKWithWireRep -> TKWithWireRep
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> TKWithWireRep -> u
forall u. (forall d. Data d => d -> u) -> TKWithWireRep -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TKWithWireRep -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TKWithWireRep -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TKWithWireRep -> m TKWithWireRep
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TKWithWireRep -> m TKWithWireRep
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TKWithWireRep
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TKWithWireRep -> c TKWithWireRep
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TKWithWireRep)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c TKWithWireRep)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TKWithWireRep -> c TKWithWireRep
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TKWithWireRep -> c TKWithWireRep
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TKWithWireRep
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TKWithWireRep
$ctoConstr :: TKWithWireRep -> Constr
toConstr :: TKWithWireRep -> Constr
$cdataTypeOf :: TKWithWireRep -> DataType
dataTypeOf :: TKWithWireRep -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TKWithWireRep)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TKWithWireRep)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c TKWithWireRep)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c TKWithWireRep)
$cgmapT :: (forall b. Data b => b -> b) -> TKWithWireRep -> TKWithWireRep
gmapT :: (forall b. Data b => b -> b) -> TKWithWireRep -> TKWithWireRep
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TKWithWireRep -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TKWithWireRep -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TKWithWireRep -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TKWithWireRep -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TKWithWireRep -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> TKWithWireRep -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TKWithWireRep -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TKWithWireRep -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TKWithWireRep -> m TKWithWireRep
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TKWithWireRep -> m TKWithWireRep
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TKWithWireRep -> m TKWithWireRep
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TKWithWireRep -> m TKWithWireRep
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TKWithWireRep -> m TKWithWireRep
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TKWithWireRep -> m TKWithWireRep
Data, TKWithWireRep -> TKWithWireRep -> Bool
(TKWithWireRep -> TKWithWireRep -> Bool)
-> (TKWithWireRep -> TKWithWireRep -> Bool) -> Eq TKWithWireRep
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TKWithWireRep -> TKWithWireRep -> Bool
== :: TKWithWireRep -> TKWithWireRep -> Bool
$c/= :: TKWithWireRep -> TKWithWireRep -> Bool
/= :: TKWithWireRep -> TKWithWireRep -> Bool
Eq, (forall x. TKWithWireRep -> Rep TKWithWireRep x)
-> (forall x. Rep TKWithWireRep x -> TKWithWireRep)
-> Generic TKWithWireRep
forall x. Rep TKWithWireRep x -> TKWithWireRep
forall x. TKWithWireRep -> Rep TKWithWireRep x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TKWithWireRep -> Rep TKWithWireRep x
from :: forall x. TKWithWireRep -> Rep TKWithWireRep x
$cto :: forall x. Rep TKWithWireRep x -> TKWithWireRep
to :: forall x. Rep TKWithWireRep x -> TKWithWireRep
Generic, Eq TKWithWireRep
Eq TKWithWireRep =>
(TKWithWireRep -> TKWithWireRep -> Ordering)
-> (TKWithWireRep -> TKWithWireRep -> Bool)
-> (TKWithWireRep -> TKWithWireRep -> Bool)
-> (TKWithWireRep -> TKWithWireRep -> Bool)
-> (TKWithWireRep -> TKWithWireRep -> Bool)
-> (TKWithWireRep -> TKWithWireRep -> TKWithWireRep)
-> (TKWithWireRep -> TKWithWireRep -> TKWithWireRep)
-> Ord TKWithWireRep
TKWithWireRep -> TKWithWireRep -> Bool
TKWithWireRep -> TKWithWireRep -> Ordering
TKWithWireRep -> TKWithWireRep -> TKWithWireRep
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: TKWithWireRep -> TKWithWireRep -> Ordering
compare :: TKWithWireRep -> TKWithWireRep -> Ordering
$c< :: TKWithWireRep -> TKWithWireRep -> Bool
< :: TKWithWireRep -> TKWithWireRep -> Bool
$c<= :: TKWithWireRep -> TKWithWireRep -> Bool
<= :: TKWithWireRep -> TKWithWireRep -> Bool
$c> :: TKWithWireRep -> TKWithWireRep -> Bool
> :: TKWithWireRep -> TKWithWireRep -> Bool
$c>= :: TKWithWireRep -> TKWithWireRep -> Bool
>= :: TKWithWireRep -> TKWithWireRep -> Bool
$cmax :: TKWithWireRep -> TKWithWireRep -> TKWithWireRep
max :: TKWithWireRep -> TKWithWireRep -> TKWithWireRep
$cmin :: TKWithWireRep -> TKWithWireRep -> TKWithWireRep
min :: TKWithWireRep -> TKWithWireRep -> TKWithWireRep
Ord, Int -> TKWithWireRep -> ShowS
[TKWithWireRep] -> ShowS
TKWithWireRep -> String
(Int -> TKWithWireRep -> ShowS)
-> (TKWithWireRep -> String)
-> ([TKWithWireRep] -> ShowS)
-> Show TKWithWireRep
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TKWithWireRep -> ShowS
showsPrec :: Int -> TKWithWireRep -> ShowS
$cshow :: TKWithWireRep -> String
show :: TKWithWireRep -> String
$cshowList :: [TKWithWireRep] -> ShowS
showList :: [TKWithWireRep] -> ShowS
Show, Typeable)

data PacketRefId
    = PacketRefId
    { PacketRefId -> WireRepRef
_packetRefWireRepRef :: WireRepRef
    , PacketRefId -> Int
_packetRefIndex :: Int
    }
    deriving (Typeable PacketRefId
Typeable PacketRefId =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> PacketRefId -> c PacketRefId)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c PacketRefId)
-> (PacketRefId -> Constr)
-> (PacketRefId -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c PacketRefId))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c PacketRefId))
-> ((forall b. Data b => b -> b) -> PacketRefId -> PacketRefId)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> PacketRefId -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> PacketRefId -> r)
-> (forall u. (forall d. Data d => d -> u) -> PacketRefId -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> PacketRefId -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> PacketRefId -> m PacketRefId)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> PacketRefId -> m PacketRefId)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> PacketRefId -> m PacketRefId)
-> Data PacketRefId
PacketRefId -> Constr
PacketRefId -> DataType
(forall b. Data b => b -> b) -> PacketRefId -> PacketRefId
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> PacketRefId -> u
forall u. (forall d. Data d => d -> u) -> PacketRefId -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PacketRefId -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PacketRefId -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> PacketRefId -> m PacketRefId
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PacketRefId -> m PacketRefId
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PacketRefId
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PacketRefId -> c PacketRefId
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PacketRefId)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PacketRefId)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PacketRefId -> c PacketRefId
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> PacketRefId -> c PacketRefId
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PacketRefId
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c PacketRefId
$ctoConstr :: PacketRefId -> Constr
toConstr :: PacketRefId -> Constr
$cdataTypeOf :: PacketRefId -> DataType
dataTypeOf :: PacketRefId -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PacketRefId)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c PacketRefId)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PacketRefId)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c PacketRefId)
$cgmapT :: (forall b. Data b => b -> b) -> PacketRefId -> PacketRefId
gmapT :: (forall b. Data b => b -> b) -> PacketRefId -> PacketRefId
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PacketRefId -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> PacketRefId -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PacketRefId -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> PacketRefId -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> PacketRefId -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> PacketRefId -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> PacketRefId -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> PacketRefId -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> PacketRefId -> m PacketRefId
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> PacketRefId -> m PacketRefId
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PacketRefId -> m PacketRefId
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PacketRefId -> m PacketRefId
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PacketRefId -> m PacketRefId
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> PacketRefId -> m PacketRefId
Data, PacketRefId -> PacketRefId -> Bool
(PacketRefId -> PacketRefId -> Bool)
-> (PacketRefId -> PacketRefId -> Bool) -> Eq PacketRefId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PacketRefId -> PacketRefId -> Bool
== :: PacketRefId -> PacketRefId -> Bool
$c/= :: PacketRefId -> PacketRefId -> Bool
/= :: PacketRefId -> PacketRefId -> Bool
Eq, (forall x. PacketRefId -> Rep PacketRefId x)
-> (forall x. Rep PacketRefId x -> PacketRefId)
-> Generic PacketRefId
forall x. Rep PacketRefId x -> PacketRefId
forall x. PacketRefId -> Rep PacketRefId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. PacketRefId -> Rep PacketRefId x
from :: forall x. PacketRefId -> Rep PacketRefId x
$cto :: forall x. Rep PacketRefId x -> PacketRefId
to :: forall x. Rep PacketRefId x -> PacketRefId
Generic, Eq PacketRefId
Eq PacketRefId =>
(PacketRefId -> PacketRefId -> Ordering)
-> (PacketRefId -> PacketRefId -> Bool)
-> (PacketRefId -> PacketRefId -> Bool)
-> (PacketRefId -> PacketRefId -> Bool)
-> (PacketRefId -> PacketRefId -> Bool)
-> (PacketRefId -> PacketRefId -> PacketRefId)
-> (PacketRefId -> PacketRefId -> PacketRefId)
-> Ord PacketRefId
PacketRefId -> PacketRefId -> Bool
PacketRefId -> PacketRefId -> Ordering
PacketRefId -> PacketRefId -> PacketRefId
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: PacketRefId -> PacketRefId -> Ordering
compare :: PacketRefId -> PacketRefId -> Ordering
$c< :: PacketRefId -> PacketRefId -> Bool
< :: PacketRefId -> PacketRefId -> Bool
$c<= :: PacketRefId -> PacketRefId -> Bool
<= :: PacketRefId -> PacketRefId -> Bool
$c> :: PacketRefId -> PacketRefId -> Bool
> :: PacketRefId -> PacketRefId -> Bool
$c>= :: PacketRefId -> PacketRefId -> Bool
>= :: PacketRefId -> PacketRefId -> Bool
$cmax :: PacketRefId -> PacketRefId -> PacketRefId
max :: PacketRefId -> PacketRefId -> PacketRefId
$cmin :: PacketRefId -> PacketRefId -> PacketRefId
min :: PacketRefId -> PacketRefId -> PacketRefId
Ord, Int -> PacketRefId -> ShowS
[PacketRefId] -> ShowS
PacketRefId -> String
(Int -> PacketRefId -> ShowS)
-> (PacketRefId -> String)
-> ([PacketRefId] -> ShowS)
-> Show PacketRefId
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PacketRefId -> ShowS
showsPrec :: Int -> PacketRefId -> ShowS
$cshow :: PacketRefId -> String
show :: PacketRefId -> String
$cshowList :: [PacketRefId] -> ShowS
showList :: [PacketRefId] -> ShowS
Show, Typeable)

data SignatureWithWireRef
    = SignatureWithWireRef
    { SignatureWithWireRef -> SignaturePayload
_signatureWithWireRefValue :: SignaturePayload
    , SignatureWithWireRef -> PacketRefId
_signatureWithWireRefRef :: PacketRefId
    }
    deriving (Typeable SignatureWithWireRef
Typeable SignatureWithWireRef =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g)
 -> SignatureWithWireRef
 -> c SignatureWithWireRef)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SignatureWithWireRef)
-> (SignatureWithWireRef -> Constr)
-> (SignatureWithWireRef -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SignatureWithWireRef))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c SignatureWithWireRef))
-> ((forall b. Data b => b -> b)
    -> SignatureWithWireRef -> SignatureWithWireRef)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> SignatureWithWireRef -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> SignatureWithWireRef -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> SignatureWithWireRef -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> SignatureWithWireRef -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> SignatureWithWireRef -> m SignatureWithWireRef)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> SignatureWithWireRef -> m SignatureWithWireRef)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> SignatureWithWireRef -> m SignatureWithWireRef)
-> Data SignatureWithWireRef
SignatureWithWireRef -> Constr
SignatureWithWireRef -> DataType
(forall b. Data b => b -> b)
-> SignatureWithWireRef -> SignatureWithWireRef
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> SignatureWithWireRef -> u
forall u.
(forall d. Data d => d -> u) -> SignatureWithWireRef -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SignatureWithWireRef -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SignatureWithWireRef -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> SignatureWithWireRef -> m SignatureWithWireRef
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SignatureWithWireRef -> m SignatureWithWireRef
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SignatureWithWireRef
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SignatureWithWireRef
-> c SignatureWithWireRef
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SignatureWithWireRef)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SignatureWithWireRef)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SignatureWithWireRef
-> c SignatureWithWireRef
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SignatureWithWireRef
-> c SignatureWithWireRef
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SignatureWithWireRef
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SignatureWithWireRef
$ctoConstr :: SignatureWithWireRef -> Constr
toConstr :: SignatureWithWireRef -> Constr
$cdataTypeOf :: SignatureWithWireRef -> DataType
dataTypeOf :: SignatureWithWireRef -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SignatureWithWireRef)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SignatureWithWireRef)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SignatureWithWireRef)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SignatureWithWireRef)
$cgmapT :: (forall b. Data b => b -> b)
-> SignatureWithWireRef -> SignatureWithWireRef
gmapT :: (forall b. Data b => b -> b)
-> SignatureWithWireRef -> SignatureWithWireRef
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SignatureWithWireRef -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SignatureWithWireRef -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SignatureWithWireRef -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SignatureWithWireRef -> r
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> SignatureWithWireRef -> [u]
gmapQ :: forall u.
(forall d. Data d => d -> u) -> SignatureWithWireRef -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> SignatureWithWireRef -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> SignatureWithWireRef -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> SignatureWithWireRef -> m SignatureWithWireRef
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> SignatureWithWireRef -> m SignatureWithWireRef
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SignatureWithWireRef -> m SignatureWithWireRef
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SignatureWithWireRef -> m SignatureWithWireRef
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SignatureWithWireRef -> m SignatureWithWireRef
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SignatureWithWireRef -> m SignatureWithWireRef
Data, SignatureWithWireRef -> SignatureWithWireRef -> Bool
(SignatureWithWireRef -> SignatureWithWireRef -> Bool)
-> (SignatureWithWireRef -> SignatureWithWireRef -> Bool)
-> Eq SignatureWithWireRef
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SignatureWithWireRef -> SignatureWithWireRef -> Bool
== :: SignatureWithWireRef -> SignatureWithWireRef -> Bool
$c/= :: SignatureWithWireRef -> SignatureWithWireRef -> Bool
/= :: SignatureWithWireRef -> SignatureWithWireRef -> Bool
Eq, (forall x. SignatureWithWireRef -> Rep SignatureWithWireRef x)
-> (forall x. Rep SignatureWithWireRef x -> SignatureWithWireRef)
-> Generic SignatureWithWireRef
forall x. Rep SignatureWithWireRef x -> SignatureWithWireRef
forall x. SignatureWithWireRef -> Rep SignatureWithWireRef x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SignatureWithWireRef -> Rep SignatureWithWireRef x
from :: forall x. SignatureWithWireRef -> Rep SignatureWithWireRef x
$cto :: forall x. Rep SignatureWithWireRef x -> SignatureWithWireRef
to :: forall x. Rep SignatureWithWireRef x -> SignatureWithWireRef
Generic, Eq SignatureWithWireRef
Eq SignatureWithWireRef =>
(SignatureWithWireRef -> SignatureWithWireRef -> Ordering)
-> (SignatureWithWireRef -> SignatureWithWireRef -> Bool)
-> (SignatureWithWireRef -> SignatureWithWireRef -> Bool)
-> (SignatureWithWireRef -> SignatureWithWireRef -> Bool)
-> (SignatureWithWireRef -> SignatureWithWireRef -> Bool)
-> (SignatureWithWireRef
    -> SignatureWithWireRef -> SignatureWithWireRef)
-> (SignatureWithWireRef
    -> SignatureWithWireRef -> SignatureWithWireRef)
-> Ord SignatureWithWireRef
SignatureWithWireRef -> SignatureWithWireRef -> Bool
SignatureWithWireRef -> SignatureWithWireRef -> Ordering
SignatureWithWireRef
-> SignatureWithWireRef -> SignatureWithWireRef
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: SignatureWithWireRef -> SignatureWithWireRef -> Ordering
compare :: SignatureWithWireRef -> SignatureWithWireRef -> Ordering
$c< :: SignatureWithWireRef -> SignatureWithWireRef -> Bool
< :: SignatureWithWireRef -> SignatureWithWireRef -> Bool
$c<= :: SignatureWithWireRef -> SignatureWithWireRef -> Bool
<= :: SignatureWithWireRef -> SignatureWithWireRef -> Bool
$c> :: SignatureWithWireRef -> SignatureWithWireRef -> Bool
> :: SignatureWithWireRef -> SignatureWithWireRef -> Bool
$c>= :: SignatureWithWireRef -> SignatureWithWireRef -> Bool
>= :: SignatureWithWireRef -> SignatureWithWireRef -> Bool
$cmax :: SignatureWithWireRef
-> SignatureWithWireRef -> SignatureWithWireRef
max :: SignatureWithWireRef
-> SignatureWithWireRef -> SignatureWithWireRef
$cmin :: SignatureWithWireRef
-> SignatureWithWireRef -> SignatureWithWireRef
min :: SignatureWithWireRef
-> SignatureWithWireRef -> SignatureWithWireRef
Ord, Int -> SignatureWithWireRef -> ShowS
[SignatureWithWireRef] -> ShowS
SignatureWithWireRef -> String
(Int -> SignatureWithWireRef -> ShowS)
-> (SignatureWithWireRef -> String)
-> ([SignatureWithWireRef] -> ShowS)
-> Show SignatureWithWireRef
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SignatureWithWireRef -> ShowS
showsPrec :: Int -> SignatureWithWireRef -> ShowS
$cshow :: SignatureWithWireRef -> String
show :: SignatureWithWireRef -> String
$cshowList :: [SignatureWithWireRef] -> ShowS
showList :: [SignatureWithWireRef] -> ShowS
Show, Typeable)

data UIDWithWireRefs
    = UIDWithWireRefs
    { UIDWithWireRefs -> Text
_uidWithWireRefsValue :: Text
    , UIDWithWireRefs -> PacketRefId
_uidWithWireRefsRef :: PacketRefId
    , UIDWithWireRefs -> [SignatureWithWireRef]
_uidWithWireRefsSignatures :: [SignatureWithWireRef]
    }
    deriving (Typeable UIDWithWireRefs
Typeable UIDWithWireRefs =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> UIDWithWireRefs -> c UIDWithWireRefs)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UIDWithWireRefs)
-> (UIDWithWireRefs -> Constr)
-> (UIDWithWireRefs -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c UIDWithWireRefs))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c UIDWithWireRefs))
-> ((forall b. Data b => b -> b)
    -> UIDWithWireRefs -> UIDWithWireRefs)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> UIDWithWireRefs -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> UIDWithWireRefs -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> UIDWithWireRefs -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> UIDWithWireRefs -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> UIDWithWireRefs -> m UIDWithWireRefs)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> UIDWithWireRefs -> m UIDWithWireRefs)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> UIDWithWireRefs -> m UIDWithWireRefs)
-> Data UIDWithWireRefs
UIDWithWireRefs -> Constr
UIDWithWireRefs -> DataType
(forall b. Data b => b -> b) -> UIDWithWireRefs -> UIDWithWireRefs
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> UIDWithWireRefs -> u
forall u. (forall d. Data d => d -> u) -> UIDWithWireRefs -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UIDWithWireRefs -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UIDWithWireRefs -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UIDWithWireRefs -> m UIDWithWireRefs
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UIDWithWireRefs -> m UIDWithWireRefs
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UIDWithWireRefs
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UIDWithWireRefs -> c UIDWithWireRefs
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UIDWithWireRefs)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UIDWithWireRefs)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UIDWithWireRefs -> c UIDWithWireRefs
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UIDWithWireRefs -> c UIDWithWireRefs
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UIDWithWireRefs
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UIDWithWireRefs
$ctoConstr :: UIDWithWireRefs -> Constr
toConstr :: UIDWithWireRefs -> Constr
$cdataTypeOf :: UIDWithWireRefs -> DataType
dataTypeOf :: UIDWithWireRefs -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UIDWithWireRefs)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UIDWithWireRefs)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UIDWithWireRefs)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UIDWithWireRefs)
$cgmapT :: (forall b. Data b => b -> b) -> UIDWithWireRefs -> UIDWithWireRefs
gmapT :: (forall b. Data b => b -> b) -> UIDWithWireRefs -> UIDWithWireRefs
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UIDWithWireRefs -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UIDWithWireRefs -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UIDWithWireRefs -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UIDWithWireRefs -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> UIDWithWireRefs -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> UIDWithWireRefs -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> UIDWithWireRefs -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> UIDWithWireRefs -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UIDWithWireRefs -> m UIDWithWireRefs
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UIDWithWireRefs -> m UIDWithWireRefs
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UIDWithWireRefs -> m UIDWithWireRefs
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UIDWithWireRefs -> m UIDWithWireRefs
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UIDWithWireRefs -> m UIDWithWireRefs
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UIDWithWireRefs -> m UIDWithWireRefs
Data, UIDWithWireRefs -> UIDWithWireRefs -> Bool
(UIDWithWireRefs -> UIDWithWireRefs -> Bool)
-> (UIDWithWireRefs -> UIDWithWireRefs -> Bool)
-> Eq UIDWithWireRefs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UIDWithWireRefs -> UIDWithWireRefs -> Bool
== :: UIDWithWireRefs -> UIDWithWireRefs -> Bool
$c/= :: UIDWithWireRefs -> UIDWithWireRefs -> Bool
/= :: UIDWithWireRefs -> UIDWithWireRefs -> Bool
Eq, (forall x. UIDWithWireRefs -> Rep UIDWithWireRefs x)
-> (forall x. Rep UIDWithWireRefs x -> UIDWithWireRefs)
-> Generic UIDWithWireRefs
forall x. Rep UIDWithWireRefs x -> UIDWithWireRefs
forall x. UIDWithWireRefs -> Rep UIDWithWireRefs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. UIDWithWireRefs -> Rep UIDWithWireRefs x
from :: forall x. UIDWithWireRefs -> Rep UIDWithWireRefs x
$cto :: forall x. Rep UIDWithWireRefs x -> UIDWithWireRefs
to :: forall x. Rep UIDWithWireRefs x -> UIDWithWireRefs
Generic, Eq UIDWithWireRefs
Eq UIDWithWireRefs =>
(UIDWithWireRefs -> UIDWithWireRefs -> Ordering)
-> (UIDWithWireRefs -> UIDWithWireRefs -> Bool)
-> (UIDWithWireRefs -> UIDWithWireRefs -> Bool)
-> (UIDWithWireRefs -> UIDWithWireRefs -> Bool)
-> (UIDWithWireRefs -> UIDWithWireRefs -> Bool)
-> (UIDWithWireRefs -> UIDWithWireRefs -> UIDWithWireRefs)
-> (UIDWithWireRefs -> UIDWithWireRefs -> UIDWithWireRefs)
-> Ord UIDWithWireRefs
UIDWithWireRefs -> UIDWithWireRefs -> Bool
UIDWithWireRefs -> UIDWithWireRefs -> Ordering
UIDWithWireRefs -> UIDWithWireRefs -> UIDWithWireRefs
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: UIDWithWireRefs -> UIDWithWireRefs -> Ordering
compare :: UIDWithWireRefs -> UIDWithWireRefs -> Ordering
$c< :: UIDWithWireRefs -> UIDWithWireRefs -> Bool
< :: UIDWithWireRefs -> UIDWithWireRefs -> Bool
$c<= :: UIDWithWireRefs -> UIDWithWireRefs -> Bool
<= :: UIDWithWireRefs -> UIDWithWireRefs -> Bool
$c> :: UIDWithWireRefs -> UIDWithWireRefs -> Bool
> :: UIDWithWireRefs -> UIDWithWireRefs -> Bool
$c>= :: UIDWithWireRefs -> UIDWithWireRefs -> Bool
>= :: UIDWithWireRefs -> UIDWithWireRefs -> Bool
$cmax :: UIDWithWireRefs -> UIDWithWireRefs -> UIDWithWireRefs
max :: UIDWithWireRefs -> UIDWithWireRefs -> UIDWithWireRefs
$cmin :: UIDWithWireRefs -> UIDWithWireRefs -> UIDWithWireRefs
min :: UIDWithWireRefs -> UIDWithWireRefs -> UIDWithWireRefs
Ord, Int -> UIDWithWireRefs -> ShowS
[UIDWithWireRefs] -> ShowS
UIDWithWireRefs -> String
(Int -> UIDWithWireRefs -> ShowS)
-> (UIDWithWireRefs -> String)
-> ([UIDWithWireRefs] -> ShowS)
-> Show UIDWithWireRefs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UIDWithWireRefs -> ShowS
showsPrec :: Int -> UIDWithWireRefs -> ShowS
$cshow :: UIDWithWireRefs -> String
show :: UIDWithWireRefs -> String
$cshowList :: [UIDWithWireRefs] -> ShowS
showList :: [UIDWithWireRefs] -> ShowS
Show, Typeable)

data UATWithWireRefs
    = UATWithWireRefs
    { UATWithWireRefs -> [UserAttrSubPacket]
_uatWithWireRefsValue :: [UserAttrSubPacket]
    , UATWithWireRefs -> PacketRefId
_uatWithWireRefsRef :: PacketRefId
    , UATWithWireRefs -> [SignatureWithWireRef]
_uatWithWireRefsSignatures :: [SignatureWithWireRef]
    }
    deriving (Typeable UATWithWireRefs
Typeable UATWithWireRefs =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> UATWithWireRefs -> c UATWithWireRefs)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c UATWithWireRefs)
-> (UATWithWireRefs -> Constr)
-> (UATWithWireRefs -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c UATWithWireRefs))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c UATWithWireRefs))
-> ((forall b. Data b => b -> b)
    -> UATWithWireRefs -> UATWithWireRefs)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> UATWithWireRefs -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> UATWithWireRefs -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> UATWithWireRefs -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> UATWithWireRefs -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> UATWithWireRefs -> m UATWithWireRefs)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> UATWithWireRefs -> m UATWithWireRefs)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> UATWithWireRefs -> m UATWithWireRefs)
-> Data UATWithWireRefs
UATWithWireRefs -> Constr
UATWithWireRefs -> DataType
(forall b. Data b => b -> b) -> UATWithWireRefs -> UATWithWireRefs
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> UATWithWireRefs -> u
forall u. (forall d. Data d => d -> u) -> UATWithWireRefs -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UATWithWireRefs -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UATWithWireRefs -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UATWithWireRefs -> m UATWithWireRefs
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UATWithWireRefs -> m UATWithWireRefs
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UATWithWireRefs
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UATWithWireRefs -> c UATWithWireRefs
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UATWithWireRefs)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UATWithWireRefs)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UATWithWireRefs -> c UATWithWireRefs
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> UATWithWireRefs -> c UATWithWireRefs
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UATWithWireRefs
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c UATWithWireRefs
$ctoConstr :: UATWithWireRefs -> Constr
toConstr :: UATWithWireRefs -> Constr
$cdataTypeOf :: UATWithWireRefs -> DataType
dataTypeOf :: UATWithWireRefs -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UATWithWireRefs)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c UATWithWireRefs)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UATWithWireRefs)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c UATWithWireRefs)
$cgmapT :: (forall b. Data b => b -> b) -> UATWithWireRefs -> UATWithWireRefs
gmapT :: (forall b. Data b => b -> b) -> UATWithWireRefs -> UATWithWireRefs
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UATWithWireRefs -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> UATWithWireRefs -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UATWithWireRefs -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> UATWithWireRefs -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> UATWithWireRefs -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> UATWithWireRefs -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> UATWithWireRefs -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> UATWithWireRefs -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UATWithWireRefs -> m UATWithWireRefs
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> UATWithWireRefs -> m UATWithWireRefs
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UATWithWireRefs -> m UATWithWireRefs
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UATWithWireRefs -> m UATWithWireRefs
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UATWithWireRefs -> m UATWithWireRefs
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> UATWithWireRefs -> m UATWithWireRefs
Data, UATWithWireRefs -> UATWithWireRefs -> Bool
(UATWithWireRefs -> UATWithWireRefs -> Bool)
-> (UATWithWireRefs -> UATWithWireRefs -> Bool)
-> Eq UATWithWireRefs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UATWithWireRefs -> UATWithWireRefs -> Bool
== :: UATWithWireRefs -> UATWithWireRefs -> Bool
$c/= :: UATWithWireRefs -> UATWithWireRefs -> Bool
/= :: UATWithWireRefs -> UATWithWireRefs -> Bool
Eq, (forall x. UATWithWireRefs -> Rep UATWithWireRefs x)
-> (forall x. Rep UATWithWireRefs x -> UATWithWireRefs)
-> Generic UATWithWireRefs
forall x. Rep UATWithWireRefs x -> UATWithWireRefs
forall x. UATWithWireRefs -> Rep UATWithWireRefs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. UATWithWireRefs -> Rep UATWithWireRefs x
from :: forall x. UATWithWireRefs -> Rep UATWithWireRefs x
$cto :: forall x. Rep UATWithWireRefs x -> UATWithWireRefs
to :: forall x. Rep UATWithWireRefs x -> UATWithWireRefs
Generic, Eq UATWithWireRefs
Eq UATWithWireRefs =>
(UATWithWireRefs -> UATWithWireRefs -> Ordering)
-> (UATWithWireRefs -> UATWithWireRefs -> Bool)
-> (UATWithWireRefs -> UATWithWireRefs -> Bool)
-> (UATWithWireRefs -> UATWithWireRefs -> Bool)
-> (UATWithWireRefs -> UATWithWireRefs -> Bool)
-> (UATWithWireRefs -> UATWithWireRefs -> UATWithWireRefs)
-> (UATWithWireRefs -> UATWithWireRefs -> UATWithWireRefs)
-> Ord UATWithWireRefs
UATWithWireRefs -> UATWithWireRefs -> Bool
UATWithWireRefs -> UATWithWireRefs -> Ordering
UATWithWireRefs -> UATWithWireRefs -> UATWithWireRefs
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: UATWithWireRefs -> UATWithWireRefs -> Ordering
compare :: UATWithWireRefs -> UATWithWireRefs -> Ordering
$c< :: UATWithWireRefs -> UATWithWireRefs -> Bool
< :: UATWithWireRefs -> UATWithWireRefs -> Bool
$c<= :: UATWithWireRefs -> UATWithWireRefs -> Bool
<= :: UATWithWireRefs -> UATWithWireRefs -> Bool
$c> :: UATWithWireRefs -> UATWithWireRefs -> Bool
> :: UATWithWireRefs -> UATWithWireRefs -> Bool
$c>= :: UATWithWireRefs -> UATWithWireRefs -> Bool
>= :: UATWithWireRefs -> UATWithWireRefs -> Bool
$cmax :: UATWithWireRefs -> UATWithWireRefs -> UATWithWireRefs
max :: UATWithWireRefs -> UATWithWireRefs -> UATWithWireRefs
$cmin :: UATWithWireRefs -> UATWithWireRefs -> UATWithWireRefs
min :: UATWithWireRefs -> UATWithWireRefs -> UATWithWireRefs
Ord, Int -> UATWithWireRefs -> ShowS
[UATWithWireRefs] -> ShowS
UATWithWireRefs -> String
(Int -> UATWithWireRefs -> ShowS)
-> (UATWithWireRefs -> String)
-> ([UATWithWireRefs] -> ShowS)
-> Show UATWithWireRefs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UATWithWireRefs -> ShowS
showsPrec :: Int -> UATWithWireRefs -> ShowS
$cshow :: UATWithWireRefs -> String
show :: UATWithWireRefs -> String
$cshowList :: [UATWithWireRefs] -> ShowS
showList :: [UATWithWireRefs] -> ShowS
Show, Typeable)

data SubkeyWithWireRefs
    = SubkeyWithWireRefs
    { SubkeyWithWireRefs -> Pkt
_subkeyWithWireRefsValue :: Pkt
    , SubkeyWithWireRefs -> PacketRefId
_subkeyWithWireRefsRef :: PacketRefId
    , SubkeyWithWireRefs -> [SignatureWithWireRef]
_subkeyWithWireRefsSignatures :: [SignatureWithWireRef]
    }
    deriving (Typeable SubkeyWithWireRefs
Typeable SubkeyWithWireRefs =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g)
 -> SubkeyWithWireRefs
 -> c SubkeyWithWireRefs)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SubkeyWithWireRefs)
-> (SubkeyWithWireRefs -> Constr)
-> (SubkeyWithWireRefs -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SubkeyWithWireRefs))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c SubkeyWithWireRefs))
-> ((forall b. Data b => b -> b)
    -> SubkeyWithWireRefs -> SubkeyWithWireRefs)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> SubkeyWithWireRefs -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> SubkeyWithWireRefs -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> SubkeyWithWireRefs -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> SubkeyWithWireRefs -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> SubkeyWithWireRefs -> m SubkeyWithWireRefs)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> SubkeyWithWireRefs -> m SubkeyWithWireRefs)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> SubkeyWithWireRefs -> m SubkeyWithWireRefs)
-> Data SubkeyWithWireRefs
SubkeyWithWireRefs -> Constr
SubkeyWithWireRefs -> DataType
(forall b. Data b => b -> b)
-> SubkeyWithWireRefs -> SubkeyWithWireRefs
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> SubkeyWithWireRefs -> u
forall u. (forall d. Data d => d -> u) -> SubkeyWithWireRefs -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SubkeyWithWireRefs -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SubkeyWithWireRefs -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> SubkeyWithWireRefs -> m SubkeyWithWireRefs
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SubkeyWithWireRefs -> m SubkeyWithWireRefs
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SubkeyWithWireRefs
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SubkeyWithWireRefs
-> c SubkeyWithWireRefs
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SubkeyWithWireRefs)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SubkeyWithWireRefs)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SubkeyWithWireRefs
-> c SubkeyWithWireRefs
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SubkeyWithWireRefs
-> c SubkeyWithWireRefs
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SubkeyWithWireRefs
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SubkeyWithWireRefs
$ctoConstr :: SubkeyWithWireRefs -> Constr
toConstr :: SubkeyWithWireRefs -> Constr
$cdataTypeOf :: SubkeyWithWireRefs -> DataType
dataTypeOf :: SubkeyWithWireRefs -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SubkeyWithWireRefs)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SubkeyWithWireRefs)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SubkeyWithWireRefs)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SubkeyWithWireRefs)
$cgmapT :: (forall b. Data b => b -> b)
-> SubkeyWithWireRefs -> SubkeyWithWireRefs
gmapT :: (forall b. Data b => b -> b)
-> SubkeyWithWireRefs -> SubkeyWithWireRefs
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SubkeyWithWireRefs -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SubkeyWithWireRefs -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SubkeyWithWireRefs -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SubkeyWithWireRefs -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> SubkeyWithWireRefs -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> SubkeyWithWireRefs -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> SubkeyWithWireRefs -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> SubkeyWithWireRefs -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> SubkeyWithWireRefs -> m SubkeyWithWireRefs
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> SubkeyWithWireRefs -> m SubkeyWithWireRefs
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SubkeyWithWireRefs -> m SubkeyWithWireRefs
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SubkeyWithWireRefs -> m SubkeyWithWireRefs
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SubkeyWithWireRefs -> m SubkeyWithWireRefs
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SubkeyWithWireRefs -> m SubkeyWithWireRefs
Data, SubkeyWithWireRefs -> SubkeyWithWireRefs -> Bool
(SubkeyWithWireRefs -> SubkeyWithWireRefs -> Bool)
-> (SubkeyWithWireRefs -> SubkeyWithWireRefs -> Bool)
-> Eq SubkeyWithWireRefs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SubkeyWithWireRefs -> SubkeyWithWireRefs -> Bool
== :: SubkeyWithWireRefs -> SubkeyWithWireRefs -> Bool
$c/= :: SubkeyWithWireRefs -> SubkeyWithWireRefs -> Bool
/= :: SubkeyWithWireRefs -> SubkeyWithWireRefs -> Bool
Eq, (forall x. SubkeyWithWireRefs -> Rep SubkeyWithWireRefs x)
-> (forall x. Rep SubkeyWithWireRefs x -> SubkeyWithWireRefs)
-> Generic SubkeyWithWireRefs
forall x. Rep SubkeyWithWireRefs x -> SubkeyWithWireRefs
forall x. SubkeyWithWireRefs -> Rep SubkeyWithWireRefs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SubkeyWithWireRefs -> Rep SubkeyWithWireRefs x
from :: forall x. SubkeyWithWireRefs -> Rep SubkeyWithWireRefs x
$cto :: forall x. Rep SubkeyWithWireRefs x -> SubkeyWithWireRefs
to :: forall x. Rep SubkeyWithWireRefs x -> SubkeyWithWireRefs
Generic, Eq SubkeyWithWireRefs
Eq SubkeyWithWireRefs =>
(SubkeyWithWireRefs -> SubkeyWithWireRefs -> Ordering)
-> (SubkeyWithWireRefs -> SubkeyWithWireRefs -> Bool)
-> (SubkeyWithWireRefs -> SubkeyWithWireRefs -> Bool)
-> (SubkeyWithWireRefs -> SubkeyWithWireRefs -> Bool)
-> (SubkeyWithWireRefs -> SubkeyWithWireRefs -> Bool)
-> (SubkeyWithWireRefs -> SubkeyWithWireRefs -> SubkeyWithWireRefs)
-> (SubkeyWithWireRefs -> SubkeyWithWireRefs -> SubkeyWithWireRefs)
-> Ord SubkeyWithWireRefs
SubkeyWithWireRefs -> SubkeyWithWireRefs -> Bool
SubkeyWithWireRefs -> SubkeyWithWireRefs -> Ordering
SubkeyWithWireRefs -> SubkeyWithWireRefs -> SubkeyWithWireRefs
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: SubkeyWithWireRefs -> SubkeyWithWireRefs -> Ordering
compare :: SubkeyWithWireRefs -> SubkeyWithWireRefs -> Ordering
$c< :: SubkeyWithWireRefs -> SubkeyWithWireRefs -> Bool
< :: SubkeyWithWireRefs -> SubkeyWithWireRefs -> Bool
$c<= :: SubkeyWithWireRefs -> SubkeyWithWireRefs -> Bool
<= :: SubkeyWithWireRefs -> SubkeyWithWireRefs -> Bool
$c> :: SubkeyWithWireRefs -> SubkeyWithWireRefs -> Bool
> :: SubkeyWithWireRefs -> SubkeyWithWireRefs -> Bool
$c>= :: SubkeyWithWireRefs -> SubkeyWithWireRefs -> Bool
>= :: SubkeyWithWireRefs -> SubkeyWithWireRefs -> Bool
$cmax :: SubkeyWithWireRefs -> SubkeyWithWireRefs -> SubkeyWithWireRefs
max :: SubkeyWithWireRefs -> SubkeyWithWireRefs -> SubkeyWithWireRefs
$cmin :: SubkeyWithWireRefs -> SubkeyWithWireRefs -> SubkeyWithWireRefs
min :: SubkeyWithWireRefs -> SubkeyWithWireRefs -> SubkeyWithWireRefs
Ord, Int -> SubkeyWithWireRefs -> ShowS
[SubkeyWithWireRefs] -> ShowS
SubkeyWithWireRefs -> String
(Int -> SubkeyWithWireRefs -> ShowS)
-> (SubkeyWithWireRefs -> String)
-> ([SubkeyWithWireRefs] -> ShowS)
-> Show SubkeyWithWireRefs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SubkeyWithWireRefs -> ShowS
showsPrec :: Int -> SubkeyWithWireRefs -> ShowS
$cshow :: SubkeyWithWireRefs -> String
show :: SubkeyWithWireRefs -> String
$cshowList :: [SubkeyWithWireRefs] -> ShowS
showList :: [SubkeyWithWireRefs] -> ShowS
Show, Typeable)

data TKStructuredWithWireRep
    = TKStructuredWithWireRep
    { TKStructuredWithWireRep -> WireRepRefs
_tkStructuredWireRepRefs :: WireRepRefs
    , TKStructuredWithWireRep -> Maybe ByteRange
_tkStructuredWireRepRange :: Maybe ByteRange
    , TKStructuredWithWireRep -> (SomePKPayload, Maybe SKAddendum)
_tkStructuredPrimaryKey :: (SomePKPayload, Maybe SKAddendum)
    , TKStructuredWithWireRep -> PacketRefId
_tkStructuredPrimaryKeyRef :: PacketRefId
    , TKStructuredWithWireRep -> [SignatureWithWireRef]
_tkStructuredDirectSignatures :: [SignatureWithWireRef]
    , TKStructuredWithWireRep -> [UIDWithWireRefs]
_tkStructuredUIDs :: [UIDWithWireRefs]
    , TKStructuredWithWireRep -> [UATWithWireRefs]
_tkStructuredUAts :: [UATWithWireRefs]
    , TKStructuredWithWireRep -> [SubkeyWithWireRefs]
_tkStructuredSubkeys :: [SubkeyWithWireRefs]
    , TKStructuredWithWireRep -> [PktWithWireRep]
_tkStructuredPacketRefs :: [PktWithWireRep]
    }
    deriving (Typeable TKStructuredWithWireRep
Typeable TKStructuredWithWireRep =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g)
 -> TKStructuredWithWireRep
 -> c TKStructuredWithWireRep)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c TKStructuredWithWireRep)
-> (TKStructuredWithWireRep -> Constr)
-> (TKStructuredWithWireRep -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c TKStructuredWithWireRep))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c TKStructuredWithWireRep))
-> ((forall b. Data b => b -> b)
    -> TKStructuredWithWireRep -> TKStructuredWithWireRep)
-> (forall r r'.
    (r -> r' -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> TKStructuredWithWireRep
    -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> TKStructuredWithWireRep
    -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> TKStructuredWithWireRep -> [u])
-> (forall u.
    Int
    -> (forall d. Data d => d -> u) -> TKStructuredWithWireRep -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> TKStructuredWithWireRep -> m TKStructuredWithWireRep)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> TKStructuredWithWireRep -> m TKStructuredWithWireRep)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> TKStructuredWithWireRep -> m TKStructuredWithWireRep)
-> Data TKStructuredWithWireRep
TKStructuredWithWireRep -> Constr
TKStructuredWithWireRep -> DataType
(forall b. Data b => b -> b)
-> TKStructuredWithWireRep -> TKStructuredWithWireRep
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> TKStructuredWithWireRep -> u
forall u.
(forall d. Data d => d -> u) -> TKStructuredWithWireRep -> [u]
forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> TKStructuredWithWireRep
-> r
forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> TKStructuredWithWireRep
-> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> TKStructuredWithWireRep -> m TKStructuredWithWireRep
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> TKStructuredWithWireRep -> m TKStructuredWithWireRep
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TKStructuredWithWireRep
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> TKStructuredWithWireRep
-> c TKStructuredWithWireRep
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TKStructuredWithWireRep)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c TKStructuredWithWireRep)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> TKStructuredWithWireRep
-> c TKStructuredWithWireRep
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> TKStructuredWithWireRep
-> c TKStructuredWithWireRep
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TKStructuredWithWireRep
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TKStructuredWithWireRep
$ctoConstr :: TKStructuredWithWireRep -> Constr
toConstr :: TKStructuredWithWireRep -> Constr
$cdataTypeOf :: TKStructuredWithWireRep -> DataType
dataTypeOf :: TKStructuredWithWireRep -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TKStructuredWithWireRep)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TKStructuredWithWireRep)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c TKStructuredWithWireRep)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c TKStructuredWithWireRep)
$cgmapT :: (forall b. Data b => b -> b)
-> TKStructuredWithWireRep -> TKStructuredWithWireRep
gmapT :: (forall b. Data b => b -> b)
-> TKStructuredWithWireRep -> TKStructuredWithWireRep
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> TKStructuredWithWireRep
-> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> TKStructuredWithWireRep
-> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> TKStructuredWithWireRep
-> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> TKStructuredWithWireRep
-> r
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> TKStructuredWithWireRep -> [u]
gmapQ :: forall u.
(forall d. Data d => d -> u) -> TKStructuredWithWireRep -> [u]
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> TKStructuredWithWireRep -> u
gmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> TKStructuredWithWireRep -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> TKStructuredWithWireRep -> m TKStructuredWithWireRep
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> TKStructuredWithWireRep -> m TKStructuredWithWireRep
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> TKStructuredWithWireRep -> m TKStructuredWithWireRep
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> TKStructuredWithWireRep -> m TKStructuredWithWireRep
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> TKStructuredWithWireRep -> m TKStructuredWithWireRep
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> TKStructuredWithWireRep -> m TKStructuredWithWireRep
Data, TKStructuredWithWireRep -> TKStructuredWithWireRep -> Bool
(TKStructuredWithWireRep -> TKStructuredWithWireRep -> Bool)
-> (TKStructuredWithWireRep -> TKStructuredWithWireRep -> Bool)
-> Eq TKStructuredWithWireRep
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TKStructuredWithWireRep -> TKStructuredWithWireRep -> Bool
== :: TKStructuredWithWireRep -> TKStructuredWithWireRep -> Bool
$c/= :: TKStructuredWithWireRep -> TKStructuredWithWireRep -> Bool
/= :: TKStructuredWithWireRep -> TKStructuredWithWireRep -> Bool
Eq, (forall x.
 TKStructuredWithWireRep -> Rep TKStructuredWithWireRep x)
-> (forall x.
    Rep TKStructuredWithWireRep x -> TKStructuredWithWireRep)
-> Generic TKStructuredWithWireRep
forall x. Rep TKStructuredWithWireRep x -> TKStructuredWithWireRep
forall x. TKStructuredWithWireRep -> Rep TKStructuredWithWireRep x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TKStructuredWithWireRep -> Rep TKStructuredWithWireRep x
from :: forall x. TKStructuredWithWireRep -> Rep TKStructuredWithWireRep x
$cto :: forall x. Rep TKStructuredWithWireRep x -> TKStructuredWithWireRep
to :: forall x. Rep TKStructuredWithWireRep x -> TKStructuredWithWireRep
Generic, Eq TKStructuredWithWireRep
Eq TKStructuredWithWireRep =>
(TKStructuredWithWireRep -> TKStructuredWithWireRep -> Ordering)
-> (TKStructuredWithWireRep -> TKStructuredWithWireRep -> Bool)
-> (TKStructuredWithWireRep -> TKStructuredWithWireRep -> Bool)
-> (TKStructuredWithWireRep -> TKStructuredWithWireRep -> Bool)
-> (TKStructuredWithWireRep -> TKStructuredWithWireRep -> Bool)
-> (TKStructuredWithWireRep
    -> TKStructuredWithWireRep -> TKStructuredWithWireRep)
-> (TKStructuredWithWireRep
    -> TKStructuredWithWireRep -> TKStructuredWithWireRep)
-> Ord TKStructuredWithWireRep
TKStructuredWithWireRep -> TKStructuredWithWireRep -> Bool
TKStructuredWithWireRep -> TKStructuredWithWireRep -> Ordering
TKStructuredWithWireRep
-> TKStructuredWithWireRep -> TKStructuredWithWireRep
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: TKStructuredWithWireRep -> TKStructuredWithWireRep -> Ordering
compare :: TKStructuredWithWireRep -> TKStructuredWithWireRep -> Ordering
$c< :: TKStructuredWithWireRep -> TKStructuredWithWireRep -> Bool
< :: TKStructuredWithWireRep -> TKStructuredWithWireRep -> Bool
$c<= :: TKStructuredWithWireRep -> TKStructuredWithWireRep -> Bool
<= :: TKStructuredWithWireRep -> TKStructuredWithWireRep -> Bool
$c> :: TKStructuredWithWireRep -> TKStructuredWithWireRep -> Bool
> :: TKStructuredWithWireRep -> TKStructuredWithWireRep -> Bool
$c>= :: TKStructuredWithWireRep -> TKStructuredWithWireRep -> Bool
>= :: TKStructuredWithWireRep -> TKStructuredWithWireRep -> Bool
$cmax :: TKStructuredWithWireRep
-> TKStructuredWithWireRep -> TKStructuredWithWireRep
max :: TKStructuredWithWireRep
-> TKStructuredWithWireRep -> TKStructuredWithWireRep
$cmin :: TKStructuredWithWireRep
-> TKStructuredWithWireRep -> TKStructuredWithWireRep
min :: TKStructuredWithWireRep
-> TKStructuredWithWireRep -> TKStructuredWithWireRep
Ord, Int -> TKStructuredWithWireRep -> ShowS
[TKStructuredWithWireRep] -> ShowS
TKStructuredWithWireRep -> String
(Int -> TKStructuredWithWireRep -> ShowS)
-> (TKStructuredWithWireRep -> String)
-> ([TKStructuredWithWireRep] -> ShowS)
-> Show TKStructuredWithWireRep
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TKStructuredWithWireRep -> ShowS
showsPrec :: Int -> TKStructuredWithWireRep -> ShowS
$cshow :: TKStructuredWithWireRep -> String
show :: TKStructuredWithWireRep -> String
$cshowList :: [TKStructuredWithWireRep] -> ShowS
showList :: [TKStructuredWithWireRep] -> ShowS
Show, Typeable)

data CanonicalizeTKWithWireRepError
    = CanonicalizeStructuringError String
    | CanonicalizeMissingPacketRef PacketRefId
    deriving (Typeable CanonicalizeTKWithWireRepError
Typeable CanonicalizeTKWithWireRepError =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g)
 -> CanonicalizeTKWithWireRepError
 -> c CanonicalizeTKWithWireRepError)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r)
    -> Constr
    -> c CanonicalizeTKWithWireRepError)
-> (CanonicalizeTKWithWireRepError -> Constr)
-> (CanonicalizeTKWithWireRepError -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d))
    -> Maybe (c CanonicalizeTKWithWireRepError))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c CanonicalizeTKWithWireRepError))
-> ((forall b. Data b => b -> b)
    -> CanonicalizeTKWithWireRepError
    -> CanonicalizeTKWithWireRepError)
-> (forall r r'.
    (r -> r' -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> CanonicalizeTKWithWireRepError
    -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> CanonicalizeTKWithWireRepError
    -> r)
-> (forall u.
    (forall d. Data d => d -> u)
    -> CanonicalizeTKWithWireRepError -> [u])
-> (forall u.
    Int
    -> (forall d. Data d => d -> u)
    -> CanonicalizeTKWithWireRepError
    -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> CanonicalizeTKWithWireRepError
    -> m CanonicalizeTKWithWireRepError)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> CanonicalizeTKWithWireRepError
    -> m CanonicalizeTKWithWireRepError)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> CanonicalizeTKWithWireRepError
    -> m CanonicalizeTKWithWireRepError)
-> Data CanonicalizeTKWithWireRepError
CanonicalizeTKWithWireRepError -> Constr
CanonicalizeTKWithWireRepError -> DataType
(forall b. Data b => b -> b)
-> CanonicalizeTKWithWireRepError -> CanonicalizeTKWithWireRepError
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int
-> (forall d. Data d => d -> u)
-> CanonicalizeTKWithWireRepError
-> u
forall u.
(forall d. Data d => d -> u)
-> CanonicalizeTKWithWireRepError -> [u]
forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> CanonicalizeTKWithWireRepError
-> r
forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> CanonicalizeTKWithWireRepError
-> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> CanonicalizeTKWithWireRepError
-> m CanonicalizeTKWithWireRepError
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CanonicalizeTKWithWireRepError
-> m CanonicalizeTKWithWireRepError
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c CanonicalizeTKWithWireRepError
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> CanonicalizeTKWithWireRepError
-> c CanonicalizeTKWithWireRepError
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d))
-> Maybe (c CanonicalizeTKWithWireRepError)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CanonicalizeTKWithWireRepError)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> CanonicalizeTKWithWireRepError
-> c CanonicalizeTKWithWireRepError
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> CanonicalizeTKWithWireRepError
-> c CanonicalizeTKWithWireRepError
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c CanonicalizeTKWithWireRepError
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c CanonicalizeTKWithWireRepError
$ctoConstr :: CanonicalizeTKWithWireRepError -> Constr
toConstr :: CanonicalizeTKWithWireRepError -> Constr
$cdataTypeOf :: CanonicalizeTKWithWireRepError -> DataType
dataTypeOf :: CanonicalizeTKWithWireRepError -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d))
-> Maybe (c CanonicalizeTKWithWireRepError)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d))
-> Maybe (c CanonicalizeTKWithWireRepError)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CanonicalizeTKWithWireRepError)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CanonicalizeTKWithWireRepError)
$cgmapT :: (forall b. Data b => b -> b)
-> CanonicalizeTKWithWireRepError -> CanonicalizeTKWithWireRepError
gmapT :: (forall b. Data b => b -> b)
-> CanonicalizeTKWithWireRepError -> CanonicalizeTKWithWireRepError
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> CanonicalizeTKWithWireRepError
-> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> CanonicalizeTKWithWireRepError
-> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> CanonicalizeTKWithWireRepError
-> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> CanonicalizeTKWithWireRepError
-> r
$cgmapQ :: forall u.
(forall d. Data d => d -> u)
-> CanonicalizeTKWithWireRepError -> [u]
gmapQ :: forall u.
(forall d. Data d => d -> u)
-> CanonicalizeTKWithWireRepError -> [u]
$cgmapQi :: forall u.
Int
-> (forall d. Data d => d -> u)
-> CanonicalizeTKWithWireRepError
-> u
gmapQi :: forall u.
Int
-> (forall d. Data d => d -> u)
-> CanonicalizeTKWithWireRepError
-> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> CanonicalizeTKWithWireRepError
-> m CanonicalizeTKWithWireRepError
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> CanonicalizeTKWithWireRepError
-> m CanonicalizeTKWithWireRepError
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CanonicalizeTKWithWireRepError
-> m CanonicalizeTKWithWireRepError
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CanonicalizeTKWithWireRepError
-> m CanonicalizeTKWithWireRepError
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CanonicalizeTKWithWireRepError
-> m CanonicalizeTKWithWireRepError
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CanonicalizeTKWithWireRepError
-> m CanonicalizeTKWithWireRepError
Data, CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> Bool
(CanonicalizeTKWithWireRepError
 -> CanonicalizeTKWithWireRepError -> Bool)
-> (CanonicalizeTKWithWireRepError
    -> CanonicalizeTKWithWireRepError -> Bool)
-> Eq CanonicalizeTKWithWireRepError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> Bool
== :: CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> Bool
$c/= :: CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> Bool
/= :: CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> Bool
Eq, (forall x.
 CanonicalizeTKWithWireRepError
 -> Rep CanonicalizeTKWithWireRepError x)
-> (forall x.
    Rep CanonicalizeTKWithWireRepError x
    -> CanonicalizeTKWithWireRepError)
-> Generic CanonicalizeTKWithWireRepError
forall x.
Rep CanonicalizeTKWithWireRepError x
-> CanonicalizeTKWithWireRepError
forall x.
CanonicalizeTKWithWireRepError
-> Rep CanonicalizeTKWithWireRepError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
CanonicalizeTKWithWireRepError
-> Rep CanonicalizeTKWithWireRepError x
from :: forall x.
CanonicalizeTKWithWireRepError
-> Rep CanonicalizeTKWithWireRepError x
$cto :: forall x.
Rep CanonicalizeTKWithWireRepError x
-> CanonicalizeTKWithWireRepError
to :: forall x.
Rep CanonicalizeTKWithWireRepError x
-> CanonicalizeTKWithWireRepError
Generic, Eq CanonicalizeTKWithWireRepError
Eq CanonicalizeTKWithWireRepError =>
(CanonicalizeTKWithWireRepError
 -> CanonicalizeTKWithWireRepError -> Ordering)
-> (CanonicalizeTKWithWireRepError
    -> CanonicalizeTKWithWireRepError -> Bool)
-> (CanonicalizeTKWithWireRepError
    -> CanonicalizeTKWithWireRepError -> Bool)
-> (CanonicalizeTKWithWireRepError
    -> CanonicalizeTKWithWireRepError -> Bool)
-> (CanonicalizeTKWithWireRepError
    -> CanonicalizeTKWithWireRepError -> Bool)
-> (CanonicalizeTKWithWireRepError
    -> CanonicalizeTKWithWireRepError
    -> CanonicalizeTKWithWireRepError)
-> (CanonicalizeTKWithWireRepError
    -> CanonicalizeTKWithWireRepError
    -> CanonicalizeTKWithWireRepError)
-> Ord CanonicalizeTKWithWireRepError
CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> Bool
CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> Ordering
CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> CanonicalizeTKWithWireRepError
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> Ordering
compare :: CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> Ordering
$c< :: CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> Bool
< :: CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> Bool
$c<= :: CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> Bool
<= :: CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> Bool
$c> :: CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> Bool
> :: CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> Bool
$c>= :: CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> Bool
>= :: CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> Bool
$cmax :: CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> CanonicalizeTKWithWireRepError
max :: CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> CanonicalizeTKWithWireRepError
$cmin :: CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> CanonicalizeTKWithWireRepError
min :: CanonicalizeTKWithWireRepError
-> CanonicalizeTKWithWireRepError -> CanonicalizeTKWithWireRepError
Ord, Int -> CanonicalizeTKWithWireRepError -> ShowS
[CanonicalizeTKWithWireRepError] -> ShowS
CanonicalizeTKWithWireRepError -> String
(Int -> CanonicalizeTKWithWireRepError -> ShowS)
-> (CanonicalizeTKWithWireRepError -> String)
-> ([CanonicalizeTKWithWireRepError] -> ShowS)
-> Show CanonicalizeTKWithWireRepError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CanonicalizeTKWithWireRepError -> ShowS
showsPrec :: Int -> CanonicalizeTKWithWireRepError -> ShowS
$cshow :: CanonicalizeTKWithWireRepError -> String
show :: CanonicalizeTKWithWireRepError -> String
$cshowList :: [CanonicalizeTKWithWireRepError] -> ShowS
showList :: [CanonicalizeTKWithWireRepError] -> ShowS
Show, Typeable)

instance Ord TKUnknown where
    -- TKUnknown ordering is identity-oriented: the primary key packet defines key identity,
    -- while revocations, UIDs, and subkeys are mergeable metadata.
    compare :: TKUnknown -> TKUnknown -> Ordering
compare = (TKUnknown -> (SomePKPayload, Maybe SKAddendum))
-> TKUnknown -> TKUnknown -> Ordering
forall a b. Ord a => (b -> a) -> b -> b -> Ordering
comparing TKUnknown -> (SomePKPayload, Maybe SKAddendum)
_tkuKey

wireRepOfTK :: TKWithWireRep -> WireRepRef
wireRepOfTK :: TKWithWireRep -> WireRepRef
wireRepOfTK = WireRepRefs -> WireRepRef
forall a. NonEmpty a -> a
NE.head (WireRepRefs -> WireRepRef)
-> (TKWithWireRep -> WireRepRefs) -> TKWithWireRep -> WireRepRef
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TKWithWireRep -> WireRepRefs
_tkWireRepRefs

wireRepsOfTK :: TKWithWireRep -> WireRepRefs
wireRepsOfTK :: TKWithWireRep -> WireRepRefs
wireRepsOfTK = TKWithWireRep -> WireRepRefs
_tkWireRepRefs

packetRefsOfTK :: TKWithWireRep -> [PktWithWireRep]
packetRefsOfTK :: TKWithWireRep -> [PktWithWireRep]
packetRefsOfTK = TKWithWireRep -> [PktWithWireRep]
_tkPackets

packetRefIdOf :: PktWithWireRep -> PacketRefId
packetRefIdOf :: PktWithWireRep -> PacketRefId
packetRefIdOf PktWithWireRep
pkt = WireRepRef -> Int -> PacketRefId
PacketRefId (PktWithWireRep -> WireRepRef
_pktWireRepRef PktWithWireRep
pkt) (PktWithWireRep -> Int
_pktIndex PktWithWireRep
pkt)

lookupPacketRef
    :: TKStructuredWithWireRep -> PacketRefId -> Maybe PktWithWireRep
lookupPacketRef :: TKStructuredWithWireRep -> PacketRefId -> Maybe PktWithWireRep
lookupPacketRef TKStructuredWithWireRep
structured PacketRefId
target =
    (PktWithWireRep -> Bool)
-> [PktWithWireRep] -> Maybe PktWithWireRep
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Maybe a
find
        ((PacketRefId -> PacketRefId -> Bool
forall a. Eq a => a -> a -> Bool
== PacketRefId
target) (PacketRefId -> Bool)
-> (PktWithWireRep -> PacketRefId) -> PktWithWireRep -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PktWithWireRep -> PacketRefId
packetRefIdOf)
        (TKStructuredWithWireRep -> [PktWithWireRep]
_tkStructuredPacketRefs TKStructuredWithWireRep
structured)

packetWireBytesForRef
    :: TKStructuredWithWireRep
    -> PacketRefId
    -> Either CanonicalizeTKWithWireRepError BL.ByteString
packetWireBytesForRef :: TKStructuredWithWireRep
-> PacketRefId -> Either CanonicalizeTKWithWireRepError ByteString
packetWireBytesForRef TKStructuredWithWireRep
structured PacketRefId
refId =
    case TKStructuredWithWireRep -> PacketRefId -> Maybe PktWithWireRep
lookupPacketRef TKStructuredWithWireRep
structured PacketRefId
refId of
        Just PktWithWireRep
pkt -> ByteString -> Either CanonicalizeTKWithWireRepError ByteString
forall a b. b -> Either a b
Right (PktWithWireRep
pkt PktWithWireRep
-> Getting ByteString PktWithWireRep ByteString -> ByteString
forall s a. s -> Getting a s a -> a
^. (PktWithBytes -> Const ByteString PktWithBytes)
-> PktWithWireRep -> Const ByteString PktWithWireRep
Lens' PktWithWireRep PktWithBytes
pktWireRep ((PktWithBytes -> Const ByteString PktWithBytes)
 -> PktWithWireRep -> Const ByteString PktWithWireRep)
-> ((ByteString -> Const ByteString ByteString)
    -> PktWithBytes -> Const ByteString PktWithBytes)
-> Getting ByteString PktWithWireRep ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ByteString -> Const ByteString ByteString)
-> PktWithBytes -> Const ByteString PktWithBytes
Lens' PktWithBytes ByteString
pktRaw)
        Maybe PktWithWireRep
Nothing -> CanonicalizeTKWithWireRepError
-> Either CanonicalizeTKWithWireRepError ByteString
forall a b. a -> Either a b
Left (PacketRefId -> CanonicalizeTKWithWireRepError
CanonicalizeMissingPacketRef PacketRefId
refId)

signatureWireSortKey
    :: TKStructuredWithWireRep
    -> SignatureWithWireRef
    -> Either
        CanonicalizeTKWithWireRepError
        (BL.ByteString, PacketRefId)
signatureWireSortKey :: TKStructuredWithWireRep
-> SignatureWithWireRef
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
signatureWireSortKey TKStructuredWithWireRep
structured SignatureWithWireRef
sig =
    (\ByteString
raw -> (ByteString
raw, SignatureWithWireRef -> PacketRefId
_signatureWithWireRefRef SignatureWithWireRef
sig))
        (ByteString -> (ByteString, PacketRefId))
-> Either CanonicalizeTKWithWireRepError ByteString
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TKStructuredWithWireRep
-> PacketRefId -> Either CanonicalizeTKWithWireRepError ByteString
packetWireBytesForRef TKStructuredWithWireRep
structured (SignatureWithWireRef -> PacketRefId
_signatureWithWireRefRef SignatureWithWireRef
sig)

uidWireSortKey
    :: TKStructuredWithWireRep
    -> UIDWithWireRefs
    -> Either
        CanonicalizeTKWithWireRepError
        (BL.ByteString, PacketRefId)
uidWireSortKey :: TKStructuredWithWireRep
-> UIDWithWireRefs
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
uidWireSortKey TKStructuredWithWireRep
structured UIDWithWireRefs
uid =
    (\ByteString
raw -> (ByteString
raw, UIDWithWireRefs -> PacketRefId
_uidWithWireRefsRef UIDWithWireRefs
uid))
        (ByteString -> (ByteString, PacketRefId))
-> Either CanonicalizeTKWithWireRepError ByteString
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TKStructuredWithWireRep
-> PacketRefId -> Either CanonicalizeTKWithWireRepError ByteString
packetWireBytesForRef TKStructuredWithWireRep
structured (UIDWithWireRefs -> PacketRefId
_uidWithWireRefsRef UIDWithWireRefs
uid)

uatWireSortKey
    :: TKStructuredWithWireRep
    -> UATWithWireRefs
    -> Either
        CanonicalizeTKWithWireRepError
        (BL.ByteString, PacketRefId)
uatWireSortKey :: TKStructuredWithWireRep
-> UATWithWireRefs
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
uatWireSortKey TKStructuredWithWireRep
structured UATWithWireRefs
uat =
    (\ByteString
raw -> (ByteString
raw, UATWithWireRefs -> PacketRefId
_uatWithWireRefsRef UATWithWireRefs
uat))
        (ByteString -> (ByteString, PacketRefId))
-> Either CanonicalizeTKWithWireRepError ByteString
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TKStructuredWithWireRep
-> PacketRefId -> Either CanonicalizeTKWithWireRepError ByteString
packetWireBytesForRef TKStructuredWithWireRep
structured (UATWithWireRefs -> PacketRefId
_uatWithWireRefsRef UATWithWireRefs
uat)

subkeyWireSortKey
    :: TKStructuredWithWireRep
    -> SubkeyWithWireRefs
    -> Either
        CanonicalizeTKWithWireRepError
        (BL.ByteString, PacketRefId)
subkeyWireSortKey :: TKStructuredWithWireRep
-> SubkeyWithWireRefs
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
subkeyWireSortKey TKStructuredWithWireRep
structured SubkeyWithWireRefs
sub =
    (\ByteString
raw -> (ByteString
raw, SubkeyWithWireRefs -> PacketRefId
_subkeyWithWireRefsRef SubkeyWithWireRefs
sub))
        (ByteString -> (ByteString, PacketRefId))
-> Either CanonicalizeTKWithWireRepError ByteString
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TKStructuredWithWireRep
-> PacketRefId -> Either CanonicalizeTKWithWireRepError ByteString
packetWireBytesForRef TKStructuredWithWireRep
structured (SubkeyWithWireRefs -> PacketRefId
_subkeyWithWireRefsRef SubkeyWithWireRefs
sub)

compareSignatureWithWireRefCanonical
    :: TKStructuredWithWireRep
    -> SignatureWithWireRef
    -> SignatureWithWireRef
    -> Either CanonicalizeTKWithWireRepError Ordering
compareSignatureWithWireRefCanonical :: TKStructuredWithWireRep
-> SignatureWithWireRef
-> SignatureWithWireRef
-> Either CanonicalizeTKWithWireRepError Ordering
compareSignatureWithWireRefCanonical TKStructuredWithWireRep
structured SignatureWithWireRef
a SignatureWithWireRef
b =
    (ByteString, PacketRefId) -> (ByteString, PacketRefId) -> Ordering
forall a. Ord a => a -> a -> Ordering
compare
        ((ByteString, PacketRefId)
 -> (ByteString, PacketRefId) -> Ordering)
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
-> Either
     CanonicalizeTKWithWireRepError
     ((ByteString, PacketRefId) -> Ordering)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TKStructuredWithWireRep
-> SignatureWithWireRef
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
signatureWireSortKey TKStructuredWithWireRep
structured SignatureWithWireRef
a
        Either
  CanonicalizeTKWithWireRepError
  ((ByteString, PacketRefId) -> Ordering)
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
-> Either CanonicalizeTKWithWireRepError Ordering
forall a b.
Either CanonicalizeTKWithWireRepError (a -> b)
-> Either CanonicalizeTKWithWireRepError a
-> Either CanonicalizeTKWithWireRepError b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> TKStructuredWithWireRep
-> SignatureWithWireRef
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
signatureWireSortKey TKStructuredWithWireRep
structured SignatureWithWireRef
b

compareUIDWithWireRefsCanonical
    :: TKStructuredWithWireRep
    -> UIDWithWireRefs
    -> UIDWithWireRefs
    -> Either CanonicalizeTKWithWireRepError Ordering
compareUIDWithWireRefsCanonical :: TKStructuredWithWireRep
-> UIDWithWireRefs
-> UIDWithWireRefs
-> Either CanonicalizeTKWithWireRepError Ordering
compareUIDWithWireRefsCanonical TKStructuredWithWireRep
structured UIDWithWireRefs
a UIDWithWireRefs
b =
    (ByteString, PacketRefId) -> (ByteString, PacketRefId) -> Ordering
forall a. Ord a => a -> a -> Ordering
compare
        ((ByteString, PacketRefId)
 -> (ByteString, PacketRefId) -> Ordering)
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
-> Either
     CanonicalizeTKWithWireRepError
     ((ByteString, PacketRefId) -> Ordering)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TKStructuredWithWireRep
-> UIDWithWireRefs
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
uidWireSortKey TKStructuredWithWireRep
structured UIDWithWireRefs
a
        Either
  CanonicalizeTKWithWireRepError
  ((ByteString, PacketRefId) -> Ordering)
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
-> Either CanonicalizeTKWithWireRepError Ordering
forall a b.
Either CanonicalizeTKWithWireRepError (a -> b)
-> Either CanonicalizeTKWithWireRepError a
-> Either CanonicalizeTKWithWireRepError b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> TKStructuredWithWireRep
-> UIDWithWireRefs
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
uidWireSortKey TKStructuredWithWireRep
structured UIDWithWireRefs
b

compareUATWithWireRefsCanonical
    :: TKStructuredWithWireRep
    -> UATWithWireRefs
    -> UATWithWireRefs
    -> Either CanonicalizeTKWithWireRepError Ordering
compareUATWithWireRefsCanonical :: TKStructuredWithWireRep
-> UATWithWireRefs
-> UATWithWireRefs
-> Either CanonicalizeTKWithWireRepError Ordering
compareUATWithWireRefsCanonical TKStructuredWithWireRep
structured UATWithWireRefs
a UATWithWireRefs
b =
    (ByteString, PacketRefId) -> (ByteString, PacketRefId) -> Ordering
forall a. Ord a => a -> a -> Ordering
compare
        ((ByteString, PacketRefId)
 -> (ByteString, PacketRefId) -> Ordering)
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
-> Either
     CanonicalizeTKWithWireRepError
     ((ByteString, PacketRefId) -> Ordering)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TKStructuredWithWireRep
-> UATWithWireRefs
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
uatWireSortKey TKStructuredWithWireRep
structured UATWithWireRefs
a
        Either
  CanonicalizeTKWithWireRepError
  ((ByteString, PacketRefId) -> Ordering)
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
-> Either CanonicalizeTKWithWireRepError Ordering
forall a b.
Either CanonicalizeTKWithWireRepError (a -> b)
-> Either CanonicalizeTKWithWireRepError a
-> Either CanonicalizeTKWithWireRepError b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> TKStructuredWithWireRep
-> UATWithWireRefs
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
uatWireSortKey TKStructuredWithWireRep
structured UATWithWireRefs
b

compareSubkeyWithWireRefsCanonical
    :: TKStructuredWithWireRep
    -> SubkeyWithWireRefs
    -> SubkeyWithWireRefs
    -> Either CanonicalizeTKWithWireRepError Ordering
compareSubkeyWithWireRefsCanonical :: TKStructuredWithWireRep
-> SubkeyWithWireRefs
-> SubkeyWithWireRefs
-> Either CanonicalizeTKWithWireRepError Ordering
compareSubkeyWithWireRefsCanonical TKStructuredWithWireRep
structured SubkeyWithWireRefs
a SubkeyWithWireRefs
b =
    (ByteString, PacketRefId) -> (ByteString, PacketRefId) -> Ordering
forall a. Ord a => a -> a -> Ordering
compare
        ((ByteString, PacketRefId)
 -> (ByteString, PacketRefId) -> Ordering)
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
-> Either
     CanonicalizeTKWithWireRepError
     ((ByteString, PacketRefId) -> Ordering)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TKStructuredWithWireRep
-> SubkeyWithWireRefs
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
subkeyWireSortKey TKStructuredWithWireRep
structured SubkeyWithWireRefs
a
        Either
  CanonicalizeTKWithWireRepError
  ((ByteString, PacketRefId) -> Ordering)
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
-> Either CanonicalizeTKWithWireRepError Ordering
forall a b.
Either CanonicalizeTKWithWireRepError (a -> b)
-> Either CanonicalizeTKWithWireRepError a
-> Either CanonicalizeTKWithWireRepError b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> TKStructuredWithWireRep
-> SubkeyWithWireRefs
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
subkeyWireSortKey TKStructuredWithWireRep
structured SubkeyWithWireRefs
b

sortCanonicalByKey
    :: Ord key
    => (a -> Either CanonicalizeTKWithWireRepError key)
    -> [a]
    -> Either CanonicalizeTKWithWireRepError [a]
sortCanonicalByKey :: forall key a.
Ord key =>
(a -> Either CanonicalizeTKWithWireRepError key)
-> [a] -> Either CanonicalizeTKWithWireRepError [a]
sortCanonicalByKey a -> Either CanonicalizeTKWithWireRepError key
keyFn [a]
xs =
    ((key, a) -> a) -> [(key, a)] -> [a]
forall a b. (a -> b) -> [a] -> [b]
map (key, a) -> a
forall a b. (a, b) -> b
snd ([(key, a)] -> [a])
-> ([(key, a)] -> [(key, a)]) -> [(key, a)] -> [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((key, a) -> key) -> [(key, a)] -> [(key, a)]
forall b a. Ord b => (a -> b) -> [a] -> [a]
sortOn (key, a) -> key
forall a b. (a, b) -> a
fst
        ([(key, a)] -> [a])
-> Either CanonicalizeTKWithWireRepError [(key, a)]
-> Either CanonicalizeTKWithWireRepError [a]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (a -> Either CanonicalizeTKWithWireRepError (key, a))
-> [a] -> Either CanonicalizeTKWithWireRepError [(key, a)]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse (\a
x -> (\key
k -> (key
k, a
x)) (key -> (key, a))
-> Either CanonicalizeTKWithWireRepError key
-> Either CanonicalizeTKWithWireRepError (key, a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> Either CanonicalizeTKWithWireRepError key
keyFn a
x) [a]
xs

sortSignatureWithWireRefsCanonical
    :: TKStructuredWithWireRep
    -> [SignatureWithWireRef]
    -> Either CanonicalizeTKWithWireRepError [SignatureWithWireRef]
sortSignatureWithWireRefsCanonical :: TKStructuredWithWireRep
-> [SignatureWithWireRef]
-> Either CanonicalizeTKWithWireRepError [SignatureWithWireRef]
sortSignatureWithWireRefsCanonical TKStructuredWithWireRep
structured =
    (SignatureWithWireRef
 -> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId))
-> [SignatureWithWireRef]
-> Either CanonicalizeTKWithWireRepError [SignatureWithWireRef]
forall key a.
Ord key =>
(a -> Either CanonicalizeTKWithWireRepError key)
-> [a] -> Either CanonicalizeTKWithWireRepError [a]
sortCanonicalByKey (TKStructuredWithWireRep
-> SignatureWithWireRef
-> Either CanonicalizeTKWithWireRepError (ByteString, PacketRefId)
signatureWireSortKey TKStructuredWithWireRep
structured)

sortUIDWithWireRefsCanonical
    :: TKStructuredWithWireRep
    -> [UIDWithWireRefs]
    -> Either CanonicalizeTKWithWireRepError [UIDWithWireRefs]
sortUIDWithWireRefsCanonical :: TKStructuredWithWireRep
-> [UIDWithWireRefs]
-> Either CanonicalizeTKWithWireRepError [UIDWithWireRefs]
sortUIDWithWireRefsCanonical TKStructuredWithWireRep
structured [UIDWithWireRefs]
uids = do
    normalized <-
        (UIDWithWireRefs
 -> Either CanonicalizeTKWithWireRepError UIDWithWireRefs)
-> [UIDWithWireRefs]
-> Either CanonicalizeTKWithWireRepError [UIDWithWireRefs]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse
            ( \UIDWithWireRefs
uid ->
                (\[SignatureWithWireRef]
sigs -> UIDWithWireRefs
uid {_uidWithWireRefsSignatures = sigs})
                    ([SignatureWithWireRef] -> UIDWithWireRefs)
-> Either CanonicalizeTKWithWireRepError [SignatureWithWireRef]
-> Either CanonicalizeTKWithWireRepError UIDWithWireRefs
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TKStructuredWithWireRep
-> [SignatureWithWireRef]
-> Either CanonicalizeTKWithWireRepError [SignatureWithWireRef]
sortSignatureWithWireRefsCanonical
                        TKStructuredWithWireRep
structured
                        (UIDWithWireRefs -> [SignatureWithWireRef]
_uidWithWireRefsSignatures UIDWithWireRefs
uid)
            )
            [UIDWithWireRefs]
uids
    sortCanonicalByKey (uidWireSortKey structured) normalized

sortUATWithWireRefsCanonical
    :: TKStructuredWithWireRep
    -> [UATWithWireRefs]
    -> Either CanonicalizeTKWithWireRepError [UATWithWireRefs]
sortUATWithWireRefsCanonical :: TKStructuredWithWireRep
-> [UATWithWireRefs]
-> Either CanonicalizeTKWithWireRepError [UATWithWireRefs]
sortUATWithWireRefsCanonical TKStructuredWithWireRep
structured [UATWithWireRefs]
uats = do
    normalized <-
        (UATWithWireRefs
 -> Either CanonicalizeTKWithWireRepError UATWithWireRefs)
-> [UATWithWireRefs]
-> Either CanonicalizeTKWithWireRepError [UATWithWireRefs]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse
            ( \UATWithWireRefs
uat ->
                (\[SignatureWithWireRef]
sigs -> UATWithWireRefs
uat {_uatWithWireRefsSignatures = sigs})
                    ([SignatureWithWireRef] -> UATWithWireRefs)
-> Either CanonicalizeTKWithWireRepError [SignatureWithWireRef]
-> Either CanonicalizeTKWithWireRepError UATWithWireRefs
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TKStructuredWithWireRep
-> [SignatureWithWireRef]
-> Either CanonicalizeTKWithWireRepError [SignatureWithWireRef]
sortSignatureWithWireRefsCanonical
                        TKStructuredWithWireRep
structured
                        (UATWithWireRefs -> [SignatureWithWireRef]
_uatWithWireRefsSignatures UATWithWireRefs
uat)
            )
            [UATWithWireRefs]
uats
    sortCanonicalByKey (uatWireSortKey structured) normalized

sortSubkeyWithWireRefsCanonical
    :: TKStructuredWithWireRep
    -> [SubkeyWithWireRefs]
    -> Either CanonicalizeTKWithWireRepError [SubkeyWithWireRefs]
sortSubkeyWithWireRefsCanonical :: TKStructuredWithWireRep
-> [SubkeyWithWireRefs]
-> Either CanonicalizeTKWithWireRepError [SubkeyWithWireRefs]
sortSubkeyWithWireRefsCanonical TKStructuredWithWireRep
structured [SubkeyWithWireRefs]
subs = do
    normalized <-
        (SubkeyWithWireRefs
 -> Either CanonicalizeTKWithWireRepError SubkeyWithWireRefs)
-> [SubkeyWithWireRefs]
-> Either CanonicalizeTKWithWireRepError [SubkeyWithWireRefs]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse
            ( \SubkeyWithWireRefs
sub ->
                (\[SignatureWithWireRef]
sigs -> SubkeyWithWireRefs
sub {_subkeyWithWireRefsSignatures = sigs})
                    ([SignatureWithWireRef] -> SubkeyWithWireRefs)
-> Either CanonicalizeTKWithWireRepError [SignatureWithWireRef]
-> Either CanonicalizeTKWithWireRepError SubkeyWithWireRefs
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TKStructuredWithWireRep
-> [SignatureWithWireRef]
-> Either CanonicalizeTKWithWireRepError [SignatureWithWireRef]
sortSignatureWithWireRefsCanonical
                        TKStructuredWithWireRep
structured
                        (SubkeyWithWireRefs -> [SignatureWithWireRef]
_subkeyWithWireRefsSignatures SubkeyWithWireRefs
sub)
            )
            [SubkeyWithWireRefs]
subs
    sortCanonicalByKey (subkeyWireSortKey structured) normalized

canonicalizeTKStructuredWithWireRep
    :: TKStructuredWithWireRep
    -> Either CanonicalizeTKWithWireRepError TKUnknown
canonicalizeTKStructuredWithWireRep :: TKStructuredWithWireRep
-> Either CanonicalizeTKWithWireRepError TKUnknown
canonicalizeTKStructuredWithWireRep TKStructuredWithWireRep
structured =
    [SignatureWithWireRef]
-> [UIDWithWireRefs]
-> [UATWithWireRefs]
-> [SubkeyWithWireRefs]
-> TKUnknown
buildTK
        ([SignatureWithWireRef]
 -> [UIDWithWireRefs]
 -> [UATWithWireRefs]
 -> [SubkeyWithWireRefs]
 -> TKUnknown)
-> Either CanonicalizeTKWithWireRepError [SignatureWithWireRef]
-> Either
     CanonicalizeTKWithWireRepError
     ([UIDWithWireRefs]
      -> [UATWithWireRefs] -> [SubkeyWithWireRefs] -> TKUnknown)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TKStructuredWithWireRep
-> [SignatureWithWireRef]
-> Either CanonicalizeTKWithWireRepError [SignatureWithWireRef]
sortSignatureWithWireRefsCanonical
            TKStructuredWithWireRep
structured
            (TKStructuredWithWireRep -> [SignatureWithWireRef]
_tkStructuredDirectSignatures TKStructuredWithWireRep
structured)
        Either
  CanonicalizeTKWithWireRepError
  ([UIDWithWireRefs]
   -> [UATWithWireRefs] -> [SubkeyWithWireRefs] -> TKUnknown)
-> Either CanonicalizeTKWithWireRepError [UIDWithWireRefs]
-> Either
     CanonicalizeTKWithWireRepError
     ([UATWithWireRefs] -> [SubkeyWithWireRefs] -> TKUnknown)
forall a b.
Either CanonicalizeTKWithWireRepError (a -> b)
-> Either CanonicalizeTKWithWireRepError a
-> Either CanonicalizeTKWithWireRepError b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> TKStructuredWithWireRep
-> [UIDWithWireRefs]
-> Either CanonicalizeTKWithWireRepError [UIDWithWireRefs]
sortUIDWithWireRefsCanonical
            TKStructuredWithWireRep
structured
            (TKStructuredWithWireRep -> [UIDWithWireRefs]
_tkStructuredUIDs TKStructuredWithWireRep
structured)
        Either
  CanonicalizeTKWithWireRepError
  ([UATWithWireRefs] -> [SubkeyWithWireRefs] -> TKUnknown)
-> Either CanonicalizeTKWithWireRepError [UATWithWireRefs]
-> Either
     CanonicalizeTKWithWireRepError ([SubkeyWithWireRefs] -> TKUnknown)
forall a b.
Either CanonicalizeTKWithWireRepError (a -> b)
-> Either CanonicalizeTKWithWireRepError a
-> Either CanonicalizeTKWithWireRepError b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> TKStructuredWithWireRep
-> [UATWithWireRefs]
-> Either CanonicalizeTKWithWireRepError [UATWithWireRefs]
sortUATWithWireRefsCanonical
            TKStructuredWithWireRep
structured
            (TKStructuredWithWireRep -> [UATWithWireRefs]
_tkStructuredUAts TKStructuredWithWireRep
structured)
        Either
  CanonicalizeTKWithWireRepError ([SubkeyWithWireRefs] -> TKUnknown)
-> Either CanonicalizeTKWithWireRepError [SubkeyWithWireRefs]
-> Either CanonicalizeTKWithWireRepError TKUnknown
forall a b.
Either CanonicalizeTKWithWireRepError (a -> b)
-> Either CanonicalizeTKWithWireRepError a
-> Either CanonicalizeTKWithWireRepError b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> TKStructuredWithWireRep
-> [SubkeyWithWireRefs]
-> Either CanonicalizeTKWithWireRepError [SubkeyWithWireRefs]
sortSubkeyWithWireRefsCanonical
            TKStructuredWithWireRep
structured
            (TKStructuredWithWireRep -> [SubkeyWithWireRefs]
_tkStructuredSubkeys TKStructuredWithWireRep
structured)
  where
    buildTK :: [SignatureWithWireRef]
-> [UIDWithWireRefs]
-> [UATWithWireRefs]
-> [SubkeyWithWireRefs]
-> TKUnknown
buildTK [SignatureWithWireRef]
directSigs [UIDWithWireRefs]
uids [UATWithWireRefs]
uats [SubkeyWithWireRefs]
subs =
        TKUnknown
            { _tkuKey :: (SomePKPayload, Maybe SKAddendum)
_tkuKey = TKStructuredWithWireRep -> (SomePKPayload, Maybe SKAddendum)
_tkStructuredPrimaryKey TKStructuredWithWireRep
structured
            , _tkuRevs :: [SignaturePayload]
_tkuRevs = (SignatureWithWireRef -> SignaturePayload)
-> [SignatureWithWireRef] -> [SignaturePayload]
forall a b. (a -> b) -> [a] -> [b]
map SignatureWithWireRef -> SignaturePayload
_signatureWithWireRefValue [SignatureWithWireRef]
directSigs
            , _tkuUIDs :: [(Text, [SignaturePayload])]
_tkuUIDs =
                (UIDWithWireRefs -> (Text, [SignaturePayload]))
-> [UIDWithWireRefs] -> [(Text, [SignaturePayload])]
forall a b. (a -> b) -> [a] -> [b]
map
                    ( UIDWithWireRefs -> Text
_uidWithWireRefsValue
                        (UIDWithWireRefs -> Text)
-> (UIDWithWireRefs -> [SignaturePayload])
-> UIDWithWireRefs
-> (Text, [SignaturePayload])
forall b c c'. (b -> c) -> (b -> c') -> b -> (c, c')
forall (a :: * -> * -> *) b c c'.
Arrow a =>
a b c -> a b c' -> a b (c, c')
&&& ((SignatureWithWireRef -> SignaturePayload)
-> [SignatureWithWireRef] -> [SignaturePayload]
forall a b. (a -> b) -> [a] -> [b]
map SignatureWithWireRef -> SignaturePayload
_signatureWithWireRefValue ([SignatureWithWireRef] -> [SignaturePayload])
-> (UIDWithWireRefs -> [SignatureWithWireRef])
-> UIDWithWireRefs
-> [SignaturePayload]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UIDWithWireRefs -> [SignatureWithWireRef]
_uidWithWireRefsSignatures)
                    )
                    [UIDWithWireRefs]
uids
            , _tkuUAts :: [([UserAttrSubPacket], [SignaturePayload])]
_tkuUAts =
                (UATWithWireRefs -> ([UserAttrSubPacket], [SignaturePayload]))
-> [UATWithWireRefs] -> [([UserAttrSubPacket], [SignaturePayload])]
forall a b. (a -> b) -> [a] -> [b]
map
                    ( UATWithWireRefs -> [UserAttrSubPacket]
_uatWithWireRefsValue
                        (UATWithWireRefs -> [UserAttrSubPacket])
-> (UATWithWireRefs -> [SignaturePayload])
-> UATWithWireRefs
-> ([UserAttrSubPacket], [SignaturePayload])
forall b c c'. (b -> c) -> (b -> c') -> b -> (c, c')
forall (a :: * -> * -> *) b c c'.
Arrow a =>
a b c -> a b c' -> a b (c, c')
&&& ((SignatureWithWireRef -> SignaturePayload)
-> [SignatureWithWireRef] -> [SignaturePayload]
forall a b. (a -> b) -> [a] -> [b]
map SignatureWithWireRef -> SignaturePayload
_signatureWithWireRefValue ([SignatureWithWireRef] -> [SignaturePayload])
-> (UATWithWireRefs -> [SignatureWithWireRef])
-> UATWithWireRefs
-> [SignaturePayload]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. UATWithWireRefs -> [SignatureWithWireRef]
_uatWithWireRefsSignatures)
                    )
                    [UATWithWireRefs]
uats
            , _tkuSubs :: [(Pkt, [SignaturePayload])]
_tkuSubs =
                (SubkeyWithWireRefs -> (Pkt, [SignaturePayload]))
-> [SubkeyWithWireRefs] -> [(Pkt, [SignaturePayload])]
forall a b. (a -> b) -> [a] -> [b]
map
                    ( SubkeyWithWireRefs -> Pkt
_subkeyWithWireRefsValue
                        (SubkeyWithWireRefs -> Pkt)
-> (SubkeyWithWireRefs -> [SignaturePayload])
-> SubkeyWithWireRefs
-> (Pkt, [SignaturePayload])
forall b c c'. (b -> c) -> (b -> c') -> b -> (c, c')
forall (a :: * -> * -> *) b c c'.
Arrow a =>
a b c -> a b c' -> a b (c, c')
&&& ((SignatureWithWireRef -> SignaturePayload)
-> [SignatureWithWireRef] -> [SignaturePayload]
forall a b. (a -> b) -> [a] -> [b]
map SignatureWithWireRef -> SignaturePayload
_signatureWithWireRefValue ([SignatureWithWireRef] -> [SignaturePayload])
-> (SubkeyWithWireRefs -> [SignatureWithWireRef])
-> SubkeyWithWireRefs
-> [SignaturePayload]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SubkeyWithWireRefs -> [SignatureWithWireRef]
_subkeyWithWireRefsSignatures)
                    )
                    [SubkeyWithWireRefs]
subs
            }

canonicalizeTKWithWireRep
    :: TKWithWireRep -> Either CanonicalizeTKWithWireRepError TKUnknown
canonicalizeTKWithWireRep :: TKWithWireRep -> Either CanonicalizeTKWithWireRepError TKUnknown
canonicalizeTKWithWireRep TKWithWireRep
tk = do
    structured <-
        case TKWithWireRep -> Either String TKStructuredWithWireRep
toStructuredTKWithWireRep TKWithWireRep
tk of
            Left String
err -> CanonicalizeTKWithWireRepError
-> Either CanonicalizeTKWithWireRepError TKStructuredWithWireRep
forall a b. a -> Either a b
Left (String -> CanonicalizeTKWithWireRepError
CanonicalizeStructuringError String
err)
            Right TKStructuredWithWireRep
s -> TKStructuredWithWireRep
-> Either CanonicalizeTKWithWireRepError TKStructuredWithWireRep
forall a b. b -> Either a b
Right TKStructuredWithWireRep
s
    canonicalizeTKStructuredWithWireRep structured

toStructuredTKWithWireRep
    :: TKWithWireRep -> Either String TKStructuredWithWireRep
toStructuredTKWithWireRep :: TKWithWireRep -> Either String TKStructuredWithWireRep
toStructuredTKWithWireRep TKWithWireRep
tkWithRefs = do
    let tk :: TKUnknown
tk = TKWithWireRep -> TKUnknown
_tkValue TKWithWireRep
tkWithRefs
        refs :: [PktWithWireRep]
refs = TKWithWireRep -> [PktWithWireRep]
_tkPackets TKWithWireRep
tkWithRefs
        (SomePKPayload
pkp, Maybe SKAddendum
mska) = TKUnknown -> (SomePKPayload, Maybe SKAddendum)
_tkuKey TKUnknown
tk
        primaryPkt :: Pkt
primaryPkt = SomeKeyPkt -> Pkt
someKeyPktToPkt (SomePKPayload -> Maybe SKAddendum -> SomeKeyPkt
mkPrimaryKeyPkt SomePKPayload
pkp Maybe SKAddendum
mska)
    zipper <- case [PktWithWireRep] -> Maybe (PacketZipper PktWithWireRep)
forall a. [a] -> Maybe (PacketZipper a)
zFromList [PktWithWireRep]
refs of
        Just PacketZipper PktWithWireRep
z -> PacketZipper PktWithWireRep
-> Either String (PacketZipper PktWithWireRep)
forall a b. b -> Either a b
Right PacketZipper PktWithWireRep
z
        Maybe (PacketZipper PktWithWireRep)
Nothing ->
            String -> Either String (PacketZipper PktWithWireRep)
forall a b. a -> Either a b
Left String
"no packet references available for TKUnknown structuring"
    (primaryRef, z1') <-
        consumePktZ "primary key packet" primaryPkt zipper
    -- Move past the primary key to process its signatures and following packets
    z1 <- case zMoveNext z1' of
        Just PacketZipper PktWithWireRep
z -> PacketZipper PktWithWireRep
-> Either String (PacketZipper PktWithWireRep)
forall a b. b -> Either a b
Right PacketZipper PktWithWireRep
z
        Maybe (PacketZipper PktWithWireRep)
Nothing ->
            -- Primary key is the only packet; only valid if no revisions, UIDs, UATs, or subkeys
            if [SignaturePayload] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (TKUnknown -> [SignaturePayload]
_tkuRevs TKUnknown
tk)
                Bool -> Bool -> Bool
&& [(Text, [SignaturePayload])] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (TKUnknown -> [(Text, [SignaturePayload])]
_tkuUIDs TKUnknown
tk)
                Bool -> Bool -> Bool
&& [([UserAttrSubPacket], [SignaturePayload])] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (TKUnknown -> [([UserAttrSubPacket], [SignaturePayload])]
_tkuUAts TKUnknown
tk)
                Bool -> Bool -> Bool
&& [(Pkt, [SignaturePayload])] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (TKUnknown -> [(Pkt, [SignaturePayload])]
_tkuSubs TKUnknown
tk)
                then PacketZipper PktWithWireRep
-> Either String (PacketZipper PktWithWireRep)
forall a b. b -> Either a b
Right PacketZipper PktWithWireRep
z1'
                else
                    String -> Either String (PacketZipper PktWithWireRep)
forall a b. a -> Either a b
Left String
"missing signatures/UIDs/subkeys after primary key packet"
    (directSigs, z2) <-
        consumeSigsZ "direct-key signatures" (_tkuRevs tk) z1
    (uids, z3) <- consumeUIDsZ (_tkuUIDs tk) z2
    (uats, z4) <- consumeUATsZ (_tkuUAts tk) z3
    (subs, z5) <- consumeSubsZ (_tkuSubs tk) z4
    -- Check if there are trailing packets AFTER the current focus (not including it)
    case _zpAfter z5 of
        [] ->
            TKStructuredWithWireRep -> Either String TKStructuredWithWireRep
forall a b. b -> Either a b
Right
                ( WireRepRefs
-> Maybe ByteRange
-> (SomePKPayload, Maybe SKAddendum)
-> PacketRefId
-> [SignatureWithWireRef]
-> [UIDWithWireRefs]
-> [UATWithWireRefs]
-> [SubkeyWithWireRefs]
-> [PktWithWireRep]
-> TKStructuredWithWireRep
TKStructuredWithWireRep
                    (TKWithWireRep -> WireRepRefs
_tkWireRepRefs TKWithWireRep
tkWithRefs)
                    (TKWithWireRep -> Maybe ByteRange
_tkWireRepRange TKWithWireRep
tkWithRefs)
                    (TKUnknown -> (SomePKPayload, Maybe SKAddendum)
_tkuKey TKUnknown
tk)
                    (PktWithWireRep -> PacketRefId
packetRefIdOf PktWithWireRep
primaryRef)
                    [SignatureWithWireRef]
directSigs
                    [UIDWithWireRefs]
uids
                    [UATWithWireRefs]
uats
                    [SubkeyWithWireRefs]
subs
                    (TKWithWireRep -> [PktWithWireRep]
_tkPackets TKWithWireRep
tkWithRefs)
                )
        (PktWithWireRep
unexpected : [PktWithWireRep]
_) ->
            String -> Either String TKStructuredWithWireRep
forall a b. a -> Either a b
Left
                ( String
"unexpected trailing packet reference at position "
                    String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show (PacketZipper PktWithWireRep -> Int
forall a. PacketZipper a -> Int
zPosition PacketZipper PktWithWireRep
z5 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1)
                    String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" while structuring TKUnknown provenance (tag "
                    String -> ShowS
forall a. [a] -> [a] -> [a]
++ Word8 -> String
forall a. Show a => a -> String
show (Pkt -> Word8
pktTag (PktWithWireRep
unexpected PktWithWireRep -> Getting Pkt PktWithWireRep Pkt -> Pkt
forall s a. s -> Getting a s a -> a
^. (PktWithBytes -> Const Pkt PktWithBytes)
-> PktWithWireRep -> Const Pkt PktWithWireRep
Lens' PktWithWireRep PktWithBytes
pktWireRep ((PktWithBytes -> Const Pkt PktWithBytes)
 -> PktWithWireRep -> Const Pkt PktWithWireRep)
-> ((Pkt -> Const Pkt Pkt)
    -> PktWithBytes -> Const Pkt PktWithBytes)
-> Getting Pkt PktWithWireRep Pkt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Pkt -> Const Pkt Pkt) -> PktWithBytes -> Const Pkt PktWithBytes
Lens' PktWithBytes Pkt
pktValue))
                    String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
")"
                )
  where
    consumePktZ
        :: String
        -> Pkt
        -> PacketZipper PktWithWireRep
        -> Either String (PktWithWireRep, PacketZipper PktWithWireRep)
    consumePktZ :: String
-> Pkt
-> PacketZipper PktWithWireRep
-> Either String (PktWithWireRep, PacketZipper PktWithWireRep)
consumePktZ String
context Pkt
expected PacketZipper PktWithWireRep
z
        | (PacketZipper PktWithWireRep -> PktWithWireRep
forall a. PacketZipper a -> a
forall (w :: * -> *) a. Comonad w => w a -> a
extract PacketZipper PktWithWireRep
z) PktWithWireRep -> Getting Pkt PktWithWireRep Pkt -> Pkt
forall s a. s -> Getting a s a -> a
^. (PktWithBytes -> Const Pkt PktWithBytes)
-> PktWithWireRep -> Const Pkt PktWithWireRep
Lens' PktWithWireRep PktWithBytes
pktWireRep ((PktWithBytes -> Const Pkt PktWithBytes)
 -> PktWithWireRep -> Const Pkt PktWithWireRep)
-> ((Pkt -> Const Pkt Pkt)
    -> PktWithBytes -> Const Pkt PktWithBytes)
-> Getting Pkt PktWithWireRep Pkt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Pkt -> Const Pkt Pkt) -> PktWithBytes -> Const Pkt PktWithBytes
Lens' PktWithBytes Pkt
pktValue Pkt -> Pkt -> Bool
forall a. Eq a => a -> a -> Bool
== Pkt
expected =
            (PktWithWireRep, PacketZipper PktWithWireRep)
-> Either String (PktWithWireRep, PacketZipper PktWithWireRep)
forall a b. b -> Either a b
Right (PacketZipper PktWithWireRep -> PktWithWireRep
forall a. PacketZipper a -> a
forall (w :: * -> *) a. Comonad w => w a -> a
extract PacketZipper PktWithWireRep
z, PacketZipper PktWithWireRep
z)
        | Bool
otherwise =
            String
-> Either String (PktWithWireRep, PacketZipper PktWithWireRep)
forall a b. a -> Either a b
Left
                ( String
"packet/reference mismatch for "
                    String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
context
                    String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" at position "
                    String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show (PacketZipper PktWithWireRep -> Int
forall a. PacketZipper a -> Int
zPosition PacketZipper PktWithWireRep
z)
                    String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
": expected tag "
                    String -> ShowS
forall a. [a] -> [a] -> [a]
++ Word8 -> String
forall a. Show a => a -> String
show (Pkt -> Word8
pktTag Pkt
expected)
                    String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
", got tag "
                    String -> ShowS
forall a. [a] -> [a] -> [a]
++ Word8 -> String
forall a. Show a => a -> String
show (Pkt -> Word8
pktTag ((PacketZipper PktWithWireRep -> PktWithWireRep
forall a. PacketZipper a -> a
forall (w :: * -> *) a. Comonad w => w a -> a
extract PacketZipper PktWithWireRep
z) PktWithWireRep -> Getting Pkt PktWithWireRep Pkt -> Pkt
forall s a. s -> Getting a s a -> a
^. (PktWithBytes -> Const Pkt PktWithBytes)
-> PktWithWireRep -> Const Pkt PktWithWireRep
Lens' PktWithWireRep PktWithBytes
pktWireRep ((PktWithBytes -> Const Pkt PktWithBytes)
 -> PktWithWireRep -> Const Pkt PktWithWireRep)
-> ((Pkt -> Const Pkt Pkt)
    -> PktWithBytes -> Const Pkt PktWithBytes)
-> Getting Pkt PktWithWireRep Pkt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Pkt -> Const Pkt Pkt) -> PktWithBytes -> Const Pkt PktWithBytes
Lens' PktWithBytes Pkt
pktValue))
                )

    tryMoveNext
        :: String
        -> PacketZipper PktWithWireRep
        -> Bool
        -> Either String (PacketZipper PktWithWireRep)
    tryMoveNext :: String
-> PacketZipper PktWithWireRep
-> Bool
-> Either String (PacketZipper PktWithWireRep)
tryMoveNext String
errorPrefix PacketZipper PktWithWireRep
z Bool
isLastItem =
        case PacketZipper PktWithWireRep -> Maybe (PacketZipper PktWithWireRep)
forall a. PacketZipper a -> Maybe (PacketZipper a)
zMoveNext PacketZipper PktWithWireRep
z of
            Just PacketZipper PktWithWireRep
z' -> PacketZipper PktWithWireRep
-> Either String (PacketZipper PktWithWireRep)
forall a b. b -> Either a b
Right PacketZipper PktWithWireRep
z'
            Maybe (PacketZipper PktWithWireRep)
Nothing ->
                if Bool
isLastItem
                    then PacketZipper PktWithWireRep
-> Either String (PacketZipper PktWithWireRep)
forall a b. b -> Either a b
Right PacketZipper PktWithWireRep
z
                    else
                        String -> Either String (PacketZipper PktWithWireRep)
forall a b. a -> Either a b
Left
                            ( String
errorPrefix
                                String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
" at position "
                                String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show (PacketZipper PktWithWireRep -> Int
forall a. PacketZipper a -> Int
zPosition PacketZipper PktWithWireRep
z)
                            )

    consumeSigsZ
        :: String
        -> [SignaturePayload]
        -> PacketZipper PktWithWireRep
        -> Either
            String
            ([SignatureWithWireRef], PacketZipper PktWithWireRep)
    consumeSigsZ :: String
-> [SignaturePayload]
-> PacketZipper PktWithWireRep
-> Either
     String ([SignatureWithWireRef], PacketZipper PktWithWireRep)
consumeSigsZ String
context [SignaturePayload]
sigs PacketZipper PktWithWireRep
z = [SignatureWithWireRef]
-> [SignaturePayload]
-> PacketZipper PktWithWireRep
-> Either
     String ([SignatureWithWireRef], PacketZipper PktWithWireRep)
go [] [SignaturePayload]
sigs PacketZipper PktWithWireRep
z
      where
        go :: [SignatureWithWireRef]
-> [SignaturePayload]
-> PacketZipper PktWithWireRep
-> Either
     String ([SignatureWithWireRef], PacketZipper PktWithWireRep)
go [SignatureWithWireRef]
acc [] PacketZipper PktWithWireRep
zipper = ([SignatureWithWireRef], PacketZipper PktWithWireRep)
-> Either
     String ([SignatureWithWireRef], PacketZipper PktWithWireRep)
forall a b. b -> Either a b
Right ([SignatureWithWireRef] -> [SignatureWithWireRef]
forall a. [a] -> [a]
reverse [SignatureWithWireRef]
acc, PacketZipper PktWithWireRep
zipper)
        go [SignatureWithWireRef]
acc (SignaturePayload
sig : [SignaturePayload]
sigRest) PacketZipper PktWithWireRep
zipper = do
            (sigPkt, z') <- String
-> Pkt
-> PacketZipper PktWithWireRep
-> Either String (PktWithWireRep, PacketZipper PktWithWireRep)
consumePktZ String
context (SignaturePayload -> Pkt
SignaturePkt SignaturePayload
sig) PacketZipper PktWithWireRep
zipper
            z'' <- tryMoveNext "missing signature packet" z' (null sigRest)
            go
                (SignatureWithWireRef sig (packetRefIdOf sigPkt) : acc)
                sigRest
                z''

    consumeUIDsZ
        :: [(Text, [SignaturePayload])]
        -> PacketZipper PktWithWireRep
        -> Either String ([UIDWithWireRefs], PacketZipper PktWithWireRep)
    consumeUIDsZ :: [(Text, [SignaturePayload])]
-> PacketZipper PktWithWireRep
-> Either String ([UIDWithWireRefs], PacketZipper PktWithWireRep)
consumeUIDsZ [] PacketZipper PktWithWireRep
z = ([UIDWithWireRefs], PacketZipper PktWithWireRep)
-> Either String ([UIDWithWireRefs], PacketZipper PktWithWireRep)
forall a b. b -> Either a b
Right ([], PacketZipper PktWithWireRep
z)
    consumeUIDsZ ((Text
uid, [SignaturePayload]
sigs) : [(Text, [SignaturePayload])]
rest) PacketZipper PktWithWireRep
z = do
        (uidPkt, z1) <- String
-> Pkt
-> PacketZipper PktWithWireRep
-> Either String (PktWithWireRep, PacketZipper PktWithWireRep)
consumePktZ String
"UID packet" (Text -> Pkt
UserIdPkt Text
uid) PacketZipper PktWithWireRep
z
        z2 <- tryMoveNext "missing UID" z1 (null rest && null sigs)
        (uidSigs, z3) <- consumeSigsZ "UID signature" sigs z2
        (tailUIDs, z4) <- consumeUIDsZ rest z3
        Right
            ( UIDWithWireRefs uid (packetRefIdOf uidPkt) uidSigs : tailUIDs
            , z4
            )

    consumeUATsZ
        :: [([UserAttrSubPacket], [SignaturePayload])]
        -> PacketZipper PktWithWireRep
        -> Either String ([UATWithWireRefs], PacketZipper PktWithWireRep)
    consumeUATsZ :: [([UserAttrSubPacket], [SignaturePayload])]
-> PacketZipper PktWithWireRep
-> Either String ([UATWithWireRefs], PacketZipper PktWithWireRep)
consumeUATsZ [] PacketZipper PktWithWireRep
z = ([UATWithWireRefs], PacketZipper PktWithWireRep)
-> Either String ([UATWithWireRefs], PacketZipper PktWithWireRep)
forall a b. b -> Either a b
Right ([], PacketZipper PktWithWireRep
z)
    consumeUATsZ (([UserAttrSubPacket]
uat, [SignaturePayload]
sigs) : [([UserAttrSubPacket], [SignaturePayload])]
rest) PacketZipper PktWithWireRep
z = do
        (uatPkt, z1) <- String
-> Pkt
-> PacketZipper PktWithWireRep
-> Either String (PktWithWireRep, PacketZipper PktWithWireRep)
consumePktZ String
"UAT packet" ([UserAttrSubPacket] -> Pkt
UserAttributePkt [UserAttrSubPacket]
uat) PacketZipper PktWithWireRep
z
        z2 <- tryMoveNext "missing UAT" z1 (null rest && null sigs)
        (uatSigs, z3) <- consumeSigsZ "UAT signature" sigs z2
        (tailUats, z4) <- consumeUATsZ rest z3
        Right
            ( UATWithWireRefs uat (packetRefIdOf uatPkt) uatSigs : tailUats
            , z4
            )

    consumeSubsZ
        :: [(Pkt, [SignaturePayload])]
        -> PacketZipper PktWithWireRep
        -> Either String ([SubkeyWithWireRefs], PacketZipper PktWithWireRep)
    consumeSubsZ :: [(Pkt, [SignaturePayload])]
-> PacketZipper PktWithWireRep
-> Either
     String ([SubkeyWithWireRefs], PacketZipper PktWithWireRep)
consumeSubsZ [] PacketZipper PktWithWireRep
z = ([SubkeyWithWireRefs], PacketZipper PktWithWireRep)
-> Either
     String ([SubkeyWithWireRefs], PacketZipper PktWithWireRep)
forall a b. b -> Either a b
Right ([], PacketZipper PktWithWireRep
z)
    consumeSubsZ ((Pkt
subPkt, [SignaturePayload]
sigs) : [(Pkt, [SignaturePayload])]
rest) PacketZipper PktWithWireRep
z = do
        (subRef, z1) <- String
-> Pkt
-> PacketZipper PktWithWireRep
-> Either String (PktWithWireRep, PacketZipper PktWithWireRep)
consumePktZ String
"subkey packet" Pkt
subPkt PacketZipper PktWithWireRep
z
        z2 <- tryMoveNext "missing subkey" z1 (null rest && null sigs)
        (subSigs, z3) <- consumeSigsZ "subkey signature" sigs z2
        (tailSubs, z4) <- consumeSubsZ rest z3
        Right
            ( SubkeyWithWireRefs subPkt (packetRefIdOf subRef) subSigs
                : tailSubs
            , z4
            )

tksFromWireRep
    :: WireRepRef -> [TKWithWireRep] -> [TKWithWireRep]
tksFromWireRep :: WireRepRef -> [TKWithWireRep] -> [TKWithWireRep]
tksFromWireRep WireRepRef
src = (TKWithWireRep -> Bool) -> [TKWithWireRep] -> [TKWithWireRep]
forall a. (a -> Bool) -> [a] -> [a]
filter (WireRepRef -> [WireRepRef] -> Bool
forall a. Eq a => a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
elem WireRepRef
src ([WireRepRef] -> Bool)
-> (TKWithWireRep -> [WireRepRef]) -> TKWithWireRep -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WireRepRefs -> [WireRepRef]
forall a. NonEmpty a -> [a]
NE.toList (WireRepRefs -> [WireRepRef])
-> (TKWithWireRep -> WireRepRefs) -> TKWithWireRep -> [WireRepRef]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TKWithWireRep -> WireRepRefs
wireRepsOfTK)

tksContainingPacket
    :: PktWithWireRep -> [TKWithWireRep] -> [TKWithWireRep]
tksContainingPacket :: PktWithWireRep -> [TKWithWireRep] -> [TKWithWireRep]
tksContainingPacket PktWithWireRep
pkt = (TKWithWireRep -> Bool) -> [TKWithWireRep] -> [TKWithWireRep]
forall a. (a -> Bool) -> [a] -> [a]
filter (PktWithWireRep -> [PktWithWireRep] -> Bool
forall a. Eq a => a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
elem PktWithWireRep
pkt ([PktWithWireRep] -> Bool)
-> (TKWithWireRep -> [PktWithWireRep]) -> TKWithWireRep -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TKWithWireRep -> [PktWithWireRep]
packetRefsOfTK)

$(ATH.deriveToJSON ATH.defaultOptions ''TKUnknown)

type KeyringIxs = '[EightOctetKeyId, Fingerprint, Text]

-- | Kinded keyrings: homogeneous collections of public or secret TKs
type PublicKeyring = IxSet KeyringIxs (TK 'PublicTK)

type SecretKeyring = IxSet KeyringIxs (TK 'SecretTK)

-- | Parameterized kinded keyring for generic operations
type family KeyringOf (k :: TKKind) :: Type where
    KeyringOf 'PublicTK = PublicKeyring
    KeyringOf 'SecretTK = SecretKeyring

$(makeLenses ''TKUnknown)
$(makeLenses ''TK)
$(makeLenses ''TKWithWireRep)
$(makeLenses ''PacketRefId)
$(makeLenses ''PacketZipper)
$(makeLenses ''SignatureWithWireRef)
$(makeLenses ''UIDWithWireRefs)
$(makeLenses ''UATWithWireRefs)
$(makeLenses ''SubkeyWithWireRefs)
$(makeLenses ''TKStructuredWithWireRep)