sign method
Create a signature of the body
with key
return the signature as bytes
Implementation
@override
Uint8List sign(JWTKey key, Uint8List body) {
assert(key is SecretKey, 'key must be a SecretKey');
final secretKey = key as SecretKey;
final keyBytes = decodeHMACSecret(secretKey.key, secretKey.isBase64Encoded);
final hmac = pc.Mac('${_getHash(name)}/HMAC');
hmac.init(pc.KeyParameter(keyBytes));
return Uint8List.fromList(hmac.process(body));
}