Skip to content

Commit

Permalink
Merge pull request #158 from dhensby/pulls/cavage-spacing
Browse files Browse the repository at this point in the history
fix: remove spaces between comma separated values in the cavage signature header
  • Loading branch information
dhensby authored Nov 28, 2023
2 parents ebe32d4 + c2ef06f commit 5567a17
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cavage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export async function signMessage<T extends Request | Response = Request | Respo
}),
`headers="${headerNames.join(' ')}"`,
`signature="${signature.toString('base64')}"`,
].join(', ');
].join(',');
return {
...message,
headers: {
Expand Down
4 changes: 2 additions & 2 deletions test/cavage/new.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ describe('cavage', () => {
'Content-Type': 'application/json',
'Digest': 'SHA-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=',
'Content-Length': '18',
'Signature': 'keyId="rsa-key-1", algorithm="hs2019", created=1402170695, expires=1402170995, headers="(request-target) (created) (expires) host digest content-length", signature="YSBmYWtlIHNpZ25hdHVyZQ=="',
'Signature': 'keyId="rsa-key-1",algorithm="hs2019",created=1402170695,expires=1402170995,headers="(request-target) (created) (expires) host digest content-length",signature="YSBmYWtlIHNpZ25hdHVyZQ=="',
});
expect(signer.sign).to.have.been.calledOnceWithExactly(Buffer.from(
'(request-target): post /foo\n' +
Expand Down Expand Up @@ -388,7 +388,7 @@ describe('cavage', () => {
'Date': 'Tue, 20 Apr 2021 02:07:56 GMT',
'Content-Type': 'application/json',
'Content-Length': '62',
'Signature': 'created=1618884479, keyId="test-key-ecc-p256", headers="content-length content-type", signature="YSBmYWtlIHNpZ25hdHVyZQ=="',
'Signature': 'created=1618884479,keyId="test-key-ecc-p256",headers="content-length content-type",signature="YSBmYWtlIHNpZ25hdHVyZQ=="',
});
expect(signer.sign).to.have.been.calledOnceWithExactly(Buffer.from(
'content-length: 62\n' +
Expand Down

0 comments on commit 5567a17

Please sign in to comment.