wrong regexp for pubsec authfile
While Silkaj's regexp for pubsec authfile format is :
regex_gannonce = compile(
"^pub: [1-9A-HJ-NP-Za-km-z]{43,44}\nsec: [1-9A-HJ-NP-Za-km-z]{88,90}.*$"
)
Duniterpy's one is :
regex_pubkey = re.compile("pub: ([1-9A-HJ-NP-Za-km-z]{43,44})", re.MULTILINE)
regex_signkey = re.compile("sec: ([1-9A-HJ-NP-Za-km-z]{87,90})", re.MULTILINE)
We can see that :
- for Silkaj, length is {88, 90} and it should be {87, 90}. So, Silkaj refuses valid privkeys.
- Silkaj only matches pubsec files that begin with
pub : XXX
and are not compatible with the pubsec format generated by Duniterpy.
Proposal :
either keep the newline between pub and sec lines (no ^ at the beginning and length {87, 90}:
regex_gannonce = compile(
"pub: [1-9A-HJ-NP-Za-km-z]{43,44}\nsec: [1-9A-HJ-NP-Za-km-z]{87,90}.*$"
)
or use Duniterpy's regexp as shown above, and change following "if" statement.
Consequences :
Silkaj will accept PubSec format compatible with Cesium and Duniterpy. However, it is not sure that this format is compatible with Duniter's one.
Duniter's Pubsec format :
pub : "<pubkey>"
sec : "<privkey>"
Pubsec V1 :
Type: PubSec
Version: 1
pub: <pubkey>
sec: <privkey>
Edited by matograine