nsToCid static method

Future<CID> nsToCid(
  1. String ns
)

Converts a namespace string to a CID

Implementation

static Future<CID> nsToCid(String ns) async {
  final bytes = utf8.encode(ns);
  final hash = sha256.convert(bytes);

  // Create a CID from the hash
  return CID.create(CID.V1, 'sha-256', Uint8List.fromList(hash.bytes));
}