Skip to content

Commit

Permalink
integrate TrustChainResolveResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmelati committed Nov 14, 2024
1 parent 2343bfa commit 4636def
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 53 deletions.
2 changes: 1 addition & 1 deletion packages/oid4vci-holder/src/agent/OID4VCIHolder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ export class OID4VCIHolder implements IAgentPlugin {
trustAnchors: [trustAnchor]
})

if (Array.isArray(resolveResult) && resolveResult.length > 0) {
if (!resolveResult.error) {
trustedAnchors.push(trustAnchor)
}
}
Expand Down
29 changes: 6 additions & 23 deletions packages/oidf-client/__tests__/shared/oidfClientAgentLogic.ts

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/oidf-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"dependencies": {
"@sphereon/ssi-types": "workspace:*",
"@sphereon/ssi-sdk.resource-resolver": "workspace:*",
"@sphereon/openid-federation-open-api": "0.1.1-unstable.49c7542",
"@sphereon/openid-federation-client": "0.1.1-unstable.49c7542",
"@sphereon/openid-federation-common": "0.1.1-unstable.49c7542",
"@sphereon/openid-federation-open-api": "0.1.1-unstable.74fc359",
"@sphereon/openid-federation-client": "0.1.1-unstable.74fc359",
"@sphereon/openid-federation-common": "0.1.1-unstable.74fc359",
"@sphereon/ssi-sdk-ext.jwt-service": "0.25.0"
},
"devDependencies": {
Expand Down
9 changes: 4 additions & 5 deletions packages/oidf-client/src/agent/OIDFClient.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {FederationClient, ICryptoService, IFetchService} from '@sphereon/openid-federation-client'
import {FederationClient, ICryptoService, IFetchService, TrustChainResolveResponse} from '@sphereon/openid-federation-client'
import {JWK} from "@sphereon/ssi-types";
import {IAgentPlugin} from '@veramo/core'
import {Request} from "cross-fetch";
Expand All @@ -7,8 +7,7 @@ import {
IOIDFClient,
OIDFClientArgs,
IRequiredContext,
ResolveTrustChainArgs,
ResolveTrustChainCallbackResult
ResolveTrustChainArgs
} from '../types/IOIDFClient'

export const oidfClientMethods: Array<string> = ['resolveTrustChain']
Expand All @@ -21,7 +20,7 @@ export class OIDFClient implements IAgentPlugin {
}
readonly schema = schema.IOIDFClient

constructor(args: OIDFClientArgs) {
constructor(args?: OIDFClientArgs) {
const {fetchServiceCallback, cryptoServiceCallback} = {...args}

this.fetchServiceCallback = fetchServiceCallback
Expand Down Expand Up @@ -65,7 +64,7 @@ export class OIDFClient implements IAgentPlugin {
)
}

private async resolveTrustChain(args: ResolveTrustChainArgs, context: IRequiredContext): Promise<ResolveTrustChainCallbackResult> {
private async resolveTrustChain(args: ResolveTrustChainArgs, context: IRequiredContext): Promise<TrustChainResolveResponse> {
const { entityIdentifier, trustAnchors } = args

const oidfClient = this.getOIDFClient(context)
Expand Down
8 changes: 2 additions & 6 deletions packages/oidf-client/src/types/IOIDFClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ import {IAgentContext, IPluginMethodMap} from '@veramo/core';
import {
IJwtService,
} from '@sphereon/ssi-sdk-ext.jwt-service';
import { ICryptoService, IFetchService } from '@sphereon/openid-federation-client'
import {ICryptoService, IFetchService, TrustChainResolveResponse} from '@sphereon/openid-federation-client'

export type IRequiredPlugins = IJwtService & IResourceResolver
export type IRequiredContext = IAgentContext<IRequiredPlugins>

type Nullable<T> = T | null | undefined

export interface IOIDFClient extends IPluginMethodMap {
resolveTrustChain(args: ResolveTrustChainArgs, context: IRequiredContext): Promise<ResolveTrustChainCallbackResult>
resolveTrustChain(args: ResolveTrustChainArgs, context: IRequiredContext): Promise<TrustChainResolveResponse>
}

export type ResolveTrustChainArgs = {
Expand All @@ -23,5 +21,3 @@ export type OIDFClientArgs = {
fetchServiceCallback?: IFetchService
cryptoServiceCallback?: ICryptoService
}

export type ResolveTrustChainCallbackResult = Nullable<Array<string>>
30 changes: 15 additions & 15 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4636def

Please sign in to comment.