MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / storeToken

Function storeToken

scripts/mars-credentials.mjs:200–217  ·  view source on GitHub ↗

Keep a token where this store keeps tokens; false when it was refused.

(connection, token)

Source from the content-addressed store, hash-verified

198
199 /** Keep a token where this store keeps tokens; false when it was refused. */
200 function storeToken(connection, token) {
201 memoryTokens.set(connection.id, token);
202 if (!secrets) {
203 connection.token = encrypt(token);
204 return true;
205 }
206 try {
207 secrets.write(
208 secretAccountFor(connection.id),
209 JSON.stringify({ v: SECRET_VERSION, kind: connection.kind, token }),
210 );
211 return true;
212 } catch (error) {
213 // Usable for this run; the UI says it was not saved.
214 log(error instanceof Error ? error.message : String(error));
215 return false;
216 }
217 }
218
219 function forgetToken(id) {
220 memoryTokens.delete(id);

Callers 2

saveFunction · 0.85
setTeamFunction · 0.85

Calls 4

encryptFunction · 0.85
secretAccountForFunction · 0.85
setMethod · 0.80
writeMethod · 0.80

Tested by

no test coverage detected