diff options
Diffstat (limited to 'packages/anastasis-core/src')
-rw-r--r-- | packages/anastasis-core/src/anastasis-data.ts | 742 | ||||
-rw-r--r-- | packages/anastasis-core/src/crypto.test.ts | 16 | ||||
-rw-r--r-- | packages/anastasis-core/src/crypto.ts | 21 | ||||
-rw-r--r-- | packages/anastasis-core/src/index.ts | 14 |
4 files changed, 793 insertions, 0 deletions
diff --git a/packages/anastasis-core/src/anastasis-data.ts b/packages/anastasis-core/src/anastasis-data.ts new file mode 100644 index 000000000..4946e9dfd --- /dev/null +++ b/packages/anastasis-core/src/anastasis-data.ts @@ -0,0 +1,742 @@ +// This file is auto-generated, do not modify. +// Generated from v0.2.0-4-g61ea83c on Tue, 05 Oct 2021 10:40:32 +0200 +// To re-generate, run contrib/gen-ts.sh from the main anastasis code base. + +export const anastasisData = { + providersList: { + license: "GPLv3+", + "SPDX-License-Identifier": "GPL3.0-or-later", + anastasis_provider: [ + { + url: "https://anastasis.demo.taler.net/", + currency: "KUDOS", + }, + { + url: "https://kudos.demo.anastasis.lu/", + currency: "KUDOS", + }, + { + url: "http://localhost:8086/", + currency: "TESTKUDOS", + }, + { + url: "http://localhost:8087/", + currency: "TESTKUDOS", + }, + { + url: "http://localhost:8088/", + currency: "TESTKUDOS", + }, + { + url: "http://localhost:8089/", + currency: "TESTKUDOS", + }, + ], + }, + countriesList: { + license: "GPLv3+", + "SPDX-License-Identifier": "GPL3.0-or-later", + countries: [ + { + code: "al", + name: "Albania", + continent: "Europe", + name_i18n: { + de_DE: "Albanien", + en_UK: "Albania", + }, + currency: "ALL", + call_code: "+355", + }, + { + code: "be", + name: "Belgium", + continent: "Europe", + name_i18n: { + de_DE: "Belgien", + en_UK: "Belgium", + }, + currency: "EUR", + call_code: "+32", + }, + { + code: "ch", + name: "Switzerland", + continent: "Europe", + name_i18n: { + de_DE: "Schweiz", + de_CH: "Schwiiz", + fr_FR: "Suisse", + en_UK: "Swiss", + }, + currency: "CHF", + call_code: "+41", + }, + { + code: "cz", + name: "Czech Republic", + continent: "Europe", + name_i18n: { + en_UK: "Czech Republic", + }, + currency: "CZK", + call_code: "+420", + }, + { + code: "de", + name: "Germany", + continent: "Europe", + continent_i18n: { de_DE: "Europa" }, + name_i18n: { + de_DE: "Deutschland", + de_CH: "Deutschland", + fr_FR: "Allemagne", + en_UK: "Germany", + }, + currency: "EUR", + call_code: "+49", + }, + { + code: "dk", + name: "Denmark", + continent: "Europe", + continent_i18n: { de_DE: "Europa" }, + name_i18n: { + en_UK: "Denmark", + }, + currency: "DKK", + call_code: "+45", + }, + { + code: "es", + name: "Spain", + continent: "Europe", + continent_i18n: { es_ES: "Europa" }, + name_i18n: { + es_ES: "España", + }, + currency: "EUR", + call_code: "+44", + }, + { + code: "in", + name: "India", + continent: "India", + continent_i18n: { en_EN: "India" }, + name_i18n: { + de_DE: "Indien", + de_CH: "Indien", + fr_FR: "l'Inde", + en_UK: "India", + }, + currency: "INR", + call_code: "+91", + }, + { + code: "it", + name: "Italy", + continent: "Europe", + name_i18n: { + de_DE: "Italien", + en_UK: "Italy", + }, + currency: "EUR", + call_code: "+39", + }, + { + code: "jp", + name: "Japan", + continent: "Asia", + continent_i18n: { en_EN: "Japan" }, + name_i18n: { + de_DE: "Japan", + de_CH: "Japan", + en_UK: "Japan", + }, + currency: "JPY", + call_code: "+81", + }, + { + code: "sl", + name: "Slovakia", + continent: "Europe", + name_i18n: { + en_UK: "Slovakia", + }, + currency: "EUR", + call_code: "+421", + }, + { + code: "us", + name: "United States of America (USA)", + continent: "North America", + continent_i18n: { de_DE: "Nordamerika" }, + name_i18n: { + de_DE: "Vereinigte Staaten von Amerika (USA)", + de_CH: "Vereinigte Staaten von Amerika (USA)", + fr_FR: "États-Unis d'Amérique (USA)", + en_UK: "United States of America (USA)", + }, + currency: "USD", + call_code: "+1", + }, + { + code: "xx", + name: "Testland", + continent: "Testcontinent", + continent_i18n: { de_DE: "Testkontinent" }, + name_i18n: { + de_DE: "Testlandt", + de_CH: "Testlandi", + fr_FR: "Testpais", + en_UK: "Testland", + }, + currency: "TESTKUDOS", + call_code: "+00", + }, + { + code: "xy", + name: "Demoland", + continent: "Testcontinent", + continent_i18n: { de_DE: "Testkontinent" }, + name_i18n: { + de_DE: "Demolandt", + de_CH: "Demolandi", + fr_FR: "Demopais", + en_UK: "Demoland", + }, + currency: "KUDOS", + call_code: "+01", + }, + ], + }, + countryDetails: { + al: { + license: "GPLv3+", + "SPDX-License-Identifier": "GPL3.0-or-later", + required_attributes: [ + { + type: "string", + name: "full_name", + label: "Full name", + widget: "anastasis_gtk_ia_full_name", + uuid: "9e8f463f-575f-42cb-85f3-759559997331", + }, + { + type: "string", + name: "birthplace", + label: "Birthplace", + widget: "anastasis_gtk_ia_birthplace", + uuid: "4c822e8e-89c6-11eb-95c4-8b077ad8489f", + }, + { + type: "string", + name: "nid_number", + label: "Numri i Identitetit", + label_i18n: { + en: "Identity Number", + al: "Numri i Identitetit", + }, + widget: "anastasis_gtk_ia_nid_al", + uuid: "256e5d30-d65e-481b-9ac4-55f5ac03b24a", + "validation-regex": + "^[0-9A-T][0-9](((0|5)[0-9])|10|11|51|52)[0-9]{3}[A-W]$", + "validation-logic": "AL_NID_check", + }, + ], + }, + be: { + license: "GPLv3+", + "SPDX-License-Identifier": "GPL3.0-or-later", + required_attributes: [ + { + type: "string", + name: "full_name", + label: "Full name", + widget: "anastasis_gtk_ia_full_name", + uuid: "9e8f463f-575f-42cb-85f3-759559997331", + }, + { + type: "date", + name: "birthdate", + label: "Birthdate", + widget: "anastasis_gtk_ia_birthdate", + uuid: "83d655c7-bdb6-484d-904e-80c1058c8854", + }, + { + type: "string", + name: "birthplace", + label: "Birthplace", + widget: "anastasis_gtk_ia_birthplace", + uuid: "4c822e8e-89c6-11eb-95c4-8b077ad8489f", + }, + { + type: "string", + name: "nrn_number", + label: "National Register Number", + label_i18n: { + en: "National Register Number", + }, + widget: "anastasis_gtk_ia_nid_be", + uuid: "0452f99a-06f7-48bd-8ac0-2e4ed9a24560", + "validation-regex": "^[0-9]{11}$", + "validation-logic": "BE_NRN_check", + }, + ], + }, + ch: { + license: "GPLv3+", + "SPDX-License-Identifier": "GPL3.0-or-later", + required_attributes: [ + { + type: "string", + name: "full_name", + label: "Full name", + widget: "anastasis_gtk_ia_full_name", + uuid: "9e8f463f-575f-42cb-85f3-759559997331", + }, + { + type: "date", + name: "birthdate", + label: "Birthdate", + widget: "anastasis_gtk_ia_birthdate", + uuid: "83d655c7-bdb6-484d-904e-80c1058c8854", + }, + { + type: "string", + name: "birthplace", + label: "Birthplace", + widget: "anastasis_gtk_ia_birthplace", + uuid: "4c822e8e-89c6-11eb-95c4-8b077ad8489f", + }, + { + type: "string", + name: "ahv_number", + label: "AHV number", + label_i18n: { + de_DE: "AHV-Nummer", + de_CH: "AHV-Nummer", + }, + widget: "anastasis_gtk_ia_ahv", + uuid: "1da87570-ba16-4f62-8a7e-cbda92f51591", + "validation-regex": + "^(756).[0-9]{4}.[0-9]{4}.[0-9]{2}|(756)[0-9]{10}$", + "validation-logic": "CH_AHV_check", + }, + ], + }, + cz: { + license: "GPLv3+", + "SPDX-License-Identifier": "GPL3.0-or-later", + required_attributes: [ + { + type: "string", + name: "full_name", + label: "Full name", + widget: "anastasis_gtk_ia_full_name", + uuid: "9e8f463f-575f-42cb-85f3-759559997331", + }, + { + type: "string", + name: "birthplace", + label: "Birthplace", + widget: "anastasis_gtk_ia_birthplace", + uuid: "4c822e8e-89c6-11eb-95c4-8b077ad8489f", + }, + { + type: "string", + name: "birth_number", + label: "Birth Number", + label_i18n: { + en: "Birth Number", + cz: "rodné číslo", + }, + widget: "anastasis_gtk_ia_birthnumber_cz", + uuid: "03e3a05b-1192-44f1-ac36-7425512eee1a", + "validation-regex": + "^[0-9]{2}(((0|2|5|7)[0-9])|10|11|31|32|51|52|81|82)/[0-9]{3}[0-9]?$", + "validation-logic": "CZ_BN_check", + }, + ], + }, + de: { + license: "GPLv3+", + "SPDX-License-Identifier": "GPL3.0-or-later", + required_attributes: [ + { + type: "string", + name: "full_name", + label: "Full name", + widget: "anastasis_gtk_ia_full_name", + uuid: "9e8f463f-575f-42cb-85f3-759559997331", + }, + { + type: "date", + name: "birthdate", + label: "Birthdate", + widget: "anastasis_gtk_ia_birthdate", + uuid: "83d655c7-bdb6-484d-904e-80c1058c8854", + }, + { + type: "string", + name: "birthplace", + label: "Birthplace", + widget: "anastasis_gtk_ia_birthplace", + uuid: "4c822e8e-89c6-11eb-95c4-8b077ad8489f", + }, + { + type: "string", + name: "tax_number", + label: "Taxpayer identification number", + label_i18n: { + de_DE: "Steuerliche Identifikationsnummer", + en: "German taxpayer identification number", + }, + widget: "anastasis_gtk_ia_tax_de", + uuid: "dae48f85-e3ff-47a4-a4a3-ed981ed8c3c6", + "validation-regex": "^[0-9]{11}$", + "validation-logic": "DE_TIN_check", + }, + { + type: "string", + name: "social_security_number", + label: "Social security number", + label_i18n: { + de_DE: "Deutsche Sozialversicherungsnummer", + en: "German Social security number", + }, + widget: "anastasis_gtk_ia_ssn_de", + uuid: "d5e2aa79-1c88-4cf4-a4d2-252508b38e05", + "validation-regex": "^[0-9]{8}[[:upper:]][0-9]{3}$", + "validation-logic": "DE_SVN_check", + optional: true, + }, + ], + }, + dk: { + license: "GPLv3+", + "SPDX-License-Identifier": "GPL3.0-or-later", + required_attributes: [ + { + type: "string", + name: "full_name", + label: "Full name", + widget: "anastasis_gtk_ia_full_name", + uuid: "9e8f463f-575f-42cb-85f3-759559997331", + }, + { + type: "string", + name: "birthplace", + label: "Birthplace", + widget: "anastasis_gtk_ia_birthplace", + uuid: "4c822e8e-89c6-11eb-95c4-8b077ad8489f", + }, + { + type: "string", + name: "cpr_number", + label: "CPR-nummer", + label_i18n: { + en: "CPR Number", + dk: "CPR-nummer", + }, + widget: "anastasis_gtk_ia_cpr_dk", + uuid: "38f13a4d-4302-4ada-ada1-c3ff4a8ff689", + "validation-regex": + "^(0[1-9]|[1-2][0-9]|30|31)((0[1-9]|10|11|12))[0-9]{2}-[0-9A-Z]{4}$", + }, + ], + }, + es: { + license: "GPLv3+", + "SPDX-License-Identifier": "GPL3.0-or-later", + required_attributes: [ + { + type: "string", + name: "full_name", + label: "Full name", + widget: "anastasis_gtk_ia_full_name", + uuid: "9e8f463f-575f-42cb-85f3-759559997331", + }, + { + type: "date", + name: "birthdate", + label: "Birthdate", + widget: "anastasis_gtk_ia_birthdate", + uuid: "83d655c7-bdb6-484d-904e-80c1058c8854", + }, + { + type: "string", + name: "birthplace", + label: "Birthplace", + widget: "anastasis_gtk_ia_birthplace", + uuid: "4c822e8e-89c6-11eb-95c4-8b077ad8489f", + }, + { + type: "string", + name: "tax_number", + label: "Tax number", + label_i18n: { + es_ES: "Número de Identificación Fiscal (DNI, NIE)", + }, + widget: "anastasis_gtk_ia_es_dni", + uuid: "ac8bd865-6be8-445c-b650-6a18eef16a49", + "validation-regex": "^[0-9MXYZ][0-9]{7}[TRWAGMYFPDXBNJZSQVHLCKE]$", + "validation-logic": "ES_DNI_check", + }, + { + type: "string", + name: "ssn_number", + label: "Social security number", + label_i18n: { + es_ES: "Número de Seguridad Social", + }, + widget: "anastasis_gtk_ia_es_ssn", + uuid: "22396a19-f3bb-497e-b63a-961fd639140e", + "validation-regex": "^[0-9]{11}$", + }, + ], + }, + in: { + license: "GPLv3+", + "SPDX-License-Identifier": "GPL3.0-or-later", + required_attributes: [ + { + type: "string", + name: "full_name", + label: "Full name", + widget: "anastasis_gtk_ia_full_name", + uuid: "9e8f463f-575f-42cb-85f3-759559997331", + }, + { + type: "date", + name: "birthdate", + label: "Birthdate", + widget: "anastasis_gtk_ia_birthdate", + uuid: "83d655c7-bdb6-484d-904e-80c1058c8854", + }, + { + type: "string", + name: "birthplace", + label: "Birthplace", + widget: "anastasis_gtk_ia_birthplace", + uuid: "4c822e8e-89c6-11eb-95c4-8b077ad8489f", + }, + { + type: "string", + name: "aadhar_number", + label: "Aadhar number", + label_i18n: { + en: "Aadhar number", + }, + widget: "anastasis_gtk_ia_aadhar_in", + uuid: "55afe97a-98bc-48d1-bb37-a9658be3fdc9", + "validation-regex": "^[2-9]{1}[0-9]{3}\\s[0-9]{4}\\s[0-9]{4}$", + "validation-logic": "IN_AADHAR_check", + }, + ], + }, + it: { + license: "GPLv3+", + "SPDX-License-Identifier": "GPL3.0-or-later", + required_attributes: [ + { + type: "string", + name: "full_name", + label: "Full name", + widget: "anastasis_gtk_ia_full_name", + uuid: "9e8f463f-575f-42cb-85f3-759559997331", + }, + { + type: "string", + name: "birthplace", + label: "Birthplace", + widget: "anastasis_gtk_ia_birthplace", + uuid: "4c822e8e-89c6-11eb-95c4-8b077ad8489f", + }, + { + type: "string", + name: "fiscal_code", + label: "Codice fiscale", + label_i18n: { + it: "Codice fiscale", + en: "Fiscal code", + }, + widget: "anastasis_gtk_ia_cf_it", + uuid: "88f53c51-52ad-4d63-a163-ec042589f925", + "validation-regex": + "^[[:upper:]]{6}[0-9]{2}[A-EHLMPRT](([0-24-6][0-9])|(30|31|70|71))[A-MZ][0-9]{3}[A-Z]$", + "validation-logic": "IT_CF_check", + }, + ], + }, + jp: { + license: "GPLv3+", + "SPDX-License-Identifier": "GPL3.0-or-later", + required_attributes: [ + { + type: "string", + name: "full_name", + label: "Full name", + widget: "anastasis_gtk_ia_full_name", + uuid: "9e8f463f-575f-42cb-85f3-759559997331", + }, + { + type: "date", + name: "birthdate", + label: "Birthdate", + widget: "anastasis_gtk_ia_birthdate", + uuid: "83d655c7-bdb6-484d-904e-80c1058c8854", + }, + { + type: "string", + name: "birthplace", + label: "Birthplace", + widget: "anastasis_gtk_ia_birthplace", + uuid: "4c822e8e-89c6-11eb-95c4-8b077ad8489f", + }, + { + type: "string", + name: "my_number", + label: "My number", + label_i18n: { + en: "My number", + jp: "マイナンバー", + }, + widget: "anastasis_gtk_ia_my_jp", + uuid: "90848f42-a83e-4226-8186-329696c14152", + "validation-regex": "^[0-9]{12}$", + }, + ], + }, + sk: { + license: "GPLv3+", + "SPDX-License-Identifier": "GPL3.0-or-later", + required_attributes: [ + { + type: "string", + name: "full_name", + label: "Full name", + widget: "anastasis_gtk_ia_full_name", + uuid: "9e8f463f-575f-42cb-85f3-759559997331", + }, + { + type: "string", + name: "birthplace", + label: "Birthplace", + widget: "anastasis_gtk_ia_birthplace", + uuid: "4c822e8e-89c6-11eb-95c4-8b077ad8489f", + }, + { + type: "string", + name: "birth_number", + label: "Birth Number", + label_i18n: { + en: "Birth Number", + sk: "rodné číslo", + }, + widget: "anastasis_gtk_ia_birthnumber_sk", + uuid: "1cd372fe-2cea-4928-9f29-66f2bdd8555c", + "validation-regex": + "^[0-9]{2}(((0|2|5|7)[0-9])|10|11|31|32|51|52|81|82)/[0-9]{3}[0-9]?$", + "validation-logic": "CZ_BN_check", + }, + ], + }, + us: { + license: "GPLv3+", + "SPDX-License-Identifier": "GPL3.0-or-later", + required_attributes: [ + { + type: "string", + name: "full_name", + label: "Full name", + widget: "anastasis_gtk_ia_full_name", + uuid: "9e8f463f-575f-42cb-85f3-759559997331", + }, + { + type: "date", + name: "birthdate", + label: "Birthdate", + widget: "anastasis_gtk_ia_birthdate", + uuid: "83d655c7-bdb6-484d-904e-80c1058c8854", + }, + { + type: "string", + name: "birthplace", + label: "Birthplace", + widget: "anastasis_gtk_ia_birthplace", + uuid: "4c822e8e-89c6-11eb-95c4-8b077ad8489f", + }, + { + type: "string", + name: "social_security_number", + label: "Social security number", + label_i18n: { + en: "US Social security number", + }, + widget: "anastasis_gtk_ia_ssn_us", + uuid: "310a138c-b0b7-4985-b8b8-d00e765e9f9b", + "validation-regex": "^d{3}-d{2}-d{4}$", + }, + ], + }, + xx: { + license: "GPLv3+", + "SPDX-License-Identifier": "GPL3.0-or-later", + required_attributes: [ + { + type: "string", + name: "full_name", + label: "Full name", + widget: "anastasis_gtk_ia_full_name", + uuid: "9e8f463f-575f-42cb-85f3-759559997331", + }, + { + type: "date", + name: "birthdate", + label: "Birthdate", + widget: "anastasis_gtk_ia_birthdate", + uuid: "83d655c7-bdb6-484d-904e-80c1058c8854", + }, + { + type: "string", + name: "sq_number", + label: "Square number", + widget: "anastasis_gtk_xx_square", + uuid: "ed790bca-89bf-11eb-96f2-233996cf644e", + "validation-regex": "^[0-9]+$", + "validation-logic": "XX_SQUARE_check", + }, + ], + }, + xy: { + license: "GPLv3+", + "SPDX-License-Identifier": "GPL3.0-or-later", + required_attributes: [ + { + type: "string", + name: "full_name", + label: "Full name", + widget: "anastasis_gtk_ia_full_name", + uuid: "9e8f463f-575f-42cb-85f3-759559997331", + }, + { + type: "date", + name: "birthdate", + label: "Birthdate", + widget: "anastasis_gtk_ia_birthdate", + uuid: "83d655c7-bdb6-484d-904e-80c1058c8854", + }, + { + type: "string", + name: "prime_number", + label: "Prime number", + widget: "anastasis_gtk_xx_prime", + uuid: "39190a95-cacb-4412-8bae-1f7da3f980b4", + "validation-regex": "^[0-9]+$", + "validation-logic": "XY_PRIME_check", + }, + ], + }, + }, +}; diff --git a/packages/anastasis-core/src/crypto.test.ts b/packages/anastasis-core/src/crypto.test.ts new file mode 100644 index 000000000..346806fac --- /dev/null +++ b/packages/anastasis-core/src/crypto.test.ts @@ -0,0 +1,16 @@ +import test from "ava"; + +// Vector generated with taler-anastasis-tvg +const userIdVector = { + input_id_data: { + name: "Fleabag", + ssn: "AB123", + }, + input_server_salt: "FZ48EFS7WS3R2ZR4V53A3GFFY4", + output_id: + "YS45R6CGJV84K1NN7T14ZBCPVTZ6H15XJSM1FV0R748MHPV82SM0126EBZKBAAGCR34Q9AFKPEW1HRT2Q9GQ5JRA3642AB571DKZS18", +}; + +test("user ID derivation", async (t) => { + t.fail(); +}); diff --git a/packages/anastasis-core/src/crypto.ts b/packages/anastasis-core/src/crypto.ts new file mode 100644 index 000000000..54f27b646 --- /dev/null +++ b/packages/anastasis-core/src/crypto.ts @@ -0,0 +1,21 @@ +import { argon2id } from "hash-wasm"; + +async function userIdentifierDerive( + idData: any, + serverSalt: string, +): Promise<string> { + throw Error("not implemented"); +} + +// interface Keypair { +// pub: string; +// priv: string; +// } + +// async function accountKeypairDerive(): Promise<Keypair> {} + +// async function secureAnswerHash( +// answer: string, +// truthUuid: string, +// questionSalt: string, +// ): Promise<string> {} diff --git a/packages/anastasis-core/src/index.ts b/packages/anastasis-core/src/index.ts new file mode 100644 index 000000000..7a14440a6 --- /dev/null +++ b/packages/anastasis-core/src/index.ts @@ -0,0 +1,14 @@ +import { md5, sha1, sha512, sha3 } from 'hash-wasm'; + +async function run() { + console.log('MD5:', await md5('demo')); + + const int8Buffer = new Uint8Array([0, 1, 2, 3]); + console.log('SHA1:', await sha1(int8Buffer)); + console.log('SHA512:', await sha512(int8Buffer)); + + const int32Buffer = new Uint32Array([1056, 641]); + console.log('SHA3-256:', await sha3(int32Buffer, 256)); +} + +run();
\ No newline at end of file |