feat: establish NekoNest Cloud control and relay

This commit is contained in:
2026-08-12 23:25:43 +08:00
commit f27606b709
222 changed files with 71456 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
package tenantstore
import (
"crypto/rand"
"crypto/sha256"
"encoding/hex"
"encoding/json"
)
func generateToken() string {
b := make([]byte, 32)
if _, err := rand.Read(b); err != nil {
return ""
}
return hex.EncodeToString(b)
}
func hashToken(token string) string {
h := sha256.Sum256([]byte(token))
return hex.EncodeToString(h[:])
}
func marshalJSON(v any) ([]byte, error) {
return json.Marshal(v)
}
func unmarshalJSON(data []byte, v any) error {
return json.Unmarshal(data, v)
}