{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Wire.API.MLS.HPKEPublicKey where
import Imports
import Test.QuickCheck
import Wire.API.MLS.Serialisation
newtype HPKEPublicKey = HPKEPublicKey {HPKEPublicKey -> ByteString
unHPKEPublicKey :: ByteString}
deriving (Int -> HPKEPublicKey -> ShowS
[HPKEPublicKey] -> ShowS
HPKEPublicKey -> String
(Int -> HPKEPublicKey -> ShowS)
-> (HPKEPublicKey -> String)
-> ([HPKEPublicKey] -> ShowS)
-> Show HPKEPublicKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> HPKEPublicKey -> ShowS
showsPrec :: Int -> HPKEPublicKey -> ShowS
$cshow :: HPKEPublicKey -> String
show :: HPKEPublicKey -> String
$cshowList :: [HPKEPublicKey] -> ShowS
showList :: [HPKEPublicKey] -> ShowS
Show, HPKEPublicKey -> HPKEPublicKey -> Bool
(HPKEPublicKey -> HPKEPublicKey -> Bool)
-> (HPKEPublicKey -> HPKEPublicKey -> Bool) -> Eq HPKEPublicKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: HPKEPublicKey -> HPKEPublicKey -> Bool
== :: HPKEPublicKey -> HPKEPublicKey -> Bool
$c/= :: HPKEPublicKey -> HPKEPublicKey -> Bool
/= :: HPKEPublicKey -> HPKEPublicKey -> Bool
Eq, Gen HPKEPublicKey
Gen HPKEPublicKey
-> (HPKEPublicKey -> [HPKEPublicKey]) -> Arbitrary HPKEPublicKey
HPKEPublicKey -> [HPKEPublicKey]
forall a. Gen a -> (a -> [a]) -> Arbitrary a
$carbitrary :: Gen HPKEPublicKey
arbitrary :: Gen HPKEPublicKey
$cshrink :: HPKEPublicKey -> [HPKEPublicKey]
shrink :: HPKEPublicKey -> [HPKEPublicKey]
Arbitrary)
instance ParseMLS HPKEPublicKey where
parseMLS :: Get HPKEPublicKey
parseMLS = ByteString -> HPKEPublicKey
HPKEPublicKey (ByteString -> HPKEPublicKey)
-> Get ByteString -> Get HPKEPublicKey
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall w. (Binary w, Integral w) => Get ByteString
parseMLSBytes @VarInt
instance SerialiseMLS HPKEPublicKey where
serialiseMLS :: HPKEPublicKey -> Put
serialiseMLS = forall w. (Binary w, Integral w) => ByteString -> Put
serialiseMLSBytes @VarInt (ByteString -> Put)
-> (HPKEPublicKey -> ByteString) -> HPKEPublicKey -> Put
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HPKEPublicKey -> ByteString
unHPKEPublicKey