diff --git a/lib/src/boringssl/lookup/utils.dart b/lib/src/boringssl/lookup/utils.dart index 899929b7..87371925 100644 --- a/lib/src/boringssl/lookup/utils.dart +++ b/lib/src/boringssl/lookup/utils.dart @@ -29,10 +29,12 @@ String get libraryFileName { if (Platform.isMacOS) { return 'lib$libraryName.dylib'; } + // coverage:ignore-start throw UnsupportedError( 'Platform ${Platform.operatingSystem} is unsupported or embed ' 'the binary webcrypto library for package:webcrypto', ); + // coverage:ignore-end } /// Look for the webcrypto binary library in the `.dart_tool/webcrypto/` folder. diff --git a/lib/src/impl_ffi/impl_ffi.aes_common.dart b/lib/src/impl_ffi/impl_ffi.aes_common.dart index 219267f7..3d22f600 100644 --- a/lib/src/impl_ffi/impl_ffi.aes_common.dart +++ b/lib/src/impl_ffi/impl_ffi.aes_common.dart @@ -18,7 +18,9 @@ Uint8List _aesImportRawKey(List keyData) { if (keyData.length == 24) { // 192-bit AES is intentionally unsupported, see https://crbug.com/533699 // If not supported in Chrome, there is not reason to support it in Dart. + // coverage:ignore-start throw UnsupportedError('192-bit AES keys are not supported'); + // coverage:ignore-end } if (keyData.length != 16 && keyData.length != 32) { throw const FormatException('keyData for AES must be 128 or 256 bits'); @@ -43,7 +45,9 @@ Uint8List _aesImportJwkKey( if (keyData.length == 24) { // 192-bit AES is intentionally unsupported, see https://crbug.com/533699 // If not supported in Chrome, there is not reason to support it in Dart. + // coverage:ignore-start throw UnsupportedError('192-bit AES keys are not supported'); + // coverage:ignore-end } checkJwk( keyData.length == 16 || keyData.length == 32, @@ -82,7 +86,9 @@ Uint8List _aesGenerateKey(int length) { if (length == 192) { // 192-bit AES is intentionally unsupported, see https://crbug.com/533699 // If not supported in Chrome, there is not reason to support it in Dart. + // coverage:ignore-start throw UnsupportedError('192-bit AES keys are not supported'); + // coverage:ignore-end } if (length != 128 && length != 256) { throw const FormatException('keyData for AES must be 128 or 256 bits'); diff --git a/lib/src/impl_ffi/impl_ffi.ec_common.dart b/lib/src/impl_ffi/impl_ffi.ec_common.dart index 5e9652b4..a71474b3 100644 --- a/lib/src/impl_ffi/impl_ffi.ec_common.dart +++ b/lib/src/impl_ffi/impl_ffi.ec_common.dart @@ -26,7 +26,9 @@ int _ecCurveToNID(EllipticCurve curve) { return NID_secp521r1; } // This should never happen! + // coverage:ignore-start throw UnsupportedError('curve "$curve" is not supported'); + // coverage:ignore-end } /// Get [EllipticCurve] from matching BoringSSL `ssl.NID_...`. @@ -41,7 +43,9 @@ EllipticCurve _ecCurveFromNID(int nid) { return EllipticCurve.p521; } // This should never happen! + // coverage:ignore-start throw operationError('internal error detecting curve'); + // coverage:ignore-end } String _ecCurveToJwkCrv(EllipticCurve curve) { @@ -55,7 +59,9 @@ String _ecCurveToJwkCrv(EllipticCurve curve) { return 'P-521'; } // This should never happen! + // coverage:ignore-start throw UnsupportedError('curve "$curve" is not supported'); + // coverage:ignore-end } /// Perform some post-import validation for EC keys. diff --git a/lib/src/impl_ffi/impl_ffi.ecdsa.dart b/lib/src/impl_ffi/impl_ffi.ecdsa.dart index ba399eb6..f3c56023 100644 --- a/lib/src/impl_ffi/impl_ffi.ecdsa.dart +++ b/lib/src/impl_ffi/impl_ffi.ecdsa.dart @@ -29,7 +29,9 @@ String _ecdsaCurveToJwkAlg(EllipticCurve curve) { return 'ES512'; } // This should never happen! + // coverage:ignore-start throw UnsupportedError('curve "$curve" is not supported'); + // coverage:ignore-end } Future ecdsaPrivateKey_importPkcs8Key( diff --git a/lib/src/impl_js/impl_js.utils.dart b/lib/src/impl_js/impl_js.utils.dart index 81e231d2..53ca306b 100644 --- a/lib/src/impl_js/impl_js.utils.dart +++ b/lib/src/impl_js/impl_js.utils.dart @@ -45,8 +45,10 @@ String _curveToName(EllipticCurve curve) { return 'P-521'; } // This should never happen. + // coverage:ignore-start // ignore: dead_code throw AssertionError('Unknown curve "$curve"'); + // coverage:ignore-end } Object _translateDomException( diff --git a/lib/src/impl_stub/impl_stub.aescbc.dart b/lib/src/impl_stub/impl_stub.aescbc.dart index a6bf3634..d27b2755 100644 --- a/lib/src/impl_stub/impl_stub.aescbc.dart +++ b/lib/src/impl_stub/impl_stub.aescbc.dart @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// coverage:ignore-file part of 'impl_stub.dart'; final class _StaticAesCbcSecretKeyImpl implements StaticAesCbcSecretKeyImpl { diff --git a/lib/src/impl_stub/impl_stub.aesctr.dart b/lib/src/impl_stub/impl_stub.aesctr.dart index 1a7e9f42..a4f0b290 100644 --- a/lib/src/impl_stub/impl_stub.aesctr.dart +++ b/lib/src/impl_stub/impl_stub.aesctr.dart @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// coverage:ignore-file part of 'impl_stub.dart'; final class _StaticAesCtrSecretKeyImpl implements StaticAesCtrSecretKeyImpl { diff --git a/lib/src/impl_stub/impl_stub.aesgcm.dart b/lib/src/impl_stub/impl_stub.aesgcm.dart index 58dee35f..ab7f48b1 100644 --- a/lib/src/impl_stub/impl_stub.aesgcm.dart +++ b/lib/src/impl_stub/impl_stub.aesgcm.dart @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// coverage:ignore-file part of 'impl_stub.dart'; final class _StaticAesGcmSecretKeyImpl implements StaticAesGcmSecretKeyImpl { diff --git a/lib/src/impl_stub/impl_stub.dart b/lib/src/impl_stub/impl_stub.dart index c8411eef..52680a08 100644 --- a/lib/src/impl_stub/impl_stub.dart +++ b/lib/src/impl_stub/impl_stub.dart @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// coverage:ignore-file library; import 'dart:typed_data'; diff --git a/lib/src/impl_stub/impl_stub.digest.dart b/lib/src/impl_stub/impl_stub.digest.dart index 6404d227..a33b6a43 100644 --- a/lib/src/impl_stub/impl_stub.digest.dart +++ b/lib/src/impl_stub/impl_stub.digest.dart @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// coverage:ignore-file part of 'impl_stub.dart'; final class _HashImpl implements HashImpl { diff --git a/lib/src/impl_stub/impl_stub.ecdh.dart b/lib/src/impl_stub/impl_stub.ecdh.dart index 4c79a082..b9423388 100644 --- a/lib/src/impl_stub/impl_stub.ecdh.dart +++ b/lib/src/impl_stub/impl_stub.ecdh.dart @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// coverage:ignore-file part of 'impl_stub.dart'; final class _StaticEcdhPrivateKeyImpl implements StaticEcdhPrivateKeyImpl { diff --git a/lib/src/impl_stub/impl_stub.ecdsa.dart b/lib/src/impl_stub/impl_stub.ecdsa.dart index 34f43a3d..5784badf 100644 --- a/lib/src/impl_stub/impl_stub.ecdsa.dart +++ b/lib/src/impl_stub/impl_stub.ecdsa.dart @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// coverage:ignore-file part of 'impl_stub.dart'; final class _StaticEcdsaPrivateKeyImpl implements StaticEcdsaPrivateKeyImpl { diff --git a/lib/src/impl_stub/impl_stub.hkdf.dart b/lib/src/impl_stub/impl_stub.hkdf.dart index 1e07cead..20b863cd 100644 --- a/lib/src/impl_stub/impl_stub.hkdf.dart +++ b/lib/src/impl_stub/impl_stub.hkdf.dart @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// coverage:ignore-file part of 'impl_stub.dart'; final class _StaticHkdfSecretKeyImpl implements StaticHkdfSecretKeyImpl { diff --git a/lib/src/impl_stub/impl_stub.hmac.dart b/lib/src/impl_stub/impl_stub.hmac.dart index b39310a7..e4eef5e2 100644 --- a/lib/src/impl_stub/impl_stub.hmac.dart +++ b/lib/src/impl_stub/impl_stub.hmac.dart @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// coverage:ignore-file part of 'impl_stub.dart'; final class _StaticHmacSecretKeyImpl implements StaticHmacSecretKeyImpl { diff --git a/lib/src/impl_stub/impl_stub.pbkdf2.dart b/lib/src/impl_stub/impl_stub.pbkdf2.dart index e1fc586f..03ddcd99 100644 --- a/lib/src/impl_stub/impl_stub.pbkdf2.dart +++ b/lib/src/impl_stub/impl_stub.pbkdf2.dart @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// coverage:ignore-file part of 'impl_stub.dart'; final class _StaticPbkdf2SecretKeyImpl implements StaticPbkdf2SecretKeyImpl { diff --git a/lib/src/impl_stub/impl_stub.random.dart b/lib/src/impl_stub/impl_stub.random.dart index c7f13fa8..f094a212 100644 --- a/lib/src/impl_stub/impl_stub.random.dart +++ b/lib/src/impl_stub/impl_stub.random.dart @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// coverage:ignore-file part of 'impl_stub.dart'; final class _RandomImpl implements RandomImpl { diff --git a/lib/src/impl_stub/impl_stub.rsaoaep.dart b/lib/src/impl_stub/impl_stub.rsaoaep.dart index a3daef97..c37d8f42 100644 --- a/lib/src/impl_stub/impl_stub.rsaoaep.dart +++ b/lib/src/impl_stub/impl_stub.rsaoaep.dart @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// coverage:ignore-file part of 'impl_stub.dart'; final class _StaticRsaOaepPrivateKeyImpl diff --git a/lib/src/impl_stub/impl_stub.rsapss.dart b/lib/src/impl_stub/impl_stub.rsapss.dart index ac8fbd43..78d30690 100644 --- a/lib/src/impl_stub/impl_stub.rsapss.dart +++ b/lib/src/impl_stub/impl_stub.rsapss.dart @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// coverage:ignore-file part of 'impl_stub.dart'; final class _StaticRsaPssPrivateKeyImpl implements StaticRsaPssPrivateKeyImpl { diff --git a/lib/src/impl_stub/impl_stub.rsassapkcs1v15.dart b/lib/src/impl_stub/impl_stub.rsassapkcs1v15.dart index 558e51d9..02e66068 100644 --- a/lib/src/impl_stub/impl_stub.rsassapkcs1v15.dart +++ b/lib/src/impl_stub/impl_stub.rsassapkcs1v15.dart @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// coverage:ignore-file part of 'impl_stub.dart'; final class _StaticRsaSsaPkcs1V15PrivateKeyImpl