Skip to content

Commit

Permalink
fix render bug
Browse files Browse the repository at this point in the history
  • Loading branch information
OR13 committed Apr 15, 2024
1 parent 2e4cc39 commit 878e5b1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 23 deletions.
10 changes: 0 additions & 10 deletions src/__fixtures__/ecdsa-examples/ecdsa-sig-02.txt

This file was deleted.

2 changes: 1 addition & 1 deletion src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const renderSeqPlaintext = async (seq: EDNSeq): Promise<string> => {
value.iana = algs.IANACOSEHeaderParameters[`${value.value}`]
}
}
entry.edn = `/ protected / << ${await renderMapPlaintext(protectedHeader)} >>>`
entry.edn = `/ protected / << ${await renderMapPlaintext(protectedHeader)} >>`
}
return `${entry.edn ? ' ' + entry.edn : await recursiveRenderPlaintext(entry)}${trailingComma}`;
}))).join('\n');
Expand Down
15 changes: 15 additions & 0 deletions tests/cose-sign1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,19 @@ it(testCase.title, async () => {
expect(graph1.seq.get(0).value.toString('hex')).toBe('a1013822')
const graph2 = await edn.parse(Buffer.from(testCase.output.cbor, 'hex')) as edn.EDNCoseSign1
expect(graph2.seq.get(0).value.toString('hex')).toBe('a1013822')

const text = await edn.render(Buffer.from(testCase.output.cbor, 'hex'), 'application/cbor-diagnostic')
expect(text).toBe(`
/ cose-sign1 / 18([
/ protected / << {
/ alg / 1 : -35 / ES384 /
} >>,
/ unprotected / {
/ kid / 4 : h'50333834'
},
/ payload / h'54686973...656e742e',
/ signature / h'5f150abd...59622a3c'
])
`.trim())

})
12 changes: 0 additions & 12 deletions tests/render.test.ts

This file was deleted.

0 comments on commit 878e5b1

Please sign in to comment.