From d6a30c5f2cdff3497c9972938afc74a4d8eb559d Mon Sep 17 00:00:00 2001 From: "[1000i100] Millicent Billette" <git@1000i100.fr> Date: Fri, 30 Sep 2022 16:57:25 +0200 Subject: [PATCH] v3.3.1 FIX: remove ambiguous isPubkey ( a deprecated version of isPubKey ) --- CHANGELOG.fr.md | 7 ++++++- npm/package.json | 2 +- src/crypto.mjs | 2 -- src/crypto.test.mjs | 1 - 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.fr.md b/CHANGELOG.fr.md index 006e1a3..eda12cd 100644 --- a/CHANGELOG.fr.md +++ b/CHANGELOG.fr.md @@ -15,6 +15,10 @@ et ce projet adhère au [versionnage sémantique](https://semver.org/spec/v2.0.0 ## [Non-publié/Non-Stabilisé] (par [1000i100]) +## [Version 3.3.1] - 2022-09-30 (par [1000i100]) +### Corrections +- suppression de crypto.isPubkey(pubkey) qui ne validait qu'à partir d'une regex contrairement à crypto.isPubKey(pubKey) qui effectue les vérifications implémentées dans la v3.3.0 + ## [Version 3.3.0] - 2022-09-30 (par [1000i100]) ### Ajouté - crypto.isPubKey(pubKey) identique à checkKey mais retourne vrai ou faux là où checkKey throw une erreur en cas d'échec de validation. @@ -86,8 +90,9 @@ et ce projet adhère au [versionnage sémantique](https://semver.org/spec/v2.0.0 - intégration des librairies de crypto nécessaires - calcul de la clef publique correspondant à chaque combinaison de secrets saisie, et comparaison à la clef publique de référence. -[Non-publié/Non-Stabilisé]: https://git.duniter.org/libs/g1lib.js/-/compare/v3.3.0...master +[Non-publié/Non-Stabilisé]: https://git.duniter.org/libs/g1lib.js/-/compare/v3.3.1...master +[Version 3.3.1]: https://git.duniter.org/libs/g1lib.js/-/compare/v3.3.0...v3.3.1 [Version 3.3.0]: https://git.duniter.org/libs/g1lib.js/-/compare/v3.2.0...v3.3.0 [Version 3.2.0]: https://git.duniter.org/libs/g1lib.js/-/compare/v3.1.0...v3.2.0 [Version 3.1.0]: https://git.duniter.org/libs/g1lib.js/-/compare/v3.0.3...v3.1.0 diff --git a/npm/package.json b/npm/package.json index 152c276..a6ca082 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "g1lib", - "version": "3.3.0", + "version": "3.3.1", "description": "An ubiquitous static javascript toolbox lib for Ǧ1 / Duniter ecosystem with reliability in mind.", "main": "nodejs/all.mjs", "browser": "browser/all.mjs", diff --git a/src/crypto.mjs b/src/crypto.mjs index 4ad6637..5fb9f29 100644 --- a/src/crypto.mjs +++ b/src/crypto.mjs @@ -13,8 +13,6 @@ const sha256 = sha(); const generateKeypair = nacl.sign.keyPair.fromSeed; -export const isPubkey = (value) => /^[A-HJ-NP-Za-km-z1-9]{42,45}$/.test(value) - export async function idSecPass2rawAll(idSec, pass) { const rawSeed = await saltPass2seed(idSec, pass); const keyPair = seed2keyPair(rawSeed); diff --git a/src/crypto.test.mjs b/src/crypto.test.mjs index d241c79..65e87ef 100644 --- a/src/crypto.test.mjs +++ b/src/crypto.test.mjs @@ -30,7 +30,6 @@ test('array sign string', async t => t.is((await app.sign(unsignedDocument, secr test('uint8array sign string', async t => t.is((await app.sign(unsignedDocument, secretKey, 'uint8array'))[0], 27)); test('sign throw for bad output format', async t => t.throwsAsync(() => app.sign(unsignedDocument, secretKey, 'whattt ?'))); -test("is a pubkey", (t) => t.is(app.isPubkey(pubKey), true)); test('b58 should decode/encode well', t => t.is(app.b58.encode(app.b58.decode(pubKey)), pubKey)); test('b58 on pubKey with leading 1', t => t.is(app.b58.encode(app.b58.decode('12BjyvjoAf5qik7R8TKDJAHJugsX23YgJGi2LmBUv2nx')), '12BjyvjoAf5qik7R8TKDJAHJugsX23YgJGi2LmBUv2nx')); test('b58 on pubKey without leading 1', t => t.is(app.b58.encode(app.b58.decode('2BjyvjoAf5qik7R8TKDJAHJugsX23YgJGi2LmBUv2nx')), '2BjyvjoAf5qik7R8TKDJAHJugsX23YgJGi2LmBUv2nx')); -- GitLab