Skip to content

Rewrite AutocryptHeaderParser and AutocryptGossipHeaderParser in Kotlin #9830

@shamim-emon

Description

@shamim-emon

Currently, AutocryptHeaderParser and AutocryptGossipHeaderParser are implemented in Java. For better Kotlin interoperability and idiomatic code, both classes should be converted to Kotlin with the following improvements:

  1. Convert both classes from Java to Kotlin.
  2. Maintain singleton pattern using private constructor + companion object.
  3. Use idiomatic Kotlin features:
  • when expressions for validation
  • mapNotNull instead of manual loops
  • Null safety (?., ?:, etc.)
  • Avoid redundant operations (e.g., Base64 decoding)
  1. Logging should be consistent using a dedicated TAG constant.
  2. parseAllAutocryptHeaders/parseAllAutocryptGossipHeaders should accept Collection<String> for flexibility.
  3. Preserve existing functionality and validation rules.
  4. Add @VisibleForTesting annotations to parsing functions where applicable.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions