types

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2025 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package types defines shared types used across the OAuth bridge application

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackData

type CallbackData struct {
	Success        bool   `json:"success"`
	InstallationID string `json:"installation_id,omitempty"`
	SSDInstance    string `json:"ssd_instance,omitempty"`
	ParentOrigin   string `json:"parent_origin,omitempty"`
	Error          string `json:"error,omitempty"`
	Timestamp      int64  `json:"timestamp"`
}

CallbackData represents data passed to the OAuth callback template

type ECCJWTPayload

type ECCJWTPayload struct {
	Issuer    string           `json:"iss"`           // Issuer URL (identifies the SSD service)
	Audience  string           `json:"aud"`           // Audience (OAuth Bridge URL)
	Kid       string           `json:"kid"`           // Key identifier
	ExpiresAt *jwt.NumericDate `json:"exp,omitempty"` // Expiration timestamp
	IssuedAt  *jwt.NumericDate `json:"iat,omitempty"` // Issued at timestamp
}

ECCJWTPayload represents the JWT payload for ECC-based authentication (new deterministic system)

func (*ECCJWTPayload) GetAudience

func (p *ECCJWTPayload) GetAudience() (jwt.ClaimStrings, error)

GetAudience implements jwt.Claims interface

func (*ECCJWTPayload) GetExpirationTime

func (p *ECCJWTPayload) GetExpirationTime() (*jwt.NumericDate, error)

GetExpirationTime implements jwt.Claims interface

func (*ECCJWTPayload) GetIssuedAt

func (p *ECCJWTPayload) GetIssuedAt() (*jwt.NumericDate, error)

GetIssuedAt implements jwt.Claims interface

func (*ECCJWTPayload) GetIssuer

func (p *ECCJWTPayload) GetIssuer() (string, error)

GetIssuer implements jwt.Claims interface

func (*ECCJWTPayload) GetNotBefore

func (p *ECCJWTPayload) GetNotBefore() (*jwt.NumericDate, error)

GetNotBefore implements jwt.Claims interface

func (*ECCJWTPayload) GetSubject

func (p *ECCJWTPayload) GetSubject() (string, error)

GetSubject implements jwt.Claims interface

type ErrorResponse

type ErrorResponse struct {
	Success bool   `json:"success"`
	Error   string `json:"error"`
	Code    string `json:"code,omitempty"`
}

ErrorResponse represents a standard error response

type GenerateKeyRequest

type GenerateKeyRequest struct {
	IssuerBaseURL string `json:"issuerBaseUrl"` // Base URL for issuer (e.g., "https://ssd-services.company.com")
	Kid           string `json:"kid"`           // Key identifier
}

GenerateKeyRequest represents the request to generate a private key for a domain

type GenerateKeyResponse

type GenerateKeyResponse struct {
	Success       bool   `json:"success"`
	PrivateKey    string `json:"privateKey,omitempty"` // PEM-encoded private key
	Domain        string `json:"domain,omitempty"`     // Extracted domain
	Kid           string `json:"kid,omitempty"`
	IssuerBaseURL string `json:"issuerBaseUrl,omitempty"` // Original issuer base URL
	Error         string `json:"error,omitempty"`
}

GenerateKeyResponse represents the response containing a generated private key

type GitHubJWTPayload

type GitHubJWTPayload struct {
	Issuer    string `json:"iss"` // GitHub App ID
	ExpiresAt int64  `json:"exp"` // Expiration timestamp
	IssuedAt  int64  `json:"iat"` // Issued at timestamp
}

GitHubJWTPayload represents the JWT payload for GitHub App authentication

func (*GitHubJWTPayload) GetAudience

func (p *GitHubJWTPayload) GetAudience() (jwt.ClaimStrings, error)

GetAudience implements jwt.Claims interface

func (*GitHubJWTPayload) GetExpirationTime

func (p *GitHubJWTPayload) GetExpirationTime() (*jwt.NumericDate, error)

GetExpirationTime implements jwt.Claims interface

func (*GitHubJWTPayload) GetIssuedAt

func (p *GitHubJWTPayload) GetIssuedAt() (*jwt.NumericDate, error)

GetIssuedAt implements jwt.Claims interface

func (*GitHubJWTPayload) GetIssuer

func (p *GitHubJWTPayload) GetIssuer() (string, error)

GetIssuer implements jwt.Claims interface

func (*GitHubJWTPayload) GetNotBefore

func (p *GitHubJWTPayload) GetNotBefore() (*jwt.NumericDate, error)

GetNotBefore implements jwt.Claims interface

func (*GitHubJWTPayload) GetSubject

func (p *GitHubJWTPayload) GetSubject() (string, error)

GetSubject implements jwt.Claims interface

type HealthCheckResponse

type HealthCheckResponse struct {
	Status    string            `json:"status"`
	Version   string            `json:"version"`
	Timestamp time.Time         `json:"timestamp"`
	Checks    map[string]string `json:"checks,omitempty"`
}

HealthCheckResponse represents the health check endpoint response

type InstallationInfo

type InstallationInfo struct {
	ID           int64             `json:"id"`
	AppID        int64             `json:"app_id"`
	AccountType  string            `json:"account_type"`
	AccountLogin string            `json:"account_login"`
	Permissions  map[string]string `json:"permissions"`
	CreatedAt    time.Time         `json:"created_at"`
	UpdatedAt    time.Time         `json:"updated_at"`
}

InstallationInfo represents GitHub App installation information

type OAuthState

type OAuthState struct {
	OrgID        string `json:"orgId"`         // Organization identifier
	SessionID    string `json:"sessionId"`     // Unique session ID for cache isolation
	ParentOrigin string `json:"parent_origin"` // Origin for postMessage
	Timestamp    int64  `json:"timestamp"`     // Creation timestamp for expiration
}

OAuthState represents the OAuth state parameter for CSRF protection

type PostMessageData

type PostMessageData struct {
	Success        bool   `json:"success"`
	InstallationID string `json:"installation_id,omitempty"`
	SSDInstance    string `json:"ssd_instance,omitempty"`
	Error          string `json:"error,omitempty"`
	Timestamp      int64  `json:"timestamp"`
}

PostMessageData represents the data structure sent via postMessage to parent window

type StartInstallationRequest

type StartInstallationRequest struct {
	Action string `json:"action"`
}

StartInstallationRequest represents the request to start GitHub App installation

type StartInstallationResponse

type StartInstallationResponse struct {
	Success    bool   `json:"success"`
	InstallURL string `json:"install_url,omitempty"`
	State      string `json:"state,omitempty"`
	Error      string `json:"error,omitempty"`
}

StartInstallationResponse represents the response to start installation request

type TokenRequest

type TokenRequest struct {
	Action         string            `json:"action"`
	InstallationID string            `json:"installation_id"`
	Repositories   []string          `json:"repositories,omitempty"`
	Permissions    map[string]string `json:"permissions,omitempty"`
}

TokenRequest represents the request to generate an installation access token

type TokenResponse

type TokenResponse struct {
	Success     bool              `json:"success"`
	Token       string            `json:"token,omitempty"`
	ExpiresAt   time.Time         `json:"expires_at,omitempty"`
	Permissions map[string]string `json:"permissions,omitempty"`
	Error       string            `json:"error,omitempty"`
}

TokenResponse represents the response containing the installation access token

Jump to

Keyboard shortcuts

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