Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rename securing mechanism to OpenAttestationHashProof2018 #316

Open
wants to merge 1 commit into
base: beta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/4.0/__tests__/digest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ describe("V4 digestCredential", () => {
const OBFUSCATED_WRAPPED_DOCUMENT = {
// no visible fields
proof: {
type: "OpenAttestationMerkleProofSignature2018",
type: "OpenAttestationHashProof2018",
proofPurpose: "assertionMethod",
targetHash: "0b1f90bc8e87cfce8ec49cea60d406291ad130ddedc26e866a8c4f2152747abc",
proofs: [],
Expand Down
6 changes: 3 additions & 3 deletions src/4.0/__tests__/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe("V4 E2E Test Scenarios", () => {
"https://schemata.openattestation.com/com/openattestation/4.0/context.json",
]);
expect(wrappedDocument.type).toEqual(["VerifiableCredential", "OpenAttestationCredential"]);
expect(wrappedDocument.proof.type).toBe("OpenAttestationMerkleProofSignature2018");
expect(wrappedDocument.proof.type).toBe("OpenAttestationHashProof2018");
expect(wrappedDocument.proof.targetHash).toBeDefined();
expect(wrappedDocument.proof.merkleRoot).toBeDefined();
expect(wrappedDocument.proof.proofs).toEqual([]);
Expand Down Expand Up @@ -125,8 +125,8 @@ describe("V4 E2E Test Scenarios", () => {
const wrappedDocuments = await wrapDocuments(DATUM);
wrappedDocuments.forEach((doc, i: number) => {
expect(doc.type).toEqual(["VerifiableCredential", "OpenAttestationCredential"]);
expect(doc.proof.type).toBe("OpenAttestationMerkleProofSignature2018");
expect(doc.proof.type).toBe("OpenAttestationMerkleProofSignature2018");
expect(doc.proof.type).toBe("OpenAttestationHashProof2018");
expect(doc.proof.type).toBe("OpenAttestationHashProof2018");
expect(doc.credentialSubject.key1).toEqual(expect.stringContaining(DATUM[i].credentialSubject.key1));
expect(doc.proof.targetHash).toBeDefined();
expect(doc.proof.merkleRoot).toBeDefined();
Expand Down
4 changes: 2 additions & 2 deletions src/4.0/__tests__/wrap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("V4.0 wrap document", () => {
expect(proof.proofs).toEqual([]);
expect(proof.salts.length).toBeGreaterThan(0);
expect(proof.targetHash.length).toBe(64);
expect(proof.type).toBe("OpenAttestationMerkleProofSignature2018");
expect(proof.type).toBe("OpenAttestationHashProof2018");
});

test("given a document with explicit v4 contexts, but does not conform to the V4 document schema, should throw", async () => {
Expand Down Expand Up @@ -127,6 +127,6 @@ describe("V4.0 wrap document", () => {
expect(wrapped.proof.proofs).toEqual([]);
expect(wrapped.proof.salts.length).toBeGreaterThan(0);
expect(wrapped.proof.targetHash.length).toBe(64);
expect(wrapped.proof.type).toBe("OpenAttestationMerkleProofSignature2018");
expect(wrapped.proof.type).toBe("OpenAttestationHashProof2018");
});
});
2 changes: 1 addition & 1 deletion src/4.0/contexts/__generated__/index.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions src/4.0/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export const WRAPPED_DOCUMENT_DID = freezeObject({
{ id: "https://demo-renderer.opencerts.io", type: "OpenAttestationEmbeddedRenderer", templateName: "GOVTECH_DEMO" },
],
proof: {
type: "OpenAttestationMerkleProofSignature2018",
type: "OpenAttestationHashProof2018",
proofPurpose: "assertionMethod",
targetHash: "0b1f90bc8e87cfce8ec49cea60d406291ad130ddedc26e866a8c4f2152747abc",
proofs: [],
Expand Down Expand Up @@ -245,7 +245,7 @@ export const WRAPPED_DOCUMENT_DID_OSCP = freezeObject({
{ id: "https://demo-renderer.opencerts.io", type: "OpenAttestationEmbeddedRenderer", templateName: "GOVTECH_DEMO" },
],
proof: {
type: "OpenAttestationMerkleProofSignature2018",
type: "OpenAttestationHashProof2018",
proofPurpose: "assertionMethod",
targetHash: "0f60b3ef4b9b826de4753c4e68bb5ac9fdd2496549f901331a9d07464469366c",
proofs: [],
Expand Down Expand Up @@ -296,7 +296,7 @@ export const BATCHED_WRAPPED_DOCUMENTS_DID = freezeObject([
},
],
proof: {
type: "OpenAttestationMerkleProofSignature2018",
type: "OpenAttestationHashProof2018",
proofPurpose: "assertionMethod",
targetHash: "d744b98a001ed34fa133762206e312b5105478f0cc25bf86c3a2a35866597264",
proofs: ["63edb5b6919143505c522fc96d31bac58ce7b4aa57d366d2df2026c5bb425a64"],
Expand Down Expand Up @@ -340,7 +340,7 @@ export const BATCHED_WRAPPED_DOCUMENTS_DID = freezeObject([
},
],
proof: {
type: "OpenAttestationMerkleProofSignature2018",
type: "OpenAttestationHashProof2018",
proofPurpose: "assertionMethod",
targetHash: "63edb5b6919143505c522fc96d31bac58ce7b4aa57d366d2df2026c5bb425a64",
proofs: ["d744b98a001ed34fa133762206e312b5105478f0cc25bf86c3a2a35866597264"],
Expand Down Expand Up @@ -388,7 +388,7 @@ export const SIGNED_WRAPPED_DOCUMENT_DID = freezeObject({
{ id: "https://demo-renderer.opencerts.io", type: "OpenAttestationEmbeddedRenderer", templateName: "GOVTECH_DEMO" },
],
proof: {
type: "OpenAttestationMerkleProofSignature2018",
type: "OpenAttestationHashProof2018",
proofPurpose: "assertionMethod",
targetHash: "0b1f90bc8e87cfce8ec49cea60d406291ad130ddedc26e866a8c4f2152747abc",
proofs: [],
Expand Down Expand Up @@ -438,7 +438,7 @@ export const SIGNED_WRAPPED_DOCUMENT_DID_OSCP = freezeObject({
{ id: "https://demo-renderer.opencerts.io", type: "OpenAttestationEmbeddedRenderer", templateName: "GOVTECH_DEMO" },
],
proof: {
type: "OpenAttestationMerkleProofSignature2018",
type: "OpenAttestationHashProof2018",
proofPurpose: "assertionMethod",
targetHash: "0f60b3ef4b9b826de4753c4e68bb5ac9fdd2496549f901331a9d07464469366c",
proofs: [],
Expand Down Expand Up @@ -480,7 +480,7 @@ export const SIGNED_WRAPPED_DOCUMENT_DID_OBFUSCATED = freezeObject({
],
},
proof: {
type: "OpenAttestationMerkleProofSignature2018",
type: "OpenAttestationHashProof2018",
proofPurpose: "assertionMethod",
targetHash: "0b1f90bc8e87cfce8ec49cea60d406291ad130ddedc26e866a8c4f2152747abc",
proofs: [],
Expand Down Expand Up @@ -537,7 +537,7 @@ export const BATCHED_SIGNED_WRAPPED_DOCUMENTS_DID = freezeObject([
},
],
proof: {
type: "OpenAttestationMerkleProofSignature2018",
type: "OpenAttestationHashProof2018",
proofPurpose: "assertionMethod",
targetHash: "d744b98a001ed34fa133762206e312b5105478f0cc25bf86c3a2a35866597264",
proofs: ["63edb5b6919143505c522fc96d31bac58ce7b4aa57d366d2df2026c5bb425a64"],
Expand Down Expand Up @@ -584,7 +584,7 @@ export const BATCHED_SIGNED_WRAPPED_DOCUMENTS_DID = freezeObject([
},
],
proof: {
type: "OpenAttestationMerkleProofSignature2018",
type: "OpenAttestationHashProof2018",
proofPurpose: "assertionMethod",
targetHash: "63edb5b6919143505c522fc96d31bac58ce7b4aa57d366d2df2026c5bb425a64",
proofs: ["d744b98a001ed34fa133762206e312b5105478f0cc25bf86c3a2a35866597264"],
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/4.0/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export const V4OpenAttestationDocument = _W3cVerifiableCredential
.strict();

const WrappedProof = z.object({
type: z.literal("OpenAttestationMerkleProofSignature2018"),
type: z.literal("OpenAttestationHashProof2018"),
proofPurpose: z.literal("assertionMethod"),
targetHash: z.string(),
proofs: z.array(z.string()),
Expand Down
2 changes: 1 addition & 1 deletion src/4.0/wrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const wrapDocument = async <T extends V4OpenAttestationDocument>(
const verifiableCredential: V4WrappedDocument = {
...documentReadyForWrapping,
proof: {
type: "OpenAttestationMerkleProofSignature2018",
type: "OpenAttestationHashProof2018",
proofPurpose: "assertionMethod",
targetHash: digest,
proofs: merkleProof,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading