-
-
Notifications
You must be signed in to change notification settings - Fork 505
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Adding support for
age.Plugin
identities (#2960)
* Feat: support age plugin identities, including age-plugin-yubikey ones. Signed-off-by: Yolan Romailler <[email protected]> * Applying code review comments and adding test Signed-off-by: Yolan Romailler <[email protected]> --------- Signed-off-by: Yolan Romailler <[email protected]>
- Loading branch information
1 parent
9797b87
commit 2c268d2
Showing
17 changed files
with
586 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package age | ||
|
||
import ( | ||
"context" | ||
|
||
"filippo.io/age/plugin" | ||
"github.com/gopasspw/gopass/internal/cui" | ||
"github.com/gopasspw/gopass/internal/out" | ||
"github.com/gopasspw/gopass/pkg/termio" | ||
) | ||
|
||
var pluginTerminalUI = &plugin.ClientUI{ | ||
DisplayMessage: func(name, message string) error { | ||
out.Printf(context.Background(), "%s plugin: %s", name, message) | ||
|
||
return nil | ||
}, | ||
RequestValue: func(name, message string, _ bool) (string, error) { | ||
var err error | ||
defer func() { | ||
if err != nil { | ||
out.Warningf(context.Background(), "could not read value for age-plugin-%s: %v", name, err) | ||
} | ||
}() | ||
secret, err := termio.AskForPassword(context.Background(), "secret", false) | ||
if err != nil { | ||
return "", err | ||
} | ||
|
||
return secret, nil | ||
}, | ||
Confirm: func(name, message, yes, no string) (bool, error) { | ||
rep, _ := cui.GetSelection(context.Background(), message, []string{yes, no}) | ||
if rep == yes { | ||
return true, nil | ||
} | ||
|
||
return false, nil | ||
}, | ||
|
||
WaitTimer: func(name string) { | ||
out.Printf(context.Background(), "waiting on %s plugin...", name) | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.