anchorDigest method

  1. @override
Future<String> anchorDigest({
  1. required Identifier controller,
  2. required List<String> sais,
  3. dynamic hint,
})
override

Creates new Interaction Event along with provided Self Addressing Identifiers.

Implementation

@override
Future<String> anchorDigest(
    {required Identifier controller,
    required List<String> sais,
    dynamic hint}) async {
  try {
    return await api.anchorDigest(identifier: controller, sais: sais);
  } on FfiException catch (e) {
    if (e.message.contains('Unknown id')) {
      throw IdentifierException(
          'Unknown controller identifier. Check the confroller for identifier once again.');
    }
    if (e.message.contains('Can\'t parse controller')) {
      throw IdentifierException(
          'Can\'t parse controller prefix. Check the confroller for identifier once again.');
    }
    if (e.message.contains('Deserialize error')) {
      throw IdentifierException(
          'The identifier provided to the controller is incorrect. Check the identifier once again.');
    }
    if (e.message.contains('Can\'t parse self addressing identifier')) {
      throw SelfAddressingIndentifierException(
          'The SAI provided to the anchor is incorrect. Check the list once again.');
    }
    if (e.message.contains('Controller wasn\'t initialized')) {
      throw IdentifierException(
          "Controller has not been initialized. Execute initKel() before incepting.");
    }
    rethrow;
  }
}