powerauth-crypto icon indicating copy to clipboard operation
powerauth-crypto copied to clipboard

Map version codes to crypto features to allow more high-level decision making

Open petrdvorak opened this issue 1 year ago • 0 comments

Currently, we can see code pieces like this one:

if (!"3.2".equals(version)) {
    // do something better
} else {
    // keep the legacy behavior
}

To simplify code and prevent possible errors, we should introduce a mapping to features, i.e., a map of <String,CryptoFeatures>, like so:

{
  "3.2": {
    "tokenExpiration": "SHORT",
    "uniquenessChecks": true,
    "...": "..."
  }
}

Then, we should be able to branch the code more easily, based on features rather than versions, and it would be easier to see all impacted parts depending on specific versions.

We should also introduce a helper class to provide the default strict feature set for unknown versions.

petrdvorak avatar Sep 07 '23 07:09 petrdvorak