Documentation
¶
Index ¶
- func Decrypt(ciphertext []byte, key *[32]byte) (plaintext []byte, err error)
- func Encrypt(plaintext []byte, key *[32]byte) (ciphertext []byte, err error)
- func NewEncryptionKey() *[32]byte
- type ProjectRepository
- type RepoClientRepository
- type Repository
- type ServiceAccountRepository
- type SessionRepository
- type UserRepository
- type WriteProject
- type WriteUser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
Decrypt decrypts data using 256-bit AES-GCM. This both hides the content of the data and provides a check that it hasn't been altered. Expects input form nonce|ciphertext|tag where '|' indicates concatenation.
func Encrypt ¶
Encrypt encrypts data using 256-bit AES-GCM. This both hides the content of the data and provides a check that it hasn't been altered. Output takes the form nonce|ciphertext|tag where '|' indicates concatenation.
func NewEncryptionKey ¶
func NewEncryptionKey() *[32]byte
NewEncryptionKey generates a random 256-bit key for Encrypt() and Decrypt(). It panics if the source of randomness fails.
Types ¶
type ProjectRepository ¶
type ProjectRepository interface {
CreateProject(project *models.Project) (*models.Project, error)
CreateProjectRole(project *models.Project, role *models.Role) (*models.Role, error)
ReadProject(id uint) (*models.Project, error)
ListProjectsByUserID(userID uint) ([]*models.Project, error)
DeleteProject(project *models.Project) (*models.Project, error)
}
ProjectRepository represents the set of queries on the Project model
type RepoClientRepository ¶
type RepoClientRepository interface {
CreateRepoClient(rc *models.RepoClient) (*models.RepoClient, error)
ReadRepoClient(id uint) (*models.RepoClient, error)
ListRepoClientsByProjectID(projectID uint) ([]*models.RepoClient, error)
}
RepoClientRepository represents the set of queries on the RepoClient model
type Repository ¶
type Repository struct {
User UserRepository
Project ProjectRepository
Session SessionRepository
ServiceAccount ServiceAccountRepository
RepoClient RepoClientRepository
}
Repository collects the repositories for each model
type ServiceAccountRepository ¶
type ServiceAccountRepository interface {
CreateServiceAccountCandidate(saCandidate *models.ServiceAccountCandidate) (*models.ServiceAccountCandidate, error)
ReadServiceAccountCandidate(id uint) (*models.ServiceAccountCandidate, error)
ListServiceAccountCandidatesByProjectID(projectID uint) ([]*models.ServiceAccountCandidate, error)
UpdateServiceAccountCandidateCreatedSAID(id uint, createdSAID uint) (*models.ServiceAccountCandidate, error)
CreateServiceAccount(sa *models.ServiceAccount) (*models.ServiceAccount, error)
ReadServiceAccount(id uint) (*models.ServiceAccount, error)
ListServiceAccountsByProjectID(projectID uint) ([]*models.ServiceAccount, error)
UpdateServiceAccountTokenCache(tokenCache *models.TokenCache) (*models.ServiceAccount, error)
}
ServiceAccountRepository represents the set of queries on the ServiceAccount model
type SessionRepository ¶
type SessionRepository interface {
CreateSession(session *models.Session) (*models.Session, error)
UpdateSession(session *models.Session) (*models.Session, error)
DeleteSession(session *models.Session) (*models.Session, error)
SelectSession(session *models.Session) (*models.Session, error)
}
SessionRepository represents the set of queries on the Session model
type UserRepository ¶
type UserRepository interface {
CreateUser(user *models.User) (*models.User, error)
CheckPassword(id int, pwd string) (bool, error)
ReadUser(id uint) (*models.User, error)
ReadUserByEmail(email string) (*models.User, error)
UpdateUser(user *models.User) (*models.User, error)
DeleteUser(user *models.User) (*models.User, error)
}
UserRepository represents the set of queries on the User model
type WriteProject ¶
WriteProject is the function type for all Project write operations