This commit is contained in:
Christien Rioux 2023-07-25 01:04:22 -04:00
parent a6666d3a6c
commit 00aad2c728
12 changed files with 158 additions and 183 deletions

View file

@ -571,13 +571,15 @@ class VeilidJS extends Veilid {
@override
List<CryptoKind> validCryptoKinds() {
return jsonDecode(js_util.callMethod(wasm, "valid_crypto_kinds", []));
final vck = jsonDecode(js_util.callMethod(wasm, "valid_crypto_kinds", []))
as List<dynamic>;
return vck.map((v) => v as CryptoKind).toList();
}
@override
Future<VeilidCryptoSystem> getCryptoSystem(CryptoKind kind) async {
if (!validCryptoKinds().contains(kind)) {
throw VeilidAPIExceptionGeneric("unsupported cryptosystem");
throw const VeilidAPIExceptionGeneric("unsupported cryptosystem");
}
return VeilidCryptoSystemJS._(this, kind);
}