You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have issues with the library after the update to 0.3.3. The problem is caused by this commit (94630ea).
We use the JsonWebSignature.fromJson(Map<String, dynamic> json) method to parse JWS. The issue is caused by the typecasting from the dynamic to List<Map<String, Object>> that throws the Unhandled Exception: type 'List<dynamic>' is not a subtype of type 'List<Map<String, Object>>' in type cast.
If I use map directly as it's implemented in the tests, then everything works. But if you encode the map to JSON and then decode it back to the map, it crashes.
final testData = {
'payload':
'eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGF'
'tcGxlLmNvbS9pc19yb290Ijp0cnVlfQ',
'signatures': [
{
'protected': 'eyJhbGciOiJSUzI1NiJ9',
'header': {'kid': '2010-12-29'},
'signature': 'cC4hiUPoj9Eetdgtv3hF80EGrhuB__dzERat0XF9g2VtQgr9PJbu3XOiZj5RZ'
'mh7AAuHIm4Bh-0Qc_lF5YKt_O8W2Fp5jujGbds9uJdbF9CUAr7t1dnZcAcQjb'
'KBYNX4BAynRFdiuB--f_nZLgrnbyTyWzO75vRK5h6xBArLIARNPvkSjtQBMHl'
'b1L07Qe7K0GarZRmB_eSN9383LcOLn6_dO--xi12jzDwusC-eOkHWEsqtFZES'
'c6BfI7noOPqvhJ1phCnvWh6IeYI2w9QOYEUipUTI8np6LbgGY9Fs98rqVt5AX'
'LIhWkWywlVmtVrBp0igcN_IoypGlUPQGe77Rw'
},
{
'protected': 'eyJhbGciOiJFUzI1NiJ9',
'header': {'kid': 'e9bc097a-ce51-4036-9562-d2ade882db0d'},
'signature':
'DtEhU3ljbEg8L38VWAfUAqOyKAM6-Xx-F4GawxaepmXFCgfTjDxw5djxLa8IS'
'lSApmWQxfKTUJqPP3-Kg6NU1Q'
}
]
};
final jsonJWS = jsonEncode(testData);
final jwsMap = jsonDecode(jsonJWS) as Map<String, dynamic>;
final jws = JsonWebSignature.fromJson(jwsMap);
Thank you for your response.
Best regards,
O.
The text was updated successfully, but these errors were encountered:
Hello,
I have issues with the library after the update to 0.3.3. The problem is caused by this commit (94630ea).
We use the
JsonWebSignature.fromJson(Map<String, dynamic> json)
method to parse JWS. The issue is caused by the typecasting from thedynamic
toList<Map<String, Object>>
that throws theUnhandled Exception: type 'List<dynamic>' is not a subtype of type 'List<Map<String, Object>>' in type cast
.If I use map directly as it's implemented in the tests, then everything works. But if you encode the map to JSON and then decode it back to the map, it crashes.
Thank you for your response.
Best regards,
O.
The text was updated successfully, but these errors were encountered: