signPowerUpSignature static method
Uint8List
signPowerUpSignature({
- required String senderDid,
- required String pairwiseDid,
- required String timestamp,
- required CommercioRSAPrivateKey rsaPrivateKey,
Takes senderDid
, pairwiseDid
, timestamp
and:
- Concatenate senderDid, pairwiseDid and timestamp as payload
- Returns the RSA PKCS1v1.5 (the SHA256 digest is calculated inside the
signer) and sign using the
rsaPrivateKey
Implementation
static Uint8List signPowerUpSignature({
required String senderDid,
required String pairwiseDid,
required String timestamp,
required CommercioRSAPrivateKey rsaPrivateKey,
}) {
final concat = senderDid + pairwiseDid + timestamp;
final rsaSigner = RSASigner(SHA256Digest(), '0609608648016503040201');
rsaSigner.init(
true,
PrivateKeyParameter<RSAPrivateKey>(rsaPrivateKey.privateKey),
);
final sig =
rsaSigner.generateSignature(Uint8List.fromList(utf8.encode(concat)));
return sig.bytes;
}