Documentation
¶
Overview ¶
Package remote is the AuthKit remote SDK: a Go client that talks to a standalone AuthKit server's management API over HTTP and satisfies the SAME authkit.Client contract an in-process embedded.Client does (#142), so a host swaps embedded↔remote with one construction line:
var c authkit.Client c, _ = embedded.New(cfg, pg) // in-process c, _ = remote.New(baseURL, token) // standalone, over HTTP c.CreateUser(ctx, "a@b.com", "alice")
Transport: every method marshals its arguments to the management API's generic POST /v1/call/{Method} contract (see authkit/server) and decodes {"result": ...}. Argument/result structs are shared with the server package (etcd's api/v3 model), so the two transports cannot drift. AuthKit sentinel errors are re-derived from the wire via authkit.ErrorForCode, so errors.Is(err, authkit.ErrX) holds across the network. Lean: net/http + encoding/json + the authkit contract only — no engine, no pgx.
Index ¶
- type Client
- func (c *Client) AdminCountUsers(ctx context.Context, opts authkit.AdminUserListOptions) (int64, error)
- func (c *Client) AdminGetUser(ctx context.Context, id string) (*authkit.AdminUser, error)
- func (c *Client) AdminListUserSessions(ctx context.Context, userID string) ([]authkit.Session, error)
- func (c *Client) AdminListUsers(ctx context.Context, opts authkit.AdminUserListOptions) (*authkit.AdminListUsersResult, error)
- func (c *Client) AdminRevokeUserSessions(ctx context.Context, userID string) error
- func (c *Client) AdminSetPassword(ctx context.Context, userID string, new string) error
- func (c *Client) ApplyBootstrapManifest(ctx context.Context, manifest authkit.BootstrapManifest, ...) (authkit.BootstrapManifestResult, error)
- func (c *Client) AssignGroupRole(ctx context.Context, persona string, instanceSlug string, subjectID string, ...) error
- func (c *Client) AssignGroupRoleAs(ctx context.Context, actorUserID string, persona string, instanceSlug string, ...) error
- func (c *Client) AssignRoleBySlug(ctx context.Context, userID string, slug string) error
- func (c *Client) AssignRoleBySlugAs(ctx context.Context, actorUserID string, userID string, slug string) error
- func (c *Client) BanUser(ctx context.Context, userID string, reason *string, until *time.Time, ...) error
- func (c *Client) Can(ctx context.Context, subjectID string, subjectKind string, persona string, ...) (bool, error)
- func (c *Client) ChangePassword(ctx context.Context, userID string, current string, new string, ...) error
- func (c *Client) CheckSMSHealth(ctx context.Context) error
- func (c *Client) CleanupExpiredAuthState(ctx context.Context) error
- func (c *Client) ClearPasswordlessCodeAttempts(ctx context.Context, identifier string)
- func (c *Client) ConfirmPasswordlessCode(ctx context.Context, identifier string, code string) (authkit.PasswordlessConfirmResult, error)
- func (c *Client) ConfirmPasswordlessToken(ctx context.Context, token string) (authkit.PasswordlessConfirmResult, error)
- func (c *Client) CreateGroupInviteLink(ctx context.Context, req authkit.CreateGroupInviteLinkRequest) (authkit.GroupInviteLinkCreated, error)
- func (c *Client) CreatePermissionGroup(ctx context.Context, req authkit.CreatePermissionGroupRequest) (string, error)
- func (c *Client) CreateUser(ctx context.Context, email string, username string) (*authkit.User, error)
- func (c *Client) DeleteRemoteApplication(ctx context.Context, issuer string) error
- func (c *Client) EnsureRootGroup(ctx context.Context) (string, error)
- func (c *Client) ExchangeRefreshToken(ctx context.Context, refreshToken string, ua string, ip net.IP) (string, time.Time, string, error)
- func (c *Client) ExternalInvitesEnabled() bool
- func (c *Client) GetEmailByUserID(ctx context.Context, id string) (string, error)
- func (c *Client) GetProviderUsername(ctx context.Context, userID string, provider string) (string, error)
- func (c *Client) GetRemoteApplication(ctx context.Context, issuer string) (*authkit.RemoteApplication, error)
- func (c *Client) GetUserByEmail(ctx context.Context, email string) (*authkit.User, error)
- func (c *Client) GetUserByPhone(ctx context.Context, phone string) (*authkit.User, error)
- func (c *Client) GetUserBySolanaAddress(ctx context.Context, address string) (*authkit.User, error)
- func (c *Client) GetUserByUsername(ctx context.Context, username string) (*authkit.User, error)
- func (c *Client) GetUserMetadata(ctx context.Context, userID string) (map[string]any, error)
- func (c *Client) HardDeleteUser(ctx context.Context, userID string) error
- func (c *Client) HasEmailSender() bool
- func (c *Client) HasSMSSender() bool
- func (c *Client) ImportUsers(ctx context.Context, inputs []authkit.ImportUserInput) (authkit.ImportUsersResult, error)
- func (c *Client) IsUserAllowed(ctx context.Context, userID string) (bool, error)
- func (c *Client) IssueAccessToken(ctx context.Context, userID string, email string, extra map[string]any) (string, time.Time, error)
- func (c *Client) LinkProvider(ctx context.Context, userID string, provider string, subject string, ...) error
- func (c *Client) LinkProviderByIssuer(ctx context.Context, userID string, issuer string, providerSlug string, ...) error
- func (c *Client) ListAPIKeys(ctx context.Context, persona string, instanceSlug string) ([]authkit.APIKey, error)
- func (c *Client) ListEffectivePermissions(ctx context.Context, subjectID string, subjectKind string, persona string, ...) ([]string, error)
- func (c *Client) ListEntitlements(ctx context.Context, userID string) []string
- func (c *Client) ListGroupInviteLinks(ctx context.Context, persona string, instanceSlug string) ([]authkit.GroupInviteLink, error)
- func (c *Client) ListGroupMembers(ctx context.Context, persona string, instanceSlug string) ([]authkit.GroupMember, error)
- func (c *Client) ListRemoteApplications(ctx context.Context, activeOnly bool) ([]authkit.RemoteApplication, error)
- func (c *Client) ListRoleSlugsByUser(ctx context.Context, userID string) []string
- func (c *Client) ListRoleSlugsByUserErr(ctx context.Context, userID string) ([]string, error)
- func (c *Client) ListSubjectGroups(ctx context.Context, subjectID string, subjectKind string) ([]authkit.SubjectGroupMembership, error)
- func (c *Client) ListUserSessions(ctx context.Context, userID string) ([]authkit.Session, error)
- func (c *Client) ListUsersDeletedBefore(ctx context.Context, cutoff time.Time, limit int) ([]string, error)
- func (c *Client) MintAPIKey(ctx context.Context, persona string, instanceSlug string, name string, ...) (authkit.APIKey, string, error)
- func (c *Client) MintAPIKeyWithOptions(ctx context.Context, persona string, instanceSlug string, ...) (authkit.APIKey, string, error)
- func (c *Client) MintCustomJWT(ctx context.Context, opts authkit.CustomJWTMintOptions) (string, error)
- func (c *Client) MintDelegatedAccessToken(ctx context.Context, p authkit.DelegatedAccessParams) (string, error)
- func (c *Client) MintRemoteApplicationAccessToken(ctx context.Context, p authkit.RemoteApplicationAccessParams) (string, error)
- func (c *Client) MintServiceJWT(ctx context.Context, opts authkit.ServiceJWTMintOptions) (string, authkit.ServiceJWTClaims, error)
- func (c *Client) PatchUserMetadata(ctx context.Context, userID string, patch map[string]any) error
- func (c *Client) RecordFailedPasswordlessCode(ctx context.Context, identifier string)
- func (c *Client) RedeemGroupInviteLink(ctx context.Context, code string, redeemerUserID string) (authkit.RedeemGroupInviteLinkResult, error)
- func (c *Client) RemoveGroupSubjectAs(ctx context.Context, actorUserID string, persona string, instanceSlug string, ...) error
- func (c *Client) RemoveRoleBySlug(ctx context.Context, userID string, slug string) error
- func (c *Client) RemoveRoleBySlugAs(ctx context.Context, actorUserID string, userID string, slug string) error
- func (c *Client) ResolveAPIKey(ctx context.Context, keyID string, secret string) (string, []string, error)
- func (c *Client) ResolveAPIKeyWithResources(ctx context.Context, keyID string, secret string) (authkit.ResolvedAPIKey, error)
- func (c *Client) ResolveGroupIDForSlug(ctx context.Context, persona string, instanceSlug string) (string, error)
- func (c *Client) ResolveRemoteAppAttributeDef(ctx context.Context, appID string, key string, version int32) (*authkit.RemoteAppAttributeDef, error)
- func (c *Client) ResolveRemoteApplicationAuthority(ctx context.Context, appID string) ([]string, error)
- func (c *Client) RestoreUser(ctx context.Context, id string) error
- func (c *Client) RevokeAPIKey(ctx context.Context, persona string, instanceSlug string, tokenID string) (bool, error)
- func (c *Client) RevokeAllSessions(ctx context.Context, userID string, keepSessionID *string) error
- func (c *Client) RevokeGroupInviteLink(ctx context.Context, persona string, instanceSlug string, linkID string) error
- func (c *Client) SMSAvailable() bool
- func (c *Client) SeedPermissionGroupContainment(ctx context.Context) error
- func (c *Client) SetEmailVerified(ctx context.Context, id string, v bool) error
- func (c *Client) SoftDeleteUser(ctx context.Context, id string) error
- func (c *Client) StartPasswordless(ctx context.Context, req authkit.PasswordlessStartRequest) (authkit.PasswordlessStartResult, error)
- func (c *Client) TimeUntilUsernameRenameAvailable(ctx context.Context, userID string, now time.Time) (int64, error)
- func (c *Client) UnassignGroupRoleAs(ctx context.Context, actorUserID string, persona string, instanceSlug string, ...) error
- func (c *Client) UnbanUser(ctx context.Context, userID string) error
- func (c *Client) UnlinkProvider(ctx context.Context, userID string, provider string) error
- func (c *Client) UpdateBiography(ctx context.Context, id string, bio *string) error
- func (c *Client) UpdateEmail(ctx context.Context, id string, email string) error
- func (c *Client) UpdateImportedUser(ctx context.Context, userID string, input authkit.ImportUserInput) (*authkit.User, error)
- func (c *Client) UpdateUsername(ctx context.Context, id string, username string) error
- func (c *Client) UpsertPasswordHash(ctx context.Context, userID string, hash string, algo string, params []byte) error
- func (c *Client) UpsertRemoteApplication(ctx context.Context, in authkit.RemoteApplication) (*authkit.RemoteApplication, error)
- func (c *Client) UpsertRoleBySlug(ctx context.Context, name string, slug string, description *string) error
- func (c *Client) UsersByIDs(ctx context.Context, ids []string) ([]authkit.UserRef, error)
- func (c *Client) ValidateVerificationConfiguration() error
- func (c *Client) VerifyUserPassword(ctx context.Context, userID string, pass string) bool
- func (c *Client) WithHTTPClient(hc *http.Client) *Client
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a remote-backed AuthKit client. It satisfies authkit.Client; the compile-time assertion lives in conformance.go.
func New ¶
New builds a remote client for the management API at baseURL, authenticating with a static bearer token (the app→server credential; "" = none).
func (*Client) AdminCountUsers ¶ added in v0.70.0
func (*Client) AdminGetUser ¶ added in v0.70.0
func (*Client) AdminListUserSessions ¶ added in v0.70.0
func (*Client) AdminListUsers ¶ added in v0.70.0
func (c *Client) AdminListUsers(ctx context.Context, opts authkit.AdminUserListOptions) (*authkit.AdminListUsersResult, error)
func (*Client) AdminRevokeUserSessions ¶ added in v0.70.0
func (*Client) AdminSetPassword ¶ added in v0.70.0
func (*Client) ApplyBootstrapManifest ¶ added in v0.70.0
func (c *Client) ApplyBootstrapManifest(ctx context.Context, manifest authkit.BootstrapManifest, opts authkit.BootstrapReconcileOptions) (authkit.BootstrapManifestResult, error)
func (*Client) AssignGroupRole ¶ added in v0.70.0
func (*Client) AssignGroupRoleAs ¶ added in v0.70.0
func (*Client) AssignRoleBySlug ¶ added in v0.70.0
func (*Client) AssignRoleBySlugAs ¶ added in v0.70.0
func (*Client) ChangePassword ¶ added in v0.70.0
func (*Client) CheckSMSHealth ¶ added in v0.70.0
func (*Client) CleanupExpiredAuthState ¶ added in v0.70.0
func (*Client) ClearPasswordlessCodeAttempts ¶ added in v0.70.0
func (*Client) ConfirmPasswordlessCode ¶ added in v0.70.0
func (*Client) ConfirmPasswordlessToken ¶ added in v0.70.0
func (*Client) CreateGroupInviteLink ¶ added in v0.70.0
func (c *Client) CreateGroupInviteLink(ctx context.Context, req authkit.CreateGroupInviteLinkRequest) (authkit.GroupInviteLinkCreated, error)
func (*Client) CreatePermissionGroup ¶ added in v0.70.0
func (*Client) CreateUser ¶ added in v0.70.0
func (*Client) DeleteRemoteApplication ¶ added in v0.70.0
func (*Client) EnsureRootGroup ¶ added in v0.70.0
func (*Client) ExchangeRefreshToken ¶ added in v0.70.0
func (*Client) ExternalInvitesEnabled ¶ added in v0.70.0
func (*Client) GetEmailByUserID ¶ added in v0.70.0
func (*Client) GetProviderUsername ¶ added in v0.70.0
func (*Client) GetRemoteApplication ¶ added in v0.70.0
func (*Client) GetUserByEmail ¶ added in v0.70.0
func (*Client) GetUserByPhone ¶ added in v0.70.0
func (*Client) GetUserBySolanaAddress ¶ added in v0.70.0
func (*Client) GetUserByUsername ¶ added in v0.70.0
func (*Client) GetUserMetadata ¶ added in v0.70.0
func (*Client) HardDeleteUser ¶ added in v0.70.0
func (*Client) HasEmailSender ¶ added in v0.70.0
func (*Client) HasSMSSender ¶ added in v0.70.0
func (*Client) ImportUsers ¶ added in v0.70.0
func (c *Client) ImportUsers(ctx context.Context, inputs []authkit.ImportUserInput) (authkit.ImportUsersResult, error)
func (*Client) IsUserAllowed ¶
func (*Client) IssueAccessToken ¶ added in v0.70.0
func (*Client) LinkProvider ¶ added in v0.70.0
func (*Client) LinkProviderByIssuer ¶ added in v0.70.0
func (*Client) ListAPIKeys ¶ added in v0.70.0
func (*Client) ListEffectivePermissions ¶
func (*Client) ListEntitlements ¶ added in v0.70.0
func (*Client) ListGroupInviteLinks ¶ added in v0.70.0
func (*Client) ListGroupMembers ¶ added in v0.70.0
func (*Client) ListRemoteApplications ¶ added in v0.70.0
func (*Client) ListRoleSlugsByUser ¶ added in v0.70.0
func (*Client) ListRoleSlugsByUserErr ¶
func (*Client) ListSubjectGroups ¶ added in v0.70.0
func (*Client) ListUserSessions ¶ added in v0.70.0
func (*Client) ListUsersDeletedBefore ¶ added in v0.70.0
func (*Client) MintAPIKey ¶ added in v0.70.0
func (*Client) MintAPIKeyWithOptions ¶ added in v0.70.0
func (*Client) MintCustomJWT ¶ added in v0.70.0
func (*Client) MintDelegatedAccessToken ¶ added in v0.70.0
func (*Client) MintRemoteApplicationAccessToken ¶ added in v0.70.0
func (*Client) MintServiceJWT ¶ added in v0.70.0
func (c *Client) MintServiceJWT(ctx context.Context, opts authkit.ServiceJWTMintOptions) (string, authkit.ServiceJWTClaims, error)
func (*Client) PatchUserMetadata ¶ added in v0.70.0
func (*Client) RecordFailedPasswordlessCode ¶ added in v0.70.0
func (*Client) RedeemGroupInviteLink ¶ added in v0.70.0
func (*Client) RemoveGroupSubjectAs ¶ added in v0.70.0
func (*Client) RemoveRoleBySlug ¶ added in v0.70.0
func (*Client) RemoveRoleBySlugAs ¶ added in v0.70.0
func (*Client) ResolveAPIKey ¶ added in v0.70.0
func (*Client) ResolveAPIKeyWithResources ¶ added in v0.70.0
func (*Client) ResolveGroupIDForSlug ¶ added in v0.70.0
func (*Client) ResolveRemoteAppAttributeDef ¶ added in v0.70.0
func (*Client) ResolveRemoteApplicationAuthority ¶ added in v0.70.0
func (*Client) RestoreUser ¶ added in v0.70.0
func (*Client) RevokeAPIKey ¶ added in v0.70.0
func (*Client) RevokeAllSessions ¶ added in v0.70.0
func (*Client) RevokeGroupInviteLink ¶ added in v0.70.0
func (*Client) SMSAvailable ¶ added in v0.70.0
func (*Client) SeedPermissionGroupContainment ¶ added in v0.70.0
func (*Client) SetEmailVerified ¶ added in v0.70.0
func (*Client) SoftDeleteUser ¶ added in v0.70.0
func (*Client) StartPasswordless ¶ added in v0.70.0
func (c *Client) StartPasswordless(ctx context.Context, req authkit.PasswordlessStartRequest) (authkit.PasswordlessStartResult, error)
func (*Client) TimeUntilUsernameRenameAvailable ¶ added in v0.70.0
func (*Client) UnassignGroupRoleAs ¶ added in v0.70.0
func (*Client) UnlinkProvider ¶ added in v0.70.0
func (*Client) UpdateBiography ¶ added in v0.70.0
func (*Client) UpdateEmail ¶ added in v0.70.0
func (*Client) UpdateImportedUser ¶ added in v0.70.0
func (*Client) UpdateUsername ¶ added in v0.70.0
func (*Client) UpsertPasswordHash ¶ added in v0.70.0
func (*Client) UpsertRemoteApplication ¶ added in v0.70.0
func (c *Client) UpsertRemoteApplication(ctx context.Context, in authkit.RemoteApplication) (*authkit.RemoteApplication, error)