catarrh
0fd91d7771
C-APDU parser + BER fixes: DCS prefix, qualifier tables, EFRMA refs, CLA labels; v1.9.0
...
Parser + BER constructor (TS 102 223 / TS 102 226):
- DCS byte: genBerPcValue prepends DCS to 8D (00=GSM7, 08=UCS2, 04=unpacked)
- decodeTextData: consume DCS first, legacy no-DCS fallback kept
- BER_QUAL.display['80']: 'Clear after delay' -> 'Wait for user to clear message'
- BER_QUAL.tone: 'Monotonous/Alternating' -> 'Vibrate alert' names
- describeProactiveCommand: map type byte -> correct BER_QUAL key
(01->refresh, 21->display, 20->tone); proper command names
- parseActionRow: values 01-7F -> 'Reference to EFRMA record'
- parseOneApdu: CLA 84-87 -> 'GlobalPlatform (secure messaging)'
- PARSE_INS: added GET RESPONSE (INS C0)
Version: 1.8.1 -> 1.9.0, SW cache otaman-v9 -> otaman-v10
2026-08-21 22:53:16 +03:00
catarrh
288c2e5954
C-APDU constructor spec fixes (TS 102 221 / GPC v2.3 / TS 102 226)
...
SIM/USIM tab (TS 102 221):
- Record P2 modes: 04/06/02 -> 04/02/03; P1=00 for next/previous
- SELECT Le rules: USIM FID no Le, path/dfname P2=04+Le; SIM no Le
- Path placeholder: 3F007FFF6FC5 -> 7FFF6FC5
- ACTIVATE/DEACTIVATE: 5-byte -> 4-byte case-1
- VERIFY PIN: dedicated input, Lc=08, FF-pad to 8 bytes
- CHANGE PIN: old/new inputs, Lc=10, two 8-byte fields
- ERASE BINARY removed from USIM tab
RAM tab (GPC v2.3):
- INSTALL: all 5 variants rewritten to strict LV + Le 00
- ELF/Module AID inputs for install-install
- Privileges: 1 byte if only byte-1, else 3 bytes
- InstallParams: C9 00 + toolkit TLV (mandatory)
- LOAD/DELETE/GET STATUS: append Le 00
- GET STATUS P2: drop 40/42, keep 02/03/00
- GET DATA: 2F00/5031 -> case-4 5C00 data
- SET STATUS: raw AID (no 4F), ISD card states, P1=60
- EXT AUTH: CLA 84, P1 security level, Lc=10
- INT AUTH: CLA 00
Toolkit (TS 102 226):
- MSL: 01 <msl> -> 00 (no check) or 02 01 <msl>
- SIM CA wrapped in EF: C9 00 EF <len> CA...
- TAR length %3 validation
- Menu IDs <= 7F validation
Script Chaining (TS 102 226 Table 5.9a):
- Removed Script ID + Additional Data fields
- Emit strictly 83 01 <flags>
- Deleted generateScriptIdHint
Privilege label: Token Verification -> Token Management
2026-08-21 22:37:39 +03:00
catarrh
0857c5f68b
C-APDU Parser: remove tree border lines, keep indentation only
2026-08-20 23:22:52 +03:00
catarrh
b832372ac8
C-APDU Parser: indigo hex data color + rebuild CSS
2026-08-20 23:21:03 +03:00
catarrh
1d4693305d
C-APDU Parser: descriptive action indicator names (81=session indication, 82=early response)
2026-08-20 23:06:26 +03:00
catarrh
2782ff35c4
C-APDU Parser: increase decoded tree font from text-xs to text-sm
2026-08-20 22:54:40 +03:00
catarrh
5f2eaf6e9d
C-APDU Parser: space-separated placeholder for consistency with Response parser
2026-08-20 22:46:44 +03:00
catarrh
b7d0d53b94
C-APDU Parser: include raw qualifier value in description
2026-08-20 22:37:51 +03:00
catarrh
1ce23f021c
C-APDU Parser: change Parse button to Decode (existing i18n key)
2026-08-20 22:21:39 +03:00
catarrh
72b0116bad
C-APDU Parser: client-side hex parser for APDU/expanded script decode
...
New 'Parser' subtab in C-APDU section. Detects format (compact C-APDU
chain, expanded AA/AE80 script) and renders collapsible tree with decoded
parameters. Key features:
- BER-TLV parser with multi-byte tag support and CR-bit handling
- Proactive command decoder (types from BER_QUAL, devices from BER_DEVICES)
- SIM/UICC toolkit parameter decoder (CA/EA/80)
- GSM7 text decode (7-bit packed, escape sequences)
- Best-effort UCS2/GSM7 text detection
- Compact C-APDU chain with implied-CLA support (SELECT + op chaining)
- 18 test cases from exchange vectors (apdu_parse.test.js)
2026-08-20 22:11:55 +03:00
catarrh
8019326cfb
Error Action: render builder directly, remove redundant subtype select
...
Error Action (tag 82) now renders buildErrorActionRow() directly in
onBerTypeChange, bypassing the shared ber-subtype select which had
confusing 'Action indicator' option and dead 'Proactive command'/'Custom
hex' choices. Removed the now-unreachable type === 'error' branch from
onBerSubTypeChange.
2026-08-20 21:39:59 +03:00
catarrh
01931b9693
Fix Error Action proactive: filter REFRESH out of allowed commands
...
When Error Action (tag 82) uses the Proactive command subtype, only
DISPLAY TEXT and PLAY TONE are allowed per TS 102 226 Table 5.9.
Pass allowed=['display','tone'] to buildBerPcHtml for error-type rows.
2026-08-20 21:34:38 +03:00
catarrh
03ec13364c
Fix onErrorActionTypeChange: sel.nextElementSibling -> sel.parentElement.nextElementSibling
...
The Error Action HTML structure wraps the select in a flex div sibling to
the .error-action-body div, so sel.nextElementSibling was null.
2026-08-20 21:29:07 +03:00
catarrh
e6602c40bf
RAM constructor fixes: EA/CA nesting, access domain order, menu pairs, BER lengths, services byte (TS 102 226)
...
- UICC Toolkit tag 80 nested inside EA (EA 12 80 10 ...)
- ram-tk-mode value ea (was 80), label 'UICC Toolkit (Tag EA)'
- SIM (CA) access domain FIRST in payload, blank = 00
- Menu entries: 2×m pairs (i=1 first, i=m last, else 0000)
- CA/EA lengths via berLenStr() (supports 81xx long form)
- UICC trailing 'Maximum number of services' byte (ram-tk-services)
- DELETE: P1=00 fixed, mode in P2 (80E4 00 <mode> ...)
- STORE DATA: ram-enc 00/40/80/C0/E0 with correct labels
- LOAD: P1 fixed to 0x80 (last block)
- USIM SELECT: selP1 0x09 -> 0x00 (select by file id)
- ram.test.js: 11 exact-hex tests from exchange vectors
- v1.8.1, SW cache otaman-v9
2026-08-20 21:23:37 +03:00
catarrh
4a6a142c3d
Expanded Format spec fixes: REFRESH qualifiers, Error Action forms, Script Chaining flags, CR-bit tags (TS 102 226)
...
- BER_QUAL.refresh: full TS 102 223 §8.6 table (00-0A)
- Error Action rebuilt as single select: Proactive (DISPLAY/PLAY TONE only) /
No action (82 00) / EFRMA ref (82 01 xx) / Custom hex; drop bogus
Action Type / Trigger Conditions / Retry Count UI
- buildBerPcHtml(allowed): no Custom option; typeBytes tone 31 -> 20
- DISPLAY TEXT Duration control emitting 84 02 <unit> <interval>
- File list tag 12 -> 92 (CR bit set)
- Script Chaining flags 01/11/02/03 + keep-across-reset checkbox (RFM)
- ber.test.js: exact-hex tests for all above (exchange vectors)
2026-08-20 21:13:41 +03:00
catarrh
0217f8dc92
Error Action Recovery: add Action Indicator / Proactive Command / None selector per TS 102 226 §7.3.3
2026-08-20 02:04:18 +03:00
catarrh
6d8ef55398
Fix Error Action Recovery Action: extract buildBerPcHtml, fix container vs element in genBerPcValue call
2026-08-20 01:48:15 +03:00
catarrh
43242210ab
Fix Error Action Recovery Action builder: append to DOM before querying
2026-08-20 01:41:09 +03:00
catarrh
53daf2c6ea
Auto-connect on same-origin detection
2026-08-20 01:36:54 +03:00
catarrh
79cf003444
Fix Script Chaining selector bugs in genScriptChainingValue
...
Fixed all three selectors to use rowIdx from dataset.berIdx:
- 'chaining-][value="first"]' → 'chaining-{rowIdx}[value="first"]'
- 'chaining][value="intermediary"]' → 'chaining-{rowIdx}[value="intermediary"]'
- Already fixed: 'chaining]-last' → 'chaining-{rowIdx}-last'
Now bits 0/1/2 correctly set based on First/Intermediary/Last checkboxes.
Frontend: frontend/index.html
Tests: 14 Node green
2026-08-19 23:51:10 +03:00
catarrh
e8a8ef3d1b
Fix Script Chaining Last Script checkbox selector typo
...
Fixed malformed querySelector in genScriptChainingValue:
- 'chaining-]-last' → 'chaining-{rowIdx}-last'
- Last Script checkbox (bit 2) now correctly contributes to flags byte
- First+Last = 0x05, Intermediary+Last = 0x06, Last alone = 0x04
Frontend: frontend/index.html
Tests: 14 Node green
2026-08-19 23:44:33 +03:00
catarrh
d75604a751
TS 102 226: Expanded Script compliance with Error Action, Script Chaining, Expanded Response
...
Server:
- ExpandedRemoteResponse parser for per-command results (TS 102 226 §5.2.2)
- _decode_por() tries expanded parsing first, fallback to CompactRemoteResp
- response_type indicator: 'expanded'/'compact'/'none' + per-command details
Frontend:
- Error Action TLV (tag 82): structured UI with Action Type, SW pattern builder, recovery command, retry count
- Script Chaining TLV (tag 83): First/Intermediary/Last flags, Script ID with auto-increment hints, Additional Data
- Error Action replaces old 'action indicator' dropdown (breaking change)
- genErrorActionValue()/genScriptChainingValue() encoding functions
- updateSwMaskDisplay() for visual SW pattern builder
Documentation:
- help.html/help-ru.html: Error Action, Script Chaining, Expanded Response sections
Tests:
- TestExpandedRemoteResponse: construct parsing, error handling, chaining context
- 49 Python + 14 Node tests green
2026-08-19 23:20:24 +03:00
catarrh
80a860549a
v1.8.0: proactive log overhaul, Expanded Script rename, proactive view sizing
...
Server:
- Track all TERMINAL RESPONSEs (chain, TP, pySim auto-handler, menu-respond
link to paused entry) with shared _build_tr/_record_tr
- Log entry ids + cmd_num; server-side decode of fetched commands and TRs
(compact PLI port); Result CTLV extracted as tr_result/tr_result_name
- _LoggingApduTracer captures TR SW for pySim auto-handler responses
- _DefaultProactiveHandler answers PLI with editor data (no re-request)
- VERSION 1.8.0
Frontend:
- Expandable proactive log rows (click to expand, state survives re-render)
- Response section: Result name + hex, decoded fields, width-restrained
readonly hex inputs; no SW display
- Rename Expanded Script tab/pill/button/docs; proactive UICC view font
sizing increase; card reader pills text-sm
2026-08-19 18:04:08 +03:00
catarrh
a916e8a255
PLI list: vertical layout, full descriptions, wider inputs, row separators
...
- Drop truncation: full qualifier descriptions (wrap)
- Raw hex input moves under the description, fills row width (flex-1)
- Subtle bottom-border separator between qualifiers
2026-08-16 00:47:06 +03:00
catarrh
62ba09d25e
Probe: require JSON version field to confirm same-origin API
...
SPA-fallback static hosts return 200 HTML for /api/version, which falsely
triggered same-origin mode. Now validate the body parses as JSON with a string
version field before switching to a relative base.
2026-08-15 14:33:00 +03:00
catarrh
966ada21eb
Replace embedded flag with same-origin API probe
...
- Server serves frontend verbatim (drop window.PYSIM_EMBEDDED injection)
- Frontend probes /api/version once; res.ok -> relative base + cleared URL input,
otherwise fall back to http://127.0.0.1:8080
- sw.js: never intercept/cache /api/* (live card data)
2026-08-15 14:10:24 +03:00
catarrh
d2c292e5b8
Merge pysim-otaman-server into otaman (monorepo, v1.7.0)
...
- Move PWA into frontend/; server package at pysim_otaman_server/
- Server now serves the PWA (same origin -> no CORS/PNA): static file handler
+ --web-dir flag + injects window.PYSIM_EMBEDDED marker into index.html
- Frontend defaults to relative API base when embedded (pysimBase = '')
- Version 1.7.0 aligned: server.py VERSION, pyproject.toml, PWA header
- SW cache bump otaman-v7 -> otaman-v8
- Docs: combined README + docs/api.md endpoint reference; update links
- Fix stale package.json repository URL
2026-08-14 15:48:38 +03:00