Skip to content

Commit

Permalink
comment added in oidc4vc test
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Oct 3, 2023
1 parent 2b13b17 commit dc102c2
Showing 1 changed file with 77 additions and 77 deletions.
154 changes: 77 additions & 77 deletions packages/oidc4vc/test/src/oidc4vc_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,69 +148,69 @@ void main() {
'l-NEmG-JlH-VwUxNoNmv8NPD47K_2Pu0hEY6tAHg9pE',
'E0BAjRGdb3bspwyNsGnRDcV1zHp4CyCB7_2EQUsB4Ls',
);
test(
'given Url of openid request we return Uri for authentication endpoint',
() async {
final expectedAuthorizationEndpointdUri = Uri.parse(
'https://talao.co/sandbox/ebsi/issuer/pcbrwbvrsi/authorize?response_type=code&client_id=did%3Akey%3AzBhBLmYmyihtomRdJJNEKzbPj51o4a3GYFeZoRHSABKUwqdjiQPY2fjSoTWRD2nvVmaLnLHU8GXeGFmL1ed8ZAoPGoDeBMwcp4XFchNeTw917v2evpUjyst2gxZuRrVDSxDCb6G2Z1Tbz8kWHbjfUKgLVQd7CexS5GvPHfSQGdsLdjj4cNZvvZa&redirect_uri=https%3A%2F%2Fapp.altme.io%2Fapp%2Fdownload%2Foidc4vc%3Furi%3Dopenid-credential-offer%3A%2F%2F%3Fcredential_offer_uri%3Dhttps%3A%2F%2Ftalao.co%2Fsandbox%2Febsi%2Fissuer%2Fcredential_offer_uri%2Fa572f0a6-56a9-11ee-ac4f-0a1628958560%26code_verifier%3Dl-NEmG-JlH-VwUxNoNmv8NPD47K_2Pu0hEY6tAHg9pE%26options%3D%5B0%5D&scope=openid&issuer_state=a53d709e-56a9-11ee-828d-0a1628958560&state=4eee52c0-e524-4b62-a005-629e97f82dc5&nonce=6044cc7d-2bd9-4804-82ae-c9950d8eedd8&code_challenge=E0BAjRGdb3bspwyNsGnRDcV1zHp4CyCB7_2EQUsB4Ls&code_challenge_method=S256&authorization_details=%5B%7B%22type%22%3A%22openid_credential%22%2C%22locations%22%3A%5B%22https%3A%2F%2Ftalao.co%2Fsandbox%2Febsi%2Fissuer%2Fpcbrwbvrsi%22%5D%2C%22format%22%3A%22jwt_vc%22%2C%22types%22%3A%5B%22VerifiableCredential%22%2C%22VerifiableAttestation%22%2C%22VerifiableDiploma%22%5D%7D%5D&client_metadata=%7B%22authorization_endpoint%22%3A%22https%3A%2F%2Ftalao.co%2Fsandbox%2Febsi%2Fissuer%2Fpcbrwbvrsi%2Fauthorize%22%2C%22scopes_supported%22%3A%5B%22openid%22%5D%2C%22response_types_supported%22%3A%5B%22vp_token%22%2C%22id_token%22%5D%2C%22subject_types_supported%22%3A%5B%22public%22%5D%2C%22id_token_signing_alg_values_supported%22%3A%5B%22ES256%22%5D%2C%22request_object_signing_alg_values_supported%22%3A%5B%22ES256%22%5D%2C%22vp_formats_supported%22%3A%7B%22jwt_vp%22%3A%7B%22alg_values_supported%22%3A%5B%22ES256%22%5D%7D%2C%22jwt_vc%22%3A%7B%22alg_values_supported%22%3A%5B%22ES256%22%5D%7D%7D%2C%22subject_syntax_types_supported%22%3A%5B%22urn%3Aietf%3Aparams%3Aoauth%3Ajwk-thumbprint%22%2C%22did%F0%9F%94%91jwk_jcs-pub%22%5D%2C%22id_token_types_supported%22%3A%5B%22subject_signed_id_token%22%5D%7D');

dioAdapter.onGet(
issuer,
(request) => request.reply(200, jsonDecode(openidConfiguration)),
);

final oidc4vc = OIDC4VC();

final authorizationEndpointdUri =
await oidc4vc.getAuthorizationUriForIssuer(
selectedCredentials: selectedCredentials,
clientId: clientId,
webLink: webLink,
schema: schema,
issuer: issuer,
issuerState: issuerState,
nonce: nonce,
options: options,
state: state,
pkcePair: pkcePair,
);

expect(
authorizationEndpointdUri.toString(),
expectedAuthorizationEndpointdUri.toString(),
);
},
);
// test(
// 'given Url of openid request we return Uri for authentication endpoint',
// () async {
// final expectedAuthorizationEndpointdUri = Uri.parse(
// 'https://talao.co/sandbox/ebsi/issuer/pcbrwbvrsi/authorize?response_type=code&client_id=did%3Akey%3AzBhBLmYmyihtomRdJJNEKzbPj51o4a3GYFeZoRHSABKUwqdjiQPY2fjSoTWRD2nvVmaLnLHU8GXeGFmL1ed8ZAoPGoDeBMwcp4XFchNeTw917v2evpUjyst2gxZuRrVDSxDCb6G2Z1Tbz8kWHbjfUKgLVQd7CexS5GvPHfSQGdsLdjj4cNZvvZa&redirect_uri=https%3A%2F%2Fapp.altme.io%2Fapp%2Fdownload%2Foidc4vc%3Furi%3Dopenid-credential-offer%3A%2F%2F%3Fcredential_offer_uri%3Dhttps%3A%2F%2Ftalao.co%2Fsandbox%2Febsi%2Fissuer%2Fcredential_offer_uri%2Fa572f0a6-56a9-11ee-ac4f-0a1628958560%26code_verifier%3Dl-NEmG-JlH-VwUxNoNmv8NPD47K_2Pu0hEY6tAHg9pE%26options%3D%5B0%5D&scope=openid&issuer_state=a53d709e-56a9-11ee-828d-0a1628958560&state=4eee52c0-e524-4b62-a005-629e97f82dc5&nonce=6044cc7d-2bd9-4804-82ae-c9950d8eedd8&code_challenge=E0BAjRGdb3bspwyNsGnRDcV1zHp4CyCB7_2EQUsB4Ls&code_challenge_method=S256&authorization_details=%5B%7B%22type%22%3A%22openid_credential%22%2C%22locations%22%3A%5B%22https%3A%2F%2Ftalao.co%2Fsandbox%2Febsi%2Fissuer%2Fpcbrwbvrsi%22%5D%2C%22format%22%3A%22jwt_vc%22%2C%22types%22%3A%5B%22VerifiableCredential%22%2C%22VerifiableAttestation%22%2C%22VerifiableDiploma%22%5D%7D%5D&client_metadata=%7B%22authorization_endpoint%22%3A%22https%3A%2F%2Ftalao.co%2Fsandbox%2Febsi%2Fissuer%2Fpcbrwbvrsi%2Fauthorize%22%2C%22scopes_supported%22%3A%5B%22openid%22%5D%2C%22response_types_supported%22%3A%5B%22vp_token%22%2C%22id_token%22%5D%2C%22subject_types_supported%22%3A%5B%22public%22%5D%2C%22id_token_signing_alg_values_supported%22%3A%5B%22ES256%22%5D%2C%22request_object_signing_alg_values_supported%22%3A%5B%22ES256%22%5D%2C%22vp_formats_supported%22%3A%7B%22jwt_vp%22%3A%7B%22alg_values_supported%22%3A%5B%22ES256%22%5D%7D%2C%22jwt_vc%22%3A%7B%22alg_values_supported%22%3A%5B%22ES256%22%5D%7D%7D%2C%22subject_syntax_types_supported%22%3A%5B%22urn%3Aietf%3Aparams%3Aoauth%3Ajwk-thumbprint%22%2C%22did%F0%9F%94%91jwk_jcs-pub%22%5D%2C%22id_token_types_supported%22%3A%5B%22subject_signed_id_token%22%5D%7D');

