Skip to content

Commit

Permalink
feat: Add support for background_image for credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Jun 12, 2023
1 parent 8274708 commit a3c2561
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions packages/common/lib/types/Generic.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { CredentialRequestV1_0_11 } from './v1_0_11.types';
/**
* Important Note: please be aware that these Common interfaces are based on versions v1_0.11 and v1_0.09
*/
export interface CredentialLogo {
export interface ImageInfo {
url?: string;
alt_text?: string;

Expand All @@ -24,7 +24,7 @@ export interface NameAndLocale {
}

export interface LogoAndColor {
logo?: CredentialLogo; // OPTIONAL. A JSON object with information about the logo of the Credential with a following non-exhaustive list of parameters that MAY be included:
logo?: ImageInfo; // OPTIONAL. A JSON object with information about the logo of the Credential with a following non-exhaustive list of parameters that MAY be included:
description?: string; // OPTIONAL. String value of a description of the Credential.
background_color?: string; //OPTIONAL. String value of a background color of the Credential represented as numerical color values defined in CSS Color Module Level 37 [CSS-Color].
text_color?: string; // OPTIONAL. String value of a text color of the Credential represented as numerical color values defined in CSS Color Module Level 37 [CSS-Color].
Expand All @@ -33,6 +33,7 @@ export interface LogoAndColor {
export type CredentialsSupportedDisplay = NameAndLocale &
LogoAndColor & {
name: string; // REQUIRED. String value of a display name for the Credential.
background_image?: ImageInfo; //OPTIONAL, NON-SPEC compliant!. URL of a background image useful for card views of credentials. Expected to an image that fills the full card-view of a wallet
};

export type MetadataDisplay = NameAndLocale &
Expand Down
6 changes: 3 additions & 3 deletions packages/issuer/lib/builder/DisplayBuilder.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { CredentialLogo, MetadataDisplay } from '@sphereon/oid4vci-common'
import { ImageInfo, MetadataDisplay } from '@sphereon/oid4vci-common'

export class DisplayBuilder {
name?: string
locale?: string
additionalProperties: Record<string, unknown> = {}

logo?: CredentialLogo
logo?: ImageInfo
backgroundColor?: string
textColor?: string

Expand All @@ -19,7 +19,7 @@ export class DisplayBuilder {
return this
}

withLogo(logo: CredentialLogo) {
withLogo(logo: ImageInfo) {
if (logo) {
if (!logo.url) {
throw Error(`logo without url will not work`)
Expand Down

0 comments on commit a3c2561

Please sign in to comment.