ezshare/store/store.go
2021-12-05 01:00:32 +01:00

27 lines
632 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)
}