Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 69f0541

Browse files
Fix registration
1 parent 54d322b commit 69f0541

File tree

7 files changed

+17
-5
lines changed

7 files changed

+17
-5
lines changed

cmd/textsecure/.config/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
tel: "+1771111001"
33

44
#Server URL
5-
server: https://textsecure-service.whispersystems.org:443
5+
server: https://chat.signal.org:443
66

77
#Server's TLS root certificate path when using a non-default server
88
#See https://github.com/janimo/textsecure-docker#using-https

config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func loadConfig() (*config.Config, error) {
9090
}
9191

9292
if cfg.Server == "" {
93-
cfg.Server = "https://textsecure-service.whispersystems.org:443"
93+
cfg.Server = "https://chat.signal.org:443"
9494
}
9595

9696
if cfg.VerificationType == "" {

crayfish/messages.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ type CrayfishWebSocketRequest_VERIFY_REGISTER_MESSAGE struct {
1212
Number string `json:"number"`
1313
Password string `json:"password"`
1414
SignalingKey [52]byte `json:"signaling_key"`
15+
Name string `json:"name"`
1516
}
1617

1718
type CrayfishWebSocketRequestMessageTyp_SEALED_SESSION_DECRYPT_Message struct {

crayfish/register.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func (c *CrayfishInstance) CrayfishRegisterWithCode(registrationInfo *registrati
5353
Code: codeInt,
5454
SignalingKey: signalingKey,
5555
Password: registrationInfo.Password,
56+
Name: registrationInfo.Name,
5657
}
5758
requestVerifyType := CrayfishWebSocketRequestMessageTyp_VERIFY_REGISTRATION
5859
verificationRequest := &CrayfishWebSocketRequestMessage{

profiles/profile.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,11 @@ func GetProfileAndCredential(UUID string, profileKey []byte) (*Profile, error) {
203203
if len(profileKey) == 0 {
204204
return nil, errors.New("profileKey is empty")
205205
}
206+
if (len(UUID) == 0) || (UUID == "00000000-0000-0000-0000-000000000000") {
207+
return nil, errors.New("UUID is empty")
208+
}
206209

207-
log.Infoln("[textsecure] GetProfileAndCredential for " + UUID)
210+
log.Infoln("[textsecure] GetProfileAndCredential for" + UUID)
208211
uuid, err := uuidUtil.FromString(UUID)
209212
if err != nil {
210213
log.Debugln("[textsecure] GetProfileAndCredential", err)

registration/registration.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type RegistrationInfo struct {
2323
RegistrationID uint32
2424
SignalingKey []byte
2525
CaptchaToken string
26+
Name string
2627
}
2728

2829
var Registration RegistrationInfo

textsecure.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ var (
236236
// and environment variables
237237
func setupLogging() {
238238
loglevel := config.ConfigFile.LogLevel
239-
if loglevel == "" {
239+
if loglevel == "" || os.Getenv("TEXTSECURE_LOGLEVEL") != "" {
240240
loglevel = os.Getenv("TEXTSECURE_LOGLEVEL")
241241
}
242242
fmt.Printf("INFO[0000] [textsecure] Setting log level to %s\n", loglevel)
@@ -250,7 +250,7 @@ func setupLogging() {
250250
case "ERROR":
251251
log.SetLevel(log.ErrorLevel)
252252
default:
253-
log.SetLevel(log.ErrorLevel)
253+
log.SetLevel(log.InfoLevel)
254254
}
255255

256256
log.SetFormatter(&log.TextFormatter{
@@ -408,6 +408,8 @@ func registerDevice() error {
408408
client.GetConfig()
409409
phoneNumber := client.GetPhoneNumber()
410410
captcha := client.GetCaptchaToken()
411+
name := client.GetUsername()
412+
registration.Registration.Name = name
411413
err = RegisterWithCrayfish(&registration.Registration, phoneNumber, captcha)
412414
if err != nil {
413415
log.Errorln("[textsecure] Crayfish registration failed", err)
@@ -421,6 +423,7 @@ func registerDevice() error {
421423
}
422424
config.ConfigFile.Tel = crayfishRegistration.Tel
423425
config.ConfigFile.UUID = crayfishRegistration.UUID
426+
config.ConfigFile.Name = name
424427
config.ConfigFile.AccountCapabilities = config.AccountCapabilities{
425428
// Uuid: false,
426429
Gv2: true,
@@ -432,6 +435,9 @@ func registerDevice() error {
432435
}
433436

434437
err = saveConfig(config.ConfigFile)
438+
if err != nil {
439+
return err
440+
}
435441
log.Debugln("[textsecure] Crayfish registration done")
436442
transport.SetupTransporter(config.ConfigFile.Server, config.ConfigFile.UUID, registration.Registration.Password, config.ConfigFile.UserAgent, config.ConfigFile.ProxyServer)
437443

0 commit comments

Comments
 (0)