Skip to content

Commit

Permalink
Filter out placeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
olegnn committed Jan 17, 2025
1 parent 2fd3820 commit 39c8e8c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/credential-sdk/src/types/did/document/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,8 @@ export class CheqdDIDDocument extends TypedStruct {
const { verificationMethod } = this;

this.verificationMethod = verificationMethod.filter(
(verMethod) => !verMethod.isOffchain(),
(verMethod) => !verMethod.isOffchain()
&& !verMethod.publicKeyBytes().every((item) => !item),
);
const offchainVerMethod = verificationMethod.filter((verMethod) => verMethod.isOffchain());

Expand All @@ -423,14 +424,16 @@ export class CheqdDIDDocument extends TypedStruct {
service,
} = this;

const assertionMethodOffchainKeys = [...assertionMethod]
.filter((keyRefOrKey) => keyRefOrKey.id);
const assertionMethodOffchainKeys = [...assertionMethod].filter(
(keyRefOrKey) => keyRefOrKey.id,
);
const verificationMethodWithOffchainKeys = [
...verificationMethod,
...assertionMethodOffchainKeys,
];
const assertionMethodOnlyRefs = [...assertionMethod]
.map((keyRefOrKey) => keyRefOrKey.id ?? keyRefOrKey);
const assertionMethodOnlyRefs = [...assertionMethod].map(
(keyRefOrKey) => keyRefOrKey.id ?? keyRefOrKey,
);

return new DIDDocument(
context,
Expand Down

0 comments on commit 39c8e8c

Please sign in to comment.