MCPcopy Index your code
hub / github.com/coder/coder / parseCredentialsJSON

Function parseCredentialsJSON

cli/sessionstore/sessionstore.go:88–99  ·  view source on GitHub ↗

parseCredentialsJSON parses the JSON from the keyring into a credentialsMap.

(jsonData []byte)

Source from the content-addressed store, hash-verified

86
87// parseCredentialsJSON parses the JSON from the keyring into a credentialsMap.
88func 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.

Callers 5

ReadMethod · 0.85
WriteMethod · 0.85
DeleteMethod · 0.85
TestParseCredentialsJSONFunction · 0.85

Calls 2

UnmarshalMethod · 0.45
ErrorfMethod · 0.45

Tested by 2

TestParseCredentialsJSONFunction · 0.68