View index.js
(() => {
const ary = []
document.querySelectorAll(".g").forEach((dom) => {
const title = dom.querySelector("h3").innerText;
const date = dom.querySelector(".s span.f") ? dom.querySelector(".s span.f").innerText.replace(' - ', '') : '';
const url = dom.querySelector("cite") ? dom.querySelector("cite").innerText : '';
ary.push(`${date}\t\t${title}\t${url}`);
})
console.log(ary.join("\n"))
})();
View index.js
self.addEventListener('message', async (e) => {
const cache = await caches.open(CACHE_NAME)
switch (e.data.action) {
case 'cache':
const res = new Response(e.data.response);
cache.put(e.data.url, res);
break;
case 'delete':
cache.delete(e.data.url);
break;
View index.js
const channel = new MessageChannel();
navigator.serviceWorker.controller
.postMessage({
action: 'cache',
url: 'http://www.example.com/app',
response: 'Hello World'
}, [channel.port2]);
View index.js
let verifyAuthenticatorAttestationResponse = (webAuthnResponse) => {
let attestationBuffer = base64url.toBuffer(webAuthnResponse.response.attestationObject);
let ctapMakeCredResp = cbor.decodeAllSync(attestationBuffer)[0];
let response = {'verified': false};
if(ctapMakeCredResp.fmt === 'fido-u2f') {
let authrDataStruct = parseMakeCredAuthData(ctapMakeCredResp.authData);
if(!(authrDataStruct.flags & U2F_USER_PRESENTED))
throw new Error('User was NOT presented durring authentication!');
View index.js
if(clientData.origin !== config.origin) {
// エラー
}
View index.js
if(clientData.challenge !== request.session.challenge) {
// エラー
}
View index.json
{
"challenge":"-Qa...QFM",
"clientExtensions":{},
"hashAlgorithm":"SHA-256",
"origin":"http://localhost:3000",
"type":"webauthn.create"
}
View index.json
{
"getClientExtensionResults":{},
"rawId":"pHk...xjA",
"response":{
"attestationObject":"o2N...NB5",
"clientDataJSON":"eyJ...SJ9"
},
"id":"pHk...xjA",
"type":"public-key"
}
View index.js
navigator.credentials.create({ publicKey })
View index.js
{
challenge: "(ランダムな文字列)"
rp: {
name: "任意の社名など"
},
user: {
id: "(ランダムな文字列)",
name: "(入力されたユーザID)",
displayName: "(入力されたユーザ名)"
},