storeCredentialToKeychain method

Future<bool> storeCredentialToKeychain(
  1. String atSign, {
  2. String? secret,
  3. String? privateKey,
  4. String? publicKey,
})

Implementation

Future<bool> storeCredentialToKeychain(String atSign,
    {String? secret, String? privateKey, String? publicKey}) async {
  var success = false;
  try {
    assert(atSign != '');
    atSign = atSign.trim().toLowerCase().replaceAll(' ', '');
    if (secret != null) {
      secret = secret.trim().toLowerCase().replaceAll(' ', '');
      await FlutterKeychain.put(
          key: atSign + ':' + KEYCHAIN_SECRET, value: secret);
    }
    await _saveAtSignToKeychain(atSign);
    await storePkamKeysToKeychain(atSign,
        privateKey: privateKey, publicKey: publicKey);
    success = true;
  } on Exception catch (exception) {
    _logger.severe(
        'exception in storeCredentialToKeychain :${exception.toString()}');
  }
  return success;
}