Skip to content

Commit

Permalink
chore: update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Nov 20, 2023
1 parent 3081353 commit 7b24dc8
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 37 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.8.1",
"@sphereon/oid4vci-issuer": "0.8.1",
"@sphereon/oid4vci-issuer-server": "0.8.1",
"@sphereon/oid4vci-common": "0.8.2-next.4",
"@sphereon/oid4vci-issuer": "0.8.2-next.4",
"@sphereon/oid4vci-issuer-server": "0.8.2-next.4",
"@sphereon/ssi-express-support": "workspace:*",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:*",
"@sphereon/ssi-sdk.oid4vci-issuer": "workspace:*",
Expand Down
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.8.1",
"@sphereon/oid4vci-common": "0.8.2-next.4",
"@veramo/core": "4.2.0",
"cross-fetch": "^3.1.8"
},
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.8.1",
"@sphereon/oid4vci-common": "0.8.2-next.4",
"@sphereon/ssi-sdk-ext.did-utils": "0.15.0",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:*",
"@veramo/core": "4.2.0",
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.8.1",
"@sphereon/oid4vci-issuer": "0.8.1",
"@sphereon/oid4vci-common": "0.8.2-next.4",
"@sphereon/oid4vci-issuer": "0.8.2-next.4",
"@sphereon/ssi-sdk-ext.did-utils": "0.15.0",
"@sphereon/ssi-sdk.core": "workspace:*",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:*",
Expand Down
68 changes: 39 additions & 29 deletions packages/w3c-vc-api/__tests__/agent.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// import { IonPublicKeyPurpose } from '@decentralized-identity/ion-sdk'
import { getUniResolver } from '@sphereon/did-uni-client'
import { JwkDIDProvider } from '@sphereon/ssi-sdk-ext.did-provider-jwk'
import { getDidJwkResolver } from '@sphereon/ssi-sdk-ext.did-resolver-jwk'
import { ExpressBuilder } from '@sphereon/ssi-express-support'
import { DataSources } from '@sphereon/ssi-sdk.agent-config'
import { IPresentationExchange, PresentationExchange } from '@sphereon/ssi-sdk.presentation-exchange'
import {getUniResolver} from '@sphereon/did-uni-client'
import {ExpressBuilder} from '@sphereon/ssi-express-support'
import {JwkDIDProvider} from '@sphereon/ssi-sdk-ext.did-provider-jwk'
import {getDidJwkResolver} from '@sphereon/ssi-sdk-ext.did-resolver-jwk'
import {SphereonKeyManager} from "@sphereon/ssi-sdk-ext.key-manager";
import {SphereonKeyManagementSystem} from "@sphereon/ssi-sdk-ext.kms-local";
import {DataSources} from '@sphereon/ssi-sdk.agent-config'
import {IPresentationExchange, PresentationExchange} from '@sphereon/ssi-sdk.presentation-exchange'
import {
CredentialHandlerLDLocal,
ICredentialHandlerLDLocal,
Expand All @@ -16,25 +18,33 @@ import {
SphereonEd25519Signature2020,
SphereonJsonWebSignature2020,
} from '@sphereon/ssi-sdk.vc-handler-ld-local'
import { createAgent, ICredentialPlugin, ICredentialVerifier, IDataStore, IDataStoreORM, IDIDManager, IKeyManager, IResolver } from '@veramo/core'
import { CredentialPlugin } from '@veramo/credential-w3c'
import { DataStore, DataStoreORM, DIDStore, KeyStore, PrivateKeyStore } from '@veramo/data-store'
import { DIDManager } from '@veramo/did-manager'
import { EthrDIDProvider } from '@veramo/did-provider-ethr'
import { getDidIonResolver, IonDIDProvider } from '@veramo/did-provider-ion'
import { getDidKeyResolver, KeyDIDProvider } from '@veramo/did-provider-key'
import { DIDResolverPlugin } from '@veramo/did-resolver'
import { KeyManager } from '@veramo/key-manager'
import { KeyManagementSystem, SecretBox } from '@veramo/kms-local'
import {
createAgent,
ICredentialPlugin,
ICredentialVerifier,
IDataStore,
IDataStoreORM,
IDIDManager,
IKeyManager,
IResolver
} from '@veramo/core'
import {CredentialPlugin} from '@veramo/credential-w3c'
import {DataStore, DataStoreORM, DIDStore, KeyStore, PrivateKeyStore} from '@veramo/data-store'
import {DIDManager} from '@veramo/did-manager'
import {EthrDIDProvider} from '@veramo/did-provider-ethr'
import {getDidIonResolver, IonDIDProvider} from '@veramo/did-provider-ion'
import {getDidKeyResolver, KeyDIDProvider} from '@veramo/did-provider-key'
import {DIDResolverPlugin} from '@veramo/did-resolver'
import {SecretBox} from '@veramo/kms-local'
import Debug from 'debug'
import { Resolver } from 'did-resolver'
import {Resolver} from 'did-resolver'

import passport from 'passport'
import { ITokenPayload, VerifyCallback } from 'passport-azure-ad/common'
import { VcApiServer } from '../src'
import {ITokenPayload, VerifyCallback} from 'passport-azure-ad/common'
import {VcApiServer} from '../src'

import config from './config.json'
import { DB_CONNECTION_NAME_POSTGRES, DB_ENCRYPTION_KEY, postgresConfig } from './database'
import {DB_CONNECTION_NAME_SQLITE, DB_ENCRYPTION_KEY, sqliteConfig} from './database'

const debug = Debug('sphereon:vc-api')

Expand All @@ -55,9 +65,9 @@ export enum SupportedDidMethodEnum {
DID_JWK = 'jwk',
}

const PRIVATE_KEY_HEX =
'ea6aaeebe17557e0fe256bfce08e8224a412ea1e25a5ec8b5d69618a58bad89e89a4661e446b46401325a38d3b20582d1dd277eb448a3181012a671b7ae15837'
const PUBLIC_KEY_HEX = '89a4661e446b46401325a38d3b20582d1dd277eb448a3181012a671b7ae15837'
export const PRIVATE_KEY_HEX =
'a5e81a8cd50cf5c31d5b87db3e153e2817f86de350a60edc2335f76d5c3b4e0d'
export const PUBLIC_KEY_HEX = '02cfc48d497317d51e9e4cacc91a6f80ede8c07c596e0e588726ea2039a3ec0c34'

/*const RP_PRIVATE_KEY_HEX = '7dd923e40f4615ac496119f7e793cc2899e99b64b88ca8603db986700089532b'
const RP_PUBLIC_KEY_HEX = '04a23cb4c83901acc2eb0f852599610de0caeac260bf8ed05e7f902eaac0f9c8d74dd4841b94d13424d32af8ec0e9976db9abfa7e3a59e10d565c5d4d901b4be63'*/
Expand Down Expand Up @@ -95,9 +105,9 @@ export const didProviders = {
}

const dbConnection = DataSources.singleInstance()
.addConfig(DB_CONNECTION_NAME_POSTGRES, postgresConfig)
.addConfig(DB_CONNECTION_NAME_SQLITE, sqliteConfig)
// .addConfig(DB_CONNECTION_NAME_SQLITE, sqliteConfig)
.getDbConnection(DB_CONNECTION_NAME_POSTGRES)
.getDbConnection(DB_CONNECTION_NAME_SQLITE)
const privateKeyStore: PrivateKeyStore = new PrivateKeyStore(dbConnection, new SecretBox(DB_ENCRYPTION_KEY))

const agent = createAgent<
Expand All @@ -114,10 +124,10 @@ const agent = createAgent<
plugins: [
new DataStore(dbConnection),
new DataStoreORM(dbConnection),
new KeyManager({
new SphereonKeyManager({
store: new KeyStore(dbConnection),
kms: {
local: new KeyManagementSystem(privateKeyStore),
local: new SphereonKeyManagementSystem(privateKeyStore),
},
}),
new DIDManager({
Expand Down Expand Up @@ -189,7 +199,7 @@ agent
provider: 'did:jwk',
alias: 'test',
options: {
type: 'Ed25519',
type: 'Secp256r1',
key: {
privateKeyHex: PRIVATE_KEY_HEX,
},
Expand Down Expand Up @@ -224,7 +234,7 @@ agent
},
issueCredentialOpts: {
enableFeatures: ['vc-issue', 'vc-persist', 'vc-verify'],
proofFormat: 'lds',
proofFormat: 'jwt',
fetchRemoteContexts: true,
persistIssuedCredentials: true,
keyRef: PUBLIC_KEY_HEX,
Expand Down
3 changes: 3 additions & 0 deletions packages/w3c-vc-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
"@sphereon/did-uni-client": "^0.6.0",
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.15.0",
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.15.0",
"@sphereon/ssi-sdk-ext.kms-local": "0.15.0",
"@sphereon/ssi-sdk-ext.key-manager": "0.15.0",
"@sphereon/ssi-sdk.agent-config": "workspace:*",
"@sphereon/ssi-sdk.data-store": "workspace:*",
"@sphereon/ssi-sdk.vc-handler-ld-local": "workspace:*",
Expand All @@ -59,6 +61,7 @@
"@veramo/key-manager": "4.2.0",
"@veramo/kms-local": "4.2.0",
"@veramo/utils": "4.2.0",
"jose": "^5.1.0",
"did-resolver": "^4.1.0",
"morgan": "^1.10.0",
"nock": "^13.2.1",
Expand Down
12 changes: 11 additions & 1 deletion packages/w3c-vc-api/src/api-functions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { getCredentialByIdOrHash } from '@sphereon/ssi-sdk.core'
import { checkAuth, ISingleEndpointOpts, sendErrorResponse } from '@sphereon/ssi-express-support'
import { CredentialPayload } from '@veramo/core'
import {ProofFormat} from "@veramo/core/src/types/ICredentialIssuer";
import { W3CVerifiableCredential } from '@veramo/core/src/types/vc-data-model'
import { Request, Response, Router } from 'express'
import { v4 } from 'uuid'
Expand All @@ -17,6 +18,15 @@ export function issueCredentialEndpoint(router: Router, context: IRequiredContex
router.post(path, checkAuth(opts?.endpoint), async (request: Request, response: Response) => {
try {
const credential: CredentialPayload = request.body.credential
const reqOpts = request.body.options ?? {}
let reqProofFormat: ProofFormat | undefined
if (reqOpts.proofFormat) {
if (reqOpts?.proofFormat?.includes('ld')) {
reqProofFormat = 'lds'
} else {
reqProofFormat = 'jwt'
}
}
if (!credential) {
return sendErrorResponse(response, 400, 'No credential supplied')
}
Expand All @@ -27,7 +37,7 @@ export function issueCredentialEndpoint(router: Router, context: IRequiredContex
const vc = await context.agent.createVerifiableCredential({
credential,
save: opts?.persistIssuedCredentials !== false,
proofFormat: issueOpts?.proofFormat ?? 'lds',
proofFormat: reqProofFormat ?? issueOpts?.proofFormat ?? 'lds',
fetchRemoteContexts: issueOpts?.fetchRemoteContexts !== false,
})
response.statusCode = 201
Expand Down
13 changes: 13 additions & 0 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 7b24dc8

Please sign in to comment.