mirror of https://github.com/voidlizard/hbs2
renamed
This commit is contained in:
parent
e78cab0362
commit
1d4d978d1e
|
@ -30,8 +30,8 @@ data RepoForkInfo e =
|
||||||
deriving stock (Generic)
|
deriving stock (Generic)
|
||||||
|
|
||||||
|
|
||||||
data GitRepoAnnounceData s =
|
data GitRepoAnnounce s =
|
||||||
GitRepoAnnounceData
|
GitRepoAnnounce
|
||||||
{ repoLwwRef :: LWWRefKey s
|
{ repoLwwRef :: LWWRefKey s
|
||||||
, repoForkInfo :: Maybe (RepoForkInfo s)
|
, repoForkInfo :: Maybe (RepoForkInfo s)
|
||||||
}
|
}
|
||||||
|
@ -39,10 +39,10 @@ data GitRepoAnnounceData s =
|
||||||
|
|
||||||
|
|
||||||
instance ForGitIndex s => Serialise (RepoForkInfo s)
|
instance ForGitIndex s => Serialise (RepoForkInfo s)
|
||||||
instance ForGitIndex s => Serialise (GitRepoAnnounceData s)
|
instance ForGitIndex s => Serialise (GitRepoAnnounce s)
|
||||||
|
|
||||||
instance ForGitIndex s => Pretty (GitRepoAnnounceData s) where
|
instance ForGitIndex s => Pretty (GitRepoAnnounce s) where
|
||||||
pretty GitRepoAnnounceData{..} = parens $ "git-repo-announce-data" <+> pretty repoLwwRef
|
pretty GitRepoAnnounce{..} = parens $ "git-repo-announce" <+> pretty repoLwwRef
|
||||||
|
|
||||||
newtype NotifyCredentials s = NotifyCredentials (PeerCredentials s)
|
newtype NotifyCredentials s = NotifyCredentials (PeerCredentials s)
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ makeNotificationTx :: forall s . (ForGitIndex s)
|
||||||
-> SignedBox ByteString s
|
-> SignedBox ByteString s
|
||||||
makeNotificationTx ncred lww lwsk forkInfo = do
|
makeNotificationTx ncred lww lwsk forkInfo = do
|
||||||
let creds = coerce ncred :: PeerCredentials s
|
let creds = coerce ncred :: PeerCredentials s
|
||||||
let annData = GitRepoAnnounceData @s lww forkInfo
|
let annData = GitRepoAnnounce @s lww forkInfo
|
||||||
let lwpk = coerce lww :: PubKey 'Sign s
|
let lwpk = coerce lww :: PubKey 'Sign s
|
||||||
let repoAnn = makeSignedBox @s lwpk lwsk (LBS.toStrict $ serialise annData)
|
let repoAnn = makeSignedBox @s lwpk lwsk (LBS.toStrict $ serialise annData)
|
||||||
makeSignedBox @s (view peerSignPk creds) (view peerSignSk creds) (LBS.toStrict $ serialise repoAnn)
|
makeSignedBox @s (view peerSignPk creds) (view peerSignSk creds) (LBS.toStrict $ serialise repoAnn)
|
||||||
|
@ -86,7 +86,7 @@ makeNotificationTx ncred lww lwsk forkInfo = do
|
||||||
|
|
||||||
unpackNotificationTx :: forall s m . (ForGitIndex s, MonadError OperationError m)
|
unpackNotificationTx :: forall s m . (ForGitIndex s, MonadError OperationError m)
|
||||||
=> SignedBox ByteString s
|
=> SignedBox ByteString s
|
||||||
-> m (GitRepoAnnounceData s)
|
-> m (GitRepoAnnounce s)
|
||||||
unpackNotificationTx box = do
|
unpackNotificationTx box = do
|
||||||
(_, bs1) <- unboxSignedBox0 @_ @s box
|
(_, bs1) <- unboxSignedBox0 @_ @s box
|
||||||
& orThrowError SignCheckError
|
& orThrowError SignCheckError
|
||||||
|
@ -97,7 +97,7 @@ unpackNotificationTx box = do
|
||||||
(_, bs3) <- unboxSignedBox0 bs2
|
(_, bs3) <- unboxSignedBox0 bs2
|
||||||
& orThrowError SignCheckError
|
& orThrowError SignCheckError
|
||||||
|
|
||||||
deserialiseOrFail @(GitRepoAnnounceData s) (LBS.fromStrict bs3)
|
deserialiseOrFail @(GitRepoAnnounce s) (LBS.fromStrict bs3)
|
||||||
& orThrowError UnsupportedFormat
|
& orThrowError UnsupportedFormat
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue