Skip to content

Commit

Permalink
feat: Move VC API endpoints to functions, to more easily create your …
Browse files Browse the repository at this point in the history
…own API server, only supporting certain endpoints
  • Loading branch information
nklomp committed Jul 12, 2023
1 parent ca2682c commit fc03507
Show file tree
Hide file tree
Showing 7 changed files with 344 additions and 302 deletions.
17 changes: 2 additions & 15 deletions packages/w3c-vc-api/__tests__/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { KeyManager } from '@veramo/key-manager'
import { KeyManagementSystem, SecretBox } from '@veramo/kms-local'
import Debug from 'debug'
import { Resolver } from 'did-resolver'
import { VCAPIServer } from '../src'
import { VcApiServer } from '../src'
import { DB_CONNECTION_NAME, DB_ENCRYPTION_KEY, getDbConnection } from './database'
import { JwkDIDProvider } from '@sphereon/ssi-sdk-ext.did-provider-jwk'

Expand Down Expand Up @@ -62,24 +62,11 @@ const PRIVATE_UPDATE_KEY_HEX = '7288a92f6219c873446abd1f8d26fcbbe1caa5274b47f6f0
// const RP_DID_KID = `${RP_DID}#auth-key`

export const resolver = new Resolver({
/*// const SPHEREON_UNIRESOLVER_RESOLVE_URL = 'https://uniresolver.test.sphereon.io/1.0/identifiers'
...getUniResolver('jwk', {
resolveUrl: DIF_UNIRESOLVER_RESOLVE_URL
}),
...getUniResolver('ion', {
resolveUrl: DIF_UNIRESOLVER_RESOLVE_URL
}),
..getUniResolver('lto', {
resolveUrl: SPHEREON_UNIRESOLVER_RESOLVE_URL
}),*/
...getUniResolver('ethr', {
resolveUrl: DIF_UNIRESOLVER_RESOLVE_URL,
}),
...getDidKeyResolver(),
...getDidJwkResolver(),
...getUniResolver('jwk', {
resolveUrl: DIF_UNIRESOLVER_RESOLVE_URL,
}),
...getDidIonResolver(),
})

Expand Down Expand Up @@ -202,7 +189,7 @@ agent
})
.finally(
() =>
new VCAPIServer({
new VcApiServer({
opts: {
issueCredentialOpts: {
proofFormat: 'lds',
Expand Down
7 changes: 4 additions & 3 deletions packages/w3c-vc-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
"build": "tsc --build",
"build:clean": "tsc --build --clean && tsc --build",
"start:prod": "node build/index.js",
"start:dev": "ts-node __tests__/RestAPI.ts"
"start:dev": "ts-node __tests__/agent.ts"
},
"dependencies": {
"@sphereon/did-auth-siop": "0.3.2-unstable.6",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:*",
"@sphereon/ssi-sdk.presentation-exchange": "workspace:*",
"@sphereon/ssi-sdk.core": "workspace:*",
"@sphereon/ssi-types": "workspace:*",
"@types/uuid": "^9.0.1",
"@veramo/core": "4.2.0",
Expand All @@ -32,8 +33,8 @@
"@sphereon/did-uni-client": "^0.6.0",
"@sphereon/pex": "^2.0.1",
"@sphereon/pex-models": "^2.0.2",
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.12.2-next.3",
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.12.2-next.3",
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.12.2-next.4",
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.12.2-next.4",
"@sphereon/ssi-sdk.data-store": "workspace:*",
"@sphereon/ssi-sdk.vc-handler-ld-local": "workspace:*",
"@types/body-parser": "^1.19.2",
Expand Down
283 changes: 0 additions & 283 deletions packages/w3c-vc-api/src/VCAPIServer.ts

This file was deleted.

Loading

0 comments on commit fc03507

Please sign in to comment.