Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

swarm/pss: refactoring #1222

Closed
wants to merge 3 commits into from
Closed

swarm/pss: refactoring #1222

wants to merge 3 commits into from

Conversation

gluk256
Copy link

@gluk256 gluk256 commented Feb 14, 2019

split pss and keystore.
keystore-related code moved to a separate file.

fixes #1214

@gluk256 gluk256 requested a review from nolash February 14, 2019 15:57
@gluk256 gluk256 self-assigned this Feb 14, 2019
Copy link
Contributor

@nolash nolash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is all of the code in keystore.go copy from pss.go or has it been changed? Is it possible to indicate where changes have been made if not, please?

symKeyDecryptCacheCursor int // modular cursor pointing to last used, wraps on symKeyDecryptCache array
}

func newKeyStore() *KeyStore {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably be loadKeyStore() since we plan to be able to keep it across sessions. And it should probably take filename.

swarm/pss/pss.go Outdated
log.Trace("added pubkey", "pubkeyid", pubkeyid, "topic", topic, "address", address)
return nil
}

// Automatically generate a new symkey for a topic and address hint
func (p *Pss) GenerateSymmetricKey(topic Topic, address PssAddress, addToCache bool) (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this method also be in keystore?

swarm/pss/pss.go Outdated
@@ -603,161 +562,26 @@ func (p *Pss) SetSymmetricKey(key []byte, topic Topic, address PssAddress, addto

func (p *Pss) setSymmetricKey(key []byte, topic Topic, address PssAddress, addtocache bool, protected bool) (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this also in keystore?

swarm/pss/pss.go Outdated
// Returns a symmetric key byte seqyence stored in the whisper backend
// by its unique id
//
// Returns a symmetric key byte sequence stored in the whisper backend by its unique id
// Passes on the error value from the whisper backend
func (p *Pss) GetSymmetricKey(symkeyid string) ([]byte, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this in keystore?

swarm/pss/pss.go Outdated
}
}
return
return p.processSymMsg(p.w, envelope)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldnt we get the key from the store instead and decrypt?

Copy link
Contributor

@nolash nolash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

swarm/pss: Extract "keystore" code
3 participants