27 lines
1007 B
Go
27 lines
1007 B
Go
package model
|
||
|
||
import (
|
||
"time"
|
||
|
||
core "git.yuntuo.hk/k2safe/orbit/model"
|
||
)
|
||
|
||
// Credential 表示命名空间凭据,只保存秘密摘要和授权范围。
|
||
// 对应表 orbit_credentials;这是服务端持久化模型,不直接作为 API 响应。
|
||
type Credential struct {
|
||
// Record 包含命名空间、记录标识、并发版本和 UTC 时间。
|
||
core.Record
|
||
// Name 可读名称,唯一性范围由对应数据表约束。
|
||
Name string `db:"name"`
|
||
// SecretDigest 凭据秘密的 SHA-256 摘要,不保存或输出原文。
|
||
SecretDigest core.Digest `db:"secret_digest"`
|
||
// Permissions 授权范围的 JSON 快照,必须由服务端解释和校验。
|
||
Permissions core.JSON `db:"permissions"`
|
||
// ExpiresAt 凭据过期时间,统一 UTC;为空表示没有配置到期时间。
|
||
ExpiresAt *time.Time `db:"expires_at"`
|
||
// RevokedAt 撤销时间;为空表示尚未撤销。
|
||
RevokedAt *time.Time `db:"revoked_at"`
|
||
}
|
||
|
||
func (Credential) TableName() string { return "orbit_credentials" }
|