eaa2453853
Audit against GP v2.2 Am.B 4.7 / TS 102 226 / GP Card Spec 11.11 found the retry waiting delay encoded as plain hex instead of the TP-SCTS semi-octet order required by TS 102 223 8.38 -> TS 23.040 9.1.2.3 (1 min must be 10, 20 s must be 02); the builder now encodes semi-octets, clamps 0-59 / 0-99 and pads the 2-byte counter. Odd-length hex is padded instead of producing fractional BER lengths; empty 83/84/89 sub-TLVs are omitted (lengths are 1-n per Tables 4-3/4-5/4-8..10) and an empty trigger becomes 81 00; a store payload above a short APDU is chained as P1.b8=0 STORE DATA blocks (P2 = block number). Connection presets fixed: device identities 82, alpha 05, command details 81, bearer 35/03; the A5 store tag and the 'B0,00=unlimited' counter hint are marked unverified (not in the pinned spec). Docs: UICC_SPECS.md 9.6.5 example annotated 2 s, findings 10-minute timer corrected to 1 minute; help updated. SW cache otaman-v177.
70 lines
1.8 KiB
JavaScript
70 lines
1.8 KiB
JavaScript
const CACHE = 'otaman-v177';
|
|
const URLS = [
|
|
'index.html',
|
|
'help.html',
|
|
'help-ru.html',
|
|
'style.css',
|
|
'sim.png',
|
|
'favicon.svg',
|
|
'icon-192.png',
|
|
'icon-512.png',
|
|
'manifest.json',
|
|
'des-bundle.js',
|
|
'aes-bundle.js',
|
|
'sim.svg',
|
|
'sim_anim.svg',
|
|
'nosim.svg',
|
|
];
|
|
|
|
self.addEventListener('install', e => {
|
|
e.waitUntil(
|
|
caches.open(CACHE).then(c => c.addAll(URLS))
|
|
);
|
|
self.skipWaiting();
|
|
});
|
|
|
|
self.addEventListener('activate', e => {
|
|
e.waitUntil(
|
|
caches.keys().then(keys =>
|
|
Promise.all(keys.filter(k => k !== CACHE).map(k => caches.delete(k)))
|
|
).then(() => clients.claim())
|
|
);
|
|
});
|
|
|
|
const OFFLINE_RESPONSE = new Response('Offline: page not cached', {
|
|
status: 503,
|
|
statusText: 'Offline',
|
|
headers: { 'Content-Type': 'text/plain' },
|
|
});
|
|
|
|
self.addEventListener('fetch', e => {
|
|
if (!e.request.url.startsWith('http')) return;
|
|
const path = new URL(e.request.url).pathname;
|
|
if (path.startsWith('/api/')) return; // live data, never cache
|
|
if (e.request.method !== 'GET') return;
|
|
const isNavigate = e.request.mode === 'navigate';
|
|
const isSwScript = path.endsWith('/sw.js');
|
|
if (isNavigate) {
|
|
e.respondWith(
|
|
fetch(e.request).then(res => {
|
|
const clone = res.clone();
|
|
caches.open(CACHE).then(c => c.put(e.request, clone));
|
|
return res;
|
|
}).catch(() =>
|
|
caches.match(e.request)
|
|
.then(r => r || caches.match('index.html'))
|
|
.then(r => r || OFFLINE_RESPONSE)
|
|
)
|
|
);
|
|
} else if (isSwScript) {
|
|
e.respondWith(fetch(e.request).catch(() => OFFLINE_RESPONSE));
|
|
} else {
|
|
e.respondWith(
|
|
caches.match(e.request).then(r => r || fetch(e.request).then(res => {
|
|
const clone = res.clone();
|
|
caches.open(CACHE).then(c => c.put(e.request, clone));
|
|
return res;
|
|
}))
|
|
);
|
|
}
|
|
}); |