feat: let administrators view and copy encrypted integration credentials
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"time"
|
||||
|
||||
"git.yuntuo.hk/k2safe/orbit/internal/config"
|
||||
"git.yuntuo.hk/k2safe/orbit/internal/credentialvault"
|
||||
"git.yuntuo.hk/k2safe/orbit/internal/storage/mysql"
|
||||
core "git.yuntuo.hk/k2safe/orbit/model"
|
||||
)
|
||||
@@ -112,7 +113,11 @@ func runCredentialChange(args []string, action string) error {
|
||||
if err := writePrivateOperation(output, op); err != nil {
|
||||
return err
|
||||
}
|
||||
receipt, err := mysql.ApplyCredentialOperation(ctx, db, op)
|
||||
vault, err := credentialvault.LoadFile(os.Getenv("ORBIT_CREDENTIAL_KEY_FILE"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
receipt, err := mysql.ApplyCredentialOperation(ctx, db, op, vault)
|
||||
if err != nil {
|
||||
return errors.New("credential operation was not confirmed; the private operation file was retained for reconciliation")
|
||||
}
|
||||
@@ -138,7 +143,11 @@ func runCredentialApply(args []string) error {
|
||||
return err
|
||||
}
|
||||
defer closeDB()
|
||||
receipt, err := mysql.ApplyCredentialOperation(ctx, db, op)
|
||||
vault, err := credentialvault.LoadFile(os.Getenv("ORBIT_CREDENTIAL_KEY_FILE"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
receipt, err := mysql.ApplyCredentialOperation(ctx, db, op, vault)
|
||||
if err != nil {
|
||||
return errors.New("credential operation was not confirmed; retry with the same private operation file")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user