Skip to content

Commit 0c07ef3

Browse files
authored
Release 0.10.0 (#218)
* Add presentation profiles selection (#217) * Add presentation-options component * Migrate to initTransaction v2 * Add authorization request URI handling and update presentation options component * Refactor presentation options component layout and styles for improved clarity and usability * Fixed events endpoint (#219) * Fixed events endpoint * Refactored endpoint constants * Refactored endpoint constants * Remove scheme from burger menu (#220) * Remove scheme from burger menu * Remove scheme from burger menu * Label update * Label update
1 parent 50d82ee commit 0c07ef3

22 files changed

Lines changed: 402 additions & 229 deletions

src/app/core/constants/general.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
import { Profile, RequestUriMethod } from "../models/TransactionInitializationRequest";
2+
13
export const ACTIVE_TRANSACTION = 'ACTIVE_TRANSACTION';
24
export const SCHEME = 'scheme';
3-
export const DEFAULT_SCHEME = 'haip-vp://';
45
export const ISSUER_CHAIN = 'ISSUER_CHAIN';
6+
7+
export const DefaultRequestUriMethod: RequestUriMethod = 'get';
8+
export const DefaultProfile: Profile = 'haip';

src/app/core/layout/wallet-layout/wallet-layout-header/wallet-layout-header.component.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
<a id="inspectLogs" mat-menu-item (click)="inspectLogs()"
99
>Inspect transaction logs</a
1010
>
11-
<a id="customScheme" mat-menu-item (click)="changeCustomScheme()"
12-
>Change default scheme</a
13-
>
1411
<a id="issuerChain" mat-menu-item (click)="changeIssuerChain()"
1512
>Configure issuer chain</a
1613
>

src/app/core/layout/wallet-layout/wallet-layout-header/wallet-layout-header.component.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { MatMenuModule } from "@angular/material/menu";
66
import { MatToolbarModule } from '@angular/material/toolbar';
77
import { OpenLogsComponent } from "@shared/elements/open-logs/open-logs.component";
88
import { MatDialog, MatDialogModule } from "@angular/material/dialog";
9-
import {InputSchemeComponent} from "@shared/elements/input-scheme/input-scheme.component";
109
import { IssuerChainComponent } from '@app/shared/elements/trusted-issuer/issuer-chain.component';
1110

1211
@Component({
@@ -40,16 +39,6 @@ export class WalletLayoutHeaderComponent {
4039
});
4140
}
4241

43-
changeCustomScheme () {
44-
this.dialog.open(InputSchemeComponent, {
45-
data: {
46-
transactionId: '',
47-
label: 'Inspect transaction logs',
48-
isInspectLogs: true
49-
},
50-
});
51-
}
52-
5342
changeIssuerChain () {
5443
this.dialog.open(IssuerChainComponent, {
5544
data: {
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
import { RequestUriMethod } from "./TransactionInitializationRequest"
2+
13
export type InitializedTransaction = {
24
client_id: string,
35
request_uri: string,
4-
request_uri_method: 'get' | 'post',
5-
transaction_id: string
6+
request_uri_method: RequestUriMethod,
7+
transaction_id: string,
8+
authorization_request_uri: string
69
}
Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11
import { DCQL } from './dcql/DCQL';
22

3+
export type RequestUriMethod = 'get' | 'post';
4+
export type Profile = 'haip' | 'openid4vp';
5+
export type ProfileOptions = {
6+
endpoint: string;
7+
}
8+
export const profileOptions: Record<Profile, ProfileOptions> = {
9+
haip: {
10+
endpoint: 'haip-vp://',
11+
},
12+
openid4vp: {
13+
endpoint: 'openid4vp://',
14+
},
15+
};
16+
317
export type TransactionInitializationRequest = {
418
nonce: string;
5-
request_uri_method: 'get' | 'post';
19+
request_uri_method: RequestUriMethod;
620
dcql_query: DCQL;
721
issuer_chain?: string;
22+
profile: Profile;
23+
authorization_request_uri: string;
824
};
925

1026
export type PresentationQuery = DCQL;

src/app/core/services/dcql-service.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
AttributeSelectionMethod,
99
} from '@app/features/presentation-request-preparation/models/AttestationSelection';
1010
import { v4 as uuidv4 } from 'uuid';
11-
import { TransactionInitializationRequest } from '../models/TransactionInitializationRequest';
11+
import { Profile, RequestUriMethod, TransactionInitializationRequest } from '../models/TransactionInitializationRequest';
1212
import {
1313
MsoMdocAttestation,
1414
SdJwtVcAttestation,
@@ -21,7 +21,9 @@ export class DCQLService {
2121
dcqlPresentationRequest(
2222
selectedAttestations: AttestationSelection[],
2323
selectedAttributes: { [id: string]: string[] },
24-
selectedRequestUriMethod: 'get' | 'post',
24+
selectedRequestUriMethod: RequestUriMethod,
25+
selectedProfile: Profile,
26+
authorizationRequestUri: string,
2527
issuerChain?: string
2628
): TransactionInitializationRequest {
2729
let dcqlQueries: CredentialQuery[] = selectedAttestations.map(
@@ -44,6 +46,8 @@ export class DCQLService {
4446
nonce: uuidv4(),
4547
request_uri_method: selectedRequestUriMethod,
4648
issuer_chain: issuerChain,
49+
profile: selectedProfile,
50+
authorization_request_uri: authorizationRequestUri
4751
};
4852
}
4953

src/app/core/services/verifier-endpoint.service.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ import {ActiveTransaction} from "@core/models/ActiveTransaction";
1414
import { SessionStorageService } from './session-storage.service';
1515

1616
const SAME_DEVICE_UI_RE_ENTRY_URL = '/get-wallet-code?response_code={RESPONSE_CODE}';
17-
const PRESENTATIONS_ENDPOINT = 'ui/presentations';
18-
const VALIDATE_SD_JWT_VC_PRESENTATION_ENDPOINT = 'utilities/process/sdJwtVc';
17+
const INIT_TRANSACTION_ENDPOINT = 'ui/presentations/v2';
18+
const WALLET_RESPONSE_ENDPOINT = 'ui/presentations/${transactionId}';
19+
const EVENTS_ENDPOINT = 'ui/presentations/${transactionId}/events';
20+
const VALIDATE_SD_JWT_VC_PRESENTATION_ENDPOINT = 'utilities/validations/sdJwtVc';
1921

2022
@Injectable()
2123
export class VerifierEndpointService {
@@ -34,7 +36,7 @@ export class VerifierEndpointService {
3436
if (!this.deviceDetectorService.isDesktop()) {
3537
payload['wallet_response_redirect_uri_template'] = location.origin + SAME_DEVICE_UI_RE_ENTRY_URL;
3638
}
37-
this.httpService.post<InitializedTransaction, string>(PRESENTATIONS_ENDPOINT, payload)
39+
this.httpService.post<InitializedTransaction, string>(INIT_TRANSACTION_ENDPOINT, payload)
3840
.pipe(
3941
tap((res) => {
4042
let activeTransaction : ActiveTransaction = {
@@ -49,14 +51,14 @@ export class VerifierEndpointService {
4951

5052
getWalletResponse(transaction_id: string, code?: string): Observable<WalletResponse> {
5153
if (typeof code == 'undefined') {
52-
return this.httpService.get(PRESENTATIONS_ENDPOINT+`/${transaction_id}`);
54+
return this.httpService.get(WALLET_RESPONSE_ENDPOINT.replace('${transactionId}', transaction_id));
5355
} else {
54-
return this.httpService.get(PRESENTATIONS_ENDPOINT+`/${transaction_id}?response_code=${code}`);
56+
return this.httpService.get(WALLET_RESPONSE_ENDPOINT.replace('${transactionId}', transaction_id) + `?response_code=${code}`);
5557
}
5658
}
5759

5860
getsTransactionEventsLogs(transactionId: string): Observable<EventLog[]> {
59-
return this.httpService.get(PRESENTATIONS_ENDPOINT+`/${transactionId}/events`)
61+
return this.httpService.get(EVENTS_ENDPOINT.replace('${transactionId}', transactionId))
6062
.pipe(
6163
map((data: any) => {
6264
return data.events.map((event: EventLog) => {

src/app/features/invoke-wallet/components/qr-code/qr-code.component.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class QrCodeComponent implements OnInit, OnDestroy {
5050
transaction!: ActiveTransaction;
5151

5252
deepLinkTxt!: string;
53-
scheme!: string;
53+
5454
qrCodeDownloadLink!: SafeUrl;
5555
readonly dialog!: MatDialog;
5656

@@ -69,12 +69,6 @@ export class QrCodeComponent implements OnInit, OnDestroy {
6969
this.localStorageService = this.injector.get(LocalStorageService);
7070
this.dialog = this.injector.get(MatDialog);
7171
this.isCrossDevice = this.deviceDetectorService.isDesktop();
72-
73-
if (this.localStorageService.get(constants.SCHEME)) {
74-
this.scheme = this.localStorageService.get(constants.SCHEME) ?? constants.DEFAULT_SCHEME;
75-
} else {
76-
this.scheme = constants.DEFAULT_SCHEME;
77-
}
7872
}
7973

8074
ngOnInit(): void {
@@ -84,7 +78,7 @@ export class QrCodeComponent implements OnInit, OnDestroy {
8478
if (!this.transaction) {
8579
this.navigateService.goHome();
8680
} else {
87-
this.deepLinkTxt = this.buildQrCode(this.transaction.initialized_transaction);
81+
this.deepLinkTxt = this.transaction.initialized_transaction.authorization_request_uri;
8882
if (this.isCrossDevice) {
8983
this.pollingRequest(this.transaction.initialized_transaction.transaction_id);
9084
}
@@ -131,10 +125,6 @@ export class QrCodeComponent implements OnInit, OnDestroy {
131125
return concludedTransaction;
132126
}
133127

134-
private buildQrCode(data: { client_id: string, request_uri: string, request_uri_method: 'get' | 'post', transaction_id: string }): string {
135-
return `${this.scheme}?client_id=${encodeURIComponent(data.client_id)}&request_uri=${encodeURIComponent(data.request_uri)}&request_uri_method=${encodeURIComponent(data.request_uri_method)}`;
136-
}
137-
138128
openLogs() {
139129
this.dialog.open(OpenLogsComponent, {
140130
data: {

src/app/features/presentation-request-preparation/components/attribute-selection/attribute-selection.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="component-root">
22
<ng-container *ngFor="let selection of attestationsSelection">
3-
<mat-card appearance="outlined">
3+
<mat-card >
44
<mat-card-header>
55
<mat-card-title>{{ nameOf(selection.type) }}</mat-card-title>
66
<mat-card-subtitle>
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<mat-card>
2+
<mat-card-header>
3+
<mat-card-title>Presentation Options</mat-card-title>
4+
<mat-card-subtitle>
5+
Configure the options for your presentation request.
6+
</mat-card-subtitle>
7+
</mat-card-header>
8+
9+
<mat-card-content>
10+
<div class="request-options-grid">
11+
<div class="request-options-row">
12+
<div class="request-options-label">
13+
<span>Presentation Profile</span>
14+
<p class="request-options-helper">
15+
Defines the rules and constraints of the presentation
16+
</p>
17+
</div>
18+
<div class="request-options-control">
19+
<mat-button-toggle-group
20+
[formControl]="presentationProfileControl"
21+
(valueChange)="profileChange.emit($event)"
22+
aria-label="Presentation Profile"
23+
>
24+
<mat-button-toggle value="haip">HAIP</mat-button-toggle>
25+
<mat-button-toggle value="openid4vp">OpenID4VP</mat-button-toggle>
26+
</mat-button-toggle-group>
27+
</div>
28+
</div>
29+
30+
<div class="request-options-row">
31+
<div class="request-options-label">
32+
<span>Request URI Method</span>
33+
<p class="request-options-helper">
34+
Choose how the wallet fetches the authorization request
35+
</p>
36+
</div>
37+
<div class="request-options-control">
38+
<mat-button-toggle-group
39+
[formControl]="requestUriMethodControl"
40+
(valueChange)="requestUriMethodChange.emit($event)"
41+
aria-label="Request URI Method"
42+
>
43+
<mat-button-toggle value="get">GET</mat-button-toggle>
44+
<mat-button-toggle value="post">POST</mat-button-toggle>
45+
</mat-button-toggle-group>
46+
</div>
47+
</div>
48+
49+
<div class="request-options-row">
50+
<div class="request-options-label">
51+
<span>Authorization Endpoint</span>
52+
<p class="request-options-helper">
53+
Specify an endpoint URI for the authorization request
54+
</p>
55+
</div>
56+
<div class="request-options-control">
57+
<mat-form-field appearance="outline" class="config-option-field">
58+
<mat-label>Authorization Endpoint</mat-label>
59+
<input
60+
matInput
61+
placeholder="scheme://"
62+
[formControl]="authorizationSchemeControl"
63+
autocomplete="off"
64+
(input)="
65+
authorizationSchemeChange.emit(authorizationSchemeControl.value)
66+
"
67+
/>
68+
</mat-form-field>
69+
</div>
70+
</div>
71+
</div>
72+
</mat-card-content>
73+
</mat-card>

0 commit comments

Comments
 (0)