chore: establish local platform baseline
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package deviceauth
|
||||
|
||||
import "context"
|
||||
|
||||
type contextKey string
|
||||
|
||||
const identityKey contextKey = "device-identity"
|
||||
|
||||
type Identity struct {
|
||||
ID string
|
||||
PublicID string
|
||||
TenantID string
|
||||
Status string
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user