iam

package
v1.5.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package iam is the canonical import path for Hanzo IAM client types and helpers. Downstream services should import:

import "github.com/hanzoai/base/iam"

and use iam.Client / iam.User / iam.NewClient. The implementation lives in plugins/platform; this package is the stable, brand-neutral surface.

One way to talk to IAM. Type aliases — not copies — so plugins/platform and iam are interchangeable at the type level: a *platform.IAMClient IS an *iam.Client.

Index

Constants

This section is empty.

Variables

ExchangeOAuth2 exchanges an authorization code for access + refresh tokens via the IAM OAuth2 token endpoint.

NewClient constructs a Client pointed at the given IAM base URL. Empty baseURL defaults to https://hanzo.id. Trailing slashes are trimmed.

View Source
var NewClientWithCache = platform.NewIAMClientWithCache

NewClientWithCache constructs a Client with a custom cache capacity. Use this when the default 10,000-entry cache is the wrong size — large gateways or low-memory edge nodes.

View Source
var ValidateToken = platform.ValidateIAMToken

ValidateToken validates a bearer token against IAM userinfo without caching. Prefer Client.ValidateToken for production use.

Functions

func IsAPIKey

func IsAPIKey(token string) bool

IsAPIKey reports whether token is any IAM API key (pk-/sk-/hk-).

func IsAnalytics

func IsAnalytics(token string) bool

IsAnalytics reports whether token is an insights (hi-) or analytics (ha-) key.

func IsPublishable

func IsPublishable(token string) bool

IsPublishable reports whether token has the publishable key prefix (pk-).

func IsSecret

func IsSecret(token string) bool

IsSecret reports whether token has the secret key prefix (sk-).

func IsWidget

func IsWidget(token string) bool

IsWidget reports whether token is a widget embed key (hz-).

Types

type AdminCreds

type AdminCreds = platform.AdminCreds

AdminCreds are the service-level IAM application credentials used by server-to-server methods (LookupByAttribute, EnsureUser).

type Client

type Client = platform.IAMClient

Client talks to a Hanzo IAM instance with token caching.

type Config

type Config = platform.PlatformConfig

Config is the platform configuration required by ValidateToken / ExchangeOAuth2.

type EnsureUserSpec

type EnsureUserSpec = platform.EnsureUserSpec

EnsureUserSpec describes a user to provision idempotently via EnsureUser.

type Key

type Key = platform.IAMKey

Key is an API key record from IAM's Key table.

type User

type User = platform.IAMUser

User is an authenticated user record from Hanzo IAM.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL