happyuc-keyfile-recognizer
Version:
Checks for valid structure of happyuc webu-secret-storage/presale keyfiles
53 lines (37 loc) • 1.78 kB
Markdown
# happyuc-keyfile-recognizer
[](https://travis-ci.org/happyuc/happyuc-keyfile-recognizer) [](https://coveralls.io/github/happyuc/happyuc-keyfile-recognizer?branch=master) [](https://codeclimate.com/github/happyuc/happyuc-keyfile-recognizer) [](https://badge.fury.io/js/happyuc-keyfile-recognizer)
[](https://david-dm.org/happyuc/happyuc-keyfile-recognizer)
Checks for structural sanity (key-names and value-types) of `json`-keyfiles.
Currently recognized keyfiles:
- Hucersale
- [webu-secret-storage](https://github.com/happyuc-project/wiki/wiki/Webu-Secret-Storage-Definition) (v3)
- scrypt
- pbkdf2
## Installation
```shell
npm install --save happyuc-keyfile-recognizer
```
## Usage
```javascript
var fs = require('fs');
var recognizer = require('happyuc-keyfile-recognizer');
fs.readFile('keyfile.json', (err, data) => {
var json = JSON.parse(data);
var result = recognizer(json);
/** result
* [ 'webu', 3 ] webu (v3) keyfile
* [ 'hucersale', undefined ] Hucersale keyfile
* null no valid keyfile
*/
}));
```
## Development
To build and run the tests:
```shell
$ npm install
$ npm test
```
## Contributions
Contributions welcome - see [CONTRIBUTING.md](CONTRIBUTING.md)
## License
MIT - see [LICENSE.md](LICENSE.md)