Skip to content

Commit

Permalink
chore: update to latest vci deps
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Aug 8, 2023
1 parent bba073b commit d16b004
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 67 deletions.
6 changes: 3 additions & 3 deletions packages/oid4vci-issuer-rest-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"start:dev": "ts-node __tests__/RestAPI.ts"
},
"dependencies": {
"@sphereon/oid4vci-common": "0.6.0",
"@sphereon/oid4vci-issuer": "0.6.0",
"@sphereon/oid4vci-issuer-server": "0.6.0",
"@sphereon/oid4vci-common": "0.6.1-next.6",
"@sphereon/oid4vci-issuer": "0.6.1-next.6",
"@sphereon/oid4vci-issuer-server": "0.6.1-next.6",
"@sphereon/ssi-express-support": "workspace:*",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:*",
"@sphereon/ssi-sdk.oid4vci-issuer": "workspace:*",
Expand Down
32 changes: 12 additions & 20 deletions packages/oid4vci-issuer-rest-api/src/OID4VCIRestAPI.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CredentialDataSupplier, VcIssuer } from '@sphereon/oid4vci-issuer'
import { OID4VCIServer } from '@sphereon/oid4vci-issuer-server'
import { IOID4VCIServerOpts } from '@sphereon/oid4vci-issuer-server/lib/OID4VCIServer'
import { ExpressBuilder, ExpressSupport } from '@sphereon/ssi-express-support'
import { ExpressSupport } from '@sphereon/ssi-express-support'
import { getAccessTokenKeyRef, getAccessTokenSignerCallback, IIssuerInstanceArgs, IssuerInstance } from '@sphereon/ssi-sdk.oid4vci-issuer'
import { DIDDocument } from 'did-resolver'
import { Express } from 'express'
Expand All @@ -10,7 +10,7 @@ import { IRequiredContext } from './types'
export interface IOID4VCIRestAPIOpts extends IOID4VCIServerOpts {}

export class OID4VCIRestAPI {
private readonly _express: Express
private readonly _expressSupport: ExpressSupport
private readonly _context: IRequiredContext
private readonly _opts?: IOID4VCIRestAPIOpts
private readonly _restApi: OID4VCIServer<DIDDocument>
Expand All @@ -21,19 +21,12 @@ export class OID4VCIRestAPI {
context: IRequiredContext
issuerInstanceArgs: IIssuerInstanceArgs
credentialDataSupplier?: CredentialDataSupplier
expressSupport?: ExpressSupport
opts?: IOID4VCIRestAPIOpts
expressSupport: ExpressSupport
opts: IOID4VCIRestAPIOpts
}): Promise<OID4VCIRestAPI> {
const { issuerInstanceArgs, context } = args
const opts = args.opts ?? {}
const expressSupport =
args.expressSupport ??
ExpressBuilder.fromServerOpts({
port: opts?.serverOpts?.port,
hostname: opts?.serverOpts?.host,
basePath: opts?.serverOpts?.baseUrl,
existingExpress: opts?.serverOpts?.app,
}).build()
const expressSupport = args.expressSupport
const instance = await context.agent.oid4vciGetInstance(args.issuerInstanceArgs)
const issuer = await instance.get({ context, credentialDataSupplier: args.credentialDataSupplier })

Expand Down Expand Up @@ -72,19 +65,14 @@ export class OID4VCIRestAPI {
const { context, opts } = args
this._context = context
this._opts = opts ?? {}
this._express = args.expressSupport.express
this._expressSupport = args.expressSupport
this._issuer = args.issuer
this._instance = args.instance

this._opts.serverOpts = {
...opts.serverOpts,
app: this._express,
}
this._restApi = new OID4VCIServer<DIDDocument>({ ...opts, issuer: this._issuer })
this._restApi = new OID4VCIServer<DIDDocument>(args.expressSupport, { ...opts, issuer: this._issuer })
}

get express(): Express {
return this._express
return this._expressSupport.express
}

get context(): IRequiredContext {
Expand All @@ -106,4 +94,8 @@ export class OID4VCIRestAPI {
get issuer(): VcIssuer<DIDDocument> {
return this._issuer
}

async stop(): Promise<boolean> {
return this._expressSupport.stop()
}
}
2 changes: 1 addition & 1 deletion packages/oid4vci-issuer-rest-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"generate-plugin-schema": "ts-node ../../packages/dev/bin/sphereon.js dev generate-plugin-schema"
},
"dependencies": {
"@sphereon/oid4vci-common": "0.6.0",
"@sphereon/oid4vci-common": "0.6.1-next.6",
"@veramo/core": "4.2.0",
"cross-fetch": "^3.1.5"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/oid4vci-issuer-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"build:clean": "tsc --build --clean && tsc --build"
},
"dependencies": {
"@sphereon/oid4vci-common": "0.6.0",
"@sphereon/oid4vci-common": "0.6.1-next.6",
"@sphereon/ssi-sdk-ext.did-utils": "0.13.0",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:*",
"@types/uuid": "^9.0.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/oid4vci-issuer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"build:clean": "tsc --build --clean && tsc --build"
},
"dependencies": {
"@sphereon/oid4vci-common": "0.6.0",
"@sphereon/oid4vci-issuer": "0.6.0",
"@sphereon/oid4vci-common": "0.6.1-next.6",
"@sphereon/oid4vci-issuer": "0.6.1-next.6",
"@sphereon/ssi-sdk-ext.did-utils": "0.13.0",
"@sphereon/ssi-sdk.core": "workspace:*",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:*",
Expand Down
Loading

0 comments on commit d16b004

Please sign in to comment.