mirror of
https://github.com/sbrow/envr.git
synced 2025-12-29 23:47:39 -05:00
refactor: Removed TODOs.
This commit is contained in:
@@ -207,8 +207,7 @@ func (c Config) searchPaths() (paths []string, err error) {
|
|||||||
return paths, nil
|
return paths, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Should this be private?
|
func (s SshKeyPair) identity() (age.Identity, error) {
|
||||||
func (s SshKeyPair) Identity() (age.Identity, error) {
|
|
||||||
sshKey, err := os.ReadFile(s.Private)
|
sshKey, err := os.ReadFile(s.Private)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to read SSH key: %w", err)
|
return nil, fmt.Errorf("failed to read SSH key: %w", err)
|
||||||
@@ -222,8 +221,7 @@ func (s SshKeyPair) Identity() (age.Identity, error) {
|
|||||||
return id, nil
|
return id, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Should this be private?
|
func (s SshKeyPair) recipient() (age.Recipient, error) {
|
||||||
func (s SshKeyPair) Recipient() (age.Recipient, error) {
|
|
||||||
sshKey, err := os.ReadFile(s.Public)
|
sshKey, err := os.ReadFile(s.Public)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to read SSH key: %w", err)
|
return nil, fmt.Errorf("failed to read SSH key: %w", err)
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ func decryptDb(tmpFilePath string, keys []SshKeyPair) error {
|
|||||||
identities := make([]age.Identity, 0, len(keys))
|
identities := make([]age.Identity, 0, len(keys))
|
||||||
|
|
||||||
for _, key := range keys {
|
for _, key := range keys {
|
||||||
id, err := key.Identity()
|
id, err := key.identity()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -245,7 +245,7 @@ func encryptDb(tmpFilePath string, keys []SshKeyPair) error {
|
|||||||
|
|
||||||
recipients := make([]age.Recipient, 0, len(keys))
|
recipients := make([]age.Recipient, 0, len(keys))
|
||||||
for _, key := range keys {
|
for _, key := range keys {
|
||||||
recipient, err := key.Recipient()
|
recipient, err := key.recipient()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user