covid-certificate
Version:
Parse and verify a european digital covid certificate (dcc)
286 lines (285 loc) • 10.6 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.schema = void 0;
// https://github.com/ehn-dcc-development/ehn-dcc-schema/blob/release/1.3.0/DCC.combined-schema.json
exports.schema = {
$id: "https://id.uvci.eu/DCC.combined-schema.json",
title: "EU DCC",
description: "EU Digital Covid Certificate",
$comment: "Schema version 1.3.0",
type: "object",
oneOf: [
{
required: ["ver", "nam", "dob", "v"],
},
{
required: ["ver", "nam", "dob", "t"],
},
{
required: ["ver", "nam", "dob", "r"],
},
],
properties: {
ver: {
title: "Schema version",
description: "Version of the schema, according to Semantic versioning (ISO, https://semver.org/ version 2.0.0 or newer)",
type: "string",
pattern: "^\\d+.\\d+.\\d+$",
examples: ["1.3.0"],
},
nam: {
description: "Surname(s), forename(s) - in that order",
$ref: "#/$defs/person_name",
},
dob: {
title: "Date of birth",
description: "Date of Birth of the person addressed in the DCC. ISO 8601 date format restricted to range 1900-2099 or empty",
type: "string",
pattern: "^((19|20)\\d\\d(-\\d\\d){0,2}){0,1}$",
examples: ["1979-04-14", "1950", "1901-08", ""],
},
v: {
description: "Vaccination Group",
type: "array",
items: {
$ref: "#/$defs/vaccination_entry",
},
minItems: 1,
maxItems: 1,
},
t: {
description: "Test Group",
type: "array",
items: {
$ref: "#/$defs/test_entry",
},
minItems: 1,
maxItems: 1,
},
r: {
description: "Recovery Group",
type: "array",
items: {
$ref: "#/$defs/recovery_entry",
},
minItems: 1,
maxItems: 1,
},
},
$defs: {
dose_posint: {
description: "Dose Number / Total doses in Series: positive integer",
type: "integer",
minimum: 1,
},
issuer: {
description: "Certificate Issuer",
type: "string",
maxLength: 80,
},
person_name: {
description: "Person name: Surname(s), forename(s) - in that order",
required: ["fnt"],
type: "object",
properties: {
fn: {
title: "Surname",
description: "The surname or primary name(s) of the person addressed in the certificate",
type: "string",
maxLength: 80,
examples: ["d'Červenková Panklová"],
},
fnt: {
title: "Standardised surname",
description: "The surname(s) of the person, transliterated ICAO 9303",
type: "string",
pattern: "^[A-Z<]*$",
maxLength: 80,
examples: ["DCERVENKOVA<PANKLOVA"],
},
gn: {
title: "Forename",
description: "The forename(s) of the person addressed in the certificate",
type: "string",
maxLength: 80,
examples: ["Jiřina-Maria Alena"],
},
gnt: {
title: "Standardised forename",
description: "The forename(s) of the person, transliterated ICAO 9303",
type: "string",
pattern: "^[A-Z<]*$",
maxLength: 80,
examples: ["JIRINA<MARIA<ALENA"],
},
},
},
certificate_id: {
description: "Certificate Identifier, format as per UVCI: Annex 2 in https://ec.europa.eu/health/sites/health/files/ehealth/docs/vaccination-proof_interoperability-guidelines_en.pdf",
type: "string",
maxLength: 80,
},
vaccination_entry: {
description: "Vaccination Entry",
required: ["tg", "vp", "mp", "ma", "dn", "sd", "dt", "co", "is", "ci"],
type: "object",
properties: {
tg: {
description: "disease or agent targeted",
$ref: "#/$defs/disease-agent-targeted",
},
vp: {
description: "vaccine or prophylaxis",
$ref: "#/$defs/vaccine-prophylaxis",
},
mp: {
description: "vaccine medicinal product",
$ref: "#/$defs/vaccine-medicinal-product",
},
ma: {
description: "Marketing Authorization Holder - if no MAH present, then manufacturer",
$ref: "#/$defs/vaccine-mah-manf",
},
dn: {
description: "Dose Number",
$ref: "#/$defs/dose_posint",
},
sd: {
description: "Total Series of Doses",
$ref: "#/$defs/dose_posint",
},
dt: {
description: "ISO8601 complete date: Date of Vaccination",
type: "string",
},
co: {
description: "Country of Vaccination",
$ref: "#/$defs/country_vt",
},
is: {
description: "Certificate Issuer",
$ref: "#/$defs/issuer",
},
ci: {
description: "Unique Certificate Identifier: UVCI",
$ref: "#/$defs/certificate_id",
},
},
},
test_entry: {
description: "Test Entry",
required: ["tg", "tt", "sc", "tr", "co", "is", "ci"],
type: "object",
properties: {
tg: {
$ref: "#/$defs/disease-agent-targeted",
},
tt: {
description: "Type of Test",
$ref: "#/$defs/test-type",
},
nm: {
description: "NAA Test Name",
type: "string",
maxLength: 80,
},
ma: {
description: "RAT Test name and manufacturer",
$ref: "#/$defs/test-manf",
},
sc: {
description: "Date/Time of Sample Collection",
type: "string",
},
tr: {
description: "Test Result",
$ref: "#/$defs/test-result",
},
tc: {
description: "Testing Centre",
type: "string",
maxLength: 80,
},
co: {
description: "Country of Test",
$ref: "#/$defs/country_vt",
},
is: {
description: "Certificate Issuer",
$ref: "#/$defs/issuer",
},
ci: {
description: "Unique Certificate Identifier, UVCI",
$ref: "#/$defs/certificate_id",
},
},
},
recovery_entry: {
description: "Recovery Entry",
required: ["tg", "fr", "co", "is", "df", "du", "ci"],
type: "object",
properties: {
tg: {
$ref: "#/$defs/disease-agent-targeted",
},
fr: {
description: "ISO 8601 complete date of first positive NAA test result",
type: "string",
},
co: {
description: "Country of Test",
$ref: "#/$defs/country_vt",
},
is: {
description: "Certificate Issuer",
$ref: "#/$defs/issuer",
},
df: {
description: "ISO 8601 complete date: Certificate Valid From",
type: "string",
},
du: {
description: "ISO 8601 complete date: Certificate Valid Until",
type: "string",
},
ci: {
description: "Unique Certificate Identifier, UVCI",
$ref: "#/$defs/certificate_id",
},
},
},
"disease-agent-targeted": {
description: "EU eHealthNetwork: Value Sets for Digital Covid Certificates. version 1.0, 2021-04-16, section 2.1",
type: "string",
},
"vaccine-prophylaxis": {
description: "EU eHealthNetwork: Value Sets for Digital Covid Certificates. version 1.0, 2021-04-16, section 2.2",
type: "string",
},
"vaccine-medicinal-product": {
description: "EU eHealthNetwork: Value Sets for Digital Covid Certificates. version 1.0, 2021-04-16, section 2.3",
type: "string",
},
"vaccine-mah-manf": {
description: "EU eHealthNetwork: Value Sets for Digital Covid Certificates. version 1.0, 2021-04-16, section 2.4",
type: "string",
},
country_vt: {
description: "Country of Vaccination / Test, ISO 3166 alpha-2 where possible",
type: "string",
pattern: "[A-Z]{1,10}",
},
"test-manf": {
description: "EU eHealthNetwork: Value Sets for Digital Covid Certificates. version 1.0, 2021-04-16, section 2.8",
type: "string",
},
"test-result": {
description: "EU eHealthNetwork: Value Sets for Digital Covid Certificates. version 1.0, 2021-04-16, section 2.9",
type: "string",
},
"test-type": {
description: "EU eHealthNetwork: Value Sets for Digital Covid Certificates. version 1.0, 2021-04-16, section 2.7",
type: "string",
},
},
};