4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-07-03 14:17:45 +00:00

Update dependencies and remove old matterclient lib (#2067)

This commit is contained in:
Wim
2023-08-05 20:43:19 +02:00
committed by GitHub
parent 9459495484
commit 56e7bd01ca
772 changed files with 139315 additions and 121315 deletions

View File

@ -8,11 +8,10 @@
package keys
import (
"crypto/rand"
"fmt"
"go.mau.fi/libsignal/ecc"
"golang.org/x/crypto/curve25519"
"go.mau.fi/whatsmeow/util/randbytes"
)
type KeyPair struct {
@ -32,12 +31,7 @@ func NewKeyPairFromPrivateKey(priv [32]byte) *KeyPair {
}
func NewKeyPair() *KeyPair {
var priv [32]byte
_, err := rand.Read(priv[:])
if err != nil {
panic(fmt.Errorf("failed to generate curve25519 private key: %w", err))
}
priv := *(*[32]byte)(randbytes.Make(32))
priv[0] &= 248
priv[31] &= 127

View File

@ -0,0 +1,15 @@
package randbytes
import (
"crypto/rand"
"fmt"
)
func Make(length int) []byte {
random := make([]byte, length)
_, err := rand.Read(random)
if err != nil {
panic(fmt.Errorf("failed to get random bytes: %w", err))
}
return random
}