Skip to content

Commit

Permalink
feat: fixes after merge, modified some comment and prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
sksadjad committed Jul 4, 2024
1 parent f7caebf commit daebd26
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
13 changes: 11 additions & 2 deletions packages/data-store/src/types/contact/contact.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IIdentifierOpts } from '@sphereon/ssi-sdk-ext.did-utils'
import { IIdentifier } from '@veramo/core'
import {ILocaleBranding} from "../issuanceBranding/issuanceBranding";
import { ILocaleBranding } from '../issuanceBranding/issuanceBranding'

export type MetadataTypes = string | number | Date | boolean | undefined

Expand All @@ -15,7 +15,16 @@ export type Party = {
physicalAddresses: Array<PhysicalAddress>
contact: Contact
partyType: PartyType
//todo: add logic for integrating branding in here. for now we're just using the type
/**
* TODO: Integrate branding logic here in the future.
*
* Currently, we are only defining the branding type within the SDK without implementing the associated logic. This is because:
* 1. We are combining two types from the SSI-SDK to create a new type that will be used across multiple places in the wallets (web & mobile).
* 2. While it makes sense to have this combined type in the SDK, the logic to support database connections for these types is complex. The types belong to different modules, and we don't use them together currently.
* 3. Implementing the full logic now would require significant changes and cross-module interactions, which we don't have the time to address at present.
*
* For now, we are defining the type here and will use it in the mobile wallet has the logic for it. This is a temporary solution until we have the resources to integrate the branding logic fully.
*/
branding?: ILocaleBranding
relationships: Array<PartyRelationship>
createdAt: Date
Expand Down
12 changes: 9 additions & 3 deletions packages/oid4vci-holder/src/agent/OID4VCIHolder.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { OpenID4VCIClient } from '@sphereon/oid4vci-client'
import { CredentialOfferClient, MetadataClient, OpenID4VCIClient } from '@sphereon/oid4vci-client'
import {
AuthorizationDetails,
AuthorizationRequestOpts,
CredentialConfigurationSupported,
AuthorizationServerClientOpts,
AuthorizationServerOpts,
CredentialOfferRequestWithBaseUrl,
DefaultURISchemes,
EndpointMetadataResult,
getTypesFromAuthorizationDetails,
Expand Down Expand Up @@ -39,6 +42,7 @@ import { v4 as uuidv4 } from 'uuid'
import { OID4VCIMachine } from '../machine/oid4vciMachine'
import {
AddContactIdentityArgs,
AddIssuerBrandingArgs,
AssertValidCredentialsArgs,
createCredentialsToSelectFromArgs,
CredentialToAccept,
Expand Down Expand Up @@ -177,6 +181,7 @@ export class OID4VCIHolder implements IAgentPlugin {
private readonly didMethodPreferences: Array<SupportedDidMethodEnum> = [
SupportedDidMethodEnum.DID_KEY,
SupportedDidMethodEnum.DID_JWK,
SupportedDidMethodEnum.DID_EBSI,
SupportedDidMethodEnum.DID_ION,
]
private readonly jwtCryptographicSuitePreferences: Array<SignatureAlgorithmEnum> = [
Expand Down Expand Up @@ -257,6 +262,7 @@ export class OID4VCIHolder implements IAgentPlugin {
getCredentials: (args: GetCredentialsArgs) =>
this.oid4vciHolderGetCredentials({ accessTokenOpts: args.accessTokenOpts ?? opts.accessTokenOpts, ...args }, context),
addContactIdentity: (args: AddContactIdentityArgs) => this.oid4vciHolderAddContactIdentity(args, context),
addIssuerBranding: (args: AddIssuerBrandingArgs) => this.oid4vciHolderAddIssuerBranding(args, context),
assertValidCredentials: (args: AssertValidCredentialsArgs) => this.oid4vciHolderAssertValidCredentials(args, context),
storeCredentialBranding: (args: StoreCredentialBrandingArgs) => this.oid4vciHolderStoreCredentialBranding(args, context),
storeCredentials: (args: StoreCredentialsArgs) => this.oid4vciHolderStoreCredentials(args, context),
Expand Down Expand Up @@ -642,7 +648,7 @@ export class OID4VCIHolder implements IAgentPlugin {
.filter((identity) => identity.roles.includes(CredentialRole.ISSUER))
.map((identity) => identity.identifier.correlationId)[0] ?? undefined
if (issuerBrandings && issuerBrandings.length) {
const brandings: IIssuerBranding[] = await context.agent.ibGetIssuerBranding({filter:[{issuerCorrelationId}]})
const brandings: IIssuerBranding[] = await context.agent.ibGetIssuerBranding({ filter: [{ issuerCorrelationId }] })
if (!brandings || !brandings.length) {
await context.agent.ibAddIssuerBranding({ localeBranding: issuerBrandings, issuerCorrelationId })
}
Expand Down
4 changes: 2 additions & 2 deletions packages/oid4vci-holder/src/agent/OID4VCIHolderService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
CredentialsSupportedDisplay,
getSupportedCredentials,
getTypesFromObject,
MetadataDisplay,
OpenId4VCIVersion,
} from '@sphereon/oid4vci-common'
import { KeyUse } from '@sphereon/ssi-sdk-ext.did-resolver-jwk'
Expand Down Expand Up @@ -40,7 +41,6 @@ import {
GetIssuanceDidMethodArgs,
GetIssuanceOptsArgs,
GetIssuerBrandingArgs,
GetOrCreatePrimaryIdentifierArgs,
GetPreferredCredentialFormatsArgs,
GetSignerArgs,
IdentifierOpts,
Expand All @@ -60,7 +60,6 @@ import {
VerifyCredentialToAcceptArgs,
} from '../types/IOID4VCIHolder'
import { credentialLocaleBrandingFrom, issuerLocaleBrandingFrom } from './OIDC4VCIBrandingMapper'
import { MetadataDisplay } from '@sphereon/oid4vci-common/lib/types/Generic.types'

export const getCredentialBranding = async (args: GetCredentialBrandingArgs): Promise<Record<string, Array<IBasicCredentialLocaleBranding>>> => {
const { credentialsSupported, context } = args
Expand Down Expand Up @@ -229,6 +228,7 @@ export const mapCredentialToAccept = async (args: MapCredentialToAcceptArgs): Pr
return {
correlationId,
credential,
types: credential.types,
rawVerifiableCredential,
uniformVerifiableCredential,
...(credentialResponse.credential_subject_issuance && { credential_subject_issuance: credentialResponse.credential_subject_issuance }),
Expand Down
2 changes: 1 addition & 1 deletion packages/sd-jwt/src/__tests__/sd-jwt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function verifySignature<T>(data: string, signature: string, key: JsonWebK

type AgentType = IDIDManager & IKeyManager & IResolver & ISDJwtPlugin

describe.skip('Agent plugin', () => {
describe('Agent plugin', () => {
let agent: TAgent<AgentType>

let issuer: string
Expand Down
5 changes: 3 additions & 2 deletions packages/siopv2-oid4vp-op-auth/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
},
{
"path": "../presentation-exchange"
},{
"path": "../issuance-branding",
},
{
"path": "../issuance-branding"
},
{
"path": "../xstate-persistence"
Expand Down

0 comments on commit daebd26

Please sign in to comment.