Documentation
¶
Index ¶
Constants ¶
const ( KeyStateActive = "ACTIVE" KeyStateNext = "NEXT" KeyStateDeactivated = "DEACTIVATED" )
Key states
const (
MinimumPasswordLength = 8
)
const (
UserRole = "USER"
)
User roles
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthenticationRequest ¶
type AuthenticationRequest struct {
Username string `json:"username"`
Password string `json:"password"`
}
AuthenticationRequest request to signup or login.
func (AuthenticationRequest) String ¶
func (r AuthenticationRequest) String() string
func (AuthenticationRequest) Valid ¶
func (r AuthenticationRequest) Valid(checkPassword bool) error
Valid validates if an authenication request is valid.
type AuthenticationResponse ¶
AuthenticationResponse response to successfull signup or login.
func (AuthenticationResponse) String ¶
func (r AuthenticationResponse) String() string
type Credentials ¶
type Credentials struct {
Password string
Salt string
DataEncryptionKey DataEncryptionKey
}
Credentials authenication information
type DataEncryptionKey ¶
type DataEncryptionKey struct {
Body string // Body is a hex encoded string of an encrypted byte array.
KeyEncryptionKeyID int
}
DataEncryptionKey (DEK) key to encrypt and decrypt a objects. A DEK is encrypted with a KeyEncryptionKey.
func (DataEncryptionKey) String ¶
func (d DataEncryptionKey) String() string
type KeyEncryptionKey ¶
type KeyEncryptionKey struct {
ID int
// contains filtered or unexported fields
}
KeyEncryptionKey (KEK) key to encrypt and decrypt a data encryption key.
func ParseKeyEncryptionKey ¶
func ParseKeyEncryptionKey(s string) (KeyEncryptionKey, error)
ParseKeyEncryptionKey parses a hex encode key encryption key and id.
func (KeyEncryptionKey) Decrypt ¶
func (k KeyEncryptionKey) Decrypt(dek DataEncryptionKey) ([]byte, error)
Decrypt decodes the hex encoded ciphertext and decrypts the encoded data encryption key with with the key encryption key body.
func (KeyEncryptionKey) Encrypt ¶
func (k KeyEncryptionKey) Encrypt(plaintext []byte) (DataEncryptionKey, error)
Encrypt encrypts the provided data encryption key with with the key encryption key body. Encodes the result as a hex string.
func (KeyEncryptionKey) String ¶
func (k KeyEncryptionKey) String() string
func (KeyEncryptionKey) Valid ¶
func (k KeyEncryptionKey) Valid() error
Valid checks that a key is valid by asserting its size.
type User ¶
type User struct {
ID string `json:"id"`
Username string `json:"username"`
Role string `json:"role"`
Credentials Credentials `json:"-"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
User account describing a user of the object storage service.
func NewUser ¶
func NewUser(username, role string, credentials Credentials) User