1
0
mirror of https://github.com/fumiama/tienyik.git synced 2026-06-18 08:18:59 +08:00

feat: add log & supporting packages

This commit is contained in:
源文雨
2025-10-30 23:23:45 +08:00
parent 617fc662c5
commit 15fcc9a338
19 changed files with 672 additions and 12 deletions

29
api/auth/client.go Normal file
View File

@@ -0,0 +1,29 @@
package auth
import (
"bytes"
"github.com/fumiama/tienyik/internal/hcli"
"github.com/fumiama/tienyik/internal/hson"
"github.com/fumiama/tienyik/internal/textio"
)
type RequestNegotiationEncKey struct {
CertData string `json:"certData"`
CertType string `json:"certType"`
Etype string `json:"etype"`
}
type ResponseNegotiationEncKey struct {
EncData string `json:"encData"`
EncKey string `json:"encKey"`
}
func NegotiationEncKey(r *RequestNegotiationEncKey) (*ResponseNegotiationEncKey, error) {
resp, err := hcli.Post(textio.API(), bytes.NewReader(hson.Marshal(nil, r)))
if err != nil {
return nil, err
}
defer resp.Body.Close()
return hson.Unmarshal[*ResponseNegotiationEncKey](nil, resp.Body)
}