sign method
Signs signingInput (the JWS signing input: base64url(header) + "." +
base64url(payload), as ASCII bytes) with keyPair's private key.
Returns the raw JWS signature bytes (R || S for ECDSA, not DER).
Implementation
@override
Future<Uint8List> sign(DpopKeyPair keyPair, Uint8List signingInput) async {
try {
final privateKey = await wc.EcdsaPrivateKey.importPkcs8Key(
keyPair.privateKeyPkcs8,
_curve,
);
final signature =
await privateKey.signBytes(signingInput, wc.Hash.sha256);
return Uint8List.fromList(signature);
} on DpopException {
rethrow;
} catch (_) {
throw const DpopCryptoException('DPoP proof signing failed.');
}
}