trust-chain: An implementation of a trust chain

[ crypto, cryptography, library, mit ] [ Propose Tags ] [ Report a vulnerability ]

An implementation of a trust chain.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.1.0, 0.1.1.1, 0.1.1.2, 0.1.2.0, 0.1.3.0
Change log CHANGELOG.md
Dependencies base (>=4.6 && <5), binary (>=0.8 && <1), bytestring (>=0.11 && <1), containers (>=0.6 && <1), cropty (>=0.3), merge (>=0.3), network (>=3.1 && <4), text (>=1.2 && <2) [details]
License MIT
Author Samuel Schlesinger
Maintainer sgschlesinger@gmail.com
Category Cryptography, Crypto
Source repo head: git clone https://github.com/samuelschlesinger/trust-chain
Uploaded by sgschlesinger at 2021-09-19T05:59:41Z
Distributions
Downloads 564 total (7 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2021-09-19 [all 1 reports]

Readme for trust-chain-0.1.2.0

[back to package description]

Trust Chain

An implementation of a trust chain parameterized on structure and content. As an example:

type Time = Integer

data Person = Person
  { pubKey :: PublicKey
  , legalName :: Maybe Text
  , emails :: Set Text
  , posts :: Set (Time, Text)
  }
  deriving (Eq, Ord, Binary, Generic)

mergePerson :: Merge [String] Person Person
mergePerson =
  Person
  <$> required pubKey
  <*> optional legalName
  <*> combine emails
  <*> combine posts

person :: IO ()
person = do
  privateKey0 <- generatePrivateKey KeySize256
  privateKey1 <- generatePrivateKey KeySize256
  let myself = Person (privateToPublic privateKey0) (Just "Samuel Schlesinger") (Set.fromList ["sgschlesinger@gmail.com", "samuel@simspace.com"]) (Set.fromList [])
  let myfriend = Person (privateToPublic privateKey1) (Just "My Friend") (Set.fromList ["friend@friendly.com"]) Set.empty
  let partialfriend = Person (privateToPublic privateKey1) Nothing Set.empty Set.empty
  tc0 <- mkTrustProxy privateKey0 [Trustless myself, Trustless partialfriend]
  tc1 <- mkTrustProxy privateKey1 [Trustless myfriend]
  tc0' <- mkTrustProxy privateKey0 [tc0, tc1]
  tc1' <- mkTrustProxy privateKey1 [tc0, tc1]
  requires "person"
    [ assignments pubKey mergePerson (claims tc1') == assignments pubKey mergePerson (claims tc0')
    , assignments pubKey mergePerson (claims tc0') == Right (Map.fromList [(privateToPublic privateKey0, myself), (privateToPublic privateKey1, myfriend)])
    ]