Skip to content

Added visible string implementation with tests#113

Merged
Lukasa merged 6 commits intoapple:mainfrom
mcecunda:main
Feb 24, 2026
Merged

Added visible string implementation with tests#113
Lukasa merged 6 commits intoapple:mainfrom
mcecunda:main

Conversation

@mcecunda
Copy link
Copy Markdown
Contributor

Added missing ASN1 type (ASN1VisibleString) with tests. Implementations is heavily inspired by existing implementation of ASN1PrintableString. Differs only in validation rules (_isValid method) and encoding identifier (defaultIdentifier property).

@Lukasa Lukasa added the 🆕 semver/minor Adds new public API. label Feb 23, 2026
Copy link
Copy Markdown
Contributor

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! This is mostly really good, can we add some tests that fail validation just to confirm we reject invalid strings?

@mcecunda
Copy link
Copy Markdown
Contributor Author

mcecunda commented Feb 24, 2026

Oh, great catch! I missed those negative tests.

I filled in the gaps. Again, inspired by printable string. Check again please.

let validBytes = allBytes.filter { !invalidBytes.contains($0) }

for byte in invalidBytes {
print(byte)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the print.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@Lukasa Lukasa merged commit 560256f into apple:main Feb 24, 2026
108 of 109 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🆕 semver/minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants