@@ -11,12 +11,12 @@ import (
1111)
1212
1313// SecretExists is a boolean function to verify a secret is present in keychain
14- func SecretExists (secretId string ) bool {
15- allSecretIds := ListSecrets ()
14+ func SecretExists (secretID string ) bool {
15+ allsecretIDs := ListSecrets ()
1616
17- // Search all the available secretIds for this one
18- for _ , id := range allSecretIds {
19- if id == secretId {
17+ // Search all the available secretIDs for this one
18+ for _ , id := range allsecretIDs {
19+ if id == secretID {
2020 return true
2121 }
2222 }
@@ -40,21 +40,21 @@ func GetSecret() string {
4040// with the label `summon`.
4141func ListSecrets () []string {
4242 // Note: OSX use the term "account" to refer to the secret id.
43- secretIds , err := keychain .GetGenericPasswordAccounts ("summon" )
43+ secretIDs , err := keychain .GetGenericPasswordAccounts ("summon" )
4444 if err != nil {
4545 log .Fatalln (err )
4646 }
4747
48- return secretIds
48+ return secretIDs
4949}
5050
5151// AddSecret is a non-return function that adds the secret and secret value to
5252// keychain.
53- func AddSecret (secretId string ) {
53+ func AddSecret (secretID string ) {
5454 // Add new generic password item to keychain
5555 secret := []byte (GetSecret ())
5656 item := keychain .NewGenericPassword (
57- "summon" , secretId , "summon" , secret , "" ,
57+ "summon" , secretID , "summon" , secret , "" ,
5858 )
5959 item .SetSynchronizable (keychain .SynchronizableNo )
6060 item .SetAccessible (keychain .AccessibleAfterFirstUnlock )
@@ -66,7 +66,7 @@ func AddSecret(secretId string) {
6666 log .Fatalf (
6767 "An error occurred trying to add a secret to keychain.\n " +
6868 "Secret '%s' already exists. Exiting...\n " ,
69- secretId ,
69+ secretID ,
7070 )
7171 }
7272
@@ -80,25 +80,25 @@ func AddSecret(secretId string) {
8080 }
8181
8282 // Verify the secret was set in keychain successfully
83- if ! SecretExists (secretId ) {
83+ if ! SecretExists (secretID ) {
8484 log .Fatalf ("Secret %s not found in keychain. Exiting...\n " , secret )
8585 }
8686
87- fmt .Printf ("Added %s successfully to keychain.\n " , secretId )
87+ fmt .Printf ("Added %s successfully to keychain.\n " , secretID )
8888 return
8989}
9090
9191// DeleteSecret is a non-return function that removes the secret from keychain
92- func DeleteSecret (secretId string ) {
93- err := keychain .DeleteGenericPasswordItem ("summon" , secretId )
92+ func DeleteSecret (secretID string ) {
93+ err := keychain .DeleteGenericPasswordItem ("summon" , secretID )
9494 if err != nil {
9595 log .Fatalf (
9696 "An error occurred trying to remove secret from " +
9797 "keychain.\n Secret '%s' not found in keychain. Exiting...\n " ,
98- secretId ,
98+ secretID ,
9999 )
100100 }
101101
102- fmt .Printf ("Removed %s successfully from keychain.\n " , secretId )
102+ fmt .Printf ("Removed %s successfully from keychain.\n " , secretID )
103103 return
104104}
0 commit comments