Skip to content

Commit

Permalink
fix: remove json schema validation in v4.0 wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
HJunyuan committed Apr 17, 2024
1 parent de0dc70 commit 10c305a
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/4.0/wrap.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { hashToBuffer, isStringArray, SchemaValidationError } from "../shared/utils";
import { hashToBuffer, isStringArray } from "../shared/utils";
import { MerkleTree } from "../shared/merkle";
import { ContextUrl, SchemaId } from "../shared/@types/document";
import { ContextUrl } from "../shared/@types/document";
import { WrappedDocument } from "./types";
import { digestCredential } from "../4.0/digest";
import { validateSchema } from "../shared/validate";
import { WrapDocumentOptionV4 } from "../shared/@types/wrap";
import { OpenAttestationDocument, ProofPurpose } from "../__generated__/schema.4.0";
import { encodeSalt, salt } from "./salt";
import { interpretContexts, vcSchema } from "./validate";
import { getSchema } from "../shared/ajv";

export const wrapDocument = async <T extends OpenAttestationDocument>(
credential: T,
Expand Down Expand Up @@ -74,11 +72,6 @@ export const wrapDocument = async <T extends OpenAttestationDocument>(
},
};

const errors = validateSchema(verifiableCredential, getSchema(SchemaId.v4));
if (errors.length > 0) {
throw new SchemaValidationError("Invalid document", errors, verifiableCredential);
}

return verifiableCredential;
};

Expand Down

0 comments on commit 10c305a

Please sign in to comment.