Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data CHK
- data Reader = Reader {}
- data Verifier = Verifier {
- storageIndex :: ByteString
- fingerprint :: ByteString
- required :: Word16
- total :: Word16
- size :: Integer
- makeReader :: AESKey128 -> ByteString -> Word16 -> Word16 -> Integer -> Reader
- pCapability :: Parser CHK
- pVerifier :: Parser Verifier
- pReader :: Parser Reader
- dangerRealShow :: CHK -> Text
Documentation
A "Content-Hash-Key" (CHK) capability is small value that can be used to perform some operation on a (usually) larger value that may be stored somewhere else. There are two forms of CHK capabilities: verify and read. See *Verifier* and *Reader* for details.
Represent a CHK "read" capability. This capability type can be diminished to a verify capability so it confers all of the abilities of a verify capability. It can also be used to decrypt shares to reconstruct the original plaintext. See makeReader for a safe constructor that correctly derives the verify capability.
Reader | |
|
Represent a CHK "verify" capability. This capability type can be used to verify the existence and validity (bit-level) of shares for the associated piece of plaintext.
It can also be used to repair unhealthy data (I think?)
Verifier | |
|
makeReader :: AESKey128 -> ByteString -> Word16 -> Word16 -> Integer -> Reader Source #
Construct a CHK read capability from its components. This includes the correct derivation of the corresponding CHK verify capability.
pCapability :: Parser CHK Source #
A parser combinator for parsing either a verify or read CHK capability from the canonical format. This is the moral inverse of dangerRealShow.
dangerRealShow :: CHK -> Text Source #
Serialize a CHK capability to text. This operation is "dangerous" in that it will serialize the encryption key of a read capability into the text. Since the encryption key is necessary and (practically) sufficient to recover the original plaintext associated with the capability, it must be handled carefully to avoid unintentional disclosure. Serializing the key to a string is a good way to accidentally disclose it! Be warned.
The text is in the canonical form, originally used by the Python implementation of Tahoe-LAFS.