esim: decode EUICCInfo1/2 and the RAT per SGP.22 (no version bump yet)
The chip endpoint returned pySim's flattened EuiccInfo dict, whose classes are incomplete: the capability fields are raw GreedyBytes, extCardResource is raw bytes and several SGP.22 TLVs are missing from the class, so cards showed 'unknown_ber_tlv_ie_99' and raw hex instead of decoded values. - request the EUICCInfo1/2 and configured-address TLVs raw and decode them in esim.py per SGP.22 v2.6 5.7.8, cross-checked against lpac's es10c_ex.c: extended card resource, UICC/RSP capability bit lists (first octet = unused bits, MSB-first), CI PKI lists, category (both the implicit 0x8B and explicit 0xAB tag encodings), forbidden profile policy rules (0x99), ppVersion (0x04), sasAcreditationNumber (0x0C) and the optional certification data object / TRE fields; undecoded TLVs stay in raw_tlvs instead of being dropped. - add the ES10b GetRat rules authorisation table (PPR ids, allowed operators, consent flag) to the chip response. - PWA: label every new field, map nested labels per path component (the old code only matched whole keys), group the view into EUICCInfo1 / EUICCInfo2 / Addresses / RAT sections, render arrays of objects with index labels and translate the labels (RU). - tests: decoders against a real card's values (077F3E1F80, 0490, 0640, 81010082040006B32C83022646, the RAT fixture) and the frontend label mapping; sw.js simple-v229.
This commit is contained in:
@@ -42,6 +42,9 @@ test('esimGroupEid groups the hex digits in fours', () => {
|
||||
test('esimLabel maps known chip keys and prettifies the rest', () => {
|
||||
assert.strictEqual(esimLabel('svn'), 'SVN');
|
||||
assert.strictEqual(esimLabel('default_dp_address'), 'Default SM-DP+ address');
|
||||
assert.strictEqual(esimLabel('installed_application'), 'Installed applications');
|
||||
assert.strictEqual(esimLabel('forbidden_profile_policy_rules'), 'Forbidden PPRs');
|
||||
assert.strictEqual(esimLabel('allowed_operators'), 'Allowed operators');
|
||||
assert.strictEqual(esimLabel('some_unknown_key'), 'Some unknown key');
|
||||
});
|
||||
|
||||
@@ -52,12 +55,42 @@ test('esimFieldRows flattens nested values and skips empties', () => {
|
||||
});
|
||||
assert.deepStrictEqual(rows, [
|
||||
['SVN', '1.2.3'],
|
||||
['Nested / profile version', '2.2'],
|
||||
['Nested / Profile version', '2.2'],
|
||||
['List', 'a, b'],
|
||||
['Zero', '0'],
|
||||
]);
|
||||
});
|
||||
|
||||
test('esimFieldRows labels nested keys per path component', () => {
|
||||
const rows = esimFieldRows({
|
||||
euicc_ci_pki_list_for_verification: { subject_key_identifier: '8137AB' },
|
||||
ext_card_resource: {
|
||||
installed_application: 0,
|
||||
free_non_volatile_memory: 439084,
|
||||
},
|
||||
}, '');
|
||||
assert.deepStrictEqual(rows, [
|
||||
['CI PKI (verification) / Subject key identifier', '8137AB'],
|
||||
['Card resource / Installed applications', '0'],
|
||||
['Card resource / Free non-volatile memory', '439084'],
|
||||
]);
|
||||
});
|
||||
|
||||
test('esimFieldRows recurses into arrays of objects with index labels', () => {
|
||||
const rows = esimFieldRows({
|
||||
rat: [{
|
||||
ppr_ids: ['ppr1', 'ppr2'],
|
||||
allowed_operators: [{ plmn: 'EEEEEE', gid1: null, gid2: null }],
|
||||
ppr_flags: ['consentRequired'],
|
||||
}],
|
||||
}, '');
|
||||
assert.deepStrictEqual(rows, [
|
||||
['Rules authorisation table 1 / PPR IDs', 'ppr1, ppr2'],
|
||||
['Rules authorisation table 1 / Allowed operators 1 / PLMN', 'EEEEEE'],
|
||||
['Rules authorisation table 1 / PPR flags', 'consentRequired'],
|
||||
]);
|
||||
});
|
||||
|
||||
test('esimResultText localizes result codes and passes errors through', () => {
|
||||
assert.strictEqual(esimResultText({ result: 'catBusy' }), 'card is busy with a CAT session');
|
||||
assert.strictEqual(esimResultText({ result: 'ok' }), 'ok');
|
||||
|
||||
Reference in New Issue
Block a user