Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const canonize = async (doc: any, options: any = {}): Promise => {
// @ts-ignore
return jsonld.canonize(doc, options);
};
async canonize(input, {documentLoader, expansionMap, skipExpansion}) {
return jsonld.canonize(input, {
algorithm: 'URDNA2015',
format: 'application/n-quads',
documentLoader,
expansionMap,
skipExpansion,
useNative: this.useNativeCanonize
});
}
async canonize(
input, {documentLoader, expansionMap, skipExpansion}) {
return jsonld.canonize(input, {
algorithm: 'URGNA2012',
format: 'application/n-quads',
documentLoader,
expansionMap,
skipExpansion
});
}
export const canonizeClaim = async (claim: Claim): Promise => {
const contextualClaim = { ...ClaimContext, ...claim }
return canonize(contextualClaim)
}
const canonizeClaim = async (document: BaseVerifiableClaim): Promise => {
const contextualClaim = {
type: document.type,
'@context': {
...DefaultClaimContext,
...claimTypeDefaults[document.type],
...document['@context'],
},
issuer: document.issuer,
issuanceDate: document.issuanceDate,
claim: document.claim,
}
return JSONLD.canonize(contextualClaim)
}