- doc: clarify tagHex may be empty when the auth tag is already appended
- dart + js bridges coerce a null/missing tagHex to "" so the call can't
throw before the method's own try/catch fallback
- js prelude defaults tagHex to "" so callers can omit it
(kept default padding for AESMode.gcm intentionally — see PR reply: in the
'encrypt' package, gcm isn't in _streamable, so padding:null would route
decrypt() to _processBlocks() and skip GCM tag verification.)
extensions couldn't do AES-GCM, only AES-CBC (via cryptoHandler). this
adds a decryptAESGCM bridge function so dart and js extensions can decrypt
AES/GCM/NoPadding payloads (needed to port extractors like MoonExtractor).
decryptAESGCM(encrypted, keyHex, ivHex, tagHex):
- encrypted = base64 ciphertext, key/iv/tag = hex
- appends the auth tag to the ciphertext (what pointycastle's GCM and
java's AES/GCM/NoPadding expect) and decrypts with tag verification
- also works when the tag is already appended to the ciphertext: just
pass an empty tagHex
- returns the decrypted utf-8 string, or the input on failure (same as
cryptoHandler)
wired in all three layers like the existing crypto helpers:
- lib/eval/model/m_bridge.dart (impl, via the 'encrypt' package)
- lib/eval/dart/bridge/m_provider.dart (dart/d4rt registration)
- lib/eval/javascript/utils.dart (js handler + prelude function)
This commit improves memory management, reduces redundant interpreter
instantiation, and standardizes service usage patterns.
- Add `dispose()` to `ExtensionService` interface and implement it across
Dart, JS, LNReader, and Mihon services.
- Replace repeated interpreter creation in `DartExtensionService` with a
persistent `_interpreter` instance initialized once in the constructor.
- Add disposal logic for JS DOM selector and Cheerio instances to prevent
memory leaks.
- Introduce `withExtensionService()` helper to ensure services are always
disposed after use.
- Update call sites across the codebase to use `withExtensionService()`
or manual try/finally disposal.
- Improve isolate service message handling by extracting `responsePort`
earlier.
- Ensure safer defaults (e.g., returning empty lists, const lists) when
service calls fail.
- Replace list→set→list conversions with LinkedHashSet for stable ordering
- Ensure PageUrl uniqueness based on URL
- Ensure Video uniqueness based on url + originalUrl
- Add null‑safety checks when building PageUrl and Video objects
- Improve readability and reduce unnecessary allocations