This repository contains an implementation of specification of the parser for BIP32 path templates described in BIP-88 and specified by TLA+ specification at https://github.com/dgpv/bip32_template_parse_tplaplus_spec
The implementation is in bip32template.c
, public definitions is in bip32template.h
The code should be useable without standard library, (except for asserts).
It only imports <limits.h>
, <stdint.h>
and <assert.h>
.
Parse functions accept mode
argument:
BIP32_TEMPLATE_FORMAT_UNAMBIGOUS
to parse BIP32 template strings that are unambigous (specifiyng the range{1,2,3}
is not allowed, must be specified as{1-3}
BIP32_TEMPLATE_FORMAT_AMBIGOUS
to parse BIP32 template strings that allow specifiyng the range as{1,2,3}
BIP32_TEMPLATE_FORMAT_ONLYPATH
to parse just BIP32 paths (not templates) with the same code
The implementation recognizes both full and partial paths, but does not offer any facilities to combine the paths or to make sure that only full path is matched against full-path template, etc. This is a reference implementation, and the actual production implementation can implement these facilities as appropriate for their usecase, or maybe disable partial paths entirely.
Type make test
or just make
to run tests against included test/test_data.json
that was
generated by applying TLC checker to TLA+ spec with some post-processing.
Please look at test/test.c
for examples of using the public functions.
This implementation was created by Dmitry Petukhov (https://github.com/dgpv/)
Released under MIT license.