34 lines
817 B
Go
34 lines
817 B
Go
package store
|
|
|
|
import (
|
|
"crypto/ecdsa"
|
|
"crypto/x509"
|
|
"fmt"
|
|
|
|
"gitea.benny.dog/torjus/ezshare/pb"
|
|
)
|
|
|
|
var ErrNoSuchItem = fmt.Errorf("no such item")
|
|
|
|
type FileStore interface {
|
|
GetFile(id string) (*pb.File, error)
|
|
StoreFile(file *pb.File) (string, error)
|
|
DeleteFile(id string) error
|
|
ListFiles() ([]*pb.ListFilesResponse_ListFileInfo, error)
|
|
}
|
|
|
|
type CertificateStore interface {
|
|
GetCertificate(id string) (*x509.Certificate, error)
|
|
StoreCertificate(id string, cert *x509.Certificate) error
|
|
GetKey(id string) (*ecdsa.PrivateKey, error)
|
|
StoreKey(id string, key *ecdsa.PrivateKey) error
|
|
ListCertificates() ([]string, error)
|
|
}
|
|
|
|
type UserStore interface {
|
|
StoreUser(user *pb.User) error
|
|
GetUser(id string) (*pb.User, error)
|
|
GetUserByUsername(username string) (*pb.User, error)
|
|
ListUsers() ([]string, error)
|
|
}
|