getDpopToken method

  1. @override
Future<({String accessToken, String dPoP})> getDpopToken(
  1. String url,
  2. String method
)

Generates DPoP token for authenticated HTTP request.

Creates a fresh DPoP proof token bound to the url and method. Throws StateError if not authenticated (no credentials available).

Implementation

@override
Future<({String accessToken, String dPoP})> getDpopToken(
    String url, String method) async {
  if (_credentials == null) {
    throw StateError('No authentication credentials available in worker');
  }

  final dpop = _credentials!.generateDpopToken(url: url, method: method);
  return (
    accessToken: dpop.accessToken,
    dPoP: dpop.dpopToken,
  );
}