fromMultihash static method

PeerId fromMultihash(
  1. Uint8List bytes
)

Creates a PeerId from a multihash

Implementation

static PeerId fromMultihash(Uint8List bytes) {
  // Validate that the bytes are a valid multihash
  try {
    Multihash.decode(bytes);
    return PeerId(bytes);
  } catch (e) {
    throw FormatException('Invalid multihash: $e');
  }
}