Skip to content

Commit

Permalink
fix issuance
Browse files Browse the repository at this point in the history
  • Loading branch information
eike-hass committed Jun 25, 2024
1 parent 053305c commit 9b4da90
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
22 changes: 15 additions & 7 deletions backend/src/webapp/webapp.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,26 @@ export class WebAppService {
state: { issuer, credentials },
} = token;

this.logger.debug(`found session_id:${sessionId} for code:${user.code}`);

// TODO: credential.type vs credentialDefinition?
let signedCredentials: JwtCreationResponse[];

try {
signedCredentials = await Promise.all(
credentials.map((credential) => {
let credential_template =
credentialDefinition === 'company'
? CompanyCredentialConfig.template
: CitizenCredentialConfig.template;
let credential_template;
switch (credential.type) {
case 'CitizenCredential':
credential_template = CitizenCredentialConfig.template;
break;
case 'CompanyCredential':
credential_template = CompanyCredentialConfig.template;
break;

default:
throw new Error(
`credential template for ${credential.type} not found`,
);
}

credential_template.credentialSubject.id = user.did;
credential_template = {
Expand Down Expand Up @@ -260,7 +268,7 @@ export class WebAppService {

const tokenVal = (await this.cache.get(`token:${token}`)) as Token;

this.logger.debug(`found entry:${tokenVal} for token:${token}`);
this.logger.debug(`found token:${token}`, tokenVal);

await this.cache.del(`token:${token}`);

Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/Company/ReceiveCredentials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const ReceiveCredentials: React.FC = () => {
provider: Providers.Impierce,
scope: Scopes.CompanyHouse,
credentials: [{type: CompanyCredentialConfig.template.type.pop() as string, data: state.COMPANY_HOUSE?.issuanceData}],
issuer: Issuers.CompanyHouse
issuer: Issuers.Bank //TODO: should be COMPANY_HOUSE?
})
}, [dispatch]);

Expand Down

0 comments on commit 9b4da90

Please sign in to comment.