vault

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidCredential = fmt.Errorf("vault: invalid credential: %w", commonerrors.ErrValidation)
	ErrNotFound          = fmt.Errorf("vault: credential not found: %w", commonerrors.ErrNotFound)
)

Functions

This section is empty.

Types

type Credential

type Credential struct {
	ID           ids.VaultID
	GatewayID    ids.GatewayID
	PrincipalSub string
	Provider     string
	AccountRef   string
	AccessToken  string
	RefreshToken string
	Scopes       []string
	ExpiresAt    time.Time
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

func NewCredential

func NewCredential(
	gatewayID ids.GatewayID,
	principalSub, provider, accountRef, accessToken, refreshToken string,
	scopes []string,
	expiresAt time.Time,
) (*Credential, error)

func (*Credential) Expired

func (c *Credential) Expired(skew time.Duration) bool

type Encrypter

type Encrypter interface {
	Encrypt(plaintext string) (string, error)
	Decrypt(ciphertext string) (string, error)
}

type Repository

type Repository interface {
	Upsert(ctx context.Context, c *Credential) error
	Find(ctx context.Context, gatewayID ids.GatewayID, principalSub, provider string) (*Credential, error)
	ListByPrincipal(ctx context.Context, gatewayID ids.GatewayID, principalSub string) ([]*Credential, error)
	Delete(ctx context.Context, gatewayID ids.GatewayID, principalSub, provider string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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