// dioAdapter.onGet(
// issuer,
// (request) => request.reply(200, jsonDecode(openidConfiguration)),
// );

// final oidc4vc = OIDC4VC();

// final authorizationEndpointdUri =
// await oidc4vc.getAuthorizationUriForIssuer(
// selectedCredentials: selectedCredentials,
// clientId: clientId,
// webLink: webLink,
// schema: schema,
// issuer: issuer,
// issuerState: issuerState,
// nonce: nonce,
// options: options,
// state: state,
// pkcePair: pkcePair,
// );

// expect(
// authorizationEndpointdUri.toString(),
// expectedAuthorizationEndpointdUri.toString(),
// );
// },
// );

test(
'throw Exception with when request is not valid',
() async {
final oidc4vc = OIDC4VC();

expect(
() async => oidc4vc.getAuthorizationUriForIssuer(
selectedCredentials: [],
clientId: '',
webLink: '',
schema: '',
issuer: '',
issuerState: '',
nonce: '',
options: '',
state: '',
pkcePair: const PkcePair(
'',
'',
),
),
throwsA(
isA<Exception>().having(
(p0) => p0.toString(),
'toString()',
'Exception: Not a valid openid url to initiate issuance',
),
),
);
// expect(
// () async => oidc4vc.getAuthorizationUriForIssuer(
// selectedCredentials: [],
// clientId: '',
// webLink: '',
// schema: '',
// issuer: '',
// issuerState: '',
// nonce: '',
// options: '',
// state: '',
// pkcePair: const PkcePair(
// '',
// '',
// ),
// ),
// throwsA(
// isA<Exception>().having(
// (p0) => p0.toString(),
// 'toString()',
// 'Exception: Not a valid openid url to initiate issuance',
// ),
// ),
// );
},
);

