Skip to content

Commit

Permalink
Remove draft 12 #2538
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Mar 27, 2024
1 parent 5fdaae8 commit 02c2383
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
15 changes: 15 additions & 0 deletions lib/dashboard/profile/models/profile_setting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,11 @@ class CustomOidc4VcProfile extends Equatable {
final String? clientSecret;
final bool cryptoHolderBinding;
final DidKeyType defaultDid;
//TODO(bibash): temporary solution to avoid who have chosen 12
@JsonKey(
includeFromJson: true,
fromJson: oidc4vciDraftFromJson,
)
final OIDC4VCIDraftType oidc4vciDraft;
final OIDC4VPDraftType oidc4vpDraft;
final bool scope;
Expand All @@ -585,6 +590,16 @@ class CustomOidc4VcProfile extends Equatable {

Map<String, dynamic> toJson() => _$CustomOidc4VcProfileToJson(this);

static OIDC4VCIDraftType oidc4vciDraftFromJson(dynamic value) {
if (value == '11') {
return OIDC4VCIDraftType.draft11;
} else if (value == '12' || value == '13') {
return OIDC4VCIDraftType.draft13;
} else {
throw Exception();
}
}

CustomOidc4VcProfile copyWith({
ClientAuthentication? clientAuthentication,
bool? credentialManifestSupport,
Expand Down
18 changes: 9 additions & 9 deletions packages/oidc4vc/lib/src/oidc4vc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -967,15 +967,15 @@ class OIDC4VC {
credentialData['types'] = types;
credentialData['format'] = format;

case OIDC4VCIDraftType.draft12:
if (types == null) {
throw Exception('CREDENTIAL_SUPPORT_DATA_ERROR');
}

credentialData['types'] = types;
if (credentialIdentifier != null) {
credentialData['credential_identifier'] = credentialIdentifier;
}
// case OIDC4VCIDraftType.draft12:
// if (types == null) {
// throw Exception('CREDENTIAL_SUPPORT_DATA_ERROR');
// }

// credentialData['types'] = types;
// if (credentialIdentifier != null) {
// credentialData['credential_identifier'] = credentialIdentifier;
// }

case OIDC4VCIDraftType.draft13:
credentialData['format'] = format;
Expand Down
6 changes: 0 additions & 6 deletions packages/oidc4vc/lib/src/oidc4vci_draft_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import 'package:json_annotation/json_annotation.dart';
enum OIDC4VCIDraftType {
@JsonValue('11')
draft11,
@JsonValue('12')
draft12,
@JsonValue('13')
draft13,
}
Expand All @@ -14,8 +12,6 @@ extension OIDC4VCIDraftTypeX on OIDC4VCIDraftType {
switch (this) {
case OIDC4VCIDraftType.draft11:
return 'Draft 11';
case OIDC4VCIDraftType.draft12:
return 'Draft 12 (Partial)';
case OIDC4VCIDraftType.draft13:
return 'Draft 13';
}
Expand All @@ -25,8 +21,6 @@ extension OIDC4VCIDraftTypeX on OIDC4VCIDraftType {
switch (this) {
case OIDC4VCIDraftType.draft11:
return '11';
case OIDC4VCIDraftType.draft12:
return '12';
case OIDC4VCIDraftType.draft13:
return '13';
}
Expand Down

0 comments on commit 02c2383

Please sign in to comment.