Skip to content

Commit

Permalink
Merge pull request #439 from 0xPolygonID/fix/PID2441-credentials-sort…
Browse files Browse the repository at this point in the history
…-on-proof-request

Accept sort order input on get claims entry point
  • Loading branch information
Emanuel Muroni authored Sep 16, 2024
2 parents ba76ff8 + 9aeaca0 commit c2553c8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 17 deletions.
17 changes: 11 additions & 6 deletions lib/sdk/iden3comm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:polygonid_flutter_sdk/common/domain/entities/env_entity.dart';
import 'package:polygonid_flutter_sdk/common/domain/entities/filter_entity.dart';
import 'package:polygonid_flutter_sdk/common/domain/error_exception.dart';
import 'package:polygonid_flutter_sdk/common/infrastructure/stacktrace_stream_manager.dart';
import 'package:polygonid_flutter_sdk/common/utils/credential_sort_order.dart';
import 'package:polygonid_flutter_sdk/credential/domain/entities/claim_entity.dart';
import 'package:polygonid_flutter_sdk/credential/domain/use_cases/add_did_profile_info_use_case.dart';
import 'package:polygonid_flutter_sdk/credential/domain/use_cases/get_did_profile_info_list_use_case.dart';
Expand Down Expand Up @@ -110,12 +111,14 @@ abstract class PolygonIdSdkIden3comm {
///
/// The [privateKey] is the key used to access all the sensitive info from the identity
/// and also to realize operations like generating proofs
Future<List<ClaimEntity?>> getClaimsFromIden3Message(
{required Iden3MessageEntity message,
required String genesisDid,
BigInt? profileNonce,
required String privateKey,
Map<int, Map<String, dynamic>>? nonRevocationProofs});
Future<List<ClaimEntity?>> getClaimsFromIden3Message({
required Iden3MessageEntity message,
required String genesisDid,
BigInt? profileNonce,
required String privateKey,
Map<int, Map<String, dynamic>>? nonRevocationProofs,
List<CredentialSortOrder> sortOrder,
});

/// Get a list of [int] revocation nonces of claims stored in Polygon Id Sdk that fulfills
/// the request from iden3comm message.
Expand Down Expand Up @@ -414,6 +417,7 @@ class Iden3comm implements PolygonIdSdkIden3comm {
BigInt? profileNonce,
required String privateKey,
Map<int, Map<String, dynamic>>? nonRevocationProofs,
List<CredentialSortOrder> sortOrder = const [],
}) {
_stacktraceManager.clearStacktrace();
return _getIden3commClaimsUseCase.execute(
Expand All @@ -423,6 +427,7 @@ class Iden3comm implements PolygonIdSdkIden3comm {
profileNonce: profileNonce ?? GENESIS_PROFILE_NONCE,
privateKey: privateKey,
nonRevocationProofs: nonRevocationProofs ?? {},
credentialSortOrderList: sortOrder,
));
}

Expand Down
26 changes: 15 additions & 11 deletions lib/sdk/polygonid_flutter_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -508,18 +508,22 @@ class PolygonIdFlutterChannel
}

@override
Future<List<ClaimEntity?>> getClaimsFromIden3Message(
{required Iden3MessageEntity message,
required String genesisDid,
BigInt? profileNonce,
required String privateKey,
Map<int, Map<String, dynamic>>? nonRevocationProofs}) {
Future<List<ClaimEntity?>> getClaimsFromIden3Message({
required Iden3MessageEntity message,
required String genesisDid,
BigInt? profileNonce,
required String privateKey,
Map<int, Map<String, dynamic>>? nonRevocationProofs,
List<CredentialSortOrder> sortOrder = const [],
}) {
return _polygonIdSdk.iden3comm.getClaimsFromIden3Message(
message: message,
genesisDid: genesisDid,
profileNonce: profileNonce,
privateKey: privateKey,
nonRevocationProofs: nonRevocationProofs);
message: message,
genesisDid: genesisDid,
profileNonce: profileNonce,
privateKey: privateKey,
nonRevocationProofs: nonRevocationProofs,
sortOrder: sortOrder,
);
}

@override
Expand Down

0 comments on commit c2553c8

Please sign in to comment.