-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: manage templates for issuer via gui Signed-off-by: Mirko Mollik <mirkomollik@gmail.com> * add template management to verifier Signed-off-by: Mirko Mollik <mirkomollik@gmail.com> * use pnpm v9 Signed-off-by: Mirko Mollik <mirkomollik@gmail.com> * fix: demo call Signed-off-by: Mirko Mollik <mirkomollik@gmail.com> --------- Signed-off-by: Mirko Mollik <mirkomollik@gmail.com>
- Loading branch information
Showing
92 changed files
with
15,634 additions
and
11,110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
apps/issuer-backend/src/app/issuer/dto/credential-offer-session.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { | ||
CredentialOfferSession as ICredentialOfferSession, | ||
AssertedUniformCredentialOffer, | ||
IssueStatus, | ||
} from '@sphereon/oid4vci-common'; | ||
|
||
export class CredentialOfferSession implements ICredentialOfferSession { | ||
clientId?: string; | ||
credentialOffer: AssertedUniformCredentialOffer; | ||
credentialDataSupplierInput?: any; | ||
userPin?: string; | ||
status: IssueStatus; | ||
error?: string; | ||
lastUpdatedAt: number; | ||
notification_id: string; | ||
issuerState?: string; | ||
preAuthorizedCode?: string; | ||
createdAt: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import { | ||
IStateManager, | ||
STATE_MISSING_ERROR, | ||
StateType, | ||
} from '@sphereon/oid4vci-common'; | ||
|
||
export class CustomStates<T extends StateType> implements IStateManager<T> { | ||
private readonly expiresInMS: number; | ||
private readonly states: Map<string, T>; | ||
private cleanupIntervalId?: number | NodeJS.Timeout; | ||
|
||
constructor(opts?: { expiresInSec?: number }) { | ||
this.expiresInMS = | ||
opts?.expiresInSec !== undefined ? opts?.expiresInSec * 1000 : 180000; | ||
this.states = new Map(); | ||
} | ||
async clearAll(): Promise<void> { | ||
this.states.clear(); | ||
} | ||
|
||
async clearExpired(timestamp?: number): Promise<void> { | ||
const states = Array.from(this.states.entries()); | ||
const ts = timestamp ?? +new Date(); | ||
for (const [id, state] of states) { | ||
if (state.createdAt + this.expiresInMS < ts) { | ||
this.states.delete(id); | ||
} | ||
} | ||
} | ||
|
||
async delete(id: string): Promise<boolean> { | ||
if (!id) { | ||
throw Error('No id supplied'); | ||
} | ||
return this.states.delete(id); | ||
} | ||
|
||
async getAsserted(id: string): Promise<T> { | ||
if (!id) { | ||
throw Error('No id supplied'); | ||
} | ||
let result: T | undefined; | ||
if (await this.has(id)) { | ||
result = (await this.get(id)) as T; | ||
} | ||
if (!result) { | ||
throw new Error(STATE_MISSING_ERROR + ` (${id})`); | ||
} | ||
return result; | ||
} | ||
|
||
async all(): Promise<T[]> { | ||
return Array.from(this.states.values()); | ||
} | ||
|
||
async get(id: string): Promise<T | undefined> { | ||
return this.states.get(id); | ||
} | ||
|
||
async has(id: string): Promise<boolean> { | ||
if (!id) { | ||
throw Error('No id supplied'); | ||
} | ||
return this.states.has(id); | ||
} | ||
|
||
async set(id: string, stateValue: T): Promise<void> { | ||
if (!id) { | ||
throw Error('No id supplied'); | ||
} | ||
this.states.set(id, stateValue); | ||
} | ||
|
||
async startCleanupRoutine(timeout?: number): Promise<void> { | ||
if (!this.cleanupIntervalId) { | ||
this.cleanupIntervalId = setInterval( | ||
() => this.clearExpired(), | ||
timeout ?? 30000 | ||
); | ||
} | ||
} | ||
|
||
async stopCleanupRoutine(): Promise<void> { | ||
if (this.cleanupIntervalId) { | ||
clearInterval(this.cleanupIntervalId); | ||
} | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,4 @@ | ||
<div fxLayout="column" fxLayoutGap="16px" id="content"> | ||
<form | ||
[formGroup]="form" | ||
(submit)="generate()" | ||
fxLayout="column" | ||
fxLayoutGap="16px" | ||
> | ||
<mat-slide-toggle formControlName="pin" color="primary" | ||
>Require PIN</mat-slide-toggle | ||
> | ||
<button type="submit" mat-raised-button color="primary"> | ||
Generate QR-Code | ||
</button> | ||
</form> | ||
<div *ngIf="qrCodeImage" fxLayout="column" fxLayoutGap="16px"> | ||
<img [src]="qrCodeImage" alt="QR-Code" /> | ||
<mat-form-field [appearance]="'outline'"> | ||
<mat-label>QR-Code Url</mat-label> | ||
<input | ||
placeholder="QR-Code Url" | ||
matInput | ||
readonly | ||
[formControl]="qrCodeField" | ||
/> | ||
<button | ||
mat-icon-button | ||
matSuffix | ||
(click)="copyValue(qrCodeField.value!)" | ||
*ngIf="qrCodeImage" | ||
> | ||
<mat-icon>content_copy</mat-icon> | ||
</button> | ||
</mat-form-field> | ||
<mat-form-field | ||
[appearance]="'outline'" | ||
*ngIf="pinField.value && pinField.value.length > 0" | ||
> | ||
<mat-label>Pin</mat-label> | ||
<input | ||
placeholder="Issuer Name" | ||
matInput | ||
[formControl]="pinField" | ||
readonly | ||
/> | ||
<button | ||
mat-icon-button | ||
matSuffix | ||
(click)="copyValue(pinField.value!)" | ||
*ngIf="qrCodeImage" | ||
> | ||
<mat-icon>content_copy</mat-icon> | ||
</button> | ||
</mat-form-field> | ||
<p *ngIf="issuerService.statusEvent.value"> | ||
Status: {{ issuerService.statusEvent.value }} | ||
</p> | ||
</div> | ||
</div> | ||
<mat-toolbar> | ||
<a mat-button routerLink="/">Templates</a> | ||
</mat-toolbar> | ||
<router-outlet></router-outlet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +0,0 @@ | ||
#content { | ||
max-width: 300px; | ||
margin: auto; | ||
} | ||
|
||
img { | ||
width: 300px; | ||
height: 300px; | ||
} | ||
Oops, something went wrong.