Skip to content

Commit

Permalink
Merge pull request #34 from covidpass-org/dev
Browse files Browse the repository at this point in the history
Implement test and recovery certificates
  • Loading branch information
marvinsxtr authored Jul 9, 2021
2 parents 6b5335c + 49a43c7 commit fe5cebc
Show file tree
Hide file tree
Showing 14 changed files with 318 additions and 206 deletions.
62 changes: 0 additions & 62 deletions docker-compose.yml

This file was deleted.

2 changes: 1 addition & 1 deletion next-i18next.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
i18n: {
defaultLocale: 'en',
locales: ['en', 'de', 'de-DE'],
locales: ['en', 'de', 'de-DE', 'de-AT', 'de-LI', 'de-LU', 'de-CH'],
localeExtension: 'yml',
},
};
15 changes: 9 additions & 6 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,27 @@ import Page from '../components/Page';
function Index(): JSX.Element {
const { t } = useTranslation(['common', 'index', 'errors']);

const title = 'CovidPass';
const description = 'Add your EU Digital COVID Certificates to your favorite wallet app.';

return (
<>
<NextSeo
title="Covidpass"
description="Add your EU Digital Covid Vaccination Certificates to your favorite wallet app."
title={title}
description={description}
openGraph={{
url: 'https://covidpass.marvinsextro.de/',
title: 'CovidPass',
description: 'Add your EU Digital Covid Vaccination Certificates to your favorite wallet app.',
title: title,
description: description,
images: [
{
url: 'https://covidpass.marvinsextro.de/thumbnail.png',
width: 1000,
height: 500,
alt: 'CovidPass: Add your EU Digital Covid Vaccination Certificates to your favorite wallet app.',
alt: description,
}
],
site_name: 'CovidPass',
site_name: title,
}}
twitter={{
handle: '@marvinsxtr',
Expand Down
1 change: 1 addition & 0 deletions public/locales/de-AT
1 change: 1 addition & 0 deletions public/locales/de-CH
1 change: 1 addition & 0 deletions public/locales/de-LI
1 change: 1 addition & 0 deletions public/locales/de-LU
2 changes: 1 addition & 1 deletion public/locales/de/common.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
title: CovidPass
subtitle: Übertrage Deine digitalen EU COVID-Impfzertifikate in Deine Wallet-Apps.
subtitle: Übertrage Deine digitalen EU COVID-Zertifikate in Deine Wallet-Apps.
privacyPolicy: Datenschutz
donate: Unterstützen
gitHub: GitHub
Expand Down
5 changes: 4 additions & 1 deletion public/locales/de/errors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ noFileOrQrCode: Bitte scanne einen QR-Code oder wähle eine Datei aus
signatureFailed: Fehler beim Signieren der Karte auf dem Server
decodingFailed: Dekodierung der QR-Code-Daten fehlgeschlagen
invalidColor: Ungültige Farbe
vaccinationInfo: Impfinformationen konnten nicht gelesen werden
certificateData: Zertifikats-Daten konnten nicht gelesen werden
nameMissing: Name konnte nicht gelesen werden
dobMissing: Geburtsdatum konnte nicht gelesen werden
invalidMedicalProduct: Ungültiges Medizinprodukt
Expand All @@ -12,3 +12,6 @@ invalidFileType: Ungültiger Dateityp
couldNotDecode: Dekodierung aus QR-Code fehlgeschlagen
couldNotFindQrCode: QR-Code konnte in der ausgewählten Datei nicht gefunden werden
invalidQrCode: Ungültiger QR-Code
certificateType: Kein gültiger Zertifikatstyp gefunden
invalidTestResult: Ungültiges Testergebnis
invalidTestType: Ungültiger Testtyp
2 changes: 1 addition & 1 deletion public/locales/en/common.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
title: CovidPass
subtitle: Add your EU Digital Covid Vaccination Certificates to your favorite wallet apps.
subtitle: Add your EU Digital COVID Certificates to your favorite wallet apps.
privacyPolicy: Privacy Policy
donate: Sponsor
gitHub: GitHub
Expand Down
5 changes: 4 additions & 1 deletion public/locales/en/errors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ noFileOrQrCode: Please scan a QR Code, or select a file
signatureFailed: Error while signing pass on server
decodingFailed: Failed to decode QR code payload
invalidColor: Invalid color
vaccinationInfo: Failed to read vaccination information
certificateData: Failed to read certificate data
nameMissing: Failed to read name
dobMissing: Failed to read date of birth
invalidMedicalProduct: Invalid medical product
Expand All @@ -12,3 +12,6 @@ invalidFileType: Invalid file type
couldNotDecode: Could not decode QR code from file
couldNotFindQrCode: Could not find QR Code in provided file
invalidQrCode: Invalid QR code
certificateType: No valid certificate type found
invalidTestResult: Invalid test result
invalidTestType: Invalid test type
89 changes: 3 additions & 86 deletions src/pass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {toBuffer as createZip} from 'do-not-zip';
import {v4 as uuid4} from 'uuid';

import {Constants} from "./constants";
import {Payload, PayloadBody} from "./payload";
import {Payload, PayloadBody, PassDictionary} from "./payload";
import {ValueSets} from "./value_sets";

const crypto = require('crypto')
Expand All @@ -21,21 +21,6 @@ interface QrCode {
messageEncoding: Encoding;
}

interface Field {
key: string;
label: string;
value: string;
textAlignment?: string;
}

interface PassStructureDictionary {
headerFields: Array<Field>;
primaryFields: Array<Field>;
secondaryFields: Array<Field>;
auxiliaryFields: Array<Field>;
backFields: Array<Field>;
}

interface SignData {
PassJsonHash: string;
useBlackVersion: boolean;
Expand All @@ -56,7 +41,7 @@ export class PassData {
serialNumber: string;
barcodes: Array<QrCode>;
barcode: QrCode;
generic: PassStructureDictionary;
generic: PassDictionary;

// Generates a sha1 hash from a given buffer
private static getBufferHash(buffer: Buffer | string): string {
Expand Down Expand Up @@ -157,74 +142,6 @@ export class PassData {
this.serialNumber = uuid4(); // Generate random UUID v4
this.barcodes = [qrCode];
this.barcode = qrCode;
this.generic = {
headerFields: [
{
key: "type",
label: "Certificate Type",
value: payload.certificateType
}
],
primaryFields: [
{
key: "name",
label: "Name",
value: payload.name
}
],
secondaryFields: [
{
key: "dose",
label: "Dose",
value: payload.dose
},
{
key: "dov",
label: "Date of Vaccination",
value: payload.dateOfVaccination,
textAlignment: "PKTextAlignmentRight"
}
],
auxiliaryFields: [
{
key: "vaccine",
label: "Vaccine",
value: payload.vaccineName
},
{
key: "dob",
label: "Date of Birth",
value: payload.dateOfBirth,
textAlignment: "PKTextAlignmentRight"
}
],
backFields: [
{
key: "uvci",
label: "Unique Certificate Identifier (UVCI)",
value: payload.uvci
},
{
key: "issuer",
label: "Certificate Issuer",
value: payload.certificateIssuer
},
{
key: "country",
label: "Country of Vaccination",
value: payload.countryOfVaccination
},
{
key: "manufacturer",
label: "Manufacturer",
value: payload.manufacturer
},
{
key: "disclaimer",
label: "Disclaimer",
value: "This certificate is only valid in combination with the ID card of the certificate holder and expires one year + 14 days after the last dose. The validity of this certificate was not checked by CovidPass."
}
]
};
this.generic = payload.generic;
}
}
Loading

0 comments on commit fe5cebc

Please sign in to comment.