Skip to content

Commit

Permalink
Merge pull request #4 from niscy-eudiw/feature/EUDIW-767
Browse files Browse the repository at this point in the history
EUDIW-767: verifier-ui option for VP in CBOR format
  • Loading branch information
Apostolis-Galanopoulos authored Jul 24, 2023
2 parents bcf8689 + 33fe8b0 commit 29eabe7
Show file tree
Hide file tree
Showing 9 changed files with 307 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ const routes: Routes = [
then(m => m.PresentationDefinitionModule )},
{ path: 'siop',
loadChildren: () => import('./features/siop/siop.module').
then(m => m.SIOPModule )}
then(m => m.SIOPModule )},
{ path: 'cbor',
loadChildren: () => import('./features/cbor/cbor.module').
then(m => m.CborModule )}
];

@NgModule({
Expand Down
210 changes: 210 additions & 0 deletions src/app/core/data/pid_presentation_definition.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
export const PID_PRESENTATION_DEFINITION = {
'type': 'vp_token',
'presentation_definition': {
'id': '32f54163-7166-48f1-93d8-ff217bdb0653',
'input_descriptors': [
{
'id': 'eudi_pid',
'name': 'EUDI PID',
'purpose': 'We need to verify your identity',
'constraints': {
'fields': [
{
'path': [
'$.mdoc.doctype'
],
'filter': {
'type': 'string',
'const': 'eu.europa.ec.eudiw.pid.1'
}
},
{
'path': [
'$.mdoc.namespace'
],
'filter': {
'type': 'string',
'const': 'eu.europa.ec.eudiw.pid.1'
}
},
{
'path': [
'$.mdoc.family_name'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.given_name'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.birth_date'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.age_over_18'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.age_in_years'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.age_birth_year'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.unique_id'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.family_name_birth'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.given_name_birth'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.birth_place'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.birth_country'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.birth_state'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.birth_city'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.resident_address'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.resident_country'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.resident_state'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.resident_city'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.resident_postal_code'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.resident_street'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.resident_house_number'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.gender'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.nationality'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.issuance_date'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.expiry_date'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.issuing_authority'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.document_number'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.administrative_number'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.issuing_country'
],
'intent_to_retain': false
},
{
'path': [
'$.mdoc.issuing_jurisdiction'
],
'intent_to_retain': false
}
]
}
}
]
},
'nonce' : 'nonce'
};
9 changes: 9 additions & 0 deletions src/app/core/services/online-authentication-siop.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { HttpService } from '../network/http/http.service';
import { PresentationDefinitionResponse } from '../models/presentation-definition-response';
import { PID_PRESENTATION_DEFINITION } from '../data/pid_presentation_definition';

@Injectable()
export class OnlineAuthenticationSIOPService {
Expand All @@ -19,4 +20,12 @@ export class OnlineAuthenticationSIOPService {
return this.httpService.post<PresentationDefinitionResponse, {type: string, 'id_token_type': string, 'nonce': string}>
('ui/presentations', dataRequest,);
}
initCborTransaction (): Observable<PresentationDefinitionResponse> {
// const dataRequest = {
// 'type': 'id_token',
// 'id_token_type': 'subject_signed_id_token',
// 'nonce': 'nonce'
// };
return this.httpService.post('ui/presentations', PID_PRESENTATION_DEFINITION);
}
}
22 changes: 22 additions & 0 deletions src/app/features/cbor/cbor-routing.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HomeComponent } from './home/home.component';

const routes: Routes = [
{
path: '',
component: HomeComponent,
children: [
{
path: '',
loadComponent: () => import('../verifiable-credential/components/qr-code/qr-code.component').then(c => c.QrCodeComponent)
}
]
}
];

@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class CborRoutingModule { }
19 changes: 19 additions & 0 deletions src/app/features/cbor/cbor.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { CborRoutingModule } from './cbor-routing.module';
import { HomeComponent } from './home/home.component';
import { LayoutComponent } from '@app/core/layout/layout/layout.component';


@NgModule({
declarations: [
HomeComponent
],
imports: [
CommonModule,
LayoutComponent,
CborRoutingModule
]
})
export class CborModule { }
4 changes: 4 additions & 0 deletions src/app/features/cbor/home/home.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vc-layout>
<h2 title>OID4VP + CBOR</h2>
<router-outlet body></router-outlet>
</vc-layout>
23 changes: 23 additions & 0 deletions src/app/features/cbor/home/home.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { HomeComponent } from './home.component';

describe('HomeComponent', () => {
let component: HomeComponent;
let fixture: ComponentFixture<HomeComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ HomeComponent ]
})
.compileComponents();

fixture = TestBed.createComponent(HomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
9 changes: 9 additions & 0 deletions src/app/features/cbor/home/home.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Component } from '@angular/core';

@Component({
selector: 'vc-home',
templateUrl: './home.component.html'
})
export class HomeComponent {

}
9 changes: 7 additions & 2 deletions src/app/features/home/components/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class HomeComponent {
{
key: 'OID4VP_CBOR',
value: 'OID4VP + CBOR',
isDisabled: true,
isDisabled: false,
},
{
key: 'OID4VP_C',
Expand All @@ -45,7 +45,7 @@ export class HomeComponent {
if (choose === 'SIOP') {
this.navPath = 'siop';
} else if (choose === 'OID4VP_CBOR') {
this.navPath = 'OID4VP_CBOR';
this.navPath = 'cbor';
} else if (choose === 'OID4VP_C') {
this.navPath = '/presentation';
}
Expand All @@ -59,6 +59,11 @@ export class HomeComponent {
this.dataService.setQRCode(data);
this.navigateService.navigateTo(this.navPath);
});
} else if(this.navPath === 'cbor') {
this.onlineAuthenticationSIOPService.initCborTransaction().subscribe((data) => {
this.dataService.setQRCode(data);
this.navigateService.navigateTo(this.navPath);
});
}
}
}

0 comments on commit 29eabe7

Please sign in to comment.