Documentation
¶
Index ¶
- func AesGcmDecryptBase64String(key, nonce []byte, ciphertext string) (string, error)
- func AesGcmDecryptBytes(key, nonce, cipherBytes []byte) ([]byte, error)
- func AesGcmEncryptBase64String(key, nonce []byte, plaintext string) (string, error)
- func AesGcmEncryptBytes(key, nonce, plain []byte) ([]byte, error)
- func CheckIsModeAICC() bool
- func DecryptChatResponse(keyNonce []byte, response model.Response) error
- func DecryptChatStreamResponse(keyNonce []byte, response model.ChatCompletionStreamResponse) error
- func DeepCopyRequest(request model.CreateChatCompletionRequest) (model.CreateChatCompletionRequest, error)
- func ECDHMarshalBinary(pub *ecdsa.PublicKey) []byte
- func EncryptChatRequest(ctx context.Context, keyNonce []byte, ...) error
- func EncryptURL(urlString string, fn func(text string) (string, error)) (string, error)
- func GenerateKey(curve elliptic.Curve) (*ecdsa.PrivateKey, *ecdsa.PublicKey, error)
- func GetCertInfo(certPem string) (string, string, int64)
- func LoadLocalCertificate(model string) (string, error)
- func MarshalBinary(pub *ecdsa.PublicKey) []byte
- func NewHKDF(hash func() hash.Hash, secret, salt, info []byte) io.Reader
- func ProcessChatCompletionMessageContent(content *model.ChatCompletionMessageContent, ...) error
- func ProcessChatCompletionRequest(ctx context.Context, msgs []*model.ChatCompletionMessage, ...) error
- func ReadCertFromBytes(pemBytes []byte) (*x509.Certificate, error)
- func ReadCertFromString(pemString string) (*x509.Certificate, error)
- func ReadEcdsaPrivKeyFromBytes(pemBytes []byte) (*ecdsa.PrivateKey, error)
- func ReadEcdsaPrivKeyFromString(key string) (*ecdsa.PrivateKey, error)
- func SaveToLocalCertificate(model, certPem string) error
- func StringInSlice(str string, list []string) bool
- type KeyAgreementClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AesGcmDecryptBase64String ¶
AesGcmDecryptBase64String decrypt message(base64.std.string) using AES-GCM
func AesGcmDecryptBytes ¶
AesGcmDecryptBytes Decrypt message using AES-GCM
func AesGcmEncryptBase64String ¶
AesGcmEncryptBase64String Encrypt message from base64 string to string using AES-GCM
func AesGcmEncryptBytes ¶
AesGcmEncryptBytes encrypt message using AES-GCM
func CheckIsModeAICC ¶
func CheckIsModeAICC() bool
func DecryptChatStreamResponse ¶
func DecryptChatStreamResponse(keyNonce []byte, response model.ChatCompletionStreamResponse) error
func DeepCopyRequest ¶
func DeepCopyRequest(request model.CreateChatCompletionRequest) (model.CreateChatCompletionRequest, error)
func ECDHMarshalBinary ¶
func EncryptChatRequest ¶
func EncryptURL ¶
func GenerateKey ¶
GenerateKey is the constructor for Private-Public key pair
func LoadLocalCertificate ¶
func MarshalBinary ¶
func ProcessChatCompletionRequest ¶
func ProcessChatCompletionRequest(ctx context.Context, msgs []*model.ChatCompletionMessage, fn func(text string) (string, error)) error
ProcessChatCompletionRequest process chat completion request
func ReadCertFromBytes ¶
func ReadCertFromBytes(pemBytes []byte) (*x509.Certificate, error)
func ReadCertFromString ¶
func ReadCertFromString(pemString string) (*x509.Certificate, error)
func ReadEcdsaPrivKeyFromBytes ¶
func ReadEcdsaPrivKeyFromBytes(pemBytes []byte) (*ecdsa.PrivateKey, error)
func ReadEcdsaPrivKeyFromString ¶
func ReadEcdsaPrivKeyFromString(key string) (*ecdsa.PrivateKey, error)
func SaveToLocalCertificate ¶
func StringInSlice ¶
Types ¶
type KeyAgreementClient ¶
type KeyAgreementClient struct {
// contains filtered or unexported fields
}
func NewP256KeyAgreementClient ¶
func NewP256KeyAgreementClient(pemString string) (*KeyAgreementClient, error)
NewP256KeyAgreementClient Load cert and extract public key
func (*KeyAgreementClient) GenerateECIESKeyPair ¶
func (k *KeyAgreementClient) GenerateECIESKeyPair() ([]byte, string, error)
GenerateECIESKeyPair generate ECIES key pair and return the tuple (keyNonce, session token, error)
Click to show internal directories.
Click to hide internal directories.