ezshare/store/store.go
2021-12-05 11:08:09 +01:00

33 lines
763 B
Go

package store
import (
"crypto/ecdsa"
"crypto/x509"
"fmt"
"gitea.benny.dog/torjus/ezshare/pb"
)
var ErrNoSuchFile = fmt.Errorf("no such file")
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)
ListUsers() ([]string, error)
}