ministero-salute / dcc-utils

Set of utilities to read EU Digital COVID Certificates, verify signatures and rules.
GNU Affero General Public License v3.0
65 stars 16 forks source link

fetch certificates #13

Closed dnldsht closed 3 years ago

dnldsht commented 3 years ago

I wrote a script that fetch certificates from https://get.dgc.gov.it/v1 that can be used with the method dcc.checkSignatureWithKeysList(keys) introduced in this pull request.

If this scripts is welcome I will update the readme and give some info about the usage

codecov[bot] commented 3 years ago

Codecov Report

Merging #13 (9a10386) into master (1eb7214) will increase coverage by 100.00%. The diff coverage is n/a.

Impacted file tree graph

@@              Coverage Diff              @@
##           master       #13        +/-   ##
=============================================
+ Coverage        0   100.00%   +100.00%     
=============================================
  Files           0         3         +3     
  Lines           0        72        +72     
  Branches        0         9         +9     
=============================================
+ Hits            0        72        +72     
Impacted Files Coverage Δ
src/rule.js 100.00% <0.00%> (ø)
src/dcc.js 100.00% <0.00%> (ø)
src/index.js 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 1eb7214...9a10386. Read the comment docs.

astagi commented 3 years ago

Hey @dnldsht your example looks great! Just few things to change.

  1. In order to maintain the same style of the other examples, please use CommonJS imports
const fetch = require('node-fetch');
const { X509Certificate, PublicKey } = require('@peculiar/x509');
const crypto = require('isomorphic-webcrypto');
const fs = require('fs');
  1. Add certificate.json to .gitignore
  2. Add @peculiar/x509 to dev dependencies (npm install @peculiar/x509 -D)

Feel free to add notes in README alongside this PR