From f6cedec6382a0717170f7b197ea2451fd6883e98 Mon Sep 17 00:00:00 2001
From: Moul <moul@moul.re>
Date: Wed, 16 Jan 2019 18:45:37 +0100
Subject: [PATCH] [enh] #69: PubSec: Specify number of expected chars in the
 regex

- Imported from Silkaj
---
 duniterpy/key/signing_key.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/duniterpy/key/signing_key.py b/duniterpy/key/signing_key.py
index b2180caa..6fba6179 100644
--- a/duniterpy/key/signing_key.py
+++ b/duniterpy/key/signing_key.py
@@ -166,8 +166,8 @@ class SigningKey(libnacl.sign.Signer):
             pubsec_content = fh.read()
 
         # line patterns
-        regex_pubkey = compile("pub: ([1-9A-HJ-NP-Za-km-z]+)", MULTILINE)
-        regex_signkey = compile("sec: ([1-9A-HJ-NP-Za-km-z]+)", MULTILINE)
+        regex_pubkey = compile("pub: ([1-9A-HJ-NP-Za-km-z]{43,44})", MULTILINE)
+        regex_signkey = compile("sec: ([1-9A-HJ-NP-Za-km-z]{88,90})", MULTILINE)
 
         # check public key field
         match = search(regex_pubkey, pubsec_content)
-- 
GitLab