pub(crate) fn match_card_num_in_accounts(
accs: &[TrdAcc],
card_num: &str,
caller_allowed_acc_ids: Option<&HashSet<u64>>,
) -> Vec<u64>Expand description
v1.4.105 D12 (Phase 2): pure fn — 给定 (account list, card_num) 返 matched
acc_id Vec. 与 daemon TrdCache::find_acc_ids_by_card_num 行为等价.
4 位 → 末尾 suffix match (card_num + uni_card_num 都看) 16 位 → 完整 equal match 其他 → 空 Vec (caller 应已 validate; 此处容错)
返 sorted + deduped Vec.
v1.4.106 codex round 2 F1 case 2 (P1) fix: 加 caller_allowed_acc_ids
snapshot 参数. caller 受限 key (allowed_acc_ids = Some(set)) 时, match
结果先按 snapshot 交集过滤 — 不在 snapshot 中的 acc_id 视作“对该 caller 不
存在“, 防 enumeration via 1-match/0-match/N-match timing 差异.
None (full key) → 不做交集过滤 (向后兼容老 master key 行为).
Some(set) 空集 → 与 KeyRecord / Limits contract 一致,视同不限制;
deny-all 使用 fail-closed sentinel {0}。