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
+24
View File
@@ -0,0 +1,24 @@
package ed25519
import (
"crypto/ed25519"
"errors"
)
var ErrInvalidParams = errors.New("ed25519: invalid params")
func ValidateSignature(key, data, signature []byte) bool {
if len(key) != ed25519.PublicKeySize || len(signature) != ed25519.SignatureSize {
return false
}
return ed25519.Verify(key, data, signature)
}
func Signature(key, data []byte) ([]byte, error) {
if len(key) != ed25519.PrivateKeySize {
return nil, ErrInvalidParams
}
return ed25519.Sign(key, data), nil
}