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

ud: channel id tracking: fix last two methods

parent 5f680bc7
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
......@@ -46,7 +46,7 @@ type NameService interface {
SignChannelMessage(message []byte) (signature []byte, err error)
// ValidateChannelMessage
ValidateChannelMessage(username string, lease time.Time, pubKey ed25519.PublicKey, authorIDSignature ed25519.PublicKey) bool
ValidateChannelMessage(username string, lease time.Time, pubKey ed25519.PublicKey, authorIDSignature []byte) bool
}
func loadRegistrationDisk(kv *versioned.KV) (registrationDisk, error) {
......@@ -128,6 +128,13 @@ func (r registrationDisk) GetPublicKey() ed25519.PublicKey {
return r.PublicKey
}
func (r registrationDisk) GetPrivateKey() ed25519.PrivateKey {
r.rwmutex.RLock()
defer r.rwmutex.RUnlock()
return r.PrivateKey
}
func (r registrationDisk) GetLeaseSignature() ([]byte, time.Time) {
r.rwmutex.RLock()
defer r.rwmutex.RUnlock()
......@@ -237,18 +244,16 @@ func (c *clientIDTracker) GetChannelPubkey() ed25519.PublicKey {
// SignChannelMessage returns the signature of the
// given message.
func (c *clientIDTracker) SignChannelMessage(message []byte) ([]byte, error) {
return nil, nil // XXX FIXME
privateKey := c.registrationDisk.GetPrivateKey()
return ed25519.Sign(privateKey, message), nil
}
// ValidateoChannelMessage
func (c *clientIDTracker) ValidateChannelMessage(username string, lease time.Time, pubKey ed25519.PublicKey, authorIDSignature ed25519.PublicKey) bool {
// XXX FIXME
return false
func (c *clientIDTracker) ValidateChannelMessage(username string, lease time.Time, pubKey ed25519.PublicKey, authorIDSignature []byte) bool {
return channel.VerifyChannelLease(authorIDSignature, pubKey, username, lease, c.udPubKey)
}
func (c *clientIDTracker) register() error {
lease, signature, err := c.requestChannelLease()
if err != nil {
return err
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment