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

swarm/pss: refactoring#1222

Closed
gluk256 wants to merge 3 commits intoethersphere:masterfrom
gluk256:555
Closed

swarm/pss: refactoring#1222
gluk256 wants to merge 3 commits intoethersphere:masterfrom
gluk256:555

Conversation

@gluk256
Copy link
Copy Markdown

@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
Copy Markdown
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?

Comment thread swarm/pss/keystore.go Outdated
symKeyDecryptCacheCursor int // modular cursor pointing to last used, wraps on symKeyDecryptCache array
}

func newKeyStore() *KeyStore {
Copy link
Copy Markdown
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.

Comment thread swarm/pss/pss.go Outdated
}

// 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
Copy Markdown
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?

Comment thread 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
Copy Markdown
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?

Comment thread swarm/pss/pss.go Outdated
//
// 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
Copy Markdown
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?

Comment thread swarm/pss/pss.go Outdated
}
}
return
return p.processSymMsg(p.w, envelope)
Copy link
Copy Markdown
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
Copy Markdown
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