signingCredentials method

Future<AndroidSigningCredentials> signingCredentials()

Loads one upload-keystore source and its passwords.

Implementation

Future<AndroidSigningCredentials> signingCredentials() async {
  final keystoreBase64 = _required(
    'SMF_ANDROID_KEYSTORE_BASE64',
    'android-keystore-base64',
  );
  try {
    SmfError.check(
      base64Decode(keystoreBase64).isNotEmpty,
      'Android upload keystore decoded to an empty file.',
      SmfErrorCode.invalidCredential,
    );
  } on FormatException catch (error) {
    throw SmfError(
      'Android upload keystore is not valid Base64.',
      SmfErrorCode.invalidCredential,
      cause: error,
    );
  }
  return AndroidSigningCredentials(
    keystoreBase64: keystoreBase64,
    keyAlias: _required('SMF_ANDROID_KEY_ALIAS', 'android-key-alias'),
    keystorePassword: _required(
      'SMF_ANDROID_KEYSTORE_PASSWORD',
      'android-keystore-password',
    ),
    keyPassword: _required(
      'SMF_ANDROID_KEY_PASSWORD',
      'android-key-password',
    ),
  );
}