@sphereon/ssi-sdk.oid4vci-holder 0.36.1-feature.fides.fixes.111 → 0.36.1-feature.fides.fixes.119
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +13 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/package.json +20 -20
- package/src/agent/OID4VCIHolder.ts +4 -1
- package/src/services/OID4VCIHolderService.ts +7 -1
- package/src/types/IOID4VCIHolder.ts +2 -0
package/dist/index.d.cts
CHANGED
|
@@ -151,6 +151,7 @@ type OID4VCIHolderOptions = {
|
|
|
151
151
|
didMethodPreferences?: Array<SupportedDidMethodEnum>;
|
|
152
152
|
jwtCryptographicSuitePreferences?: Array<JoseSignatureAlgorithm | JoseSignatureAlgorithmString>;
|
|
153
153
|
hasher?: HasherSync;
|
|
154
|
+
defaultHolderIdentifier?: string;
|
|
154
155
|
};
|
|
155
156
|
type OnContactIdentityCreatedArgs = {
|
|
156
157
|
contactId: string;
|
|
@@ -542,6 +543,7 @@ type DefaultIssuanceOpts = {
|
|
|
542
543
|
type GetIdentifierArgs = {
|
|
543
544
|
issuanceOpt: IssuanceOpts;
|
|
544
545
|
context: RequiredContext;
|
|
546
|
+
defaultHolderIdentifier?: string;
|
|
545
547
|
};
|
|
546
548
|
type GetAuthenticationKeyArgs = {
|
|
547
549
|
identifier: ManagedIdentifierOptsOrResult;
|
|
@@ -683,6 +685,7 @@ declare const oid4vciHolderContextMethods: Array<string>;
|
|
|
683
685
|
declare function signCallback(identifier: ManagedIdentifierOptsOrResult, context: IAgentContext<IKeyManager & IDIDManager & IResolver & IIdentifierResolution & IJwtService>, nonce?: string): (jwt: Jwt, kid?: string, noIssPayloadUpdate?: boolean) => Promise<string>;
|
|
684
686
|
declare class OID4VCIHolder implements IAgentPlugin {
|
|
685
687
|
private readonly hasher?;
|
|
688
|
+
private readonly defaultHolderIdentifier?;
|
|
686
689
|
readonly eventTypes: Array<OID4VCIHolderEvent>;
|
|
687
690
|
readonly methods: IOID4VCIHolder;
|
|
688
691
|
private readonly vcFormatPreferences;
|
package/dist/index.d.ts
CHANGED
|
@@ -151,6 +151,7 @@ type OID4VCIHolderOptions = {
|
|
|
151
151
|
didMethodPreferences?: Array<SupportedDidMethodEnum>;
|
|
152
152
|
jwtCryptographicSuitePreferences?: Array<JoseSignatureAlgorithm | JoseSignatureAlgorithmString>;
|
|
153
153
|
hasher?: HasherSync;
|
|
154
|
+
defaultHolderIdentifier?: string;
|
|
154
155
|
};
|
|
155
156
|
type OnContactIdentityCreatedArgs = {
|
|
156
157
|
contactId: string;
|
|
@@ -542,6 +543,7 @@ type DefaultIssuanceOpts = {
|
|
|
542
543
|
type GetIdentifierArgs = {
|
|
543
544
|
issuanceOpt: IssuanceOpts;
|
|
544
545
|
context: RequiredContext;
|
|
546
|
+
defaultHolderIdentifier?: string;
|
|
545
547
|
};
|
|
546
548
|
type GetAuthenticationKeyArgs = {
|
|
547
549
|
identifier: ManagedIdentifierOptsOrResult;
|
|
@@ -683,6 +685,7 @@ declare const oid4vciHolderContextMethods: Array<string>;
|
|
|
683
685
|
declare function signCallback(identifier: ManagedIdentifierOptsOrResult, context: IAgentContext<IKeyManager & IDIDManager & IResolver & IIdentifierResolution & IJwtService>, nonce?: string): (jwt: Jwt, kid?: string, noIssPayloadUpdate?: boolean) => Promise<string>;
|
|
684
686
|
declare class OID4VCIHolder implements IAgentPlugin {
|
|
685
687
|
private readonly hasher?;
|
|
688
|
+
private readonly defaultHolderIdentifier?;
|
|
686
689
|
readonly eventTypes: Array<OID4VCIHolderEvent>;
|
|
687
690
|
readonly methods: IOID4VCIHolder;
|
|
688
691
|
private readonly vcFormatPreferences;
|
package/dist/index.js
CHANGED
|
@@ -1727,7 +1727,7 @@ var extractCredentialFromResponse = /* @__PURE__ */ __name((credentialResponse)
|
|
|
1727
1727
|
return credential;
|
|
1728
1728
|
}, "extractCredentialFromResponse");
|
|
1729
1729
|
var getIdentifierOpts = /* @__PURE__ */ __name(async (args) => {
|
|
1730
|
-
const { issuanceOpt, context } = args;
|
|
1730
|
+
const { issuanceOpt, context, defaultHolderIdentifier } = args;
|
|
1731
1731
|
const { identifier: identifierArg } = issuanceOpt;
|
|
1732
1732
|
if (identifierArg && isManagedIdentifierResult(identifierArg)) {
|
|
1733
1733
|
return identifierArg;
|
|
@@ -1750,6 +1750,11 @@ var getIdentifierOpts = /* @__PURE__ */ __name(async (args) => {
|
|
|
1750
1750
|
agent: context.agent
|
|
1751
1751
|
};
|
|
1752
1752
|
if ((!identifierArg || isIIdentifier(identifierArg.identifier)) && supportedPreferredDidMethod && (!supportedBindingMethods || supportedBindingMethods.length === 0 || supportedBindingMethods.filter((method) => method.startsWith("did")))) {
|
|
1753
|
+
const identifierFilter = defaultHolderIdentifier ? defaultHolderIdentifier.startsWith("did:") ? {
|
|
1754
|
+
did: defaultHolderIdentifier
|
|
1755
|
+
} : {
|
|
1756
|
+
alias: defaultHolderIdentifier
|
|
1757
|
+
} : {};
|
|
1753
1758
|
const { result, created } = await getOrCreatePrimaryIdentifier(agentContext, {
|
|
1754
1759
|
method: supportedPreferredDidMethod,
|
|
1755
1760
|
createOpts: {
|
|
@@ -1757,7 +1762,8 @@ var getIdentifierOpts = /* @__PURE__ */ __name(async (args) => {
|
|
|
1757
1762
|
type: issuanceOpt.keyType,
|
|
1758
1763
|
use: KeyUse.Signature,
|
|
1759
1764
|
codecName: issuanceOpt.codecName,
|
|
1760
|
-
kms: issuanceOpt.kms
|
|
1765
|
+
kms: issuanceOpt.kms,
|
|
1766
|
+
...identifierFilter
|
|
1761
1767
|
}
|
|
1762
1768
|
}
|
|
1763
1769
|
});
|
|
@@ -2136,6 +2142,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2136
2142
|
__name(this, "OID4VCIHolder");
|
|
2137
2143
|
}
|
|
2138
2144
|
hasher;
|
|
2145
|
+
defaultHolderIdentifier;
|
|
2139
2146
|
eventTypes = [
|
|
2140
2147
|
OID4VCIHolderEvent.CONTACT_IDENTITY_CREATED,
|
|
2141
2148
|
OID4VCIHolderEvent.CREDENTIAL_STORED,
|
|
@@ -2193,10 +2200,11 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2193
2200
|
onIdentifierCreated;
|
|
2194
2201
|
onVerifyEBSICredentialIssuer;
|
|
2195
2202
|
constructor(options) {
|
|
2196
|
-
const { onContactIdentityCreated, onCredentialStored, onIdentifierCreated, onVerifyEBSICredentialIssuer, vcFormatPreferences, jsonldCryptographicSuitePreferences, didMethodPreferences, jwtCryptographicSuitePreferences, defaultAuthorizationRequestOptions, hasher = defaultHasher2 } = {
|
|
2203
|
+
const { onContactIdentityCreated, onCredentialStored, onIdentifierCreated, onVerifyEBSICredentialIssuer, vcFormatPreferences, jsonldCryptographicSuitePreferences, didMethodPreferences, jwtCryptographicSuitePreferences, defaultAuthorizationRequestOptions, hasher = defaultHasher2, defaultHolderIdentifier } = {
|
|
2197
2204
|
...options
|
|
2198
2205
|
};
|
|
2199
2206
|
this.hasher = hasher;
|
|
2207
|
+
this.defaultHolderIdentifier = defaultHolderIdentifier;
|
|
2200
2208
|
if (vcFormatPreferences !== void 0 && vcFormatPreferences.length > 0) {
|
|
2201
2209
|
this.vcFormatPreferences = vcFormatPreferences;
|
|
2202
2210
|
}
|
|
@@ -2523,7 +2531,8 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2523
2531
|
}
|
|
2524
2532
|
const identifier = await getIdentifierOpts({
|
|
2525
2533
|
issuanceOpt,
|
|
2526
|
-
context
|
|
2534
|
+
context,
|
|
2535
|
+
defaultHolderIdentifier: this.defaultHolderIdentifier
|
|
2527
2536
|
});
|
|
2528
2537
|
issuanceOpt.identifier = identifier;
|
|
2529
2538
|
logger.info(`ID opts`, identifier);
|