forked from signal-golang/textsecure
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlink.go
More file actions
35 lines (30 loc) · 665 Bytes
/
link.go
File metadata and controls
35 lines (30 loc) · 665 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) 2020 Aaron Kimmig
// Licensed under the GPLv3, see the COPYING file for details.
package textsecure
import (
"time"
log "github.com/sirupsen/logrus"
)
var code2 string
// AddNewLinkedDevice adds a new signal desktop client
func AddNewLinkedDevice(uuid string, publicKey string) error {
log.Printf("AddNewLinkedDevice")
if code2 == "" {
code, err := getNewDeviceVerificationCode()
if err != nil {
return err
}
code2 = code
}
err := addNewDevice(uuid, publicKey, code2)
if err != nil {
log.Errorf(err.Error())
return err
}
timer := time.NewTimer(10 * time.Second)
go func() {
<-timer.C
code2 = ""
}()
return nil
}