getPemFile function
Implementation
Future<PemFile> getPemFile(String path) async {
var pem = await File(path).readAsString();
if (pem.split(CryptoUtils.BEGIN_PRIVATE_KEY).length > 1) {
return PemFile(
pem.split(CryptoUtils.BEGIN_PRIVATE_KEY)[1], KeyType.ED25519);
} else if (pem.split(CryptoUtils.BEGIN_EC_PRIVATE_KEY).length > 1) {
return PemFile(
pem.split(CryptoUtils.BEGIN_EC_PRIVATE_KEY)[1], KeyType.SECP256k1);
}
throw 'Cannot Read Pem';
}