diff --git a/example/jose_example.dart b/example/jose_example.dart index ed82546..2bdc3e5 100644 --- a/example/jose_example.dart +++ b/example/jose_example.dart @@ -72,7 +72,7 @@ Future example2() async { algorithm: 'HS256'); // build the jws - var jws = builder.build(); + var jws = await builder.build(); // output the compact serialization print('jws compact serialization: ${jws.toCompactSerialization()}'); @@ -189,7 +189,7 @@ Future example4() async { builder.encryptionAlgorithm = 'A128CBC-HS256'; // build the jws - var jwe = builder.build(); + var jwe = await builder.build(); // output the compact serialization print('jwe compact serialization: ${jwe.toCompactSerialization()}'); @@ -257,7 +257,7 @@ Future example6() async { algorithm: 'HS256'); // build the jws - var jws = builder.build(); + var jws = await builder.build(); // output the compact serialization print('jwt compact serialization: ${jws.toCompactSerialization()}'); @@ -289,7 +289,7 @@ Future example7() async { builder.addRecipient(key, algorithm: 'RS512'); // build the jws - var jws = builder.build(); + var jws = await builder.build(); // output the compact serialization print('jwt compact serialization: ${jws.toCompactSerialization()}'); @@ -304,7 +304,7 @@ Future example8() async { final hash = utf8.encode('TEST'); - var sig = key.sign(hash); + var sig = await key.sign(hash); final valid = key.verify(hash, sig); print('valid? $valid'); @@ -411,7 +411,7 @@ Future example10() async { builder.compressionAlgorithm = 'DEF'; // build the jws - var jwe = builder.build(); + var jwe = await builder.build(); // output the compact serialization print('jwe compact serialization: ${jwe.toCompactSerialization()}'); diff --git a/lib/src/jwk.dart b/lib/src/jwk.dart index 23c4959..df03086 100644 --- a/lib/src/jwk.dart +++ b/lib/src/jwk.dart @@ -16,10 +16,7 @@ import 'package:http_parser/http_parser.dart'; import 'package:jose/src/jwa.dart'; import 'package:meta/meta.dart'; import 'package:x509/x509.dart' as x509; -import 'package:pointycastle/ecc/ecdh.dart' as ecdh; import 'package:pointycastle/pointycastle.dart' as ecdh; -import 'package:pointycastle/ecc/api.dart' as ecdh; -import 'package:pointycastle/ecc/curves/brainpoolp256r1.dart' as ecdh; import 'package:pointycastle/digests/sha256.dart' as ecdh; import 'jose.dart'; @@ -262,6 +259,7 @@ class JsonWebKey extends JsonObject { } return alg + // ignore: invalid_use_of_visible_for_testing_member .jwkFromCryptoKeyPair(KeyPair.symmetric(SymmetricKey(keyValue: key))); } diff --git a/pubspec.yaml b/pubspec.yaml index ebd0e07..67c5094 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,6 +5,7 @@ homepage: https://github.com/appsup-dart/jose repository: https://github.com/appsup-dart/jose funding: - https://github.com/sponsors/rbellens +publish_to: 'none' environment: sdk: ^3.0.0 @@ -25,6 +26,7 @@ dependencies: asn1lib: ^1.0.0 collection: ^1.15.0 archive: '>=3.6.1 <5.0.0' + pointycastle: ^3.9.1 dev_dependencies: test: ^1.24.4 diff --git a/test/jwe_test.dart b/test/jwe_test.dart index 08bb2cd..03f7aa1 100644 --- a/test/jwe_test.dart +++ b/test/jwe_test.dart @@ -326,6 +326,7 @@ DwwoHgQL4BQ6fCuuc26m93ClRTrYqjo418x5fDMyvr7KWkIMwVU6xcWJNg== final compactJwt = "eyJhbGciOiJFQ0RILUVTIiwidHlwIjoiSldUIiwiZW5jIjoiQTI1NkdDTSIsImVwayI6eyJrdHkiOiJFQyIsImNydiI6IlAtMjU2IiwieCI6Ill0aDdLTUhUYzNFUUQwUHpnZ0FiN29fSDFadlFnQzFUOGdjMS1rZjFTanMiLCJ5IjoiQXZIeHF1T3RGZ1ZveHNYUHFjWGpfWjZhMDBDY0ZFMzJpRjdiY3hVZGFqdyJ9fQ..5pjvf-Iu4tII5jqf.5j3HuDUfDF4NryaG78Ib5Mpsp_bB4tfWiyffc07rzJZufR7bczu8PbNxpOCZGrTczdJR6I6nCfoe6uQRg7xw3D-4ARBVggs04bWhkt-QFLXMJ-k8_QLH6FER5ALUbw.cP7kgs48KkNoBPH6pn_YEA"; + // ignore: unused_local_variable final header = """{ "alg": "ECDH-ES", "typ": "JWT", @@ -398,7 +399,7 @@ DwwoHgQL4BQ6fCuuc26m93ClRTrYqjo418x5fDMyvr7KWkIMwVU6xcWJNg== final secret = JsonWebKey.generateECDH('A256GCM', publicKey: publicKey, privateKey: privateKey); - print("payload ${secret}"); + print("payload $secret"); // should be: 86c7d0c862e836a999b537df8542ab91d5788514669edc9de916dd3f77d52a71ce9fa5e476205ee167a757523cc2c6813a9e4730e3b3b0c1588ff720425b3f6a4a });