PageSourceSearch

https://sifrovacky.cz/assets/authentication/passkeys/reauthentication-eb31602a.js

js sifrovacky.cz collected 2026-10-05 02:16:13 UTC 1,882 bytes, 52 lines download raw bytes

1import {
2  get,
3  parseRequestOptionsFromJSON
4} from '@github/webauthn-json/browser-ponyfill'
5
6const getReauthenticationToken = async function (form) {
7  const csrfToken = document.getElementsByName('csrf-token')[0].content
8  const reauthenticationTokenFieldName = form.dataset.reauthenticationTokenFieldName
9  const reauthenticationChallengeURL = new URL(form.dataset.reauthenticationChallengeUrl)
10  const reauthenticationTokenURL = new URL(form.dataset.reauthenticationTokenUrl)
11
12  const challengeFetch = fetch(reauthenticationChallengeURL, {
13    method: 'POST',
14    headers: {
15      Accept: 'application/json',
16      'X-CSRF-Token': csrfToken
17    }
18  })
19
20  const challengeJSON = await (await challengeFetch).json()
21  const credentialAuthenticationOptions = parseRequestOptionsFromJSON({ publicKey: challengeJSON })
22
23  const credentialAuthenticationResponse = await get(credentialAuthenticationOptions)
24
25  const reauthenticationTokenFetchBody = {
26    passkey_credential: JSON.stringify(credentialAuthenticationResponse)
27  }
28
29  const reauthenticationTokenFetch = fetch(reauthenticationTokenURL, {
30    method: 'POST',
31    headers: {
32      'Content-Type': 'application/json',
33      Accept: 'application/json',
34      'X-CSRF-Token': csrfToken
35    },
36    body: JSON.stringify(reauthenticationTokenFetchBody)
37  })
38
39  const reauthenticationTokenResponse = await (await reauthenticationTokenFetch).json()
40  console.log('reauthenticationTokenResponse', reauthenticationTokenResponse)
41  form.elements[reauthenticationTokenFieldName].value = reauthenticationTokenResponse.reauthentication_token
42}
43
44const submitReauthenticatePasskeyFormEvent = async function(event){
45  event.preventDefault()
46  event.stopImmediatePropagation()
47  let form = event.currentTarget
48  await getReauthenticationToken(form)
49  form.submit()
50}
51
52export { getReauthenticationToken, submitReauthenticatePasskeyFormEvent }

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.