| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Simplex.Messaging.Crypto.Ratchet
Synopsis
- data Ratchet a = Ratchet {
- rcVersion :: RatchetVersions
- rcAD :: Str
- rcDHRs :: PrivateKey a
- rcKEM :: Maybe RatchetKEM
- rcSupportKEM :: PQSupport
- rcEnableKEM :: PQEncryption
- rcSndKEM :: PQEncryption
- rcRcvKEM :: PQEncryption
- rcRK :: RatchetKey
- rcSnd :: Maybe (SndRatchet a)
- rcRcv :: Maybe RcvRatchet
- rcNs :: Word32
- rcNr :: Word32
- rcPN :: Word32
- rcNHKs :: HeaderKey
- rcNHKr :: HeaderKey
- type RatchetX448 = Ratchet 'X448
- data MsgEncryptKey a = MsgEncryptKey {
- msgRcVersion :: VersionE2E
- msgKey :: MessageKey
- msgRcAD :: ByteString
- msgEncHeader :: ByteString
- type MsgEncryptKeyX448 = MsgEncryptKey 'X448
- data SkippedMsgDiff
- = SMDNoChange
- | SMDRemove HeaderKey Word32
- | SMDAdd SkippedMsgKeys
- type SkippedMsgKeys = Map HeaderKey SkippedHdrMsgKeys
- data InitialKeys
- pattern IKPQOn :: InitialKeys
- pattern IKPQOff :: InitialKeys
- newtype PQEncryption = PQEncryption {
- enablePQ :: Bool
- pattern PQEncOn :: PQEncryption
- pattern PQEncOff :: PQEncryption
- newtype PQSupport = PQSupport {
- supportPQ :: Bool
- pattern PQSupportOn :: PQSupport
- pattern PQSupportOff :: PQSupport
- data AUseKEM = forall s.RatchetKEMStateI s => AUseKEM (SRatchetKEMState s) (UseKEM s)
- data RatchetKEMState
- data SRatchetKEMState (s :: RatchetKEMState) where
- type RcvPrivRKEMParams = PrivRKEMParams 'RKSProposed
- data APrivRKEMParams = forall s.RatchetKEMStateI s => APRKP (SRatchetKEMState s) (PrivRKEMParams s)
- type RcvE2ERatchetParamsUri a = E2ERatchetParamsUri 'RKSProposed a
- type RcvE2ERatchetParams a = E2ERatchetParams 'RKSProposed a
- type SndE2ERatchetParams a = AE2ERatchetParams a
- data AE2ERatchetParams (a :: Algorithm) = forall s.RatchetKEMStateI s => AE2ERatchetParams (SRatchetKEMState s) (E2ERatchetParams s a)
- data E2ERatchetParamsUri (s :: RatchetKEMState) (a :: Algorithm) = E2ERatchetParamsUri VersionRangeE2E (PublicKey a) (PublicKey a) (Maybe (RKEMParams s))
- data E2ERatchetParams (s :: RatchetKEMState) (a :: Algorithm) = E2ERatchetParams VersionE2E (PublicKey a) (PublicKey a) (Maybe (RKEMParams s))
- type VersionE2E = Version E2EVersion
- type VersionRangeE2E = VersionRange E2EVersion
- pattern VersionE2E :: Word16 -> VersionE2E
- data RatchetVersions = RatchetVersions {}
- kdfX3DHE2EEncryptVersion :: VersionE2E
- pqRatchetE2EEncryptVersion :: VersionE2E
- currentE2EEncryptVersion :: VersionE2E
- supportedE2EEncryptVRange :: VersionRangeE2E
- generateRcvE2EParams :: (AlgorithmI a, DhAlgorithm a) => TVar ChaChaDRG -> VersionE2E -> PQSupport -> IO (PrivateKey a, PrivateKey a, Maybe (PrivRKEMParams 'RKSProposed), E2ERatchetParams 'RKSProposed a)
- generateSndE2EParams :: forall a. (AlgorithmI a, DhAlgorithm a) => TVar ChaChaDRG -> VersionE2E -> Maybe AUseKEM -> IO (PrivateKey a, PrivateKey a, Maybe APrivRKEMParams, AE2ERatchetParams a)
- mkRcvE2ERatchetParams :: VersionE2E -> (PrivateKey a, PrivateKey a, Maybe RcvPrivRKEMParams) -> RcvE2ERatchetParams a
- initialPQEncryption :: Bool -> InitialKeys -> PQSupport
- connPQEncryption :: InitialKeys -> PQSupport
- joinContactInitialKeys :: Bool -> PQSupport -> InitialKeys
- replyKEM_ :: VersionE2E -> Maybe (RKEMParams 'RKSProposed) -> PQSupport -> Maybe AUseKEM
- pqSupportToEnc :: PQSupport -> PQEncryption
- pqEncToSupport :: PQEncryption -> PQSupport
- pqSupportAnd :: PQSupport -> PQSupport -> PQSupport
- pqEnableSupport :: VersionE2E -> PQSupport -> PQEncryption -> PQSupport
- pqX3dhSnd :: DhAlgorithm a => PrivateKey a -> PrivateKey a -> Maybe APrivRKEMParams -> E2ERatchetParams 'RKSProposed a -> Either CryptoError (RatchetInitParams, Maybe KEMKeyPair)
- pqX3dhRcv :: forall s a. (RatchetKEMStateI s, DhAlgorithm a) => PrivateKey a -> PrivateKey a -> Maybe (PrivRKEMParams 'RKSProposed) -> E2ERatchetParams s a -> ExceptT CryptoError IO (RatchetInitParams, Maybe KEMKeyPair)
- initSndRatchet :: forall a. (AlgorithmI a, DhAlgorithm a) => RatchetVersions -> PublicKey a -> PrivateKey a -> (RatchetInitParams, Maybe KEMKeyPair) -> Ratchet a
- initRcvRatchet :: forall a. (AlgorithmI a, DhAlgorithm a) => RatchetVersions -> PrivateKey a -> (RatchetInitParams, Maybe KEMKeyPair) -> PQSupport -> Ratchet a
- rcCheckCanPad :: Int -> ByteString -> ExceptT CryptoError IO ()
- rcEncryptHeader :: AlgorithmI a => Ratchet a -> Maybe PQEncryption -> VersionE2E -> ExceptT CryptoError IO (MsgEncryptKey a, Ratchet a)
- rcEncryptMsg :: AlgorithmI a => MsgEncryptKey a -> Int -> ByteString -> ExceptT CryptoError IO ByteString
- rcDecrypt :: forall a. (AlgorithmI a, DhAlgorithm a) => TVar ChaChaDRG -> Ratchet a -> SkippedMsgKeys -> ByteString -> ExceptT CryptoError IO (DecryptResult a)
- data MsgHeader a = MsgHeader {
- msgMaxVersion :: VersionE2E
- msgDHRs :: PublicKey a
- msgKEM :: Maybe ARKEMParams
- msgPN :: Word32
- msgNs :: Word32
- data RatchetInitParams = RatchetInitParams {
- assocData :: Str
- ratchetKey :: RatchetKey
- sndHK :: HeaderKey
- rcvNextHK :: HeaderKey
- kemAccepted :: Maybe RatchetKEMAccepted
- data UseKEM (s :: RatchetKEMState) where
- data RKEMParams (s :: RatchetKEMState) where
- data ARKEMParams = forall s.RatchetKEMStateI s => ARKP (SRatchetKEMState s) (RKEMParams s)
- data SndRatchet a = SndRatchet {
- rcDHRr :: PublicKey a
- rcCKs :: RatchetKey
- rcHKs :: HeaderKey
- data RcvRatchet = RcvRatchet {
- rcCKr :: RatchetKey
- rcHKr :: HeaderKey
- data RatchetKEM = RatchetKEM {
- rcPQRs :: KEMKeyPair
- rcKEMs :: Maybe RatchetKEMAccepted
- data RatchetKEMAccepted = RatchetKEMAccepted {}
- newtype RatchetKey = RatchetKey ByteString
- fullHeaderLen :: VersionE2E -> PQSupport -> Int
- applySMDiff :: SkippedMsgKeys -> SkippedMsgDiff -> SkippedMsgKeys
- encodeMsgHeader :: AlgorithmI a => VersionE2E -> MsgHeader a -> ByteString
- msgHeaderP :: AlgorithmI a => VersionE2E -> Parser (MsgHeader a)
Documentation
Constructors
| Ratchet | |
Fields
| |
Instances
| AlgorithmI a => FromJSON (Ratchet a) Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods parseJSON :: Value -> Parser (Ratchet a) parseJSONList :: Value -> Parser [Ratchet a] omittedField :: Maybe (Ratchet a) | |
| AlgorithmI a => ToJSON (Ratchet a) Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods toEncoding :: Ratchet a -> Encoding toJSONList :: [Ratchet a] -> Value toEncodingList :: [Ratchet a] -> Encoding | |
| Show (Ratchet a) Source # | |
| (AlgorithmI a, Typeable a) => FromField (Ratchet a) Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet | |
| AlgorithmI a => ToField (Ratchet a) Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet | |
type RatchetX448 = Ratchet 'X448 Source #
data MsgEncryptKey a Source #
Constructors
| MsgEncryptKey | |
Fields
| |
Instances
| Show (MsgEncryptKey a) Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods showsPrec :: Int -> MsgEncryptKey a -> ShowS show :: MsgEncryptKey a -> String showList :: [MsgEncryptKey a] -> ShowS | |
| Encoding (MsgEncryptKey a) Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods smpEncode :: MsgEncryptKey a -> ByteString Source # smpDecode :: ByteString -> Either String (MsgEncryptKey a) Source # smpP :: Parser (MsgEncryptKey a) Source # | |
| (AlgorithmI a, Typeable a) => FromField (MsgEncryptKey a) Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods fromField :: FieldParser (MsgEncryptKey a) # | |
| AlgorithmI a => ToField (MsgEncryptKey a) Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods toField :: MsgEncryptKey a -> SQLData # | |
type MsgEncryptKeyX448 = MsgEncryptKey 'X448 Source #
data SkippedMsgDiff Source #
Constructors
| SMDNoChange | |
| SMDRemove HeaderKey Word32 | |
| SMDAdd SkippedMsgKeys |
type SkippedMsgKeys = Map HeaderKey SkippedHdrMsgKeys Source #
data InitialKeys Source #
Instances
| Show InitialKeys Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods showsPrec :: Int -> InitialKeys -> ShowS show :: InitialKeys -> String showList :: [InitialKeys] -> ShowS | |
| Eq InitialKeys Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet | |
| StrEncoding InitialKeys Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods strEncode :: InitialKeys -> ByteString Source # strDecode :: ByteString -> Either String InitialKeys Source # strP :: Parser InitialKeys Source # | |
pattern IKPQOn :: InitialKeys Source #
pattern IKPQOff :: InitialKeys Source #
newtype PQEncryption Source #
Constructors
| PQEncryption | |
Fields
| |
Instances
pattern PQEncOn :: PQEncryption Source #
pattern PQEncOff :: PQEncryption Source #
Instances
| FromJSON PQSupport Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods parseJSON :: Value -> Parser PQSupport parseJSONList :: Value -> Parser [PQSupport] omittedField :: Maybe PQSupport | |
| ToJSON PQSupport Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods toEncoding :: PQSupport -> Encoding toJSONList :: [PQSupport] -> Value toEncodingList :: [PQSupport] -> Encoding | |
| Show PQSupport Source # | |
| Eq PQSupport Source # | |
| StrEncoding PQSupport Source # | |
| FromField PQSupport Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet | |
| ToField PQSupport Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet | |
pattern PQSupportOn :: PQSupport Source #
pattern PQSupportOff :: PQSupport Source #
Constructors
| forall s.RatchetKEMStateI s => AUseKEM (SRatchetKEMState s) (UseKEM s) |
data RatchetKEMState Source #
Constructors
| RKSProposed | |
| RKSAccepted |
Instances
| TestEquality SRatchetKEMState Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods testEquality :: forall (a :: k) (b :: k). SRatchetKEMState a -> SRatchetKEMState b -> Maybe (a :~: b) | |
data SRatchetKEMState (s :: RatchetKEMState) where Source #
Constructors
| SRKSProposed :: SRatchetKEMState 'RKSProposed | |
| SRKSAccepted :: SRatchetKEMState 'RKSAccepted |
Instances
| TestEquality SRatchetKEMState Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods testEquality :: forall (a :: k) (b :: k). SRatchetKEMState a -> SRatchetKEMState b -> Maybe (a :~: b) | |
| Show (SRatchetKEMState s) Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods showsPrec :: Int -> SRatchetKEMState s -> ShowS show :: SRatchetKEMState s -> String showList :: [SRatchetKEMState s] -> ShowS | |
type RcvPrivRKEMParams = PrivRKEMParams 'RKSProposed Source #
data APrivRKEMParams Source #
Constructors
| forall s.RatchetKEMStateI s => APRKP (SRatchetKEMState s) (PrivRKEMParams s) |
Instances
| Encoding APrivRKEMParams Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods smpEncode :: APrivRKEMParams -> ByteString Source # smpDecode :: ByteString -> Either String APrivRKEMParams Source # smpP :: Parser APrivRKEMParams Source # | |
type RcvE2ERatchetParamsUri a = E2ERatchetParamsUri 'RKSProposed a Source #
type RcvE2ERatchetParams a = E2ERatchetParams 'RKSProposed a Source #
type SndE2ERatchetParams a = AE2ERatchetParams a Source #
data AE2ERatchetParams (a :: Algorithm) Source #
Constructors
| forall s.RatchetKEMStateI s => AE2ERatchetParams (SRatchetKEMState s) (E2ERatchetParams s a) |
Instances
| Show (AE2ERatchetParams a) Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods showsPrec :: Int -> AE2ERatchetParams a -> ShowS show :: AE2ERatchetParams a -> String showList :: [AE2ERatchetParams a] -> ShowS | |
| AlgorithmI a => Encoding (AE2ERatchetParams a) Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods smpEncode :: AE2ERatchetParams a -> ByteString Source # smpDecode :: ByteString -> Either String (AE2ERatchetParams a) Source # smpP :: Parser (AE2ERatchetParams a) Source # | |
data E2ERatchetParamsUri (s :: RatchetKEMState) (a :: Algorithm) Source #
Constructors
| E2ERatchetParamsUri VersionRangeE2E (PublicKey a) (PublicKey a) (Maybe (RKEMParams s)) |
Instances
data E2ERatchetParams (s :: RatchetKEMState) (a :: Algorithm) Source #
Constructors
| E2ERatchetParams VersionE2E (PublicKey a) (PublicKey a) (Maybe (RKEMParams s)) |
Instances
| Show (E2ERatchetParams s a) Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods showsPrec :: Int -> E2ERatchetParams s a -> ShowS show :: E2ERatchetParams s a -> String showList :: [E2ERatchetParams s a] -> ShowS | |
| (RatchetKEMStateI s, AlgorithmI a) => Encoding (E2ERatchetParams s a) Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods smpEncode :: E2ERatchetParams s a -> ByteString Source # smpDecode :: ByteString -> Either String (E2ERatchetParams s a) Source # smpP :: Parser (E2ERatchetParams s a) Source # | |
type VersionE2E = Version E2EVersion Source #
type VersionRangeE2E = VersionRange E2EVersion Source #
pattern VersionE2E :: Word16 -> VersionE2E Source #
data RatchetVersions Source #
Constructors
| RatchetVersions | |
Fields | |
Instances
| FromJSON RatchetVersions Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods parseJSON :: Value -> Parser RatchetVersions parseJSONList :: Value -> Parser [RatchetVersions] omittedField :: Maybe RatchetVersions | |
| ToJSON RatchetVersions Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods toJSON :: RatchetVersions -> Value toEncoding :: RatchetVersions -> Encoding toJSONList :: [RatchetVersions] -> Value toEncodingList :: [RatchetVersions] -> Encoding omitField :: RatchetVersions -> Bool | |
| Show RatchetVersions Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods showsPrec :: Int -> RatchetVersions -> ShowS show :: RatchetVersions -> String showList :: [RatchetVersions] -> ShowS | |
| Eq RatchetVersions Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods (==) :: RatchetVersions -> RatchetVersions -> Bool (/=) :: RatchetVersions -> RatchetVersions -> Bool | |
generateRcvE2EParams :: (AlgorithmI a, DhAlgorithm a) => TVar ChaChaDRG -> VersionE2E -> PQSupport -> IO (PrivateKey a, PrivateKey a, Maybe (PrivRKEMParams 'RKSProposed), E2ERatchetParams 'RKSProposed a) Source #
generateSndE2EParams :: forall a. (AlgorithmI a, DhAlgorithm a) => TVar ChaChaDRG -> VersionE2E -> Maybe AUseKEM -> IO (PrivateKey a, PrivateKey a, Maybe APrivRKEMParams, AE2ERatchetParams a) Source #
mkRcvE2ERatchetParams :: VersionE2E -> (PrivateKey a, PrivateKey a, Maybe RcvPrivRKEMParams) -> RcvE2ERatchetParams a Source #
initialPQEncryption :: Bool -> InitialKeys -> PQSupport Source #
joinContactInitialKeys :: Bool -> PQSupport -> InitialKeys Source #
replyKEM_ :: VersionE2E -> Maybe (RKEMParams 'RKSProposed) -> PQSupport -> Maybe AUseKEM Source #
pqEnableSupport :: VersionE2E -> PQSupport -> PQEncryption -> PQSupport Source #
pqX3dhSnd :: DhAlgorithm a => PrivateKey a -> PrivateKey a -> Maybe APrivRKEMParams -> E2ERatchetParams 'RKSProposed a -> Either CryptoError (RatchetInitParams, Maybe KEMKeyPair) Source #
pqX3dhRcv :: forall s a. (RatchetKEMStateI s, DhAlgorithm a) => PrivateKey a -> PrivateKey a -> Maybe (PrivRKEMParams 'RKSProposed) -> E2ERatchetParams s a -> ExceptT CryptoError IO (RatchetInitParams, Maybe KEMKeyPair) Source #
initSndRatchet :: forall a. (AlgorithmI a, DhAlgorithm a) => RatchetVersions -> PublicKey a -> PrivateKey a -> (RatchetInitParams, Maybe KEMKeyPair) -> Ratchet a Source #
Sending ratchet initialization
Please note that sPKey is not stored, and its public part together with random salt
is sent to the recipient.
RatchetInitAlicePQ2HE(state, SK, bob_dh_public_key, shared_hka, shared_nhkb, bob_pq_kem_encapsulation_key)
// below added for post-quantum KEM
state.PQRs = GENERATE_PQKEM()
state.PQRr = bob_pq_kem_encapsulation_key
state.PQRss = random // shared secret for KEM
state.PQRct = PQKEM-ENC(state.PQRr, state.PQRss) // encapsulated additional shared secret
// above added for KEM
initRcvRatchet :: forall a. (AlgorithmI a, DhAlgorithm a) => RatchetVersions -> PrivateKey a -> (RatchetInitParams, Maybe KEMKeyPair) -> PQSupport -> Ratchet a Source #
Receiving ratchet initialization, equivalent to RatchetInitBobPQ2HE in double ratchet spec
def RatchetInitBobPQ2HE(state, SK, bob_dh_key_pair, shared_hka, shared_nhkb, bob_pq_kem_key_pair)
Please note that the public part of rcDHRs was sent to the sender as part of the connection request and random salt was received from the sender.
rcCheckCanPad :: Int -> ByteString -> ExceptT CryptoError IO () Source #
rcEncryptHeader :: AlgorithmI a => Ratchet a -> Maybe PQEncryption -> VersionE2E -> ExceptT CryptoError IO (MsgEncryptKey a, Ratchet a) Source #
rcEncryptMsg :: AlgorithmI a => MsgEncryptKey a -> Int -> ByteString -> ExceptT CryptoError IO ByteString Source #
rcDecrypt :: forall a. (AlgorithmI a, DhAlgorithm a) => TVar ChaChaDRG -> Ratchet a -> SkippedMsgKeys -> ByteString -> ExceptT CryptoError IO (DecryptResult a) Source #
Constructors
| MsgHeader | |
Fields
| |
data RatchetInitParams Source #
Constructors
| RatchetInitParams | |
Fields
| |
Instances
| Show RatchetInitParams Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods showsPrec :: Int -> RatchetInitParams -> ShowS show :: RatchetInitParams -> String showList :: [RatchetInitParams] -> ShowS | |
data UseKEM (s :: RatchetKEMState) where Source #
Constructors
| ProposeKEM :: UseKEM 'RKSProposed | |
| AcceptKEM :: KEMPublicKey -> UseKEM 'RKSAccepted |
data RKEMParams (s :: RatchetKEMState) where Source #
Constructors
| RKParamsProposed :: KEMPublicKey -> RKEMParams 'RKSProposed | |
| RKParamsAccepted :: KEMCiphertext -> KEMPublicKey -> RKEMParams 'RKSAccepted |
Instances
| Show (RKEMParams s) Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods showsPrec :: Int -> RKEMParams s -> ShowS show :: RKEMParams s -> String showList :: [RKEMParams s] -> ShowS | |
| Eq (RKEMParams s) Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet | |
| RatchetKEMStateI s => Encoding (RKEMParams s) Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods smpEncode :: RKEMParams s -> ByteString Source # smpDecode :: ByteString -> Either String (RKEMParams s) Source # smpP :: Parser (RKEMParams s) Source # | |
data ARKEMParams Source #
Constructors
| forall s.RatchetKEMStateI s => ARKP (SRatchetKEMState s) (RKEMParams s) |
Instances
| Show ARKEMParams Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods showsPrec :: Int -> ARKEMParams -> ShowS show :: ARKEMParams -> String showList :: [ARKEMParams] -> ShowS | |
| Encoding ARKEMParams Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods smpEncode :: ARKEMParams -> ByteString Source # smpDecode :: ByteString -> Either String ARKEMParams Source # smpP :: Parser ARKEMParams Source # | |
| FromField ARKEMParams Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods fromField :: FieldParser ARKEMParams # | |
| ToField ARKEMParams Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods toField :: ARKEMParams -> SQLData # | |
data SndRatchet a Source #
Constructors
| SndRatchet | |
Fields
| |
Instances
| AlgorithmI a => FromJSON (SndRatchet a) Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods parseJSON :: Value -> Parser (SndRatchet a) parseJSONList :: Value -> Parser [SndRatchet a] omittedField :: Maybe (SndRatchet a) | |
| AlgorithmI a => ToJSON (SndRatchet a) Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods toJSON :: SndRatchet a -> Value toEncoding :: SndRatchet a -> Encoding toJSONList :: [SndRatchet a] -> Value toEncodingList :: [SndRatchet a] -> Encoding omitField :: SndRatchet a -> Bool | |
| Show (SndRatchet a) Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods showsPrec :: Int -> SndRatchet a -> ShowS show :: SndRatchet a -> String showList :: [SndRatchet a] -> ShowS | |
data RcvRatchet Source #
Constructors
| RcvRatchet | |
Fields
| |
Instances
| FromJSON RcvRatchet Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods parseJSON :: Value -> Parser RcvRatchet parseJSONList :: Value -> Parser [RcvRatchet] omittedField :: Maybe RcvRatchet | |
| ToJSON RcvRatchet Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods toJSON :: RcvRatchet -> Value toEncoding :: RcvRatchet -> Encoding toJSONList :: [RcvRatchet] -> Value toEncodingList :: [RcvRatchet] -> Encoding omitField :: RcvRatchet -> Bool | |
| Show RcvRatchet Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods showsPrec :: Int -> RcvRatchet -> ShowS show :: RcvRatchet -> String showList :: [RcvRatchet] -> ShowS | |
data RatchetKEM Source #
Constructors
| RatchetKEM | |
Fields
| |
Instances
| FromJSON RatchetKEM Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods parseJSON :: Value -> Parser RatchetKEM parseJSONList :: Value -> Parser [RatchetKEM] omittedField :: Maybe RatchetKEM | |
| ToJSON RatchetKEM Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods toJSON :: RatchetKEM -> Value toEncoding :: RatchetKEM -> Encoding toJSONList :: [RatchetKEM] -> Value toEncodingList :: [RatchetKEM] -> Encoding omitField :: RatchetKEM -> Bool | |
| Show RatchetKEM Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods showsPrec :: Int -> RatchetKEM -> ShowS show :: RatchetKEM -> String showList :: [RatchetKEM] -> ShowS | |
data RatchetKEMAccepted Source #
Constructors
| RatchetKEMAccepted | |
Fields | |
Instances
| FromJSON RatchetKEMAccepted Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods parseJSON :: Value -> Parser RatchetKEMAccepted parseJSONList :: Value -> Parser [RatchetKEMAccepted] omittedField :: Maybe RatchetKEMAccepted | |
| ToJSON RatchetKEMAccepted Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods toJSON :: RatchetKEMAccepted -> Value toEncoding :: RatchetKEMAccepted -> Encoding toJSONList :: [RatchetKEMAccepted] -> Value toEncodingList :: [RatchetKEMAccepted] -> Encoding omitField :: RatchetKEMAccepted -> Bool | |
| Show RatchetKEMAccepted Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods showsPrec :: Int -> RatchetKEMAccepted -> ShowS show :: RatchetKEMAccepted -> String showList :: [RatchetKEMAccepted] -> ShowS | |
newtype RatchetKey Source #
Input key material for double ratchet HKDF functions
Constructors
| RatchetKey ByteString |
Instances
| FromJSON RatchetKey Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods parseJSON :: Value -> Parser RatchetKey parseJSONList :: Value -> Parser [RatchetKey] omittedField :: Maybe RatchetKey | |
| ToJSON RatchetKey Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods toJSON :: RatchetKey -> Value toEncoding :: RatchetKey -> Encoding toJSONList :: [RatchetKey] -> Value toEncodingList :: [RatchetKey] -> Encoding omitField :: RatchetKey -> Bool | |
| Show RatchetKey Source # | |
Defined in Simplex.Messaging.Crypto.Ratchet Methods showsPrec :: Int -> RatchetKey -> ShowS show :: RatchetKey -> String showList :: [RatchetKey] -> ShowS | |
fullHeaderLen :: VersionE2E -> PQSupport -> Int Source #
applySMDiff :: SkippedMsgKeys -> SkippedMsgDiff -> SkippedMsgKeys Source #
this function is only used in tests to apply changes in skipped messages, in the agent the diff is persisted, and the whole state is loaded for the next message.
encodeMsgHeader :: AlgorithmI a => VersionE2E -> MsgHeader a -> ByteString Source #
msgHeaderP :: AlgorithmI a => VersionE2E -> Parser (MsgHeader a) Source #