Skip to content

Commit ec31621

Browse files
committed
Remove the fallback between algorithms; the user should explicitly specify whether Installation or Account message signing is used.
1 parent cc1ea7d commit ec31621

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

devtools_options.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
description: This file stores settings for Dart & Flutter DevTools.
2+
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
3+
extensions:

lib/approov_service_flutter_httpclient.dart

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,21 +1228,8 @@ class ApproovService {
12281228
}
12291229

12301230
final signatureBase = SignatureBaseBuilder(params, context).createSignatureBase();
1231-
String signature;
1232-
try { // If we fail to sign with install signing, we fall back to account signing (install signing is safer but not always available)
1233-
signature = await _signCanonicalMessage(signatureBase, params.algorithm);
1234-
} on StateError {
1235-
if (params.algorithm == SignatureAlgorithm.ecdsaP256Sha256) {
1236-
Log.w("$TAG: install message signing unavailable, falling back to account signing");
1237-
params.algorithm = SignatureAlgorithm.hmacSha256;
1238-
params.setAlg('hmac-sha256');
1239-
// Regenerate the signature base with the updated algorithm
1240-
final updatedSignatureBase = SignatureBaseBuilder(params, context).createSignatureBase();
1241-
signature = await _signCanonicalMessage(updatedSignatureBase, params.algorithm);
1242-
} else {
1243-
rethrow;
1244-
}
1245-
}
1231+
// Allow the configured algorithm to fail fast so callers can decide how to handle it.
1232+
final signature = await _signCanonicalMessage(signatureBase, params.algorithm);
12461233
if (signature.isEmpty) {
12471234
Log.d("$TAG: message signing returned empty signature for ${request.uri}");
12481235
return;

0 commit comments

Comments
 (0)