Merge pull request 'tag unpassworded users' (#62) from tagPass into trunk
continuous-integration/drone/push Build is passing Details

Reviewed-on: #62
This commit is contained in:
Sarah Jamie Lewis 2021-06-21 15:14:46 -07:00
commit b37f283fe3
2 changed files with 13 additions and 3 deletions

5
constants/globals.go Normal file
View File

@ -0,0 +1,5 @@
package constants
// We offer "un-passworded" profiles but our storage encrypts everything with a password. We need an agreed upon
// password to use in that case, that the app case use behind the scenes to password and unlock with
const DefactoPasswordForUnencryptedProfiles = "be gay do crime"

11
lib.go
View File

@ -12,6 +12,7 @@ import (
"cwtch.im/cwtch/peer"
"encoding/json"
"fmt"
"git.openprivacy.ca/flutter/libcwtch-go/constants"
contact "git.openprivacy.ca/flutter/libcwtch-go/features/contacts"
"git.openprivacy.ca/flutter/libcwtch-go/features/groups"
"git.openprivacy.ca/flutter/libcwtch-go/utils"
@ -91,7 +92,7 @@ func _startCwtch(appDir string, torPath string) {
// Ensure that the application directory exists...and then initialize settings..
os.MkdirAll(path.Join(appDir), 0700)
utils.InitGlobalSettingsFile(appDir, "be gay do crime")
utils.InitGlobalSettingsFile(appDir, constants.DefactoPasswordForUnencryptedProfiles)
log.Infof("Loading Cwtch Directory %v and tor path: %v", appDir, torPath)
@ -143,7 +144,7 @@ func _startCwtch(appDir string, torPath string) {
settings := utils.ReadGlobalSettings()
settingsJson, _ := json.Marshal(settings)
newApp.LoadProfiles("be gay do crime")
newApp.LoadProfiles(constants.DefactoPasswordForUnencryptedProfiles)
application = newApp
// Send global settings to the UI...
@ -351,7 +352,11 @@ func c_CreateProfile(nick_ptr *C.char, nick_len C.int, pass_ptr *C.char, pass_le
}
func CreateProfile(nick, pass string) {
application.CreatePeer(nick, pass)
if pass == constants.DefactoPasswordForUnencryptedProfiles {
application.CreateTaggedPeer(nick, pass, constants.ProfileTypeV1DefaultPassword)
} else {
application.CreateTaggedPeer(nick, pass, constants.ProfileTypeV1Password)
}
}
//export c_LoadProfiles