decodePrincipalId function
Implementation
PrincipalId decodePrincipalId(Pipe b) {
final x = Uint8List.fromList(safeRead((b as Pipe<int>), 1)).toHex();
if (x != '01') {
throw 'Cannot decode principal';
}
final len = lebDecode(b).toInt();
final hex = Uint8List.fromList(safeRead(b, len)).toHex().toUpperCase();
return PrincipalId.fromHex(hex);
}