trustPolicyFingerprint function

String trustPolicyFingerprint(
  1. List<String> sourceKeys,
  2. List<Object?> policy
)

Hashes the source configuration keys and policy values for restore checks.

Source key order is ignored. Policy values must be JSON encodable and retain their order in the fingerprint.

Implementation

String trustPolicyFingerprint(List<String> sourceKeys, List<Object?> policy) {
  final sorted = [...sourceKeys]..sort();
  return sha256.convert(utf8.encode(jsonEncode([sorted, policy]))).toString();
}