mirror of
https://github.com/mitchell/selfpass.git
synced 2025-12-13 21:07:22 +00:00
First iteration of selfpass gRPC backend, w/ credentials CRUD functional
This commit is contained in:
commit
719a462048
15 changed files with 1610 additions and 0 deletions
36
credentials/types/credential.go
Normal file
36
credentials/types/credential.go
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
package types
|
||||
|
||||
import "time"
|
||||
|
||||
// Credential TODO
|
||||
type Credential struct {
|
||||
Metadata
|
||||
Username string
|
||||
Email string
|
||||
Password string
|
||||
}
|
||||
|
||||
// CredentialInput TODO
|
||||
type CredentialInput struct {
|
||||
MetadataInput
|
||||
Username string
|
||||
Email string
|
||||
Password string
|
||||
}
|
||||
|
||||
// Metadata TODO
|
||||
type Metadata struct {
|
||||
ID string
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
Primary string
|
||||
SourceHost string
|
||||
LoginURL string
|
||||
}
|
||||
|
||||
// MetadataInput TODO
|
||||
type MetadataInput struct {
|
||||
Primary string
|
||||
SourceHost string
|
||||
LoginURL string
|
||||
}
|
||||
8
credentials/types/error_prefixes.go
Normal file
8
credentials/types/error_prefixes.go
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
package types
|
||||
|
||||
// These constants are the prefixes of errors that should be exposed to the client.
|
||||
// All error encoders should check for them.
|
||||
const (
|
||||
NotFound = "not found:"
|
||||
InvalidArgument = "invalid argument:"
|
||||
)
|
||||
20
credentials/types/interfaces.go
Normal file
20
credentials/types/interfaces.go
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
package types
|
||||
|
||||
import "context"
|
||||
|
||||
// Service TODO
|
||||
type Service interface {
|
||||
GetAllMetadata(ctx context.Context, sourceService string) (output <-chan Metadata, errch chan error)
|
||||
Get(ctx context.Context, id string) (output Credential, err error)
|
||||
Create(ctx context.Context, ci CredentialInput) (output Credential, err error)
|
||||
Update(ctx context.Context, id string, ci CredentialInput) (output Credential, err error)
|
||||
Delete(ctx context.Context, id string) (err error)
|
||||
}
|
||||
|
||||
// CredentialRepo TODO
|
||||
type CredentialRepo interface {
|
||||
GetAllMetadata(ctx context.Context, sourceService string, errch chan<- error) (output <-chan Metadata)
|
||||
Get(ctx context.Context, id string) (output Credential, err error)
|
||||
Put(ctx context.Context, c Credential) (err error)
|
||||
Delete(ctx context.Context, id string) (err error)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue