Skip to content

Commit

Permalink
feat: Options and naming convention update for oidc4vc profile 1752
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Jul 31, 2023
1 parent 5e88dbc commit b57fc3d
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 63 deletions.
115 changes: 58 additions & 57 deletions lib/app/shared/enum/type/oidc4vc_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,88 +2,62 @@ import 'package:dio/dio.dart';
import 'package:oidc4vc/oidc4vc.dart';

enum OIDC4VCType {
EBSIV2(
issuerVcType: 'jwt_vc',
verifierVpType: 'jwt_vp',
offerPrefix: 'openid://initiate_issuance',
DEFAULT(
issuerVcType: 'ldp_vc',
verifierVpType: 'ldp_vp',
offerPrefix: 'openid-credential-offer://',
presentationPrefix: 'openid-vc://',
cryptographicBindingMethodsSupported: ['DID'],
credentialSupported: [],
grantTypesSupported: [
'authorization_code',
'urn:ietf:params:oauth:grant-type:pre-authorized_code'
],
cryptographicSuitesSupported: [
'ES256K',
'ES256',
'ES384',
'ES512',
'RS256'
],
subjectSyntaxTypesSupported: ['did:ebsi'],
grantTypesSupported: [
'authorization_code',
'urn:ietf:params:oauth:grant-type:pre-authorized_code'
],
credentialSupported: ['VerifiableDiploma', 'VerifiableId'],
schemaForType: true,
subjectSyntaxTypesSupported: ['did:ebsi', 'did:key', 'did:ethr', 'did:tz'],
schemaForType: false,
oidc4VciDraft:
'https://openid.net/specs/openid-connect-4-verifiable-credential-issuance-1_0-05.html#abstract',
'https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html',
siopv2Draft: '',
serviceDocumentation:
'It is the profile of the EBSI V2 compliant test. DID for natural person is did:ebsi. The schema url is used as the VC type in the credential offer QR code. The prefix openid_initiate_issuance://',
serviceDocumentation: 'Last release of the OIDC4VC documentation',
),

EBSIV3(
EBSIV2(
issuerVcType: 'jwt_vc',
verifierVpType: 'jwt_vp',
offerPrefix: 'openid://initiate_issuance',
presentationPrefix: 'openid-vc://',
cryptographicBindingMethodsSupported: ['DID'],
credentialSupported: ['VerifiableDiploma', 'VerifiableId'],
grantTypesSupported: [
'authorization_code',
'urn:ietf:params:oauth:grant-type:pre-authorized_code'
],
cryptographicSuitesSupported: [
'ES256K',
'ES256',
'ES384',
'ES512',
'RS256'
],
subjectSyntaxTypesSupported: ['did:key'],
schemaForType: false,
oidc4VciDraft:
'https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html',
siopv2Draft: '',
serviceDocumentation: '',
),

GAIAX(
issuerVcType: 'ldp_vc',
verifierVpType: 'ldp_vp',
offerPrefix: 'openid-initiate-issuance://',
presentationPrefix: 'openid-vc://',
cryptographicBindingMethodsSupported: ['DID'],
credentialSupported: ['EmployeeCredential'],
subjectSyntaxTypesSupported: ['did:ebsi'],
grantTypesSupported: [
'authorization_code',
'urn:ietf:params:oauth:grant-type:pre-authorized_code'
],
cryptographicSuitesSupported: [
'ES256K',
'ES256',
'ES384',
'ES512',
'RS256'
],
subjectSyntaxTypesSupported: ['did:key'],
schemaForType: false,
credentialSupported: ['VerifiableDiploma', 'VerifiableId'],
schemaForType: true,
oidc4VciDraft:
'https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html',
'https://openid.net/specs/openid-connect-4-verifiable-credential-issuance-1_0-05.html#abstract',
siopv2Draft: '',
serviceDocumentation: 'Issuer pour projet Docaposte Gaia-X',
serviceDocumentation:
'It is the profile of the EBSI V2 compliant test. DID for natural person is did:ebsi. The schema url is used as the VC type in the credential offer QR code. The prefix openid_initiate_issuance://',
),

DEFAULT(
issuerVcType: 'ldp_vc',
verifierVpType: 'ldp_vp',
ARF(
issuerVcType: 'jwt_vc',
verifierVpType: 'jwt_vp',
offerPrefix: 'openid-credential-offer://',
presentationPrefix: 'openid-vc://',
cryptographicBindingMethodsSupported: ['DID'],
Expand All @@ -101,19 +75,18 @@ enum OIDC4VCType {
],
subjectSyntaxTypesSupported: ['did:ebsi', 'did:key', 'did:ethr', 'did:tz'],
schemaForType: false,
oidc4VciDraft:
'https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html',
oidc4VciDraft: '',
siopv2Draft: '',
serviceDocumentation: 'Last release of the OIDC4VC documentation',
serviceDocumentation: '',
),

ARF(
EBSIV3(
issuerVcType: 'jwt_vc',
verifierVpType: 'jwt_vp',
offerPrefix: 'openid-credential-offer://',
offerPrefix: 'openid://initiate_issuance',
presentationPrefix: 'openid-vc://',
cryptographicBindingMethodsSupported: ['DID'],
credentialSupported: [],
credentialSupported: ['VerifiableDiploma', 'VerifiableId'],
grantTypesSupported: [
'authorization_code',
'urn:ietf:params:oauth:grant-type:pre-authorized_code'
Expand All @@ -125,9 +98,10 @@ enum OIDC4VCType {
'ES512',
'RS256'
],
subjectSyntaxTypesSupported: ['did:ebsi', 'did:key', 'did:ethr', 'did:tz'],
subjectSyntaxTypesSupported: ['did:key'],
schemaForType: false,
oidc4VciDraft: '',
oidc4VciDraft:
'https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html',
siopv2Draft: '',
serviceDocumentation: '',
),
Expand Down Expand Up @@ -207,4 +181,31 @@ extension OIDC4VCTypeX on OIDC4VCType {
),
);
}

String get rename {
switch (this) {
case OIDC4VCType.DEFAULT:
return 'DEFAULT';
case OIDC4VCType.EBSIV2:
return 'EBSI-V2';
case OIDC4VCType.EBSIV3:
return 'EBSI-V3';
case OIDC4VCType.ARF:
return 'ARF';
case OIDC4VCType.JWTVC:
return 'JWT-VC';
}
}

bool get isEnabled {
switch (this) {
case OIDC4VCType.DEFAULT:
case OIDC4VCType.EBSIV2:
case OIDC4VCType.ARF:
return true;
case OIDC4VCType.EBSIV3:
case OIDC4VCType.JWTVC:
return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,17 @@ class OIDC4VCProfilePage extends StatelessWidget {
shrinkWrap: true,
physics: const ScrollPhysics(),
itemBuilder: (context, index) {
final OIDC4VCType currentType = OIDC4VCType.values[index];
return Column(
children: [
ListTile(
onTap: () {
if (!currentType.isEnabled) {
return;
}
context
.read<ProfileCubit>()
.updateOIDC4VCType(OIDC4VCType.values[index]);
.updateOIDC4VCType(currentType);
},
shape: const RoundedRectangleBorder(
side: BorderSide(
Expand All @@ -60,17 +64,24 @@ class OIDC4VCProfilePage extends StatelessWidget {
),
),
title: Text(
OIDC4VCType.values[index].name,
OIDC4VCType.values[index].rename,
style: Theme.of(context)
.listTileTheme
.titleTextStyle
?.copyWith(color: const Color(0xFF080F33)),
.textTheme
.bodyLarge
?.copyWith(
color: currentType.isEnabled
? Theme.of(context).colorScheme.onPrimary
: Theme.of(context).colorScheme.lightGrey,
),
),
trailing: Icon(
state.model.oidc4vcType == OIDC4VCType.values[index]
state.model.oidc4vcType == currentType
? Icons.radio_button_checked
: Icons.radio_button_unchecked,
size: Sizes.icon2x,
color: currentType.isEnabled
? Theme.of(context).colorScheme.onPrimary
: Theme.of(context).colorScheme.lightGrey,
),
),
if (index < OIDC4VCType.values.length - 1)
Expand Down

0 comments on commit b57fc3d

Please sign in to comment.