I'm facing a challenge when using https://pub.dev/packages/dart_jsonwebtoken with Firebase Functions.
I used this article to enable Firebase Functions with Dart code, but when it comes to using crypto libraries, I'm getting following error:
Error: Value of "this" must be of type nullish or must be the global object
Here's sample code I'm using:
Future<void> simpleSign() async {
String token;
final jwt = JWT(
{
'id': 123,
'server': {
'id': '3e4fc296',
'loc': 'euw-2',
}
},
issuer: 'https://github.com/jonasroussel/dart_jsonwebtoken',
);
// Sign it
final pem = rsaPrivKey;
final key = RSAPrivateKey(pem);
token = await jwt.sign(key, algorithm: JWTAlgorithm.RS256);
print('Signed token: $token\n');
}
I'd appreciate any ideas how to move forward. I want to use this feature to create JWS for further usage.