Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
OR13 committed Jan 27, 2024
1 parent 3bcd826 commit d8350c6
Show file tree
Hide file tree
Showing 10 changed files with 617 additions and 14 deletions.
136 changes: 135 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,15 @@
"@types/jest": "^29.2.4",
"@typescript-eslint/eslint-plugin": "^5.47.1",
"@typescript-eslint/parser": "^5.47.1",
"axios": "^1.6.7",
"csv-parser": "^3.0.0",
"eslint": "^8.30.0",
"jest": "^29.3.1",
"ts-jest": "^29.0.3",
"typescript": "^4.9.4"
},
"dependencies": {
"cbor": "9.0.0"
"cbor": "9.0.0",
"jose": "^5.2.0"
}
}
37 changes: 37 additions & 0 deletions scripts/make-iana-cose-headers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

const axios = require('axios');
const fs = require('fs');
const csv = require('csv-parser');

const iana = 'https://www.iana.org/assignments/cose/header-parameters.csv';

(async () => {
const response = await axios.get(iana, {
// headers: {Authorization: `Bearer ${token}`,
responseType: 'stream'
});
const stream = response.data.pipe(csv());
const IANACOSEHeaderParameters = {}
stream.on('data', row => {
if (row.Reference.startsWith('[RFC')) {
row.Reference = `https://datatracker.ietf.org/doc/${row.Reference.substring(1, row.Reference.length - 1)}`
}
IANACOSEHeaderParameters[row.Label] = row
});
stream.on('end', () => {
const file = `
export type IANACOSEHeaderParameter = {
Name: string
Label: string
'Value Type': string
'Value Registry': string
Description: string
Reference: string
}
export const IANACOSEHeaderParameters: Record<string, IANACOSEHeaderParameter> = ${JSON.stringify(IANACOSEHeaderParameters, null, 2)};
`
fs.writeFileSync('./src/cose/headers.ts', file.trim())
});
})()
27 changes: 27 additions & 0 deletions src/__fixtures__/ecdsa-examples/ecdsa-sig-02.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<section id="urn:ietf:params:cose:cose-sign1:sha-256:base64url:t-eQXtHHgwyH7hIuhnqwHIiPWpvXa4ZFPtRFo2dZWU8" class="edn-cose-sign1">
<style>

.edn-cose-sign1 { font-family: monospace; }
.edn-cose-sign1 * { margin: 0; padding: 0; }
.edn-cose-sign1 dt, dd { display: inline-block; padding-left: 8px; }
.edn-cose-sign1 ol li {
list-style: none;
padding-left: 8px;
}

</style>

/ cose-sign1 / 18([
<ol><li>/ protected / h'a1013822',</li>
<li>/ unprotected / {<dl><dt>/ kid / 4 : </dt><dd>h'50333834'</dd><dl>},</li>
<li>/ payload / h'54686973...656e742e',</li>
<li>/ signature / h'5f150abd...59622a3c'</li></ol>
])


<section>
{<dl><dt>/ alg / 1 : </dt><dd>-35</dd><dl>}
</section>


<section>
Loading

0 comments on commit d8350c6

Please sign in to comment.