Skip to content
Snippets Groups Projects
Commit aa4e9ac3 authored by Jake Taylor's avatar Jake Taylor
Browse files

added force-legacy flag

parent 9ab9ae20
No related branches found
No related tags found
3 merge requests!510Release,!267Make BuildReceptionIdentity public, and make backup restore function return a...,!263Hotfix/refactor cmd
...@@ -71,9 +71,9 @@ func init() { ...@@ -71,9 +71,9 @@ func init() {
rootCmd.AddCommand(initCmd) rootCmd.AddCommand(initCmd)
} }
// loadOrInitClient will build a new xxdk.E2e from existing storage // loadOrInitMessenger will build a new xxdk.E2e from existing storage
// or from a new storage that it will create if none already exists // or from a new storage that it will create if none already exists
func loadOrInitClient(password []byte, storeDir, regCode string, func loadOrInitMessenger(forceLegacy bool, password []byte, storeDir, regCode string,
cmixParams xxdk.CMIXParams, e2eParams xxdk.E2EParams) *xxdk.E2e { cmixParams xxdk.CMIXParams, e2eParams xxdk.E2EParams) *xxdk.E2e {
jww.INFO.Printf("Using normal sender") jww.INFO.Printf("Using normal sender")
...@@ -93,7 +93,12 @@ func loadOrInitClient(password []byte, storeDir, regCode string, ...@@ -93,7 +93,12 @@ func loadOrInitClient(password []byte, storeDir, regCode string,
jww.FATAL.Panicf("%+v", err) jww.FATAL.Panicf("%+v", err)
} }
identity, err = xxdk.MakeReceptionIdentity(net) if forceLegacy {
jww.INFO.Printf("Forcing legacy sender")
identity, err = xxdk.MakeLegacyReceptionIdentity(net)
} else {
identity, err = xxdk.MakeReceptionIdentity(net)
}
if err != nil { if err != nil {
jww.FATAL.Panicf("%+v", err) jww.FATAL.Panicf("%+v", err)
} }
......
...@@ -585,6 +585,7 @@ func initE2e(cmixParams xxdk.CMIXParams, e2eParams xxdk.E2EParams) *xxdk.E2e { ...@@ -585,6 +585,7 @@ func initE2e(cmixParams xxdk.CMIXParams, e2eParams xxdk.E2EParams) *xxdk.E2e {
storePassword := parsePassword(viper.GetString("password")) storePassword := parsePassword(viper.GetString("password"))
storeDir := viper.GetString("session") storeDir := viper.GetString("session")
regCode := viper.GetString("regcode") regCode := viper.GetString("regcode")
forceLegacy := viper.GetBool("force-legacy")
jww.DEBUG.Printf("sessionDir: %v", storeDir) jww.DEBUG.Printf("sessionDir: %v", storeDir)
// TODO: This probably shouldn't be initialized globally. // TODO: This probably shouldn't be initialized globally.
...@@ -602,7 +603,7 @@ func initE2e(cmixParams xxdk.CMIXParams, e2eParams xxdk.E2EParams) *xxdk.E2e { ...@@ -602,7 +603,7 @@ func initE2e(cmixParams xxdk.CMIXParams, e2eParams xxdk.E2EParams) *xxdk.E2e {
} else if backupPath != "" { } else if backupPath != "" {
messenger = loadOrInitBackup(backupPath, backupPass, storePassword, storeDir, cmixParams, e2eParams) messenger = loadOrInitBackup(backupPath, backupPass, storePassword, storeDir, cmixParams, e2eParams)
} else { } else {
messenger = loadOrInitClient(storePassword, storeDir, regCode, cmixParams, e2eParams) messenger = loadOrInitMessenger(forceLegacy, storePassword, storeDir, regCode, cmixParams, e2eParams)
} }
// Handle protoUser output // Handle protoUser output
...@@ -622,6 +623,9 @@ func initE2e(cmixParams xxdk.CMIXParams, e2eParams xxdk.E2EParams) *xxdk.E2e { ...@@ -622,6 +623,9 @@ func initE2e(cmixParams xxdk.CMIXParams, e2eParams xxdk.E2EParams) *xxdk.E2e {
// Handle backup output // Handle backup output
if backupOut := viper.GetString("backupOut"); backupOut != "" { if backupOut := viper.GetString("backupOut"); backupOut != "" {
if !forceLegacy {
jww.FATAL.Panicf("Unable to make backup for non-legacy sender!")
}
updateBackupCb := func(encryptedBackup []byte) { updateBackupCb := func(encryptedBackup []byte) {
jww.INFO.Printf("Backup update received, size %d", jww.INFO.Printf("Backup update received, size %d",
len(encryptedBackup)) len(encryptedBackup))
...@@ -1131,6 +1135,9 @@ func init() { ...@@ -1131,6 +1135,9 @@ func init() {
"ID to send message to (if below 40, will be precanned. Use "+ "ID to send message to (if below 40, will be precanned. Use "+
"'0x' or 'b64:' for hex and base64 representations)") "'0x' or 'b64:' for hex and base64 representations)")
viper.BindPFlag("destid", rootCmd.Flags().Lookup("destid")) viper.BindPFlag("destid", rootCmd.Flags().Lookup("destid"))
rootCmd.PersistentFlags().Bool("force-legacy", false,
"Force client to operate using legacy identities.")
viper.BindPFlag("force-legacy", rootCmd.PersistentFlags().Lookup("force-legacy"))
rootCmd.Flags().StringP("destfile", "", rootCmd.Flags().StringP("destfile", "",
"", "Read this contact file for the destination id") "", "Read this contact file for the destination id")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment