Total rework HAP pkg and HomeKit source

This commit is contained in:
Alexey Khit
2023-07-23 22:22:36 +03:00
parent d73e9f6bcf
commit 6d82b1ce89
31 changed files with 2074 additions and 2015 deletions
+18
View File
@@ -0,0 +1,18 @@
package curve25519
import (
"crypto/rand"
"golang.org/x/crypto/curve25519"
)
func GenerateKeyPair() ([]byte, []byte) {
var publicKey, privateKey [32]byte
_, _ = rand.Read(privateKey[:])
curve25519.ScalarBaseMult(&publicKey, &privateKey)
return publicKey[:], privateKey[:]
}
func SharedSecret(privateKey, otherPublicKey []byte) ([]byte, error) {
return curve25519.X25519(privateKey, otherPublicKey)
}