fromString static method

K4Lid fromString(
  1. String encoded
)

Implementation

static K4Lid fromString(String encoded) {
  if (!encoded.startsWith(PaserkKey.k4LidPrefix)) {
    throw ArgumentError('Invalid k4.lid format');
  }

  final decoded =
      SafeBase64.decode(encoded.substring(PaserkKey.k4LidPrefix.length));
  if (decoded.length != hashLength) {
    throw ArgumentError('Decoded k4.lid must be exactly $hashLength bytes');
  }
  return K4Lid(Uint8List.fromList(decoded));
}