From 41deb9974dcffcca007c4fba9f037f2f75a0bda4 Mon Sep 17 00:00:00 2001 From: Niels Klomp Date: Fri, 23 Jun 2023 04:07:44 +0200 Subject: [PATCH] feat: allow did opts from default options to be populated in instance options --- .../src/agent/SIOPv2RP.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/siopv2-oid4vp-rp-auth/src/agent/SIOPv2RP.ts b/packages/siopv2-oid4vp-rp-auth/src/agent/SIOPv2RP.ts index d55ab7f96..abfe76265 100644 --- a/packages/siopv2-oid4vp-rp-auth/src/agent/SIOPv2RP.ts +++ b/packages/siopv2-oid4vp-rp-auth/src/agent/SIOPv2RP.ts @@ -198,6 +198,25 @@ export class SIOPv2RP implements IAgentPlugin { if (!options) { throw Error(`Could not get specific nor default options for definition ${definitionId}`) } + if (this.opts.defaultOpts) { + if (!options.didOpts) { + options.didOpts = this.opts.defaultOpts?.didOpts + } else { + if (!options.didOpts.identifierOpts) { + options.didOpts.identifierOpts = this.opts.defaultOpts.didOpts.identifierOpts + } + if (!options.didOpts.resolveOpts) { + options.didOpts.resolveOpts = this.opts.defaultOpts.didOpts.resolveOpts + } + if (!options.didOpts.supportedDIDMethods) { + options.didOpts.supportedDIDMethods = this.opts.defaultOpts.didOpts.supportedDIDMethods + } + if (!options.supportedVersions) { + options.supportedVersions = this.opts.defaultOpts.supportedVersions + } + } + } + return options }