Skip to content

Commit

Permalink
feat: Updating some ids
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Oct 13, 2023
1 parent 029fb26 commit fa34a89
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 9 additions & 4 deletions lib/scan/cubit/scan_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -642,14 +642,19 @@ class ScanCubit extends Cubit<ScanState> {
if (presentationDefinition.inputDescriptors.length == 1) {
inputDescriptors.add({
'id': presentationDefinition.inputDescriptors[0].id,
'format': format,
'path': r'$.verifiableCredential',
'format': 'jwt_vp',
'path': r'$',
'path_nested': {
'format': format,
'path': r'$.verifiableCredential',
},
});
} else {
for (int i = 0; i < presentationDefinition.inputDescriptors.length; i++) {
inputDescriptors.add({
'id': presentationDefinition.inputDescriptors[i].id,
'format': format,
'format': 'jwt_vp',
'path': r'$',
'path_nested': {
'format': format,
// ignore: prefer_interpolation_to_compose_strings
Expand Down Expand Up @@ -717,8 +722,8 @@ class ScanCubit extends Cubit<ScanState> {
jsonEncode({
'@context': ['https://www.w3.org/2018/credentials/v1'],
'type': ['VerifiablePresentation'],
'id': presentationId,
'holder': did,
'id': presentationId,
'verifiableCredential': credentialsToBePresented.length == 1
? credentialsToBePresented.first.data
: credentialsToBePresented.map((c) => c.data).toList(),
Expand Down
6 changes: 4 additions & 2 deletions packages/oidc4vc/lib/src/oidc4vc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import 'package:oidc4vc/src/token_parameters.dart';
import 'package:oidc4vc/src/verification_type.dart';
import 'package:oidc4vc/src/verifier_token_parameters.dart';
import 'package:secp256k1/secp256k1.dart';
import 'package:uuid/uuid.dart';

/// {@template ebsi}
/// EBSI wallet compliance
Expand Down Expand Up @@ -873,17 +874,18 @@ class OIDC4VC {
VerifierTokenParameters tokenParameters,
) async {
final iat = (DateTime.now().millisecondsSinceEpoch / 1000).round();
final presentationId = 'urn:uuid:${const Uuid().v4()}';
final vpTokenPayload = {
'iat': iat,
'jti': 'http://example.org/presentations/talao/01',
'jti': presentationId,
'nbf': iat - 10,
'aud': tokenParameters.audience,
'exp': iat + 1000,
'sub': tokenParameters.did,
'iss': tokenParameters.did,
'vp': {
'@context': ['https://www.w3.org/2018/credentials/v1'],
'id': 'http://example.org/presentations/talao/01',
'id': presentationId,
'type': ['VerifiablePresentation'],
'holder': tokenParameters.did,
'verifiableCredential': tokenParameters.jsonIdOrJwtList,
Expand Down

0 comments on commit fa34a89

Please sign in to comment.