package platform import "time" type Role string const ( RoleAdmin Role = "admin" RoleReseller Role = "reseller" RoleCustomer Role = "customer" ) type User struct { ID string `json:"id"` Username string `json:"username"` DisplayName string `json:"displayName"` Role Role `json:"role"` ParentUserID string `json:"parentUserId,omitempty"` PasswordHash string `json:"passwordHash"` Active bool `json:"active"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` } type KeySet struct { IssuerKeyID string `json:"issuerKeyId"` IssuerPublicKey string `json:"issuerPublicKey"` IssuerPrivateCipher string `json:"issuerPrivateCipher"` LeaseKeyID string `json:"leaseKeyId"` LeasePublicKey string `json:"leasePublicKey"` LeasePrivateCipher string `json:"leasePrivateCipher"` CreatedAt int64 `json:"createdAt"` } type LicenseRecord struct { LicenseID string `json:"licenseId"` TokenCipher string `json:"tokenCipher"` TokenHash string `json:"tokenHash"` Issuer string `json:"issuer"` Customer string `json:"customer"` CustomerUserID string `json:"customerUserId,omitempty"` IssuedByUserID string `json:"issuedByUserId"` Product string `json:"product"` Edition string `json:"edition"` Features []string `json:"features,omitempty"` Limits map[string]int64 `json:"limits,omitempty"` Domains []string `json:"domains,omitempty"` InstanceIDs []string `json:"instanceIds,omitempty"` Mode string `json:"mode"` ServerURL string `json:"serverUrl,omitempty"` ExpiresAt int64 `json:"expiresAt"` Revoked bool `json:"revoked"` RevocationReason string `json:"revocationReason,omitempty"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` } type Session struct { IDHash string `json:"idHash"` UserID string `json:"userId"` CSRFToken string `json:"csrfToken"` ExpiresAt int64 `json:"expiresAt"` CreatedAt int64 `json:"createdAt"` } type AuditEvent struct { ID string `json:"id"` ActorID string `json:"actorId,omitempty"` Action string `json:"action"` Target string `json:"target,omitempty"` Detail string `json:"detail,omitempty"` RemoteIP string `json:"remoteIp,omitempty"` CreatedAt int64 `json:"createdAt"` } type document struct { Version int `json:"version"` Keys *KeySet `json:"keys,omitempty"` Users map[string]User `json:"users"` Licenses map[string]LicenseRecord `json:"licenses"` Sessions map[string]Session `json:"sessions"` Audit []AuditEvent `json:"audit"` } func unixNow() int64 { return time.Now().UTC().Unix() }