mirror of
https://github.com/mitchell/selfpass.git
synced 2025-12-14 13:27:21 +00:00
Modify sp and services to use the protobuf module
This commit is contained in:
parent
66ec035ee0
commit
4fc74b0994
23 changed files with 59 additions and 1025 deletions
|
|
@ -12,7 +12,7 @@ import (
|
|||
"github.com/mitchell/selfpass/services/credentials/types"
|
||||
)
|
||||
|
||||
type CredentialClientInit func(ctx context.Context) (c types.CredentialClient)
|
||||
type CredentialsClientInit func(ctx context.Context) (c types.CredentialsClient)
|
||||
|
||||
func check(err error) {
|
||||
if err != nil {
|
||||
|
|
@ -21,7 +21,7 @@ func check(err error) {
|
|||
}
|
||||
}
|
||||
|
||||
func selectCredential(client types.CredentialClient) types.Credential {
|
||||
func selectCredential(client types.CredentialsClient) types.Credential {
|
||||
var (
|
||||
idKey string
|
||||
source string
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import (
|
|||
clitypes "github.com/mitchell/selfpass/sp/types"
|
||||
)
|
||||
|
||||
func makeCreate(repo clitypes.ConfigRepo, initClient CredentialClientInit) *cobra.Command {
|
||||
func makeCreate(repo clitypes.ConfigRepo, initClient CredentialsClientInit) *cobra.Command {
|
||||
var length uint
|
||||
var numbers bool
|
||||
var specials bool
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import (
|
|||
"gopkg.in/AlecAivazis/survey.v1"
|
||||
)
|
||||
|
||||
func makeDelete(initClient CredentialClientInit) *cobra.Command {
|
||||
func makeDelete(initClient CredentialsClientInit) *cobra.Command {
|
||||
deleteCmd := &cobra.Command{
|
||||
Use: "delete",
|
||||
Short: "Delete a credential using the given ID",
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import (
|
|||
clitypes "github.com/mitchell/selfpass/sp/types"
|
||||
)
|
||||
|
||||
func makeGCMToCBC(repo clitypes.ConfigRepo, initClient CredentialClientInit) *cobra.Command {
|
||||
func makeGCMToCBC(repo clitypes.ConfigRepo, initClient CredentialsClientInit) *cobra.Command {
|
||||
gcmToCBC := &cobra.Command{
|
||||
Use: "gcm-to-cbc",
|
||||
Hidden: true,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import (
|
|||
clitypes "github.com/mitchell/selfpass/sp/types"
|
||||
)
|
||||
|
||||
func makeGet(repo clitypes.ConfigRepo, initClient CredentialClientInit) *cobra.Command {
|
||||
func makeGet(repo clitypes.ConfigRepo, initClient CredentialsClientInit) *cobra.Command {
|
||||
getCmd := &cobra.Command{
|
||||
Use: "get",
|
||||
Short: "Get a credential info and copy password to clipboard",
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ the users private key, and server certificates. (All of which will be encrypted)
|
|||
prompt survey.Prompt
|
||||
privateKey = strings.Replace(uuid.New().String(), "-", "", -1)
|
||||
)
|
||||
_, cfg, _ := repo.OpenConfig()
|
||||
_, cfg, err := repo.OpenConfig()
|
||||
check(err)
|
||||
|
||||
prompt = &survey.Password{Message: "New master password:"}
|
||||
check(survey.AskOne(prompt, &masterpass, nil))
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import (
|
|||
"github.com/mitchell/selfpass/services/credentials/types"
|
||||
)
|
||||
|
||||
func makeList(initClient CredentialClientInit) *cobra.Command {
|
||||
func makeList(initClient CredentialsClientInit) *cobra.Command {
|
||||
var sourceHost string
|
||||
|
||||
listCmd := &cobra.Command{
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ can interact with the entire Selfpass API.`,
|
|||
cfgFile := rootCmd.PersistentFlags().String("config", "", "config file (default is $HOME/.sp.toml)")
|
||||
|
||||
mgr := repositories.NewConfigManager(cfgFile)
|
||||
clientInit := credrepos.NewCredentialServiceClient
|
||||
clientInit := credrepos.NewCredentialsClient
|
||||
|
||||
rootCmd.AddCommand(
|
||||
makeInit(mgr),
|
||||
|
|
@ -41,8 +41,8 @@ can interact with the entire Selfpass API.`,
|
|||
check(rootCmd.Execute())
|
||||
}
|
||||
|
||||
func makeInitClient(repo types.ConfigRepo, initClient credtypes.CredentialClientInit) CredentialClientInit {
|
||||
return func(ctx context.Context) credtypes.CredentialClient {
|
||||
func makeInitClient(repo types.ConfigRepo, initClient credtypes.CredentialsClientInit) CredentialsClientInit {
|
||||
return func(ctx context.Context) credtypes.CredentialsClient {
|
||||
_, cfg, err := repo.OpenConfig()
|
||||
check(err)
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import (
|
|||
clitypes "github.com/mitchell/selfpass/sp/types"
|
||||
)
|
||||
|
||||
func makeUpdate(repo clitypes.ConfigRepo, initClient CredentialClientInit) *cobra.Command {
|
||||
func makeUpdate(repo clitypes.ConfigRepo, initClient CredentialsClientInit) *cobra.Command {
|
||||
var length uint
|
||||
var numbers bool
|
||||
var specials bool
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue