mirror of
https://github.com/mautrix/signal.git
synced 2026-05-14 21:26:54 -04:00
Compare commits
1 commit
main
...
staticchec
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6892b7a751 |
4 changed files with 1 additions and 27 deletions
|
|
@ -20,7 +20,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/aes"
|
"crypto/aes"
|
||||||
"crypto/cipher"
|
"crypto/cipher"
|
||||||
"crypto/rand"
|
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
@ -300,22 +299,6 @@ func decryptString(key *libsignalgo.ProfileKey, encryptedText []byte) (string, e
|
||||||
return string(data), err
|
return string(data), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func encryptString(key libsignalgo.ProfileKey, plaintext string, paddedLength int) ([]byte, error) {
|
|
||||||
inputLength := len(plaintext)
|
|
||||||
if inputLength > paddedLength {
|
|
||||||
return nil, errors.New("plaintext longer than paddedLength")
|
|
||||||
}
|
|
||||||
padded := append([]byte(plaintext), make([]byte, paddedLength-inputLength)...)
|
|
||||||
nonce := make([]byte, NONCE_LENGTH)
|
|
||||||
rand.Read(nonce)
|
|
||||||
keyBytes := key[:]
|
|
||||||
ciphertext, err := AesgcmEncrypt(keyBytes, nonce, padded)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return append(nonce, ciphertext...), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
const NONCE_LENGTH = 12
|
const NONCE_LENGTH = 12
|
||||||
const TAG_LENGTH_BYTES = 16
|
const TAG_LENGTH_BYTES = 16
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -303,11 +303,6 @@ type GroupMessageSendResult struct {
|
||||||
FailedToSendTo []FailedSendResult
|
FailedToSendTo []FailedSendResult
|
||||||
}
|
}
|
||||||
|
|
||||||
func contentFromDataMessage(dataMessage *signalpb.DataMessage) *signalpb.Content {
|
|
||||||
return &signalpb.Content{
|
|
||||||
DataMessage: dataMessage,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
func syncMessageFromGroupDataMessage(dataMessage *signalpb.DataMessage, results []SuccessfulSendResult) *signalpb.Content {
|
func syncMessageFromGroupDataMessage(dataMessage *signalpb.DataMessage, results []SuccessfulSendResult) *signalpb.Content {
|
||||||
unidentifiedStatuses := []*signalpb.SyncMessage_Sent_UnidentifiedDeliveryStatus{}
|
unidentifiedStatuses := []*signalpb.SyncMessage_Sent_UnidentifiedDeliveryStatus{}
|
||||||
for _, result := range results {
|
for _, result := range results {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"regexp"
|
"regexp"
|
||||||
"sync"
|
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
|
|
@ -191,8 +190,6 @@ type Puppet struct {
|
||||||
|
|
||||||
customIntent *appservice.IntentAPI
|
customIntent *appservice.IntentAPI
|
||||||
customUser *User
|
customUser *User
|
||||||
|
|
||||||
syncLock sync.Mutex
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var userIDRegex *regexp.Regexp
|
var userIDRegex *regexp.Regexp
|
||||||
|
|
|
||||||
3
user.go
3
user.go
|
|
@ -163,8 +163,7 @@ type User struct {
|
||||||
|
|
||||||
Client *signalmeow.Client
|
Client *signalmeow.Client
|
||||||
|
|
||||||
BridgeState *bridge.BridgeStateQueue
|
BridgeState *bridge.BridgeStateQueue
|
||||||
bridgeStateLock sync.Mutex
|
|
||||||
|
|
||||||
spaceMembershipChecked bool
|
spaceMembershipChecked bool
|
||||||
spaceCreateLock sync.Mutex
|
spaceCreateLock sync.Mutex
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue