<commit_before>The key store is implemented as a CouchDB database.
In the examples below, CouchDB is assumed to be running on localhost and listening on port 5984.
To create the key store:
~~~~~
./key_store_installer.py --log=INFO --delete=true
~~~~~
To get all MAC credentials currently saved in the key store:
~~~~~~
curl -s -X GET http://localhost:5984/creds/_design/creds/_view/all
~~~~~~
To get an existing set of creditials:
~~~~~
curl -s -X GET http://localhost:5984/creds/<MAC key identifier>
~~~~~
To get all credentials for a particular owner:
~~~~~
curl -s -X GET 'http://localhost:5984/creds/_design/creds/_view/by_owner?startkey="<EMAIL>"&endkey="<EMAIL>"'
~~~~~<commit_msg>update README.md with owner -> principal<commit_after>The Key Store is implemented as a [CouchDB](http://couchdb.apache.org/) database.
In the examples below, [CouchDB](http://couchdb.apache.org/) is assumed to be running
on localhost and listening on port 5984 and yar has been setup with the usual
~~~~~
cd; cd yar; source bin/cfg4dev; https://github.com/simonsdave/yar.git
~~~~~

To create a Key Store on a [CouchDB](http://couchdb.apache.org/) server
use [key_store_installer](../../bin/key_store_installer).

~~~~~
key_store_installer --log=INFO
~~~~~

[key_store_installer](../../bin/key_store_installer) has a number of command
line options. Use the --help option to list them.

~~~~~
key_store_installer --help
Usage: key_store_installer [options]

The Key Store Installer is a utility used to create and/or delete the CouchDB
database that implements yar's Key Store.

Options:
  -h, --help           show this help message and exit
  --log=LOGGING_LEVEL  logging level [DEBUG,INFO,WARNING,ERROR,CRITICAL,FATAL]
                       - default = ERROR
  --host=HOST          where's CouchDB running - default = 127.0.0.1:5984
  --database=DATABASE  database - default = creds
  --delete=DELETE      delete before creating key store - default = False
  --create=CREATE      create key store - default = True
~~~~~

To get all MAC credentials currently saved in the Key Store

~~~~~~
curl -s -X GET http://localhost:5984/creds/_design/creds/_view/all
~~~~~~

To get an existing set of credentials

~~~~~
curl -s -X GET http://localhost:5984/creds/<MAC key identifier>
~~~~~

To get all credentials for a principal

~~~~~
curl -s 'http://localhost:5984/creds/_design/creds/_view/by_principal?startkey="<EMAIL>"&endkey="<EMAIL>"'
~~~~~
{'fraction_non_alphanumeric': 0.1412685337726524, 'fraction_numerical': 0.01771004942339374, 'mean_word_length': 3.9774590163934427, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1170579', 'n_tokens_mistral': 797, 'n_tokens_neox': 763, 'n_words': 253}