Skip to content

Commit

Permalink
feat: allow default opts to be set when OID4VCI is running
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Jun 24, 2023
1 parent 41deb99 commit 7142273
Show file tree
Hide file tree
Showing 12 changed files with 161 additions and 138 deletions.
6 changes: 4 additions & 2 deletions packages/oid4vci-issuer-rest-api/__tests__/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { IonPublicKeyPurpose } from '@decentralized-identity/ion-sdk'
import { getUniResolver } from '@sphereon/did-uni-client'
import { CredentialIssuerMetadata } from '@sphereon/oid4vci-common'
import { JwkDIDProvider } from '@sphereon/ssi-sdk-ext.did-provider-jwk'
import {SphereonKeyManager} from "@sphereon/ssi-sdk-ext.key-manager";
import { /*generatePrivateKeyHex, */ toJwk } from '@sphereon/ssi-sdk-ext.key-utils'
import {SphereonKeyManagementSystem} from "@sphereon/ssi-sdk-ext.kms-local";
import { OID4VCIIssuer } from '@sphereon/ssi-sdk.oid4vci-issuer'
import { OID4VCIStore } from '@sphereon/ssi-sdk.oid4vci-issuer-store'
import {
Expand Down Expand Up @@ -112,10 +114,10 @@ const agent = createAgent<IPlugins>({
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
6 changes: 4 additions & 2 deletions packages/oid4vci-issuer-rest-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@
"@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.0",
"@sphereon/ssi-sdk-ext.key-utils": "^0.12.0",
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.12.1-next.9",
"@sphereon/ssi-sdk-ext.key-utils": "0.12.1-next.9",
"@sphereon/ssi-sdk.data-store": "workspace:*",
"@sphereon/ssi-sdk-ext.key-manager": "0.12.1-next.9",
"@sphereon/ssi-sdk-ext.kms-local": "0.12.1-next.9",
"@sphereon/ssi-sdk.vc-handler-ld-local": "workspace:*",
"@types/body-parser": "^1.19.2",
"@types/cookie-parser": "^1.4.3",
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 @@ -15,7 +15,7 @@
},
"dependencies": {
"@sphereon/oid4vci-common": "0.4.1-unstable.308",
"@sphereon/ssi-sdk-ext.did-utils": "^0.12.0",
"@sphereon/ssi-sdk-ext.did-utils": "0.12.1-next.9",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:*",
"@types/uuid": "^9.0.1",
"@veramo/core": "4.2.0",
Expand Down
7 changes: 6 additions & 1 deletion packages/oid4vci-issuer-store/src/agent/OID4VCIStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@ export class OID4VCIStore implements IAgentPlugin {
return this._defaultOpts
}

set defaultOpts(value: IIssuerDefaultOpts | undefined) {
this._defaultOpts = value
}

private readonly _metadataStores: Map<string, IKeyValueStore<CredentialIssuerMetadata>>
private readonly _optionStores: Map<string, IKeyValueStore<IIssuerOptions>>
private readonly defaultStoreId: string
private readonly defaultNamespace: string

private _defaultOpts?: IIssuerDefaultOpts

readonly methods: IOID4VCIStore = {
oid4vciStoreDefaultMetadata: this.oid4vciStoreDefaultMetadata.bind(this),
oid4vciStoreDefaultIssuerOptions: this.oid4vciStoreIssuerOptions.bind(this),
Expand All @@ -43,7 +49,6 @@ export class OID4VCIStore implements IAgentPlugin {
oid4vciStoreRemoveMetadata: this.oid4vciStoreRemoveMetadata.bind(this),
oid4vciStoreClearAllMetadata: this.oid4vciStoreClearAllMetadata.bind(this),
}
private readonly _defaultOpts?: IIssuerDefaultOpts

constructor(opts: IOID4VCIStoreOpts) {
this.defaultStoreId = opts.defaultStore ?? '_default'
Expand Down
2 changes: 1 addition & 1 deletion packages/oid4vci-issuer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"dependencies": {
"@sphereon/oid4vci-common": "0.4.1-unstable.308",
"@sphereon/oid4vci-issuer": "0.4.1-unstable.308",
"@sphereon/ssi-sdk-ext.did-utils": "^0.12.0",
"@sphereon/ssi-sdk-ext.did-utils": "0.12.1-next.9",
"@sphereon/ssi-sdk.core": "workspace:*",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:*",
"@sphereon/ssi-sdk.oid4vci-issuer-store": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/presentation-exchange/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"dependencies": {
"@sphereon/pex": "2.0.1",
"@sphereon/pex-models": "^2.0.2",
"@sphereon/ssi-sdk-ext.did-utils": "^0.12.0",
"@sphereon/ssi-sdk-ext.did-utils": "0.12.1-next.9",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:*",
"@sphereon/ssi-types": "workspace:*",
"@veramo/core": "4.2.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/siopv2-oid4vp-op-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@sphereon/did-auth-siop": "0.3.2-unstable.6",
"@sphereon/pex": "2.0.1",
"@sphereon/pex-models": "2.0.2",
"@sphereon/ssi-sdk-ext.did-utils": "^0.12.0",
"@sphereon/ssi-sdk-ext.did-utils": "0.12.1-next.9",
"@sphereon/ssi-sdk.core": "workspace:*",
"@sphereon/ssi-sdk.presentation-exchange": "workspace:*",
"@sphereon/ssi-types": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/siopv2-oid4vp-rp-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"dependencies": {
"@sphereon/did-auth-siop": "0.3.2-unstable.6",
"@sphereon/pex": "2.0.1",
"@sphereon/ssi-sdk-ext.did-utils": "^0.12.0",
"@sphereon/ssi-sdk-ext.did-utils": "0.12.1-next.9",
"@sphereon/ssi-sdk.core": "workspace:*",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:*",
"@sphereon/ssi-sdk.presentation-exchange": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/siopv2-oid4vp-rp-rest-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@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.0",
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.12.1-next.9",
"@sphereon/ssi-sdk.data-store": "workspace:*",
"@sphereon/ssi-sdk.vc-handler-ld-local": "workspace:*",
"@types/body-parser": "^1.19.2",
Expand Down
10 changes: 5 additions & 5 deletions packages/vc-handler-ld-local/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@mattrglobal/jsonld-signatures-bbs": "^1.1.1",
"@sphereon/ed25519-signature-2018": "0.7.0-unstable.6",
"@sphereon/isomorphic-webcrypto": "^2.4.0-unstable.4",
"@sphereon/ssi-sdk-ext.did-utils": "^0.12.0",
"@sphereon/ssi-sdk-ext.did-utils": "0.12.1-next.9",
"@sphereon/ssi-sdk.core": "workspace:*",
"@sphereon/ssi-types": "workspace:*",
"@transmute/ed25519-key-pair": "0.7.0-unstable.80",
Expand All @@ -50,10 +50,10 @@
},
"devDependencies": {
"@sphereon/did-uni-client": "^0.6.0",
"@sphereon/ssi-sdk-ext.did-provider-key": "^0.12.0",
"@sphereon/ssi-sdk-ext.did-provider-lto": "^0.12.0",
"@sphereon/ssi-sdk-ext.key-manager": "^0.12.0",
"@sphereon/ssi-sdk-ext.kms-local": "^0.12.0",
"@sphereon/ssi-sdk-ext.did-provider-key": "0.12.1-next.9",
"@sphereon/ssi-sdk-ext.did-provider-lto": "0.12.1-next.9",
"@sphereon/ssi-sdk-ext.key-manager": "0.12.1-next.9",
"@sphereon/ssi-sdk-ext.kms-local": "0.12.1-next.9",
"@sphereon/ssi-sdk.agent-config": "workspace:*",
"@transmute/lds-ecdsa-secp256k1-recovery2020": "^0.0.7",
"@types/nock": "^11.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/w3c-vc-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,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.0",
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "^0.12.0",
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.12.1-next.9",
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.12.1-next.9",
"@sphereon/ssi-sdk.data-store": "workspace:*",
"@sphereon/ssi-sdk.vc-handler-ld-local": "workspace:*",
"@types/body-parser": "^1.19.2",
Expand Down
Loading

0 comments on commit 7142273

Please sign in to comment.