getPublicKeyFromString function

String getPublicKeyFromString(
  1. String pgpPublicKeyString
)

Implementation

String getPublicKeyFromString(String pgpPublicKeyString) {
  if (pgpPublicKeyString.isEmpty) {
    return pgpPublicKeyString;
  }
  dynamic pgpPublicKeyJson;
  try {
    pgpPublicKeyJson = jsonDecode(pgpPublicKeyString);
    pgpPublicKeyJson = pgpPublicKeyJson["key"] ?? pgpPublicKeyString;
    return pgpPublicKeyJson;
  } catch (error) {
    return pgpPublicKeyString;
  }
}