JsonWebKey.fromKeyPair constructor

JsonWebKey.fromKeyPair({
  1. required KeyPair keyPair,
  2. required Map<String, dynamic> json,
})

Implementation

JsonWebKey.fromKeyPair({
  required KeyPair keyPair,
  required Map<String, dynamic> json,
})  : _keyPair = keyPair,
      super.from(json) {
  if (json['kty'] == null) throw ArgumentError.notNull('keyType');
  if (x509CertificateChain != null && x509CertificateChain!.isNotEmpty) {
    var cert = x509CertificateChain!.first;

    if (_keyPair.publicKey != cert.publicKey) {
      throw ArgumentError("The public key in 'x5c' does not match this key.");
    }
  }
}