load method

Future<void> load()

Implementation

Future<void> load() async {
  var m =
      jsonDecode(await rootBundle.loadString("specs/trust/trust-all.json"));
  m.forEach((item) {
    var kid = item["kid"];
    var asn = base64Decode(item["publicKey"]);

    var p = ASN1Parser(asn);
    var o = p.nextObject();
    if (o is! ASN1Sequence) {
      throw FormatException('Expected SEQUENCE, got ${o.runtimeType}');
    }
    // Public Key file (PKCS#8)
    var pub = x509.SubjectPublicKeyInfo.fromAsn1(o);
    _data[kid] = Trust(pub.subjectPublicKey, kid);
  });
  return;
}