Skip to content

Commit

Permalink
Upgrade flutter_lints (#96)
Browse files Browse the repository at this point in the history
* Upgrade flutter_lints

* Replace `part of <library>` with `part of '<file>.dart'`

* Avoid using deprecated property

* Avoid `Pointer.elementAt` in favor of + operator
jonasfj authored Mar 6, 2024
1 parent de8dbd9 commit 3656276
Showing 47 changed files with 52 additions and 53 deletions.
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
@@ -490,7 +490,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.5.4"
version: "0.5.5"
webdriver:
dependency: transitive
description:
2 changes: 1 addition & 1 deletion lib/src/flutter/webcrypto_plugin.dart
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ class WebcryptoPlugin {
final channel = MethodChannel(
'plugins.flutter.io/webcrypto',
const StandardMethodCodec(),
registrar.messenger,
registrar,
);
final instance = WebcryptoPlugin();
channel.setMethodCallHandler(instance.handleMethodCall);
2 changes: 1 addition & 1 deletion lib/src/impl_ffi/impl_ffi.aes_common.dart
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of impl_ffi;
part of 'impl_ffi.dart';

Uint8List _aesImportRawKey(List<int> keyData) {
if (keyData.length == 24) {
2 changes: 1 addition & 1 deletion lib/src/impl_ffi/impl_ffi.aescbc.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_ffi;
part of 'impl_ffi.dart';

Future<AesCbcSecretKey> aesCbc_importRawKey(List<int> keyData) async =>
_AesCbcSecretKey(_aesImportRawKey(keyData));
2 changes: 1 addition & 1 deletion lib/src/impl_ffi/impl_ffi.aesctr.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_ffi;
part of 'impl_ffi.dart';

Future<AesCtrSecretKey> aesCtr_importRawKey(List<int> keyData) async =>
_AesCtrSecretKey(_aesImportRawKey(keyData));
2 changes: 1 addition & 1 deletion lib/src/impl_ffi/impl_ffi.aesgcm.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_ffi;
part of 'impl_ffi.dart';

Future<AesGcmSecretKey> aesGcm_importRawKey(List<int> keyData) async =>
_AesGcmSecretKey(_aesImportRawKey(keyData));
2 changes: 1 addition & 1 deletion lib/src/impl_ffi/impl_ffi.digest.dart
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of impl_ffi;
part of 'impl_ffi.dart';

abstract class _Hash implements Hash {
const _Hash();
2 changes: 1 addition & 1 deletion lib/src/impl_ffi/impl_ffi.ec_common.dart
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of impl_ffi;
part of 'impl_ffi.dart';

/// Get `ssl.NID_...` from BoringSSL matching the given [curve].
int _ecCurveToNID(EllipticCurve curve) {
2 changes: 1 addition & 1 deletion lib/src/impl_ffi/impl_ffi.ecdh.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_ffi;
part of 'impl_ffi.dart';

Future<EcdhPrivateKey> ecdhPrivateKey_importPkcs8Key(
List<int> keyData,
10 changes: 5 additions & 5 deletions lib/src/impl_ffi/impl_ffi.ecdsa.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_ffi;
part of 'impl_ffi.dart';

/// Get valid value for `jwk.alg` property given an [EllipticCurve] for ECDSA.
String _ecdsaCurveToJwkAlg(EllipticCurve curve) {
@@ -116,11 +116,11 @@ Uint8List _convertEcdsaDerSignatureToWebCryptoSignature(
// Dump R and S to return value.
final out = scope<ffi.Uint8>(N * 2);
_checkOpIsOne(
ssl.BN_bn2bin_padded(out.elementAt(0), N, R.value),
ssl.BN_bn2bin_padded(out + 0, N, R.value),
fallback: 'internal error formatting R in signature',
);
_checkOpIsOne(
ssl.BN_bn2bin_padded(out.elementAt(N), N, S.value),
ssl.BN_bn2bin_padded(out + N, N, S.value),
fallback: 'internal error formatting S in signature',
);
return out.copy(N * 2);
@@ -163,11 +163,11 @@ Uint8List? _convertEcdsaWebCryptoSignatureToDerSignature(

final psig = scope.dataAsPointer<ffi.Uint8>(signature);
_checkOp(
ssl.BN_bin2bn(psig.elementAt(0), N, R.value).address != 0,
ssl.BN_bin2bn(psig + 0, N, R.value).address != 0,
fallback: 'allocation failure',
);
_checkOp(
ssl.BN_bin2bn(psig.elementAt(N), N, S.value).address != 0,
ssl.BN_bin2bn(psig + N, N, S.value).address != 0,
fallback: 'allocation failure',
);

2 changes: 1 addition & 1 deletion lib/src/impl_ffi/impl_ffi.hkdf.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_ffi;
part of 'impl_ffi.dart';

Future<HkdfSecretKey> hkdfSecretKey_importRawKey(List<int> keyData) async =>
_HkdfSecretKey(Uint8List.fromList(keyData));
2 changes: 1 addition & 1 deletion lib/src/impl_ffi/impl_ffi.hmac.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_ffi;
part of 'impl_ffi.dart';

/// Convert [data] to [Uint8List] and zero to [lengthInBits] if given.
Uint8List _asUint8ListZeroedToBitLength(List<int> data, [int? lengthInBits]) {
2 changes: 1 addition & 1 deletion lib/src/impl_ffi/impl_ffi.pbkdf2.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_ffi;
part of 'impl_ffi.dart';

Future<Pbkdf2SecretKey> pbkdf2SecretKey_importRawKey(List<int> keyData) async {
return _Pbkdf2SecretKey(Uint8List.fromList(keyData));
2 changes: 1 addition & 1 deletion lib/src/impl_ffi/impl_ffi.random.dart
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of impl_ffi;
part of 'impl_ffi.dart';

void fillRandomBytes(TypedData destination) {
return _Scope.sync((scope) {
2 changes: 1 addition & 1 deletion lib/src/impl_ffi/impl_ffi.rsa_common.dart
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of impl_ffi;
part of 'impl_ffi.dart';

_EvpPKey _importPkcs8RsaPrivateKey(List<int> keyData) {
return _Scope.sync((scope) {
5 changes: 2 additions & 3 deletions lib/src/impl_ffi/impl_ffi.rsaoaep.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_ffi;
part of 'impl_ffi.dart';

String _rsaOaepJwkAlgFromHash(_Hash hash) {
if (hash == Hash.sha1) {
@@ -117,8 +117,7 @@ Future<Uint8List> _rsaOaepeEncryptOrDecryptBytes(
ffi.Pointer<ffi.Size>,
ffi.Pointer<ffi.Uint8>,
int,
)
encryptOrDecryptFn,
) encryptOrDecryptFn,
List<int> data, {
List<int>? label,
}) async {
2 changes: 1 addition & 1 deletion lib/src/impl_ffi/impl_ffi.rsapss.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_ffi;
part of 'impl_ffi.dart';

String _rsaPssJwkAlgFromHash(_Hash hash) {
if (hash == Hash.sha1) {
2 changes: 1 addition & 1 deletion lib/src/impl_ffi/impl_ffi.rsassapkcs1v15.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_ffi;
part of 'impl_ffi.dart';

String _rsassaPkcs1V15JwkAlgFromHash(_Hash hash) {
if (hash == Hash.sha1) {
2 changes: 1 addition & 1 deletion lib/src/impl_ffi/impl_ffi.utils.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_ffi;
part of 'impl_ffi.dart';

/// Wrapper around [EVP_PKEY] which attaches finalizer and ensure that the
/// [ffi.Finalizable] is kept in scope while the [EVP_PKEY] is used.
2 changes: 1 addition & 1 deletion lib/src/impl_js/impl_js.aescbc.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_js;
part of 'impl_js.dart';

const _aesCbcAlgorithm = subtle.Algorithm(name: 'AES-CBC');

2 changes: 1 addition & 1 deletion lib/src/impl_js/impl_js.aesctr.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_js;
part of 'impl_js.dart';

const _aesCtrAlgorithm = subtle.Algorithm(name: 'AES-CTR');

2 changes: 1 addition & 1 deletion lib/src/impl_js/impl_js.aesgcm.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_js;
part of 'impl_js.dart';

const _aesGcmAlgorithm = subtle.Algorithm(name: 'AES-GCM');

2 changes: 1 addition & 1 deletion lib/src/impl_js/impl_js.digest.dart
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of impl_js;
part of 'impl_js.dart';

class _Hash implements Hash {
final String _algorithm;
2 changes: 1 addition & 1 deletion lib/src/impl_js/impl_js.ecdh.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_js;
part of 'impl_js.dart';

const _ecdhAlgorithmName = 'ECDH';

2 changes: 1 addition & 1 deletion lib/src/impl_js/impl_js.ecdsa.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_js;
part of 'impl_js.dart';

const _ecdsaAlgorithmName = 'ECDSA';

2 changes: 1 addition & 1 deletion lib/src/impl_js/impl_js.hkdf.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_js;
part of 'impl_js.dart';

const _hkdfAlgorithmName = 'HKDF';

2 changes: 1 addition & 1 deletion lib/src/impl_js/impl_js.hmac.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_js;
part of 'impl_js.dart';

const _hmacAlgorithm = subtle.Algorithm(name: 'HMAC');

2 changes: 1 addition & 1 deletion lib/src/impl_js/impl_js.pbkdf2.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_js;
part of 'impl_js.dart';

const _pbkdf2AlgorithmName = 'PBKDF2';

2 changes: 1 addition & 1 deletion lib/src/impl_js/impl_js.random.dart
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of impl_js;
part of 'impl_js.dart';

void fillRandomBytes(TypedData destination) {
try {
2 changes: 1 addition & 1 deletion lib/src/impl_js/impl_js.rsaoaep.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_js;
part of 'impl_js.dart';

const _rsaOaepAlgorithmName = 'RSA-OAEP';

2 changes: 1 addition & 1 deletion lib/src/impl_js/impl_js.rsapss.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_js;
part of 'impl_js.dart';

const _rsaPssAlgorithmName = 'RSA-PSS';

2 changes: 1 addition & 1 deletion lib/src/impl_js/impl_js.rsassapkcs1v15.dart
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@

// ignore_for_file: non_constant_identifier_names

part of impl_js;
part of 'impl_js.dart';

const _rsassaPkcs1V15Algorithm = subtle.Algorithm(name: 'RSASSA-PKCS1-v1_5');

2 changes: 1 addition & 1 deletion lib/src/impl_js/impl_js.utils.dart
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of impl_js;
part of 'impl_js.dart';

/// Convert [Stream<List<int>>] to [Uint8List].
Future<Uint8List> _bufferStream(Stream<List<int>> data) async {
2 changes: 1 addition & 1 deletion lib/src/webcrypto/webcrypto.aescbc.dart
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of webcrypto;
part of 'webcrypto.dart';

/// AES secret key for symmetric encryption and decryption using AES in
/// _Cipher Block Chaining mode_ (CBC-mode), as described in
2 changes: 1 addition & 1 deletion lib/src/webcrypto/webcrypto.aesctr.dart
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of webcrypto;
part of 'webcrypto.dart';

/// AES secret key for symmetric encryption and decryption using AES in
/// _Counter mode_ (CTR-mode), as described in [NIST SP800-38A][1].
2 changes: 1 addition & 1 deletion lib/src/webcrypto/webcrypto.aesgcm.dart
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of webcrypto;
part of 'webcrypto.dart';

@sealed
abstract class AesGcmSecretKey {
2 changes: 1 addition & 1 deletion lib/src/webcrypto/webcrypto.digest.dart
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of webcrypto;
part of 'webcrypto.dart';

/// A cryptographic hash algorithm implementation.
///
2 changes: 1 addition & 1 deletion lib/src/webcrypto/webcrypto.ecdh.dart
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of webcrypto;
part of 'webcrypto.dart';

@sealed
abstract class EcdhPrivateKey {
2 changes: 1 addition & 1 deletion lib/src/webcrypto/webcrypto.ecdsa.dart
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of webcrypto;
part of 'webcrypto.dart';

@sealed
abstract class EcdsaPrivateKey {
2 changes: 1 addition & 1 deletion lib/src/webcrypto/webcrypto.hkdf.dart
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of webcrypto;
part of 'webcrypto.dart';

/// HKDF secret key (or password) for key derivation.
///
2 changes: 1 addition & 1 deletion lib/src/webcrypto/webcrypto.hmac.dart
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of webcrypto;
part of 'webcrypto.dart';

/// Key for signing/verifying with HMAC.
///
2 changes: 1 addition & 1 deletion lib/src/webcrypto/webcrypto.pbkdf2.dart
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of webcrypto;
part of 'webcrypto.dart';

/// PBKDF2 secret key (or password) for key derivation.
///
2 changes: 1 addition & 1 deletion lib/src/webcrypto/webcrypto.random.dart
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of webcrypto;
part of 'webcrypto.dart';

/// Fill [destination] with cryptographically random values.
///
2 changes: 1 addition & 1 deletion lib/src/webcrypto/webcrypto.rsaoaep.dart
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of webcrypto;
part of 'webcrypto.dart';

/// RSAES-OAEP private key for decryption of messages.
///
2 changes: 1 addition & 1 deletion lib/src/webcrypto/webcrypto.rsapss.dart
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of webcrypto;
part of 'webcrypto.dart';

/// RSASSA-PSS private key for signing messages.
///
2 changes: 1 addition & 1 deletion lib/src/webcrypto/webcrypto.rsassapkcs1v15.dart
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of webcrypto;
part of 'webcrypto.dart';

/// RSASSA-PKCS1-v1_5 private key for signing messages.
///
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ dev_dependencies:
ffigen: ^9.0.0
test: ^1.16.0
yaml: ^3.0.0
flutter_lints: ^2.0.0
flutter_lints: ^3.0.1
flutter_test:
sdk: flutter

0 comments on commit 3656276

Please sign in to comment.