Skip to content
Snippets Groups Projects
Commit 3045b8d4 authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

Merge branch '1.sdmf-capability' into 'main'

Add simple SDMF capability representation

See merge request !6
parents d45fbc88 faf0e112
No related branches found
No related tags found
1 merge request!6Add simple SDMF capability representation
Pipeline #4586 failed
-- | Expose the library's public interface.
module Tahoe.SDMF (Share (..)) where
module Tahoe.SDMF (
module Tahoe.SDMF.Internal.Share,
module Tahoe.SDMF.Internal.Capability,
) where
import Tahoe.SDMF.Internal.Share
import Tahoe.SDMF.Internal.Capability (Reader (..), Writer (..))
import Tahoe.SDMF.Internal.Share (Share (..))
-- | Structured representations of SDMF capabilities.
module Tahoe.SDMF.Internal.Capability where
import Prelude hiding (Read)
import qualified Data.ByteString as B
import Tahoe.SDMF.Internal.Keys (Read, Write)
-- | A read capability for an SDMF object.
data Reader = Reader
{ readerReadKey :: Read
, readerVerificationKeyHash :: B.ByteString
}
deriving (Show)
-- | A write capability for an SDMF object.
data Writer = Writer
{ writerWriteKey :: Write
, writerReader :: Reader
}
deriving (Show)
......@@ -34,10 +34,15 @@ newtype Signature = Signature {unSignature :: RSA.PrivateKey}
deriving newtype (Eq, Show)
data Write = Write {unWrite :: AES128, writeKeyBytes :: ByteArray.ScrubbedBytes}
instance Show Write where
show (Write _ bs) = T.unpack $ T.concat ["<WriteKey ", encodeBase32Unpadded (ByteArray.convert bs), ">"]
data Read = Read {unRead :: AES128, readKeyBytes :: ByteArray.ScrubbedBytes}
instance Show Read where
show (Read _ bs) = T.unpack $ T.concat ["<ReadKey ", encodeBase32Unpadded (ByteArray.convert bs), ">"]
newtype StorageIndex = StorageIndex {unStorageIndex :: B.ByteString}
newtype WriteEnablerMaster = WriteEnablerMaster ByteArray.ScrubbedBytes
......
......@@ -64,6 +64,7 @@ library
hs-source-dirs: src
exposed-modules:
Tahoe.SDMF
Tahoe.SDMF.Internal.Capability
Tahoe.SDMF.Internal.Keys
Tahoe.SDMF.Internal.Share
Tahoe.SDMF.Keys
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment