Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup Service + SequenceStore refactor #241

Merged
merged 4 commits into from
May 31, 2022
Merged

Conversation

flypaper0
Copy link
Contributor

What changed

  • deleteAll() methods added for KeyManagementService, PairingStorage, SessionStorage
  • cleanup() method in public interface (for DEBUG)

@llbartekll
Copy link
Contributor

the PR should not be to the main branch as we have 2 week release cadence when we are merging develop into main

Comment on lines 57 to 59
func deleteAll() {
for key in storage.dictionaryRepresentation().keys {
storage.removeObject(forKey: key)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

correct me if I am wrong but would it clean all UserDefaults? including consuming app all preferences?

Copy link
Contributor

Choose a reason for hiding this comment

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

if so, pretty malicious xD

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added logic what delete values for current identifier only.
Also improved filtration by identifier. Now it works for "test" and "test2" identifiers too, because they starts with "test"

@llbartekll llbartekll changed the base branch from main to develop May 27, 2022 10:53
@flypaper0 flypaper0 requested a review from llbartekll May 30, 2022 10:18
Comment on lines 4 to 21
final class CleanupService {

private let pairingStore: WCPairingStorage
private let sessionStore: WCSessionStorage
private let kms: KeyManagementServiceProtocol

init(pairingStore: WCPairingStorage, sessionStore: WCSessionStorage, kms: KeyManagementServiceProtocol) {
self.pairingStore = pairingStore
self.sessionStore = sessionStore
self.kms = kms
}

func cleanup() throws {
pairingStore.deleteAll()
sessionStore.deleteAll()
try kms.deleteAll()
}
}

Choose a reason for hiding this comment

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

There are other KeyValueStore in the session and pairing engine used for proposal-approval (even though they are more like workarounds). I think it would be good to clean those too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, need to clean sessionToPairingTopic

@flypaper0 flypaper0 changed the title Cleanup Service Cleanup Service + SequenceStore refactor May 31, 2022
@flypaper0 flypaper0 merged commit 6bec5ef into develop May 31, 2022
@flypaper0 flypaper0 deleted the cleanup-service branch May 31, 2022 13:07
@flypaper0 flypaper0 mentioned this pull request Jun 9, 2022
flypaper0 added a commit that referenced this pull request Jun 9, 2022
* Cleanup Service + SequenceStore refactor (#241)

* Cleanup service

* Clean sessionToPairingTopic

* SequenceStore refactor

* Rename KeyValueStore -> CodableStore

* Deliver an invite (#254)

* Add Chat target, split packages

* savepoint

* Update networking interactor  to decode unencrypted messages

* pass on invite test

* restructure chat's project folder

* Add engine storages

* extract storage domain identifiers

* update logging

* fix schemas

* Update style

* Add publishers to Chat

* rename kv store to codable strore

* UI tests (#242)

* Pairing testcase

* Ping testcase

* ApproveSessionExistingPairing test case

* Unused extensions deleted

* Renamed to RegressionTests

* UITests step on CI

* CleanLaunch instead of deleting app

* Fix test on Real device

* Launch App fix

* Approve engine refactor (#260)

* Approve method moved ApproveEngine

* Reject and wcSessionSubscriptions for ApproveEngine

* Private methods moved in extension

* ApproveEngine errors handlers

* Try on reject

* ApproveEngine moved to callbacks

* Session Settle moved to approve Engine

* onProposeResponse subscription removed

* Reject by proposalId

* Settle moved to approve

* ApproveEngine moved to Controller folder

* typealias removed

* TODO for SettleEngine

* #256 JSON-RPC Package (& Commons) (#261)

* Add Chat target, split packages

* savepoint

* restructure chat's project folder

* fix schemas

* Add JSONRPC and Commons packages

* Moved AnyCodable to Commons

* Fixed test import

* Reintroduces either type

* Add request and response types

* Add simple response decode tests

* Add response ID parsing tests

* Fixed tests typo

* Improved response round trip coding test

* Error response decoding tests

* Invalid response decode tests

* Enabled code coverage for library

* Response decoding tests for structured result values

* Add flexible initializers with tests

* Add descriptions to errors thrown in response decoding

* Renamed response internalResult to outcome

* Basic RPC request decoding tests

* Tests for request empty cases and corner cases

* Add flexible inits for requests

* Add identifier generation inits

* Joined request notification extensions

* Renamed files

* Implemented default JSONRPC error cases

* Declared RPCRequestConvertible as public

* Remove rebase artifacts

* Added debug description to request param primitives error

Co-authored-by: Bartosz Rozwarski <bartus000@gmail.com>
Co-authored-by: André Vants <MisterVants@users.noreply.github.com>
@flypaper0 flypaper0 mentioned this pull request Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants