Closed tallinn1960 closed 2 years ago
Is ready for review. RCF-7518 ECDH-ES with cjose und jose4j is working. I need this pull request merged to make a pull request for the additions to the packages jose and crypto_keys.
Hi,
I am having trouble getting this PR to compile.
For example:
lib/ecc/ecdh.dart:54:15: Error: A value of type 'BigInt?' can't be returned from a function with return type 'BigInt' because 'BigInt?' is nullable and 'BigInt' isn't.
- 'BigInt' is from 'dart:core'.
return (P.x?.toBigInteger())!;
^
lib/key_derivators/ecdh_kdf.dart:36:45: Error: A value of type 'int?' can't be returned from a function with return type 'int' because 'int?' is nullable and 'int' isn't.
int get keySize => (parameters.privateKey.parameters?.curve.fieldSize)!;
dart --version
Dart SDK version: 2.14.4 (stable) (Wed Oct 13 11:11:32 2021 +0200) on "macos_x64"
pub run test
Compiles and passes all tests on my Mac with both:
Dart SDK version: 2.16.2 (stable) (Tue Mar 22 13:15:13 2022 +0100) on „macos_x64“ (from most recent flutter release) Dart SDK version: 2.16.1 (stable) (Tue Feb 8 12:02:33 2022 +0100) on „macos_arm64“ (from Homebrew)
Looks like they fixed a dart compiler bug there as the troubling code is correct Dart..
I can see the errors if I downgrade Homebrews Dart to 2.14.4 and use that for pub run test. Even its dart analyze thinks this is correct Dart, however, the compiler thinks otherwise here.
However, as the pubspec states compatibility with dart down to 2.12, I got 2.12 from Homebrew as well and fixed the “errors" found by both 2.14 and/or 2.12. See the latest commit. Code became even more readable this way.
The latest commit compiles and passes all tests with Dart 2.12, 2,14 and 2.16.
It just not that I like "banging" (i.e. using ! deliberately) my way through, it is not the way I do things in general. But here it seems to be a working solution to the problem :)
And happy holidays.
Am 14.04.2022 um 05:42 schrieb MW @.***>:
Hi,
I am having trouble getting this PR to compile.
For example:
lib/ecc/ecdh.dart:54:15: Error: A value of type 'BigInt?' can't be returned from a function with return type 'BigInt' because 'BigInt?' is nullable and 'BigInt' isn't.
- 'BigInt' is from 'dart:core'. return (P.x?.toBigInteger())!; ^ lib/key_derivators/ecdh_kdf.dart:36:45: Error: A value of type 'int?' can't be returned from a function with return type 'int' because 'int?' is nullable and 'int' isn't. int get keySize => (parameters.privateKey.parameters?.curve.fieldSize)!; dart --version Dart SDK version: 2.14.4 (stable) (Wed Oct 13 11:11:32 2021 +0200) on "macos_x64"
pub run test
— Reply to this email directly, view it on GitHub https://github.com/bcgit/pc-dart/pull/158#issuecomment-1098678775, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHH2PX4JAXAH5GBRZU2APETVE6HZFANCNFSM5ROBOOZQ. You are receiving this because you authored the thread.
Hi,
Thanks this has been merged and will sync up shortly.
I will do a release after that.
Implementation of ECDHBasicAgreement and ConcatKDF key derivation functions