Skip to content

Commit

Permalink
Merge pull request #1890 from blockchain-certificates/feat/vc-v2-name…
Browse files Browse the repository at this point in the history
…-description

feat(VCv2): add name and description from parser
  • Loading branch information
lemoustachiste authored Oct 25, 2024
2 parents f88868c + d72df5a commit 5b5475e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 4 additions & 1 deletion bundle-esm-stats.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/certificate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export interface Signers {
export default class Certificate {
public certificateImage?: string;
public certificateJson: Blockcerts;
public description?: string; // v1
public description?: string; // v1, v3.2
public display?: BlockcertsV3Display;
public expires: string;
public validFrom: string;
Expand All @@ -57,7 +57,7 @@ export default class Certificate {
public issuer: Issuer;
public locale: string; // enum?
public metadataJson: any; // TODO: define metadataJson interface.
public name?: string; // TODO: not formally set in V3
public name?: string;
public options: CertificateOptions;
public recipientFullName: string;
public recordLink: string;
Expand Down
6 changes: 5 additions & 1 deletion src/parsers/parseV3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export default async function parseV3 (certificateJson: BlockcertsV3): Promise<P
expirationDate,
display,
validUntil,
proof
proof,
name,
description
} = certificateJson;
let { validFrom } = certificateJson;
const certificateMetadata = metadata ?? metadataJson;
Expand All @@ -36,6 +38,8 @@ export default async function parseV3 (certificateJson: BlockcertsV3): Promise<P
issuedOn: issuanceDate ?? validFrom, // maintain backwards compatibility
id,
issuer,
name,
description,
metadataJson: certificateMetadata,
recipientFullName: getRecipientFullName(certificateJson),
recordLink: id
Expand Down

0 comments on commit 5b5475e

Please sign in to comment.