parseCredentialsJSON parses the JSON from the keyring into a credentialsMap.
(jsonData []byte)
| 86 | |
| 87 | // parseCredentialsJSON parses the JSON from the keyring into a credentialsMap. |
| 88 | func parseCredentialsJSON(jsonData []byte) (credentialsMap, error) { |
| 89 | if len(jsonData) == 0 { |
| 90 | return make(credentialsMap), nil |
| 91 | } |
| 92 | |
| 93 | var creds credentialsMap |
| 94 | if err := json.Unmarshal(jsonData, &creds); err != nil { |
| 95 | return nil, xerrors.Errorf("unmarshal credentials: %w", err) |
| 96 | } |
| 97 | |
| 98 | return creds, nil |
| 99 | } |
| 100 | |
| 101 | // Keyring is a Backend that exclusively stores the session token in the operating |
| 102 | // system keyring. Happy path usage of this type should start with NewKeyring. |