Skip to content

Commit

Permalink
Migrate from nokey on ios to re-keyed
Browse files Browse the repository at this point in the history
  • Loading branch information
cammellos committed Jan 9, 2019
1 parent 9ed80b5 commit d0d92a4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions services/shhext/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ func (s *Service) InitProtocol(address string, password string) error {
v1Path := filepath.Join(s.dataDir, fmt.Sprintf("%s.db", s.installationID))
v2Path := filepath.Join(s.dataDir, fmt.Sprintf("%s.v2.db", s.installationID))
v3Path := filepath.Join(s.dataDir, fmt.Sprintf("%s.v3.db", s.installationID))
v4Path := filepath.Join(s.dataDir, fmt.Sprintf("%s.v4.db", s.installationID))

if err := chat.MigrateDBFile(v0Path, v1Path, "ON", password); err != nil {
return err
Expand All @@ -147,6 +148,12 @@ func (s *Service) InitProtocol(address string, password string) error {
os.Remove(v3Path)
}

// Fix IOS not encrypting database
if err := chat.MigrateDBFile(v3Path, v4Path, "", hashedPassword); err != nil {
os.Remove(v3Path)
os.Remove(v4Path)
}

persistence, err := chat.NewSQLLitePersistence(v3Path, hashedPassword)
if err != nil {
return err
Expand Down

0 comments on commit d0d92a4

Please sign in to comment.