Documentation ¶
Index ¶
- Variables
- func CreateActions(ctx context.Context, exec boil.ContextExecutor, actions []Action) error
- func CreateProvisions(ctx context.Context, exec boil.ContextExecutor, ...) error
- func CreateRootKeyShare(ctx context.Context, redConn *redis.Client, rootKeyShare RootKeyShare, ...) error
- func CreateSecretStorageAsymKey(ctx context.Context, exec boil.ContextExecutor, accountID string, ...) (*sqlboiler.SecretStorageAsymKey, error)
- func CreateSecretStorageBoxKeyShare(ctx context.Context, tr *sql.Tx, accountID string, ...) (*sqlboiler.SecretStorageBoxKeyShare, error)
- func DeleteAction(ctx context.Context, exec boil.ContextExecutor, actionID, accountID string) error
- func DeleteAsymKeys(ctx context.Context, tr *sql.Tx, accountID string, pubkeys []string) error
- func DeleteBackupArchive(ctx context.Context, exec boil.ContextExecutor, archiveID, reason string) error
- func DeleteBoxKeyShares(ctx context.Context, tr *sql.Tx, accountID string, boxIDs []string) error
- func GetCurrentAccountRootKey(ctx context.Context, exec boil.ContextExecutor, accountID string) (*sqlboiler.SecretStorageAccountRootKey, error)
- func GetOrgSecrets(ctx context.Context, exec boil.ContextExecutor, accountID string) (interface{}, error)
- func GetVaultKeyByRootKeyHash(ctx context.Context, exec boil.ContextExecutor, rootKeyHash string) (*sqlboiler.SecretStorageVaultKey, error)
- func ResetAccountSecretStorage(ctx context.Context, exec boil.ContextExecutor, accountID string, ...) error
- func SetupOrgSecretStorage(ctx context.Context, exec boil.ContextExecutor, accountID string, ...) error
- func UpdateRootKey(ctx context.Context, exec boil.ContextExecutor, accountID string, ...) error
- type AccountRootKey
- type Action
- type BackupArchive
- func GetBackupArchive(ctx context.Context, exec boil.ContextExecutor, archiveID string) (BackupArchive, error)
- func GetBackupArchiveMetadata(ctx context.Context, exec boil.ContextExecutor, archiveID string) (BackupArchive, error)
- func ListBackupArchives(ctx context.Context, exec boil.ContextExecutor, accountID string) ([]BackupArchive, error)
- type IntraprocessHelper
- type OrgSecretStorageSetupData
- type Provision
- type ProvisionCreationMap
- type RootKeyShare
- type SecretStorageAsymKey
- type SecretStorageBoxKeyShare
- type SecretStorageSetupData
- type Secrets
- type VaultKey
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func CreateActions ¶
CreateActions inserts the cryptoaction in DB. if the cryptoaction has not ID it will create one
func CreateProvisions ¶
func CreateProvisions(ctx context.Context, exec boil.ContextExecutor, provisions ProvisionCreationMap, orgID string) error
func CreateRootKeyShare ¶
func CreateSecretStorageAsymKey ¶
func CreateSecretStorageAsymKey(ctx context.Context, exec boil.ContextExecutor, accountID string, asymKey SecretStorageAsymKey) (*sqlboiler.SecretStorageAsymKey, error)
func CreateSecretStorageBoxKeyShare ¶
func CreateSecretStorageBoxKeyShare(ctx context.Context, tr *sql.Tx, accountID string, share SecretStorageBoxKeyShare) (*sqlboiler.SecretStorageBoxKeyShare, error)
func DeleteAction ¶
func DeleteAction( ctx context.Context, exec boil.ContextExecutor, actionID, accountID string, ) error
DeleteAction ...
func DeleteAsymKeys ¶
func DeleteBackupArchive ¶
func DeleteBackupArchive( ctx context.Context, exec boil.ContextExecutor, archiveID, reason string, ) error
DeleteBackupArchive ...
func DeleteBoxKeyShares ¶
func GetCurrentAccountRootKey ¶
func GetCurrentAccountRootKey(ctx context.Context, exec boil.ContextExecutor, accountID string) (*sqlboiler.SecretStorageAccountRootKey, error)
func GetOrgSecrets ¶
func GetVaultKeyByRootKeyHash ¶
func GetVaultKeyByRootKeyHash(ctx context.Context, exec boil.ContextExecutor, rootKeyHash string) (*sqlboiler.SecretStorageVaultKey, error)
func ResetAccountSecretStorage ¶
func ResetAccountSecretStorage(ctx context.Context, exec boil.ContextExecutor, accountID string, data *SecretStorageSetupData) error
ResetAccountSecretStorage creates a brand new secret storage for the given account. Use it for account creation, password reset and migration from the old "secret backup" system to the secret storage system
func SetupOrgSecretStorage ¶
func SetupOrgSecretStorage(ctx context.Context, exec boil.ContextExecutor, accountID string, data *OrgSecretStorageSetupData) error
Types ¶
type AccountRootKey ¶
type AccountRootKey struct { KeyHash string `json:"key_hash"` EncryptedKey string `json:"encrypted_key"` }
func (*AccountRootKey) Validate ¶
func (k *AccountRootKey) Validate() error
type Action ¶
type Action struct { ID string `json:"id"` IdentityID string `json:"-"` SenderIdentityID null.String `json:"-"` Type string `json:"type"` BoxID null.String `json:"box_id"` EncryptionPublicKey string `json:"encryption_public_key"` Encrypted string `json:"encrypted"` CreatedAt time.Time `json:"created_at"` }
Action models and helpers
type BackupArchive ¶
type BackupArchive struct { ID string `json:"id"` AccountID string `json:"account_id"` Data null.String `json:"-"` CreatedAt time.Time `json:"created_at"` RecoveredAt null.Time `json:"recovered_at"` DeletedAt null.Time `json:"deleted_at"` }
BackupArchive ...
func GetBackupArchive ¶
func GetBackupArchive(ctx context.Context, exec boil.ContextExecutor, archiveID string) (BackupArchive, error)
GetBackupArchive ...
func GetBackupArchiveMetadata ¶
func GetBackupArchiveMetadata(ctx context.Context, exec boil.ContextExecutor, archiveID string) (BackupArchive, error)
GetBackupArchiveMetadata ...
func ListBackupArchives ¶
func ListBackupArchives(ctx context.Context, exec boil.ContextExecutor, accountID string) ([]BackupArchive, error)
ListBackupArchives ...
type IntraprocessHelper ¶
type IntraprocessHelper struct {
// contains filtered or unexported fields
}
IntraprocessHelper ...
func NewIntraprocessHelper ¶
func NewIntraprocessHelper(sqlDB *sql.DB, redConn *redis.Client) *IntraprocessHelper
NewIntraprocessHelper ...
type OrgSecretStorageSetupData ¶
type OrgSecretStorageSetupData struct { AccountRootKeyHash mcrypto.Hash `json:"account_root_key_hash"` AsymKeys map[string]SecretStorageAsymKey `json:"asym_keys"` }
The data an org must provide to setup its secret storage (only contains a subset of the user secret storage setup data)
func (*OrgSecretStorageSetupData) Validate ¶
func (data *OrgSecretStorageSetupData) Validate() error
type Provision ¶
type Provision struct { ID string `json:"id"` OrganizationID string `json:"organization_id"` IdentityID string `json:"identity_id"` PublicKey mcrypto.PublicKey `json:"public_key"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func GetProvisionByUserKeyShareHash ¶
func ListProvisionsForIdentityAndOrg ¶
func ListProvisionsForIdentityAndOrg( ctx context.Context, exec boil.ContextExecutor, identityID string, orgID string, ) ([]*Provision, error)
ListProvisionsForIdentityAndOrg returns all crypto provisions for the given identity-org couple sorted by creation date (most recent first)
type ProvisionCreationMap ¶
type ProvisionCreationMap map[string]struct { PublicKey mcrypto.PublicKey `json:"public_key"` MisakeyKeyShare mcrypto.KeyShare `json:"misakey_key_share"` UserKeyShareHash mcrypto.Hash `json:"user_key_share_hash"` }
func (*ProvisionCreationMap) Validate ¶
func (m *ProvisionCreationMap) Validate() error
type RootKeyShare ¶
type RootKeyShare struct {}
type SecretStorageAsymKey ¶
type SecretStorageAsymKey struct { PublicKey string `json:"public_key,omitempty"` EncryptedSecretKey string `json:"encrypted_secret_key"` AccountRootKeyHash string `json:"account_root_key_hash,omitempty"` }
func (*SecretStorageAsymKey) BindAndValidate ¶
func (asymKey *SecretStorageAsymKey) BindAndValidate(eCtx echo.Context) error
BindAndValidate implements request.Request.BindAndValidate
type SecretStorageBoxKeyShare ¶
type SecretStorageBoxKeyShare struct {}
func (*SecretStorageBoxKeyShare) BindAndValidate ¶
func (share *SecretStorageBoxKeyShare) BindAndValidate(eCtx echo.Context) error
BindAndValidate implements request.Request.BindAndValidate
func (*SecretStorageBoxKeyShare) Validate ¶
func (share *SecretStorageBoxKeyShare) Validate() error
type SecretStorageSetupData ¶
type SecretStorageSetupData struct { AccountRootKey AccountRootKey `json:"account_root_key"` VaultKey VaultKey `json:"vault_key"` AsymKeys map[string]SecretStorageAsymKey `json:"asym_keys"` identity.IdentityPublicKeys }
SecretStorageSetupData ... XXX identity public keys are somehow linked to the secret storage (corresponding secret keys are stored in it) but they are not really part of it. TODO group all "actual" secret storage values in a separate struct?
func (*SecretStorageSetupData) BindAndValidate ¶
func (query *SecretStorageSetupData) BindAndValidate(eCtx echo.Context) error
BindAndValidate implements request.Request.BindAndValidate
func (*SecretStorageSetupData) Validate ¶
func (query *SecretStorageSetupData) Validate() error
type Secrets ¶
type Secrets struct { AccountRootKey AccountRootKey `json:"account_root_key"` VaultKey VaultKey `json:"vault_key"` AsymKeys map[string]SecretStorageAsymKey `json:"asym_keys"` }