Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/samuelschlesinger/trust-chain
A general implementation of a chain of trust, parameterized by structure and content
https://github.com/samuelschlesinger/trust-chain
Last synced: 22 days ago
JSON representation
A general implementation of a chain of trust, parameterized by structure and content
- Host: GitHub
- URL: https://github.com/samuelschlesinger/trust-chain
- Owner: SamuelSchlesinger
- License: mit
- Created: 2021-09-16T09:41:18.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-09-19T08:26:17.000Z (over 3 years ago)
- Last Synced: 2024-10-27T19:10:32.749Z (2 months ago)
- Language: Haskell
- Size: 16.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Trust Chain
An implementation of a trust chain parameterized on structure and content. As an example:
```haskell
type Time = Integerdata 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 postsperson :: IO ()
person = do
privateKey0 <- generatePrivateKey KeySize256
privateKey1 <- generatePrivateKey KeySize256
let myself = Person (privateToPublic privateKey0) (Just "Samuel Schlesinger") (Set.fromList ["[email protected]", "[email protected]"]) (Set.fromList [])
let myfriend = Person (privateToPublic privateKey1) (Just "My Friend") (Set.fromList ["[email protected]"]) 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)])
]
```