Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement detached JWS verification #54

Merged
merged 1 commit into from
Mar 27, 2024
Merged

implement detached JWS verification #54

merged 1 commit into from
Mar 27, 2024

Conversation

mistermoe
Copy link
Contributor

Summary

Includes ability to verify a compact JWS with detached content

Usage

Signing

  final did = await DidJwk.create();
  final payload = Uint8List.fromList('hello'.codeUnits);
  final compactJws = await Jws.sign(did: did, payload: payload, detachedPayload: true);

  print('compactJws: $compactJws');

Verification

import 'dart:typed_data';

import 'package:web5/web5.dart';

void main() async {
  final did = await DidJwk.create();
  final payload = Uint8List.fromList('hello'.codeUnits);
  final compactJws = 'eyJhbGciOiJFZERTQSIsImtpZCI6ImRpZDpqd2s6ZXlKcmRIa2lPaUpQUzFBaUxDSmhiR2NpT2lKRlpFUlRRU0lzSW10cFpDSTZJa05EWm5wS1NHRlhiVEpOZFZoeU9WTm9URmxXU1Voa1JEa3pla1pmWlZScFRGQXhTekJLYm1scFMxVWlMQ0pqY25ZaU9pSkZaREkxTlRFNUlpd2llQ0k2SWpsVVExTTFhMjUyYlMxV1VHSjVVM3BmUjNOdU1HUnZOakZCYWtab1pYaHdaVmRvYTJabFFYRldXSE1pZlEjMCJ9..BuGapDpbkU2cmGTK4A4rmvpcyf-O5-GiLjN7CHuEc7GGI-7pbrPUL-2zGQkfvPlqu_YjSFDJuo9lLYOuZaiOCw';

  final decodedJws = Jws.decode(compactJws, detachedPayload: payload);
}

@mistermoe mistermoe requested a review from ethan-tbd March 27, 2024 20:54
@mistermoe mistermoe requested a review from wesbillman as a code owner March 27, 2024 20:54
Copy link
Contributor

@ethan-tbd ethan-tbd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!!

@mistermoe mistermoe merged commit eebc8a9 into main Mar 27, 2024
1 check passed
@mistermoe mistermoe deleted the jws-detached-verify branch March 27, 2024 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants