Skip to content

Commit a502a11

Browse files
committed
Test fix
1 parent 9c11cc8 commit a502a11

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/vc-delegation-engine/src/engine.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { summarizeDelegationChain, summarizeStandaloneCredential } from './summa
3030
import { DelegationError, DelegationErrorCodes, normalizeDelegationFailure } from './errors.js';
3131

3232
const CONTROL_PREDICATES = new Set(['allows', 'delegatesTo', 'listsClaim', 'inheritsParent']);
33+
const DELEGATION_TYPE_NAME = shortenTerm(VC_TYPE_DELEGATION_CREDENTIAL);
3334
const RESERVED_RESOURCE_TYPES = new Set([
3435
`${VC_NS}VerifiableCredential`,
3536
'VerifiableCredential',
@@ -459,7 +460,13 @@ export async function verifyVPWithDelegation({
459460

460461
// Early out failure if missing credential from chain
461462
normalizedCredentials.forEach((credential) => {
462-
const { id, previousCredentialId, rootCredentialId } = credential;
463+
const {
464+
id, previousCredentialId, rootCredentialId, type,
465+
} = credential;
466+
const isDelegationCredential = Array.isArray(type) && type.includes(DELEGATION_TYPE_NAME);
467+
if (!isDelegationCredential) {
468+
return;
469+
}
463470
if (previousCredentialId && !normalizedById.has(previousCredentialId)) {
464471
throw new DelegationError(
465472
DelegationErrorCodes.MISSING_CREDENTIAL,

0 commit comments

Comments
 (0)