Skip to content

Commit

Permalink
fix: type for cred request ldp
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Glastra <[email protected]>
  • Loading branch information
TimoGlastra committed Mar 11, 2024
1 parent 7a221bb commit dbbe447
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
8 changes: 3 additions & 5 deletions packages/common/lib/functions/CredentialRequestUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ export function getTypesFromRequest(credentialRequest: UniformCredentialRequest,
if (credentialRequest.format === 'jwt_vc_json' || credentialRequest.format === 'jwt_vc') {
types = credentialRequest.types;
} else if (credentialRequest.format === 'jwt_vc_json-ld' || credentialRequest.format === 'ldp_vc') {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
types =
'credential_definition' in credentialRequest && credentialRequest.credential_definition
? // eslint-disable-next-line @typescript-eslint/ban-ts-comment
? credentialRequest.credential_definition.types
: // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
credentialRequest.credential_definition.types
: credentialRequest.types;
credentialRequest.types;
} else if (credentialRequest.format === 'vc+sd-jwt') {
types = [credentialRequest.vct];
}
Expand Down
9 changes: 2 additions & 7 deletions packages/common/lib/types/v1_0_11.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {
CredentialIssuerMetadataOpts,
CredentialOfferFormat,
CredentialRequestJwtVcJson,
CredentialRequestJwtVcJsonLdAndLdpVc,
CredentialRequestSdJwtVc,
Grant,
JsonLdIssuerCredentialDefinition,
} from './Generic.types';
import { QRCodeOpts } from './QRCode.types';
import { AuthorizationServerMetadata } from './ServerMetadata';
Expand Down Expand Up @@ -58,13 +58,8 @@ export interface CredentialOfferPayloadV1_0_11 {
}

export type CredentialRequestV1_0_11 = CommonCredentialRequest &
(CredentialRequestJwtVcJson | CredentialRequestJwtVcJsonLdAndLdpVcV1_0_11 | CredentialRequestSdJwtVc);
(CredentialRequestJwtVcJson | CredentialRequestJwtVcJsonLdAndLdpVc | CredentialRequestSdJwtVc);

export interface CredentialRequestJwtVcJsonLdAndLdpVcV1_0_11
extends CommonCredentialRequest,
Pick<JsonLdIssuerCredentialDefinition, 'credentialSubject' | 'types'> {
format: 'ldp_vc' | 'jwt_vc_json-ld';
}
export interface CredentialIssuerMetadataV1_0_11 extends CredentialIssuerMetadataOpts, Partial<AuthorizationServerMetadata> {
credential_endpoint: string; // REQUIRED. URL of the Credential Issuer's Credential Endpoint. This URL MUST use the https scheme and MAY contain port, path and query parameter components.
authorization_server?: string;
Expand Down

0 comments on commit dbbe447

Please sign in to comment.