addEntityVks method

  1. @override
Future<void> addEntityVks(
  1. String fellowship,
  2. String template,
  3. List<String> entities
)

Add a new entry of entity verification keys to the wallet state's cartesian indexing. Entities are at a pair of x (fellowship) and y (template) layers and thus represent a Child verification key at a participants own x/y path. The respective x and y indices of the specified fellowship and template labels must already exist.

fellowship A String label of the fellowship to associate the new verification keys with template A String label of the template to associate the new verification keys with entities The list of Verification Keys in base58 format to add

Implementation

@override
Future<void> addEntityVks(
    String fellowship, String template, List<String> entities) async {
  final fellowshipResult = fellowshipsStore.findFirstSync(_instance,
      finder: Finder(filter: Filter.equals("name", fellowship)));

  final templateResult = templatesStore.findFirstSync(_instance,
      finder: Finder(filter: Filter.equals("name", template)));

  if (fellowshipResult != null && templateResult != null) {
    final x = fellowshipResult["x"]! as int;
    final y = templateResult["y"]! as int;
    await verificationKeysStore.add(
      _instance,
      sk.VerificationKey(
        x: x,
        y: y,
        vks: entities,
      ).toSembast,
    );
  }
}