Skip to content

Commit

Permalink
Merge pull request #34 from lumaxis/fix-slack-keychain
Browse files Browse the repository at this point in the history
Update Slack token's macOS keychain account name
  • Loading branch information
rneatherway authored Mar 29, 2023
2 parents 19c44cb + 777dcd0 commit 7559957
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion internal/slackclient/cookie_password_macos.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,25 @@ import (
)

func cookiePassword() ([]byte, error) {
accountNames := []string{"Slack Key", "Slack"}

var err error
for _, accountName := range accountNames {
var password []byte
password, err = cookiePasswordFromKeychain(accountName)
if err == nil {
return password, nil
}
}

return []byte{}, err
}

func cookiePasswordFromKeychain(accountName string) ([]byte, error) {
query := keychain.NewItem()
query.SetSecClass(keychain.SecClassGenericPassword)
query.SetService("Slack Safe Storage")
query.SetAccount("Slack")
query.SetAccount(accountName)
query.SetMatchLimit(keychain.MatchLimitOne)
query.SetReturnAttributes(true)
query.SetReturnData(true)
Expand Down

0 comments on commit 7559957

Please sign in to comment.