Skip to content

Commit

Permalink
feat: Add PID in identity category #2562
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Apr 3, 2024
1 parent 6524dce commit ac5397a
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,5 @@ enum CredentialSubjectType {
legalPersonalCredential,
identityCredential,
eudiPid,
pid,
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ extension CredentialSubjectTypeExtension on CredentialSubjectType {
case CredentialSubjectType.legalPersonalCredential:
case CredentialSubjectType.identityCredential:
case CredentialSubjectType.eudiPid:
case CredentialSubjectType.pid:
return Colors.white;
}
}
Expand Down Expand Up @@ -209,6 +210,8 @@ extension CredentialSubjectTypeExtension on CredentialSubjectType {
return 'IdentityCredential';
case CredentialSubjectType.eudiPid:
return 'EudiPid';
case CredentialSubjectType.pid:
return 'Pid';
case CredentialSubjectType.defaultCredential:
return '';
}
Expand Down Expand Up @@ -334,6 +337,8 @@ extension CredentialSubjectTypeExtension on CredentialSubjectType {
return IdentityCredentialSubjectModel.fromJson(json);
case CredentialSubjectType.eudiPid:
return EudipidSubjectModel.fromJson(json);
case CredentialSubjectType.pid:
return PidSubjectModel.fromJson(json);
}
}

Expand Down Expand Up @@ -569,6 +574,8 @@ extension CredentialSubjectTypeExtension on CredentialSubjectType {
return 'Identity Credential';
case CredentialSubjectType.eudiPid:
return 'EudiPid';
case CredentialSubjectType.pid:
return 'Pid';
case CredentialSubjectType.defaultCredential:
return '';
}
Expand Down Expand Up @@ -636,6 +643,7 @@ extension CredentialSubjectTypeExtension on CredentialSubjectType {
case CredentialSubjectType.legalPersonalCredential:
case CredentialSubjectType.identityCredential:
case CredentialSubjectType.eudiPid:
case CredentialSubjectType.pid:
return false;
}
}
Expand Down Expand Up @@ -670,6 +678,7 @@ extension CredentialSubjectTypeExtension on CredentialSubjectType {

case CredentialSubjectType.identityCredential:
case CredentialSubjectType.eudiPid:
case CredentialSubjectType.pid:
return [VCFormatType.vcSdJWT];

case CredentialSubjectType.over18:
Expand Down Expand Up @@ -1018,6 +1027,7 @@ extension CredentialSubjectTypeExtension on CredentialSubjectType {
case CredentialSubjectType.walletCredential:
case CredentialSubjectType.identityCredential:
case CredentialSubjectType.eudiPid:
case CredentialSubjectType.pid:
break;
}

Expand Down Expand Up @@ -1154,6 +1164,7 @@ extension CredentialSubjectTypeExtension on CredentialSubjectType {
case CredentialSubjectType.legalPersonalCredential:
case CredentialSubjectType.identityCredential:
case CredentialSubjectType.eudiPid:
case CredentialSubjectType.pid:
return 0;
}
}
Expand Down
1 change: 1 addition & 0 deletions lib/dashboard/home/tab_bar/credentials/models/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export 'passport_footprint/passport_footprint_model.dart';
export 'pcds_agent_certificate/pcds_agent_certificate_model.dart';
export 'pending_info/pending_info.dart';
export 'phone_pass/phone_pass_model.dart';
export 'pid/pid_subject_model.dart';
export 'polygon_associated_address/polygon_associated_address_credential.dart';
export 'polygon_associated_address/polygon_associated_address_model.dart';
export 'polygon_poo_address/polygon_poo_address_model.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import 'package:altme/app/app.dart';
import 'package:altme/dashboard/home/tab_bar/credentials/models/credential_subject/credential_subject_model.dart';
import 'package:json_annotation/json_annotation.dart';

part 'pid_subject_model.g.dart';

@JsonSerializable(explicitToJson: true)
class PidSubjectModel extends CredentialSubjectModel {
PidSubjectModel({
super.id,
super.type,
super.issuedBy,
}) : super(
credentialSubjectType: CredentialSubjectType.pid,
credentialCategory: CredentialCategory.identityCards,
);

factory PidSubjectModel.fromJson(Map<String, dynamic> json) =>
_$PidSubjectModelFromJson(json);

@override
Map<String, dynamic> toJson() => _$PidSubjectModelToJson(this);
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class CredentialDisplay extends StatelessWidget {

case CredentialSubjectType.identityCredential:
case CredentialSubjectType.eudiPid:
case CredentialSubjectType.pid:
switch (credDisplayType) {
case CredDisplayType.List:
return DefaultCredentialWidget(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,18 @@ class DisplaySelectiveDisclosure extends StatelessWidget {
final key = map.key;
final value = map.value;

// "mandatory": True,
// "value_type": "string",
// "display": [
// {"name": "Address", "locale": "en-US"},
// {"name": "Adresse", "locale": "fr-FR"}
// ],
// "street_address": {
// "mandatory": True,
// "value_type": "string",
// "display": [
// {"name": "Street address", "locale": "en-US"},
// {"name": "Rue", "locale": "fr-FR"}],
// },
// "locality": {
// "mandatory": True,
// "value_type": "string",
// "display": [
// {"name": "Locality", "locale": "en-US"},
Expand Down

0 comments on commit ac5397a

Please sign in to comment.