Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change jwt-vc-json credential endpoint payload #15

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [1.4.1]

Changed credential endpoint payload for `jwt_vc_json` to use `credential_definition.type` to support `organisation-wallet` version `0.0.13`

## [1.4.0]

Add [PAR - Pushed Authorization Request](https://www.rfc-editor.org/rfc/rfc9126.html) support
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ EXAMPLE FILES

# Meeco Organisation Wallet

Compatible version `>=0.0.10`
Compatible version `>=0.0.13`

## `meeco-wallet-cli create-credential-offer`

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"prepare": "npm run build",
"version": "oclif readme && git add README.md"
},
"version": "1.4.0",
"version": "1.4.1",
"keywords": [
"oclif",
"sd-jwt",
Expand Down
6 changes: 3 additions & 3 deletions src/types/create-credential-offer.types.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
export type CredentialMetadata = {
credential_definition: {
types?: string[];
type?: string[];
vct?: string;
};
display: Array<{ name: string }>;
format: string;
id: string;
types?: string[];
}
};

export type Credential = {
credentialIdentifier: string;
format: string;
id: string;
name: string;
types: string[];
}
};
3 changes: 1 addition & 2 deletions src/types/openid.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export enum GRANT_TYPES {

export type SupportedCredential = {
credential_definition: {
types?: string[];
type?: string[];
vct?: string;
};
cryptographic_binding_methods_supported: string[];
Expand All @@ -24,7 +24,6 @@ export type SupportedCredential = {
];
format: string;
id: string;
types?: string[];
};

export type SupportedCredentialMap = {
Expand Down
12 changes: 7 additions & 5 deletions src/utils/openid/vci.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class CredentialOfferError extends Error {
}

function parseSupportedCredential(credentialIdentifier: string, credential: CredentialMetadata): CredentialChoice {
const credentialTypes = credential.types ??
credential.credential_definition.types ?? [credential.credential_definition.vct as string];
const credentialTypes = credential.credential_definition.type ??
credential.credential_definition.type ?? [credential.credential_definition.vct as string];

const vc: Credential = {
credentialIdentifier,
Expand Down Expand Up @@ -169,10 +169,10 @@ async function exchangePreauthCodeWithToken(endpoint: string, code: string, user

type CredentialOfferMetadata = {
credential_definition?: {
vct: string;
type?: string[];
vct?: string;
};
format: string;
types?: string[]; // TODO: move this types into credential_definition to support jwt_vc_json
};

export async function issueVC(issuer: string, endpoint: string, token: TokenSet, metadata: CredentialOfferMetadata) {
Expand Down Expand Up @@ -221,7 +221,9 @@ export function getCredentialInfo(
format: credentialMetadata.format,
}
: {
credential_definition: {
type: credentialMetadata.credential_definition.type,
},
format: credentialMetadata.format,
types: credentialMetadata.credential_definition?.types ?? credentialMetadata.types,
};
}
Loading