MCPcopy
hub / github.com/conversejs/converse.js / getLoginCredentialsFromBrowser

Function getLoginCredentialsFromBrowser

src/headless/utils/init.js:330–347  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

328}
329
330async function getLoginCredentialsFromBrowser() {
331 const jid = localStorage.getItem('conversejs-session-jid');
332 if (!jid) return null;
333
334 try {
335 const creds = await navigator.credentials.get({ password: true });
336 if (creds && creds.type == 'password' && isValidJID(creds.id)) {
337 // XXX: We don't actually compare `creds.id` with `jid` because
338 // the user might have been presented a list of credentials with
339 // which to log in, and we want to respect their wish.
340 await setUserJID(creds.id);
341 return { 'jid': creds.id, 'password': creds.password };
342 }
343 } catch (e) {
344 log.error(e);
345 return null;
346 }
347}
348
349async function getLoginCredentialsFromSCRAMKeys() {
350 const jid = localStorage.getItem('conversejs-session-jid');

Callers 1

Calls 4

isValidJIDFunction · 0.90
setUserJIDFunction · 0.85
errorMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected