Documentation
¶
Index ¶
- Constants
- type APIResponse
- type Client
- func (c *Client) CreateSmartLink(ctx context.Context, opts *SmartLinkOptions) (*SmartLink, error)
- func (c *Client) FetchWellKnownConfig(ctx context.Context) (*WellKnownConfig, error)
- func (c *Client) GetUser(userID string) (*User, error)
- func (c *Client) UpdateUser(userID string, data map[string]interface{}) (*User, error)
- func (c *Client) ValidateToken(ctx context.Context, token string) (*TokenValidationResponse, error)
- type ClientConfig
- type ErrType
- type JWKS
- type RowndError
- type SmartLink
- type SmartLinkOptions
- type TokenValidation
- type TokenValidationResponse
- type User
- type UserUpdateRequest
- type ValidationError
- type Validator
- type WellKnownConfig
Constants ¶
const ( CLAIM_USER_ID = "https://auth.rownd.io/app_user_id" CLAIM_IS_VERIFIED_USER = "https://auth.rownd.io/is_verified_user" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIResponse ¶
type APIResponse struct {
Success bool `json:"success"`
Message string `json:"message,omitempty"`
Data interface{} `json:"data,omitempty"`
Error string `json:"error,omitempty"`
}
APIResponse represents a generic API response
type Client ¶
type Client struct {
AppKey string
AppSecret string
BaseURL string
HTTPClient *http.Client
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(config *ClientConfig) (*Client, error)
NewClient creates a new Rownd client instance
func (*Client) CreateSmartLink ¶
func (*Client) FetchWellKnownConfig ¶
func (c *Client) FetchWellKnownConfig(ctx context.Context) (*WellKnownConfig, error)
func (*Client) UpdateUser ¶
func (*Client) ValidateToken ¶
type ClientConfig ¶
type ClientConfig struct {
AppKey string
AppSecret string
BaseURL string
Timeout time.Duration
RetryCount int
}
ClientConfig represents the configuration for the Rownd client
type JWKS ¶ added in v0.1.8
type JWKS struct {
Keys []json.RawMessage `json:"keys"`
}
type RowndError ¶
RowndError represents a custom error type for Rownd SDK
func NewError ¶
func NewError(errType ErrType, message string, err error) *RowndError
NewError creates a new RowndError
func (*RowndError) Error ¶
func (e *RowndError) Error() string
type SmartLinkOptions ¶
type TokenValidation ¶
type TokenValidation struct {
Valid bool `json:"valid"`
UserID string `json:"user_id"`
AppID string `json:"app_id"`
IssuedAt time.Time `json:"iat"`
ExpireAt time.Time `json:"exp"`
}
TokenValidation represents the response from token validation
type TokenValidationResponse ¶
type User ¶
type User struct {
ID string `json:"id"`
Data map[string]interface{} `json:"data"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
User represents a Rownd user
type UserUpdateRequest ¶
type UserUpdateRequest struct {
Data map[string]interface{} `json:"data"`
}
UserUpdateRequest represents the request body for updating a user
type ValidationError ¶
ValidationError represents a validation error
type Validator ¶
type Validator struct{}
Validator provides validation methods for various inputs
func (*Validator) ValidateClientConfig ¶
func (v *Validator) ValidateClientConfig(config *ClientConfig) error
ValidateClientConfig validates the client configuration
func (*Validator) ValidateEmail ¶
ValidateEmail checks if the provided email is valid
func (*Validator) ValidateToken ¶
ValidateToken checks if the provided token format is valid
func (*Validator) ValidateUserID ¶
ValidateUserID checks if the provided user ID is valid
type WellKnownConfig ¶
type WellKnownConfig struct {
Issuer string `json:"issuer"`
AuthorizationEndpoint string `json:"authorization_endpoint"`
TokenEndpoint string `json:"token_endpoint"`
JwksUri string `json:"jwks_uri"`
ResponseTypesSupported []string `json:"response_types_supported"`
SubjectTypesSupported []string `json:"subject_types_supported"`
ScopesSupported []string `json:"scopes_supported"`
}
WellKnownConfig represents the OAuth well-known configuration