diff --git a/src/assertions.ts b/src/assertions.ts index 5da0178..609cd4f 100644 --- a/src/assertions.ts +++ b/src/assertions.ts @@ -45,7 +45,7 @@ export const documentStateIsValid = async (doc: any, updateKeys: string[], witne if (proof.type !== 'DataIntegrityProof') { throw new Error(`Unknown proof type ${proof.type}`); } - if (proof.proofPurpose !== 'authentication') { + if (proof.proofPurpose !== 'authentication' && proof.proofPurpose !== 'assertionMethod') { throw new Error(`Unknown proof purpose ${proof.proofPurpose}`); } if (proof.cryptosuite !== 'eddsa-jcs-2022') { diff --git a/src/cryptography.ts b/src/cryptography.ts index 5921b06..2fddc8c 100644 --- a/src/cryptography.ts +++ b/src/cryptography.ts @@ -14,7 +14,7 @@ export const createSigner = (vm: VerificationMethod, useStatic: boolean = true) cryptosuite: 'eddsa-jcs-2022', verificationMethod: useStatic ? `did:key:${vm.publicKeyMultibase}#${vm.publicKeyMultibase}` : vm.id, created: createDate(), - proofPurpose: 'authentication' + proofPurpose: 'assertionMethod' } const dataHash = createHash('sha256').update(canonicalize(doc)).digest(); const proofHash = createHash('sha256').update(canonicalize(proof)).digest(); @@ -41,7 +41,7 @@ export const generateEd25519VerificationMethod = async (): Promise { didLog = [...updatedLog]; expect(updatedDID).toBe(did); expect(updatedDoc.controller).toContain(externalAuthKey.controller); - expect(updatedDoc.authentication[1]).toContain(externalAuthKey.controller!.slice(-6)); + expect(updatedDoc.assertionMethod[1]).toContain(externalAuthKey.controller!.slice(-6)); expect(updatedDoc.verificationMethod[1].controller).toBe(externalAuthKey.controller); expect(meta.versionId.split('-')[0]).toBe("5");