Skip to content

Commit

Permalink
fix(ARC): ensure that instance value is 1 if ARC chain does not exist…
Browse files Browse the repository at this point in the history
… yet
  • Loading branch information
andris9 committed Dec 19, 2024
1 parent 3c47729 commit ab4c5e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/arc/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ const verifyAS = async (chain, opts) => {
const signAS = async (chain, entry, signatureData) => {
let { instance, algorithm, selector, signingDomain, bodyHash, cv, signTime, privateKey } = signatureData;

instance = instance || 1;

const signAlgo = algorithm?.split('-').shift();

signTime = signTime || new Date();
Expand Down Expand Up @@ -497,6 +499,8 @@ const createSeal = async (input, data) => {
await dkimSigner.finalize();
}

seal.i = seal.i || 1;

const authResults = `ARC-Authentication-Results: i=${seal.i}; ${seal.authResults}`;

// Step 2. Calculate ARC-Seal
Expand Down
2 changes: 1 addition & 1 deletion lib/dkim/dkim-signer.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ class DkimSigner extends MessageParser {
{},
signatureData,
{
instance: this.arc?.instance, // ARC only
instance: this.arc?.instance || 1, // ARC only
algorithm,
canonicalization: this.getCanonicalization(signatureData).canonicalization,

Expand Down

0 comments on commit ab4c5e9

Please sign in to comment.