{-# LANGUAGE ConstraintKinds             #-}
{-# LANGUAGE MultiParamTypeClasses       #-}
{-# LANGUAGE FlexibleInstances           #-}
{-# LANGUAGE FlexibleContexts            #-}
{-# LANGUAGE TypeFamilies                #-}

-- | Implementation for the cipher part of the AEAD construction. It
-- is assumed that the initialisation of the cipher `Internals` is
-- done in the following order.
--
-- 1. Initialise the key either using initialise or using the `WriteAccessable` interface
--
-- 2. Initialise the nounce
--
-- 3. Initialise the BlockCount
--
-- In addition to serialise the corresponding locked data we would
-- need Encodable instance for the nounce.

signature Cipher.Implementation where

import           Raaz.Core

-- | The primitive
data Prim

-- | The internal memory used by the implementation.
data Internals
instance Memory Internals

instance Initialisable Internals (Key Prim)
instance Encodable (Nounce Prim)

-- | Write access to key is provided.
instance WriteAccessible Internals
instance Initialisable Internals (Nounce Prim)
instance Initialisable Internals (BlockCount Prim) -- To restore/advance
                                                   -- to a particular
                                                   -- block in the stream