Skip to content

Add support for deciphering encrypted LCP user fields - #871

Draft
mickael-menu wants to merge 1 commit into
developfrom
fix-issue-147
Draft

mickael-menu wants to merge 1 commit into
developfrom
fix-issue-147

Conversation

@mickael-menu

Copy link
Copy Markdown
Member

Fixes #147.

Exposes liblcp's decryptField() (available since R2LCPClient 4.3.0) through the toolkit:

  • New hard requirement decryptField(field:using:) on the LCPClient facade, forwarding raw (Base64-decoded) ciphertext to R2LCPClient.decryptField. For consistency on the breaking 4.0 release, getSupportedLCPProfileURIs() also becomes a hard requirement and both backward-compatible defaults are removed.
  • New decipherUserField(_:) requirement and a best-effort decipheredUser() convenience on LCPLicense: it returns the User with the fields listed in encrypted (e.g. name, email) decrypted with the user key. Fields that cannot be deciphered are left untouched and remain listed in encrypted; the call throws when the license is restricted.

Includes TestApp facade forwarding, 9 unit tests for the field decryption, and CHANGELOG, Migration Guide and LCP guide updates.

Note: the decryptField input format (raw ciphertext, no internal Base64 decode) was verified against the disassembled 4.3.0 framework; a quick runtime check with a real license containing encrypted user fields would be a definitive confirmation.

🤖 Generated with Claude Code

Fixes #147.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mickael-menu
mickael-menu changed the base branch from swift6 to develop August 5, 2026 14:26
func decryptedString(from value: String?) throws -> String? {
guard
let value = value,
let encryptedData = Data(base64Encoded: value),

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.

I would add ignoreUnknownCharacters in case there are weird spaces in the json payload.

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.

2 participants