fromPrefixBytes static method

Future<CID> fromPrefixBytes(
  1. Uint8List prefix,
  2. Uint8List data, {
  3. String hashType = 'sha2-256',
})

Reconstructs a CID from a prefix (version + codec + multihash function

  • hash length) and the raw block data.

The digest is computed from data using the provided hashType. The resulting CID is only valid if the computed prefix matches the supplied prefix, which is verified by validate.

Implementation

static Future<CID> fromPrefixBytes(
  Uint8List prefix,
  Uint8List data, {
  String hashType = 'sha2-256',
}) async {
  final codec = _codecFromPrefixBytes(prefix);
  return fromContent(data, codec: codec, hashType: hashType);
}