2023-11-08 07:33:19 +00:00
|
|
|
package client
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"crypto/ecdh"
|
|
|
|
|
"encoding/base64"
|
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
|
|
"github.com/AYM1607/ccclip/pkg/crypto"
|
|
|
|
|
)
|
|
|
|
|
|
2025-05-10 13:59:51 -07:00
|
|
|
const serverPublicKeyB64 = "Dg6HYJ8aoQOOzGqOCw4J7tnT+QHkokjfdeWM8ktwnks="
|
2023-11-08 07:33:19 +00:00
|
|
|
|
|
|
|
|
var serverPublicKey *ecdh.PublicKey
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
pkeyBytes := make([]byte, crypto.KeySize)
|
|
|
|
|
_, err := base64.StdEncoding.Decode(pkeyBytes, []byte(serverPublicKeyB64))
|
|
|
|
|
if err != nil {
|
|
|
|
|
panic(fmt.Sprintf("cannot decode server public key: %s", err.Error()))
|
|
|
|
|
}
|
|
|
|
|
serverPublicKey = crypto.PublicKeyFromBytes(pkeyBytes)
|
|
|
|
|
}
|