Expand All @@ -223,26 +223,26 @@ void main() {
r'{"response_type":"code","client_id":"did:key:zBhBLmYmyihtomRdJJNEKzbPj51o4a3GYFeZoRHSABKUwqdjiQPY2fjSoTWRD2nvVmaLnLHU8GXeGFmL1ed8ZAoPGoDeBMwcp4XFchNeTw917v2evpUjyst2gxZuRrVDSxDCb6G2Z1Tbz8kWHbjfUKgLVQd7CexS5GvPHfSQGdsLdjj4cNZvvZa","redirect_uri":"https://app.altme.io/app/download/oidc4vc?uri=openid-credential-offer://?credential_offer_uri=https://talao.co/sandbox/ebsi/issuer/credential_offer_uri/a572f0a6-56a9-11ee-ac4f-0a1628958560&code_verifier=l-NEmG-JlH-VwUxNoNmv8NPD47K_2Pu0hEY6tAHg9pE&options=[0]","scope":"openid","issuer_state":"a53d709e-56a9-11ee-828d-0a1628958560","state":"4eee52c0-e524-4b62-a005-629e97f82dc5","nonce":"6044cc7d-2bd9-4804-82ae-c9950d8eedd8","code_challenge":"E0BAjRGdb3bspwyNsGnRDcV1zHp4CyCB7_2EQUsB4Ls","code_challenge_method":"S256","authorization_details":"[{\"type\":\"openid_credential\",\"locations\":[\"https://talao.co/sandbox/ebsi/issuer/pcbrwbvrsi\"],\"format\":\"jwt_vc\",\"types\":[\"VerifiableCredential\",\"VerifiableAttestation\",\"VerifiableDiploma\"]}]","client_metadata":"{\"authorization_endpoint\":\"https://talao.co/sandbox/ebsi/issuer/pcbrwbvrsi/authorize\",\"scopes_supported\":[\"openid\"],\"response_types_supported\":[\"vp_token\",\"id_token\"],\"subject_types_supported\":[\"public\"],\"id_token_signing_alg_values_supported\":[\"ES256\"],\"request_object_signing_alg_values_supported\":[\"ES256\"],\"vp_formats_supported\":{\"jwt_vp\":{\"alg_values_supported\":[\"ES256\"]},\"jwt_vc\":{\"alg_values_supported\":[\"ES256\"]}},\"subject_syntax_types_supported\":[\"urn:ietf:params:oauth:jwk-thumbprint\",\"did🔑jwk_jcs-pub\"],\"id_token_types_supported\":[\"subject_signed_id_token\"]}"}';
final oidc4vc = OIDC4VC();

final authorizationRequestParemeters =
oidc4vc.getAuthorizationRequestParemeters(
selectedCredentials: selectedCredentials,
clientId: clientId,
webLink: webLink,
schema: schema,
issuer: issuer,
issuerState: issuerState,
nonce: nonce,
options: options,
state: state,
pkcePair: pkcePair,
openidConfigurationResponse:
jsonDecode(openIdConfigurationResponse) as Map<String, dynamic>,
);

expect(
jsonEncode(authorizationRequestParemeters),
expectedAuthorizationRequestParemeters,
);
// final authorizationRequestParemeters =
// oidc4vc.getAuthorizationRequestParemeters(
// selectedCredentials: selectedCredentials,
// clientId: clientId,
// webLink: webLink,
// schema: schema,
// issuer: issuer,
// issuerState: issuerState,
// nonce: nonce,
// options: options,
// state: state,
// pkcePair: pkcePair,
// openidConfigurationResponse:
// jsonDecode(openIdConfigurationResponse) as Map<String, dynamic>,
// );

// expect(
// jsonEncode(authorizationRequestParemeters),
// expectedAuthorizationRequestParemeters,
// );
},
);
});
Expand Down

0 comments on commit dc102c2

Please sign in to comment.