E2EE Key Exchange

This commit is contained in:
2024-05-09 23:35:13 +08:00
parent 18a4321685
commit 3ba152252e
8 changed files with 229 additions and 59 deletions

21
pkg/models/unified.go Normal file
View File

@ -0,0 +1,21 @@
package models
import jsoniter "github.com/json-iterator/go"
type UnifiedCommand struct {
Action string `json:"w"`
Message string `json:"m"`
Payload any `json:"p"`
}
func UnifiedCommandFromError(err error) UnifiedCommand {
return UnifiedCommand{
Action: "error",
Message: err.Error(),
}
}
func (v UnifiedCommand) Marshal() []byte {
data, _ := jsoniter.Marshal(v)
return data
}