Files
story/internal/deviceauth/identity.go
T
Codex Local 0c2151ace9
ci / verify (push) Canceled after 0s
chore: checkpoint 第一版
2026-09-06 17:04:11 +08:00

28 lines
632 B
Go

package deviceauth
import "context"
type contextKey string
const identityKey contextKey = "device-identity"
type Identity struct {
ID string
PublicID string
TenantID string
Status string
ActivationState string
VoiceRuntime string
HardwareLicenseReady bool
CredentialRef string
}
func WithIdentity(ctx context.Context, identity Identity) context.Context {
return context.WithValue(ctx, identityKey, identity)
}
func FromContext(ctx context.Context) (Identity, bool) {
identity, ok := ctx.Value(identityKey).(Identity)
return identity, ok
}