Skip to content

test(crypto): add round-trip tests for Unicode and binary edge cases … - #1805

Open
Anadudev wants to merge 1 commit into
Stellar-Mail:mainfrom
Anadudev:test/unicode-binary-roundtrip-1722
Open

test(crypto): add round-trip tests for Unicode and binary edge cases …#1805
Anadudev wants to merge 1 commit into
Stellar-Mail:mainfrom
Anadudev:test/unicode-binary-roundtrip-1722

Conversation

@Anadudev

Copy link
Copy Markdown

Closes #1722

Proposed Changes

Unicode & Binary Round-Trip Tests (tests/unit/crypto/envelope-roundtrip.test.ts)

  • Added comprehensive round-trip tests verifying sealEnvelope -> openEnvelope behavior across diverse text encodings:
    • Multilingual Scripts: Tested Arabic, Hebrew, CJK, Devanagari, Cyrillic, and Greek scripts.
    • Emoji & ZWJ Sequences: Tested family emoji (👨‍👩‍👧‍👦), skin tone modifiers (👍🏽), flags, and variation selectors (\uFE0F).
    • Code Point Exactness: Asserted exact code point array matching (toCodePoints(opened.body) === toCodePoints(input)).
    • Combining Characters & Normalization Separation: Verified that NFC (é, U+00E9) and NFD (e + \u0301, U+0065 U+0301) retain their distinct code point sequences and produce distinct content commitments without silent normalization.
    • Null Bytes & Control Characters: Tested strings containing embedded null bytes (\u0000) and ASCII control characters (\u0007, \u001B).
    • Canonicalization Independence: Confirmed canonicalizePayload and canonicalizeJcs preserve exact string code points while sorting JSON keys deterministically.
    • Boundary Payloads & Attachments: Tested large 1MB multi-byte payloads and Unicode attachment filenames (📄_测试_отчёт_2026.pdf).

Verification Plan

Automated Tests

  • Executed node node_modules/vitest/vitest.mjs run tests/unit/crypto/envelope-roundtrip.test.ts: 11 passed (11).
  • Executed node node_modules/vitest/vitest.mjs run tests/unit/crypto: 26 test files passed, 240/240 tests passed.
  • Executed npx eslint tests/unit/crypto/envelope-roundtrip.test.ts: 0 lint errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add crypto round-trip tests for Unicode and binary edge cases

1 participant