decodeLabelhash static method

String decodeLabelhash(
  1. String hash
)

Implementation

static String decodeLabelhash(String hash) {
  if (!(hash.startsWith('[') && hash.endsWith(']'))) {
    throw 'Expected encoded labelhash to start and end with square brackets';
  }

  if (hash.length != 66) {
    throw 'Expected encoded labelhash to have a length of 66';
  }

  return hash.slice(1, -1);
}