Skip to content

Commit

Permalink
minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmanos committed Oct 5, 2023
1 parent 2a00417 commit a6b71b9
Show file tree
Hide file tree
Showing 20 changed files with 238 additions and 122 deletions.
22 changes: 13 additions & 9 deletions public/js/header.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
// change language cookie (eg lang=en)
// refresh window

document.getElementById('lang-el').onclick = function (event) {
document.cookie = 'lang=el; path=/'
window.location.reload();
}

document.getElementById('lang-en').onclick = function (event) {
document.cookie = 'lang=en; path=/';
window.location.reload();
}

if (document.getElementById('lang-el'))
document.getElementById('lang-el').onclick = function (event) {
document.cookie = 'lang=el; path=/'
window.location.reload();
}


if (document.getElementById('lang-en'))
document.getElementById('lang-en').onclick = function (event) {
document.cookie = 'lang=en; path=/';
window.location.reload();
}
5 changes: 5 additions & 0 deletions public/js/presentation-request.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const form = document.getElementById("PresentationRequestForm");

setTimeout(() => {
form.submit();
}, 6000);
7 changes: 6 additions & 1 deletion public/js/qr-popup.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
const qrDialog = document.getElementById('qrDialog');
const qrImage = document.getElementById('qrImage');
const qrURL = document.getElementById('qrURL');
const closeDialogBtn = document.getElementById('closeDialogBtn');

function openDialog(qrCodeURL) {
function openDialog(qrCodeURL, url) {
qrImage.src = qrCodeURL;
qrURL.onclick = (e) => {
e.preventDefault();
window.location.href = url;
}
qrDialog.showModal();
}

Expand Down
11 changes: 11 additions & 0 deletions public/styles/scan-qr-verifier.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.CenteredLayout {
width: 100%;

display: flex;
flex-direction: column;
gap: 16px;
flex-wrap: wrap;

justify-content: center;
align-items: center;
}
4 changes: 2 additions & 2 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ app.post('/', async (req, res) => {
await storeAuthorizationServerStateIdToWebClient(res, authorizationServerState.id);
return res.redirect(CONSENT_ENTRYPOINT);
}
else {
return res.redirect('/');
else if (req.body.verifier == "true") {
return res.redirect('/verifier/public/definitions');
}

})
Expand Down
11 changes: 7 additions & 4 deletions src/authorizationServiceConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@ export const authorizationServerMetadataConfiguration = {
"response_modes_supported": ["query"],
"grant_types_supported": ["authorization_code", "pre-authorized_code"],
"subject_types_supported": ["public"],
"id_token_signing_alg_values_supported": ["ES256"],
"request_object_signing_alg_values_supported": ["ES256"],
"id_token_signing_alg_values_supported": ["ES256", "EdDSA"],
"request_object_signing_alg_values_supported": ["ES256", "EdDSA"],
"request_parameter_supported": true,
"request_uri_parameter_supported": true,
"token_endpoint_auth_methods_supported": ["private_key_jwt"],
"vp_formats_supported": {
"jwt_vp": {
"alg_values_supported": ["ES256"]
"alg_values_supported": ["ES256", "EdDSA"]
},
"jwt_vc": {
"alg_values_supported": ["ES256"]
"alg_values_supported": ["ES256", "EdDSA"]
},
"jwt_vc_json": {
"alg_values_supported": ["ES256", "EdDSA"]
}
},
"subject_syntax_types_supported": ["did:key"],
Expand Down
3 changes: 3 additions & 0 deletions src/entities/VerifiablePresentation.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,7 @@ export class VerifiablePresentationEntity {
@Column({ name: "status", type: "boolean", nullable: true })
status?: boolean;


@Column({ name: "state", type: "varchar", nullable: true })
state?: string;
}
11 changes: 9 additions & 2 deletions src/services/ExpressAppService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ export class ExpressAppService {
public configure(app: Application) {
// exposed in any mode
app.post('/verification/direct_post', this.directPostEndpoint());
app.get('/verification/definition', async (req, res) => { this.presentationsReceivingService.presentationDefinitionAccessHandler(req, res); });

app.get('/verification/definition', async (req, res) => { this.presentationsReceivingService.getPresentationDefinitionHandler(req, res); });

if (applicationMode == ApplicationModeType.VERIFIER || applicationMode == ApplicationModeType.ISSUER_AND_VERIFIER) {
app.get('/verification/authorize', async (req, res) => {
Expand Down Expand Up @@ -63,6 +62,14 @@ export class ExpressAppService {
// Perform the actual redirect
res.end();
};

//@ts-ignore
(res.send as any) = (payload: string): void => {
redirected = true;
res.status(200);
res.end();
// Perform the actual redirect
};


let authorizationServerStateId;
Expand Down
8 changes: 4 additions & 4 deletions src/services/FilesystemKeystoreService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ const KeyIdentifierKeySchema = z.object({

@injectable()
export class FilesystemKeystoreService implements WalletKeystore {

private readonly algorithm: SigningAlgorithm = SigningAlgorithm.EdDSA;
// this map is indexed using the walletIdentifier
private walletIdentifiers: Map<string, Identifier> = new Map<string, Identifier>()

constructor(
private readonly algorithm: SigningAlgorithm = SigningAlgorithm.ES256,

// this map is indexed using the walletIdentifier
private walletIdentifiers: Map<string, Identifier> = new Map<string, Identifier>()
) {
this.loadWalletsFromFilesystem();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ export class OpenidForCredentialIssuingAuthorizationServerService implements Ope
}
};

const credentialOfferURL = new URL("openid-credential-offer://credential_offer");
const credentialOfferURL = new URL("openid-credential-offer://");
credentialOfferURL.searchParams.append('credential_offer', JSON.stringify(credentialOffer));
console.log("Credential offer = ", credentialOfferURL)
return { url: credentialOfferURL };
}

Expand Down Expand Up @@ -191,13 +192,14 @@ export class OpenidForCredentialIssuingAuthorizationServerService implements Ope


async tokenRequestHandler(req: Request, res: Response): Promise<void> {
console.log("URL = ", req.url)
console.log("Body ", req.body)

let body = null;
let response = null;
if (!req.body.grant_type) {
console.log("No grant type was found");
res.status(500).send({});
res.status(400).send({ error: "No grant type was found"});
return;
}

Expand Down Expand Up @@ -226,7 +228,7 @@ export class OpenidForCredentialIssuingAuthorizationServerService implements Ope
}
catch (err) {
console.error("Error = ", err)
res.status(500).json({ error: "Failed"})
res.status(400).json({ error: JSON.stringify(err) })
return
}
break;
Expand Down
Loading

0 comments on commit a6b71b9

Please sign in to comment.