crossmintMatchingLocator function

String? crossmintMatchingLocator(
  1. List<String> locators,
  2. String? locator
)

The entry of locators that names the same signer as locator, read through crossmintSignerLocatorKey, or null when none does.

Callers that send an approver use the entry this returns rather than the locator they matched with, so the API always receives bytes the backend itself reported.

Implementation

String? crossmintMatchingLocator(List<String> locators, String? locator) {
  if (locator == null) {
    return null;
  }
  final String key = crossmintSignerLocatorKey(locator);
  for (final String candidate in locators) {
    if (crossmintSignerLocatorKey(candidate) == key) {
      return candidate;
    }
  }
  return null;
}