Documentation
¶
Index ¶
- Constants
- Variables
- func TryClose(a any) error
- type Algorithmer
- type AuthenticationResult
- type BucketsReadRepository
- type BucketsRepository
- type BucketsWriteRepository
- type Cache
- type CacheDriver
- type Cipher
- type CipherTextDecoder
- type CipherTextDecoderResult
- type CipherTextEncoder
- type Clock
- type ClockFunc
- type Driver
- type FileEntriesReadRepository
- type FileEntriesRepository
- type FileEntriesWriteRepository
- type FileMeta
- type FileSystem
- type IdentityOpener
- type IdentitySealer
- type KeyDeriver
- type KeyLengther
- type KeySetManager
- type KeyValidator
- type MigrationRequest
- type Migrator
- type RevisionReadWriter
- type Session
- type SessionKey
- type SessionStore
- type SessionTokenBuilder
- type Storage
- type StoreFileCommand
- type UserAuthenticator
- type UserAuthenticatorFunc
- type UserInvitesReadRepository
- type UserInvitesRepository
- type UserInvitesWriteRepository
- type UserReadRepository
- type UserRegistration
- type UserRepository
- type UserWriteRepository
- type WriteFileCommand
Constants ¶
View Source
const ( DriverPostgres = Driver(dialect.Postgres) DriverSQLite = Driver(dialect.SQLite) )
View Source
const ( RegistrationTokenLength = 32 TokenKeyLength = 16 )
View Source
const ( IsAdminClaimName = "is_admin" SessionKeyClaimName = "idk_enc_key" SessionIdentityKeyClaimName = "idk" )
View Source
const (
SessionKeySuffixUserIdentity = "identity"
)
Variables ¶
View Source
var ErrKeyEmpty = errors.New("the key may not be empty")
View Source
var ErrNoSuchCipher = errors.New("no such cipher")
View Source
var (
ErrNoSuchSessionKey = errors.New("no such session key")
)
View Source
var ErrNoSuchStorage = errors.New("no such filesystem")
View Source
var ErrRegistrationExpired = errors.New("registration expired")
Functions ¶
Types ¶
type Algorithmer ¶
type Algorithmer interface {
Algorithm() string
}
type AuthenticationResult ¶
type AuthenticationResult struct {
User domain.User
IdentityKey SessionKey
SessionEncryptionKey []byte
}
func (AuthenticationResult) Session ¶
func (r AuthenticationResult) Session() *Session
type BucketsReadRepository ¶
type BucketsReadRepository interface {
}
type BucketsRepository ¶
type BucketsRepository interface {
BucketsReadRepository
BucketsWriteRepository
}
type BucketsWriteRepository ¶
type BucketsWriteRepository interface {
CreateBucket(ctx context.Context, bucket dto.CreateBucketCommand) (*dto.CreateBucketResponse, error)
}
type CacheDriver ¶
type Cipher ¶
type Cipher interface {
Algorithmer
KeyLengther
Seal(plainText, key []byte) (sealed, nonce []byte, err error)
Open(sealed, key, nonce []byte) (plainText []byte, err error)
}
type CipherTextDecoder ¶
type CipherTextDecoder interface {
Decode(text []byte) (*CipherTextDecoderResult, error)
}
type CipherTextDecoderResult ¶
type CipherTextDecoderResult struct {
Salt []byte
Nonce []byte
CipherText []byte
Deriver KeyDeriver
Cipher Cipher
}
type CipherTextEncoder ¶
type CipherTextEncoder interface {
EncodeHash(key, salt []byte, deriver KeyDeriver) []byte
EncodeCipherText(cipherText, salt, nonce []byte, deriver KeyDeriver, cipher Cipher) []byte
}
type FileEntriesRepository ¶
type FileEntriesRepository interface {
FileEntriesReadRepository
FileEntriesWriteRepository
}
type FileEntriesWriteRepository ¶
type FileEntriesWriteRepository interface {
}
type FileSystem ¶
type IdentityOpener ¶
type IdentityOpener interface {
OpenIdentity(cipherText, key []byte) (*age.X25519Identity, error)
}
type IdentitySealer ¶
type IdentitySealer interface {
KeyLengther
SealIdentity(identity *age.X25519Identity, key []byte) ([]byte, error)
}
type KeyDeriver ¶
type KeyDeriver interface {
encoding.TextMarshaler
encoding.TextUnmarshaler
Algorithmer
GenerateKey(password, existingSalt []byte, keyLength int) (key, salt []byte)
}
type KeyLengther ¶
type KeyLengther interface {
KeyLength() int
}
type KeySetManager ¶
type KeyValidator ¶
type MigrationRequest ¶
type Migrator ¶
type Migrator interface {
Migrate(ctx context.Context, req MigrationRequest) error
}
type RevisionReadWriter ¶
type RevisionReadWriter interface {
migrate.RevisionReadWriter
Client() *ent.Client
}
type Session ¶
type Session struct {
SessionID ulid.ULID `json:"sid"`
IdentityKey SessionKey `json:"idk"`
IdentityEncryptionKey []byte `json:"idk_enc_key"`
UserID uuid.UUID `json:"sub"`
Email string `json:"email"`
GivenName string `json:"given_name"`
Surname string `json:"surname"`
IsAdmin bool `json:"is_admin"`
}
type SessionKey ¶
type SessionKey []byte
func NewSessionKey ¶
func NewSessionKey(userId uuid.UUID, suffix string) SessionKey
func (SessionKey) Bytes ¶
func (k SessionKey) Bytes() []byte
func (SessionKey) MarshalJSON ¶
func (k SessionKey) MarshalJSON() ([]byte, error)
func (SessionKey) String ¶
func (k SessionKey) String() string
func (*SessionKey) UnmarshalJSON ¶
func (k *SessionKey) UnmarshalJSON(b []byte) error
type SessionStore ¶
type SessionStore interface {
Set(ctx context.Context, key SessionKey, value []byte) error
Get(ctx context.Context, key SessionKey) (value []byte, err error)
}
type SessionTokenBuilder ¶
type Storage ¶
type Storage interface {
StoreFile(cmd StoreFileCommand) (any, error)
}
type StoreFileCommand ¶
type StoreFileCommand struct {
Reader io.ReadCloser
StorageKey string
Path string
Meta FileMeta
}
type UserAuthenticator ¶
type UserAuthenticatorFunc ¶
type UserAuthenticatorFunc func(ctx context.Context, userMail string, password []byte) (*AuthenticationResult, error)
func (UserAuthenticatorFunc) AuthenticateWithPassword ¶
func (f UserAuthenticatorFunc) AuthenticateWithPassword(ctx context.Context, userMail string, password []byte) (*AuthenticationResult, error)
type UserInvitesRepository ¶
type UserInvitesRepository interface {
UserInvitesReadRepository
UserInvitesWriteRepository
}
type UserInvitesWriteRepository ¶
type UserInvitesWriteRepository interface {
CreateInvite(ctx context.Context, invite dto.CreateUserInviteCommand) (*dto.CreateUserInviteResponse, error)
}
type UserReadRepository ¶
type UserRegistration ¶
type UserRegistration interface {
RegisterUser(ctx context.Context, cmd dto.RegisterUserCommand) error
}
type UserRepository ¶
type UserRepository interface {
UserReadRepository
UserWriteRepository
}
type UserWriteRepository ¶
type UserWriteRepository interface {
CreateUser(ctx context.Context, user dto.CreateUserCommand) error
}
type WriteFileCommand ¶
Click to show internal directories.
Click to hide internal directories.