Skip to content
Snippets Groups Projects
Commit 577a396b authored by David Stainton's avatar David Stainton
Browse files

Fixup requestChannelLease

parent 6cec7548
No related branches found
No related tags found
7 merge requests!510Release,!419rewrote the health tracker to both consider if there are waiting rounds and...,!371[Channel RSAtoPrivate] Implement Reverse Asymmetric in Client/Broadcast,!354Channels impl,!340Project/channels,!339Project/channels,!338Xx 4055/channel identity tracking
......@@ -3,7 +3,7 @@ module gitlab.com/elixxir/client
go 1.17
replace gitlab.com/elixxir/crypto => /home/human/code/crypto
replace gitlab.com/elixxir/comms => /home/human/code/comms
require (
github.com/cloudflare/circl v1.2.0
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
......
......@@ -11,7 +11,14 @@ import (
"gitlab.com/elixxir/crypto/fastRNG"
)
func requestChannelLease(userPubKey ed25519.PublicKey, username string, comms channelLeaseComms, ud *userDiscovery, receptionIdentity xxdk.ReceptionIdentity, rngGenerator *fastRNG.StreamGenerator) (int64, []byte, error) {
func requestChannelLease(userPubKey ed25519.PublicKey,
username string,
comms channelLeaseComms,
ud *userDiscovery,
receptionIdentity xxdk.ReceptionIdentity,
rngGenerator *fastRNG.StreamGenerator,
signerPubKey ed25519.PublicKey) (int64, []byte, error) {
ts := time.Now().UnixNano()
privKey, err := receptionIdentity.GetRSAPrivatePem()
if err != nil {
......@@ -24,11 +31,11 @@ func requestChannelLease(userPubKey ed25519.PublicKey, username string, comms ch
}
rng.Close()
msg := &mixmessages.ChannelAuthenticationRequest{
UserID: receptionIdentity.ID.Marshal(),
UserEd25519PubKey: userPubKey,
Timestamp: ts,
UserSignedEdPubKey: fSig,
msg := &mixmessages.ChannelLeaseRequest{
UserID: receptionIdentity.ID.Marshal(),
UserEd25519PubKey: userPubKey,
Timestamp: ts,
UserPubKeyRSASignature: fSig,
}
resp, err := comms.SendChannelAuthRequest(ud.host, msg)
......@@ -36,10 +43,11 @@ func requestChannelLease(userPubKey ed25519.PublicKey, username string, comms ch
return 0, nil, err
}
ok := channel.VerifyChannelLease(resp.UDLeaseEd25519Signature, resp.UDSignedEdPubKey, userPubKey, uint64(resp.Lease), nil)
ok := channel.VerifyChannelLease(resp.UDLeaseEd25519Signature,
userPubKey, username, time.Unix(0, resp.Lease), signerPubKey)
if !ok {
return 0, nil, errors.New("error could not verify signature returned with channel lease")
}
return resp.Lease, resp.UDSignedEdPubKey, err
return resp.Lease, resp.UDLeaseEd25519Signature, err
}
......@@ -38,7 +38,7 @@ type Comms interface {
// gRPC send functions.
GetHost(hostId *id.ID) (*connect.Host, bool)
SendChannelAuthRequest(host *connect.Host, message *pb.ChannelAuthenticationRequest) (*pb.ChannelAuthenticationResponse, error)
SendChannelAuthRequest(host *connect.Host, message *pb.ChannelLeaseRequest) (*pb.ChannelLeaseResponse, error)
}
// removeFactComms is a sub-interface of the Comms interface for the
......@@ -72,5 +72,5 @@ type addFactComms interface {
}
type channelLeaseComms interface {
SendChannelAuthRequest(host *connect.Host, message *pb.ChannelAuthenticationRequest) (*pb.ChannelAuthenticationResponse, error)
SendChannelAuthRequest(host *connect.Host, message *pb.ChannelLeaseRequest) (*pb.ChannelLeaseResponse, error)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment