metering

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Password/OTP based providers
	ProviderEmail = "email"
	ProviderPhone = "phone"

	// MFA providers
	ProviderMFATOTP     = "totp"
	ProviderMFAPhone    = "phone"
	ProviderMFAWebAuthn = "webauthn"

	// SSO providers
	ProviderSAML = "saml"
)

Provider constants for consistent login analytics

Variables

This section is empty.

Functions

func RecordLogin

func RecordLogin(loginType LoginType, userID uuid.UUID, data *LoginData)

Types

type LoginData

type LoginData struct {
	// Provider is the authentication provider (e.g., "email", "phone", "google", "github", "web3", etc.)
	Provider string `json:"provider"`

	// Web3 specific data (for blockchain authentication)
	Web3 *Web3Data `json:"web3,omitempty"`

	// Additional context for future extensibility
	Extra map[string]interface{} `json:"extra,omitempty"`
}

LoginData contains structured data for login events

type LoginType

type LoginType string

LoginType represents the type of login method used

const (
	LoginTypeAnonymous LoginType = "anonymous"
	LoginTypeSSO       LoginType = "sso"
	LoginTypeOAuth     LoginType = "oauth"
	LoginTypeWeb3      LoginType = "web3"
	LoginTypeImplicit  LoginType = "implicit"
	LoginTypeOIDC      LoginType = "oidc"
	LoginTypeOTP       LoginType = "otp"
	LoginTypePassword  LoginType = "password"
	LoginTypePKCE      LoginType = "pkce"
	LoginTypeToken     LoginType = "token" // for refresh token flows, to be backward-compatible with existing data
	LoginTypeMFA       LoginType = "mfa"   // for MFA verifications
	LoginTypePasskey   LoginType = "passkey"
)

LoginType constants for consistent login analytics

type Web3Data

type Web3Data struct {
	// Chain name (e.g., "ethereum", "polygon", "arbitrum")
	Chain string `json:"chain,omitempty"`
	// Network ID (e.g., "1" for mainnet)
	Network string `json:"network,omitempty"`
	// Wallet address that signed the message
	Address string `json:"address,omitempty"`
	// Domain
	Domain string `json:"domain,omitempty"`
	// URI
	URI string `json:"uri,omitempty"`
}

Web3Data contains Web3/blockchain-specific authentication data

Jump to

Keyboard shortcuts

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