perf: delete transformedOptions key -> assign undefined with key literal

This commit is contained in:
ThatOneCalculator 2023-08-21 11:12:42 -07:00
parent 799fcd3c73
commit 652ecd2d16
No known key found for this signature in database
GPG Key ID: 8703CACD01000000

View File

@ -68,13 +68,13 @@ export class LdSignature {
...options, ...options,
"@context": "https://w3id.org/identity/v1", "@context": "https://w3id.org/identity/v1",
}; };
delete transformedOptions["type"]; transformedOptions.type = undefined;
delete transformedOptions["id"]; transformedOptions.id = undefined;
delete transformedOptions["signatureValue"]; transformedOptions.signatureValue = undefined;
const canonizedOptions = await this.normalize(transformedOptions); const canonizedOptions = await this.normalize(transformedOptions);
const optionsHash = this.sha256(canonizedOptions); const optionsHash = this.sha256(canonizedOptions);
const transformedData = { ...data }; const transformedData = { ...data };
delete transformedData["signature"]; transformedData.signature = undefined;
const cannonidedData = await this.normalize(transformedData); const cannonidedData = await this.normalize(transformedData);
if (this.debug) console.debug(`cannonidedData: ${cannonidedData}`); if (this.debug) console.debug(`cannonidedData: ${cannonidedData}`);
const documentHash = this.sha256(cannonidedData); const documentHash = this.sha256(cannonidedData);