### Verify KERI Inception Event Message in Python Source: https://github.com/weboftrust/keripy/blob/main/ref/getting_started.md Demonstrates how to verify an inception event message using the keri.py library. It initializes a Kevery, parses an inception message, and checks its validity. Requires keri.core, keri.app, and keri.db modules. ```python import keri.core.eventing as eventing import keri.core.coring as coring import keri.core.parsing as parsing import keri.app.keeping as keeping import keri.db.dbing as dbing with dbing.openLMDB(name="edy") as db, keeping.openKS(name="edy") as kpr: # -----------------------Basic Transferable Identifier---------------------- salt = coring.Salter().qb64 # Init key pair manager mgr = keeping.Manager(ks=kpr, salt=salt) verfers, digers, _, _ = mgr.incept(icount=1, ncount=1) keys = [verfers[0].qb64] srdr = eventing.incept(keys=keys, ndigs=[digers[0].qb64], code=coring.MtrDex.Ed25519) sigers = mgr.sign(ser=srdr.raw, verfers=verfers) # Create the message msg = eventing.messagize(srdr, sigers=sigers) # --------------------------------Validation-------------------------------- kevery = eventing.Kevery(db=db) valid = True try: parsing.Parser().parseOne(ims=msg, kvy=kevery) except Exception: valid = False print("Valid: {}".format(valid)) print() ``` -------------------------------- ### Complete KeriPy Workflow Example (Bash) Source: https://context7.com/weboftrust/keripy/llms.txt A comprehensive bash script demonstrating a full KeriPy workflow, including initializing keystores, creating identifiers with witnesses, exchanging OOBIs for discovery, and initiating a credential registry. ```bash #!/bin/bash # Clean environment and start witnesses rm -rf /usr/local/var/keri/* kli witness demo & sleep 2 # Initialize keystores for issuer and holder kli init --name issuer --salt 0ACDEyMzQ1Njc4OWxtbm9aBc --nopasscode \ --config-dir ${KERI_SCRIPT_DIR} --config-file demo-witness-oobis kli init --name holder --salt 0ACDEyMzQ1Njc4OWxtbm9qWc --nopasscode \ --config-dir ${KERI_SCRIPT_DIR} --config-file demo-witness-oobis # Create identifiers with witnesses kli incept --name issuer --alias issuer --file ${KERI_DEMO_SCRIPT_DIR}/data/gleif-sample.json kli incept --name holder --alias holder --file ${KERI_DEMO_SCRIPT_DIR}/data/gleif-sample.json # Exchange OOBIs for mutual discovery kli oobi resolve --name issuer --oobi-alias holder \ --oobi http://127.0.0.1:5642/oobi/ELjSFdrTdCebJlmvbFNX9-TLhR2PO0_60al1kQp5_e6k/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha kli oobi resolve --name holder --oobi-alias issuer \ --oobi http://127.0.0.1:5642/oobi/EKxICWTx5Ph4EKq5xie2znZf7amggUn4Sd-2-46MIQTg/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha # Create credential registry kli vc registry incept --name issuer --alias issuer --registry-name vLEI ``` -------------------------------- ### Set Up KERI Development Environment Source: https://github.com/weboftrust/keripy/blob/main/docs/readme.rst Steps to set up a virtual environment for KERI development. This involves creating a virtual environment, activating it, and installing project dependencies from a requirements file. ```shell python3 -m venv keripy source keripy/bin/activate pip install -r requirements.txt ``` -------------------------------- ### C Code Readability Example Source: https://github.com/weboftrust/keripy/blob/main/ref/naming.md Demonstrates readable C code with proper indentation and whitespace compared to a less readable version. Emphasizes the importance of vertical whitespace and line length for code clarity. ```c void display(void) { int start; start = -1; if(start == -1) return; } ``` ```c void display(void){ int start; start = -1; if(start == -1) return; } ``` -------------------------------- ### Run KERI Eve Demo in Zsh Source: https://github.com/weboftrust/keripy/blob/main/src/keri/demo/demo.md This command executes the KERI Eve demo script. Eve starts as an agent, listening on TCP port 5621, and connects to Bob on port 5620. The output displays Eve's identifier and the initiation of the connection to Bob. ```zsh % python3 -m keri.demo.demo_eve Direct Mode demo of eve as EpDA1n-WiBA0A8YOqnKrB-wWQYYC49i5zY_qrIZIicQg on TCP port 5621 to port 5620. EpDA1n-WiBA0A8YOqnKrB-wWQYYC49i5zY_qrIZIicQg: connected to ('127.0.0.1', 5620). ``` -------------------------------- ### Install blake3-py Source: https://github.com/weboftrust/keripy/blob/main/ref/CypherSuites.md Installs the blake3-py package, which provides Python bindings for the official Rust implementation of BLAKE3. This package supports extendable output, keying, and multithreading. ```shell pip3 install blake3 ``` -------------------------------- ### Manage Witnesses with kli Source: https://context7.com/weboftrust/keripy/llms.txt Starts and manages witness infrastructure for KERI, facilitating receipt collection and event verification. Uses the 'kli' command-line tool. Options include starting demo witnesses, a single witness, and resolving witness OOBIs. ```bash # Start demo witnesses (3 witnesses on known ports) kli witness demo # Start a single witness kli witness start --name wan --port 5643 # In scripts, resolve witness OOBIs after starting kli oobi resolve --name my-keystore \ --oobi http://127.0.0.1:5643/oobi/BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM/controller \ --oobi-alias wan kli oobi resolve --name my-keystore \ --oobi http://127.0.0.1:5642/oobi/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha/controller \ --oobi-alias wil # Create identifier with witnesses and wait for receipts kli incept --name my-keystore --alias my-id --receipt-endpoint \ --wits BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha \ --wits BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM \ --toad 2 --icount 1 --isith 1 --ncount 1 --nsith 1 ``` -------------------------------- ### Rotate Keys for a KERI Identifier in Python Source: https://github.com/weboftrust/keripy/blob/main/ref/getting_started.md Illustrates the process of rotating keys for a KERI identifier using the keri.py library. It first creates a basic inception event, then generates new keys and creates a rotation event. Requires keri.core, keri.app, and keri.db modules. ```python import keri.core.eventing as eventing import keri.core.coring as coring import keri.app.keeping as keeping import keri.db.dbing as dbing with dbing.openLMDB(name="edy") as db, keeping.openKS(name="edy") as kpr: # -----------------------Basic Transferable Identifier---------------------- salt = coring.Salter().qb64 # Init key pair manager mgr = keeping.Manager(ks=kpr, salt=salt) verfers, digers, _, _ = mgr.incept(icount=1, ncount=1, transferable=True) keys = [verfers[0].qb64] srdr = eventing.incept(keys=keys, ndigs=[digers[0].qb64], code=coring.MtrDex.Ed25519) # code marks this identifier as basic print(srdr.raw.decode("utf-8")) print() # -------------------------------Basic Rotation----------------------------- verfers, digers, _, _ = mgr.rotate(verfers[0].qb64) # generate new keys # create rotation event identifier = srdr.pre keys = [verfers[0].qb64] icpDigest = srdr.saider.qb64 srdr = eventing.rotate(pre=identifier, keys=keys, dig=icpDigest, ndigs=[digers[0].qb64], sn=1) # Create rotation event print(srdr.raw.decode("utf-8")) print() ``` -------------------------------- ### Install Individual KERI Python Packages Source: https://github.com/weboftrust/keripy/blob/main/docs/readme.rst Installs individual Python packages for KERI dependencies separately using pip. This is an alternative to the consolidated installation command and allows for granular control over package installation. ```shell pip3 install -U lmdb pip3 install -U pysodium pip3 install -U blake3 pip3 install -U msgpack pip3 install -U simplejson pip3 install -U cbor2 ``` -------------------------------- ### Install KERI Python Packages Source: https://github.com/weboftrust/keripy/blob/main/docs/readme.rst Installs all necessary Python packages for KERI using pip. This command ensures all dependencies like lmdb, pysodium, blake3, msgpack, simplejson, and cbor2 are installed or upgraded. ```shell pip3 install -U lmdb pysodium blake3 msgpack simplejson cbor2 ``` -------------------------------- ### Create and Sign KERI Inception Event in Python Source: https://github.com/weboftrust/keripy/blob/main/ref/getting_started.md This Python code snippet demonstrates how to create and sign a KERI inception event message using the keri library. It involves initializing a key pair manager, generating keys, creating the inception event, signing it, and then packaging it into a complete message. ```python import keri.core.eventing as eventing import keri.core.coring as coring import keri.app.keeping as keeping import keri.db.dbing as dbing with dbing.openLMDB(name="edy") as db, keeping.openKS(name="edy") as kpr: # -----------------------Basic Transferable Identifier---------------------- salt = coring.Salter().qb64 # Init key pair manager mgr = keeping.Manager(ks=kpr, salt=salt) verfers, digers, _, _ = mgr.incept(icount=1, ncount=1) keys = [verfers[0].qb64] srdr = eventing.incept(keys=keys, ndigs=[digers[0].qb64], code=coring.MtrDex.Ed25519) sigers = mgr.sign(ser=srdr.raw, verfers=verfers) # Create the message msg = eventing.messagize(srdr, sigers=sigers) print(msg) print() ``` -------------------------------- ### Example Credential Data Source: https://context7.com/weboftrust/keripy/llms.txt Example JSON data structure for a verifiable credential, specifically for a LEI (Legal Entity Identifier). This file would be referenced by the '--data @credential-data.json' argument in 'kli vc create'. ```json { "LEI": "254900OPPU84GM83MG36" } ``` -------------------------------- ### KERI Initialization (icp) Message Example Source: https://github.com/weboftrust/keripy/blob/main/src/keri/demo/vectors/eve.2021-03-08_23-41-40_603809.txt This snippet shows an example of an initialization (icp) message in the KERI protocol. It contains version, identifier, sequence number, message type, key configuration, and endorsements. This is a fundamental message for establishing a new KERI agent. ```json {"v":"KERI10JSON0000e6_","i":"EH7Oq9oxCgYa-nnNLvwhp9sFZpALILlRYyB-6n4WDi7w","s":"0","t":"icp","kt":"1","k":["DSuhyBcPZEZLK-fcw5tzHn2N46wRCG_ZOoeKtWTOunRA"],"n":"EPYuj8mq_PYYsoBKkzX1kxSPGYBWaIya3slgCOyOtlqU","wt":"0","w":[],"c":[]}-AABAAmDoPp9jDio1hznNDO-3T2KA_FUbY8f_qybT6_FqPAuf89e9AMDXP5wch6jvT4Ev4QRp8HqtTb9t2Y6_KJPYlBw ``` -------------------------------- ### Python Docstring Formatting (Google Style) Source: https://github.com/weboftrust/keripy/blob/main/ref/naming.md Demonstrates the Google style for multi-line docstrings, including argument and return value descriptions. This format is used for code documentation within KERIpy, compatible with sphinx.ext.napoleon. ```python def func(arg1, arg2): """Summary line. Extended description of function. Args: arg1 (int): Description of arg1 arg2 (str): Description of arg2 Returns: bool: Description of return value """ return True ``` -------------------------------- ### SkelHab for Parsing and Signing (Python) Source: https://github.com/weboftrust/keripy/blob/main/ref/MultiHab.md SkelHab provides basic functionality for parsing and signing events. It serves as a starting point for more complex Hab implementations. ```python class SkelHab: def parse_event(self, serder, sigers): # Implementation for parsing events pass def sign_event(self, serder): # Implementation for signing events pass ``` -------------------------------- ### KERI Validator Receipt JSON Example Source: https://github.com/weboftrust/keripy/blob/main/ref/getting_started.md This JSON object represents a validator receipt in the KERI protocol. It confirms the reception of an event message and includes identifiers for the event and the receipt. ```json { "v":"KERI10JSON000105_", "i":"EsU9ZQwug7DS-GU040Ugj1t7p6Au14VkBOCJnPYabcas", "s":"2", "t":"vrc", "d":"EuCLxtdKdRgzzgBnPhTwFKz36u58DqQyMqhX5CUrurPE", "a":{ "i":"EBiIFxr_o1b4x1YR21PblAFpFG61qDghqFBDyVSOXYW0", "s":"0", "d":"ElsHFkbZQjRb7xHnuE-wyiarIZ9j-1CEQ89I0E3WevcE" } } ``` -------------------------------- ### Run KERI Bob Demo (Zsh) Source: https://github.com/weboftrust/keripy/blob/main/src/keri/demo/demo.md This command executes the Bob demonstration script for KERI. It initiates a direct mode communication, establishes a connection, and logs the sent and received events, including initialization (icp), verification (vrc), rotation (rot), and interaction (ixn) messages. No external dependencies are required beyond Python 3 and the KERI library. ```zsh % python3 -m keri.demo.demo_bob Direct Mode demo of bob as EH7Oq9oxCgYa-nnNLvwhp9sFZpALILlRYyB-6n4WDi7w on TCP port 5620 to port 5621. EH7Oq9oxCgYa-nnNLvwhp9sFZpALILlRYyB-6n4WDi7w: connected to ('127.0.0.1', 5621). EH7Oq9oxCgYa-nnNLvwhp9sFZpALILlRYyB-6n4WDi7w sent event: b'{"v":"KERI10JSON0000e6_","i":"EH7Oq9oxCgYa-nnNLvwhp9sFZpALILlRYyB-6n4WDi7w","s":"0","t":"icp","kt":"1","k":["DSuhyBcPZEZLK-fcw5tzHn2N46wRCG_ZOoeKtWTOunRA"],"n":"EPYuj8mq_PYYsoBKkzX1kxSPGYBWaIya3slgCOyOtlqU","wt":"0","w":[],"c":[]}-AABAAmDoPp9jDio1hznNDO-3T2KA_FUbY8f_qybT6_FqPAuf89e9AMDXP5wch6jvT4Ev4QRp8HqtTb9t2Y6_KJPYlBw' EH7Oq9oxCgYa-nnNLvwhp9sFZpALILlRYyB-6n4WDi7w received: bytearray(b'{"v":"KERI10JSON0000e6_","i":"EpDA1n-WiBA0A8YOqnKrB-wWQYYC49i5zY_qrIZIicQg","s":"0","t":"icp","kt":"1","k":["D8KY1sKmgyjAiUDdUBPNPyrSz_ad_Qf9yzhDNZlEKiMc"],"n":"EOWDAJvex5dZzDxeHBANyaIoUG3F4-ic81G6GwtnC4f4","wt":"0","w":[],"c":[]}-AABAAll_W0_FsjUyJnYokSNPqq7xdwIBs0ebq2eUez6RKNB-UG_y6fD0e6fb_nANvmNCWjsoFjWv3XP3ApXUabMgyBA{"v":"KERI10JSON000105_","i":"EH7Oq9oxCgYa-nnNLvwhp9sFZpALILlRYyB-6n4WDi7w","s":"0","t":"vrc","d":"EEnwxEm5Bg5s5aTLsgQCNpubIYzwlvMwZIzdOM0Z3u7o","a":{"i":"EpDA1n-WiBA0A8YOqnKrB-wWQYYC49i5zY_qrIZIicQg","s":"0","d":"EGFSGYH2BjtKwX1osO0ZvLw98nuuo3lMkveRoPIJzupo"}}-AABAAb6S-RXeAqUKl8UuNwYpiaFARhMj-95elxmr7uNU8m7buVSPVLbTWcQYfI_04HoP_A_fvlU_b099fiEJyDSA2Cg') EH7Oq9oxCgYa-nnNLvwhp9sFZpALILlRYyB-6n4WDi7w sent cue: {'pre': 'EpDA1n-WiBA0A8YOqnKrB-wWQYYC49i5zY_qrIZIicQg', 'serder': } EH7Oq9oxCgYa-nnNLvwhp9sFZpALILlRYyB-6n4WDi7w sent chit: b'{"v":"KERI10JSON000105_","i":"EpDA1n-WiBA0A8YOqnKrB-wWQYYC49i5zY_qrIZIicQg","s":"0","t":"vrc","d":"EGFSGYH2BjtKwX1osO0ZvLw98nuuo3lMkveRoPIJzupo","a":{"i":"EH7Oq9oxCgYa-nnNLvwhp9sFZpALILlRYyB-6n4WDi7w","s":"0","d":"EEnwxEm5Bg5s5aTLsgQCNpubIYzwlvMwZIzdOM0Z3u7o"}}-AABAAZqxNTt_LDZnmwEIaJX0cK9VKkCGq1UieEx6881MKKOtlRirvs_4pzFgmw3aRwAaIM2XV0biQ7xHeOoXglluDCA' EH7Oq9oxCgYa-nnNLvwhp9sFZpALILlRYyB-6n4WDi7w sent event: b'{"v":"KERI10JSON000122_","i":"EH7Oq9oxCgYa-nnNLvwhp9sFZpALILlRYyB-6n4WDi7w","s":"1","t":"rot","p":"EEnwxEm5Bg5s5aTLsgQCNpubIYzwlvMwZIzdOM0Z3u7o","kt":"1","k":["DVcuJOOJF1IE8svqEtrSuyQjGTd2HhfAkt9y2QkUtFJI"],"n":"E-dapdcC6XR1KWmWDsNl4J_OxcGxNZw1Xd95JH5a34fI","wt":"0","wr":[],"wa":[],"a":[]}-AABAAEuHTj2jo-QgGg1FP0tq_q2MjCeJnzYoJY1Iw2h4ov3J4ki82aHDWxYhxMiXX-E8b0vRDfr3-EB11ofd_zx3cBQ' EH7Oq9oxCgYa-nnNLvwhp9sFZpALILlRYyB-6n4WDi7w received: bytearray(b'{"v":"KERI10JSON000105_","i":"EH7Oq9oxCgYa-nnNLvwhp9sFZpALILlRYyB-6n4WDi7w","s":"1","t":"vrc","d":"Enrq74_Q11S2vHx1gpK_46Ik5Q7Yy9K1zZ5BavqGDKnk","a":{"i":"EpDA1n-WiBA0A8YOqnKrB-wWQYYC49i5zY_qrIZIicQg","s":"0","d":"EGFSGYH2BjtKwX1osO0ZvLw98nuuo3lMkveRoPIJzupo"}}-AABAAb1BJLLTkcTlefF1DOPKiOixLgQqnqxRsqEqGaaADLNwQ-uDeb2nNTQBB6SeclaihimPg9QwLnulUbdgYxI5ADg') EH7Oq9oxCgYa-nnNLvwhp9sFZpALILlRYyB-6n4WDi7w sent event: b'{"v":"KERI10JSON000098_","i":"EH7Oq9oxCgYa-nnNLvwhp9sFZpALILlRYyB-6n4WDi7w","s":"2","t":"ixn","p":"Enrq74_Q11S2vHx1gpK_46Ik5Q7Yy9K1zZ5BavqGDKnk","a":[]}-AABAARxj7iqT5m3wQIPOfCPFkeGEw1j5QY-lXbRGaRSVxzW9SZIX-mXJfIjs7m6MlaYFEIJs3fiCWCj9JdUz0BHlRDA' EH7Oq9oxCgYa-nnNLvwhp9sFZpALILlRYyB-6n4WDi7w received: bytearray(b'{"v":"KERI10JSON000105_","i":"EH7Oq9oxCgYa-nnNLvwhp9sFZpALILlRYyB-6n4WDi7w","s":"2","t":"vrc","d":"E-5RimdY_OWoreR-Z-Q5G81-I4tjASJCaP_MqkBbtM2w","a":{"i":"EpDA1n-WiBA0A8YOqnKrB-wWQYYC49i5zY_qrIZIicQg","s":"0","d":"EGFSGYH2BjtKwX1osO0ZvLw98nuuo3lMkveRoPIJzupo"}}-AABAA71XY3Y7gt3FQ3RkRDN2JN5wsKVFSqxc55yBl3PecKEpSSn_tjjtKxhvZZgWtvUxHiaSt94h8huBZ0jVdWeM6DA') ``` -------------------------------- ### KERI Interaction Event JSON Example Source: https://github.com/weboftrust/keripy/blob/main/ref/getting_started.md This JSON object represents an interaction event in the KERI protocol. It includes version, identifier, sequence number, event type, and a reference to the previous event. ```json { "v":"KERI10JSON000098_", "i":"EsU9ZQwug7DS-GU040Ugj1t7p6Au14VkBOCJnPYabcas", "s":"2", "t":"ixn", "p":"EO7V6wDClWWiN_7sfGDTD8KsfRQaHyap6fz_O4CYvsek", "a":[] } ``` -------------------------------- ### KERI Inception Event JSON Example Source: https://github.com/weboftrust/keripy/blob/main/ref/getting_started.md This JSON object represents an inception event in the KERI protocol. It includes version, identifier, sequence number, event type, keys, and other relevant metadata. ```json { "v":"KERI10JSON0000e6_", "i":"EsU9ZQwug7DS-GU040Ugj1t7p6Au14VkBOCJnPYabcas", "s":"0", "t":"icp", "kt":"1", "k":[ "Dpt7mGZ3y5UmhT1NLExb1IW8vMJ8ylQW3K44LfkTgAqE" ], "n":"Erpltchg7BUv21Qz3ZXhOhVu63m7S7YbPb21lSeGYd90", "wt":"0", "w":[], "c":[] } ``` -------------------------------- ### KERI Rotation Event JSON Example Source: https://github.com/weboftrust/keripy/blob/main/ref/getting_started.md This JSON object represents a rotation event in the KERI protocol. It includes version, identifier, sequence number, event type, previous event identifier, new keys, and other metadata. ```json { "v":"KERI10JSON000122_", "i":"EsU9ZQwug7DS-GU040Ugj1t7p6Au14VkBOCJnPYabcas", "s":"1", "t":"rot", "p":"Ey2pXEnaoQVwxA4jB6k0QH5G2Us-0juFL5hOAHAwIEkc", "kt":"1", "k":[ "D-HwiqmaETxls3vAVSh0xpXYTs94NUJX6juupWj_EgsA" ], "n":"ED6lKZwg-BWl_jlCrjosQkOEhqKD4BJnlqYqWmhqPhaU", "wt":"0", "wr":[], "wa":[], "a":[] } ``` -------------------------------- ### Create Abandoned Self-Addressing Identifier (Python) Source: https://github.com/weboftrust/keripy/blob/main/ref/getting_started.md Illustrates the creation of an abandoned self-addressing identifier. This is for educational purposes and typically achieved through rotation, not inception. The example shows an inception event with a transferable derivation code but an empty next key state. ```python import keri.core.eventing as eventing import keri.core.coring as coring import keri.app.keeping as keeping import keri.db.dbing as dbing with dbing.openLMDB(name="edy") as db, keeping.openKS(name="edy") as kpr: # ----------Abandoned Self-Addressing Identifier(Non Transferable)---------- # Has a transferable derivation code, but contains an empty pre-rotation key. Essentially the identifier has been # abandoned. This example is for illustration purposes only you should never need to abandon a self-addressing # identifier on inception. Normally this is done with a rotation. salt = coring.Salter().qb64 # Init key pair manager mgr = keeping.Manager(ks=kpr, salt=salt) verfers, _, _, _ = mgr.incept(icount=1, ncount=0, transferable=True) srdr = eventing.incept(keys=[verfers[0].qb64], code=coring.MtrDex.Blake3_256) # empty nxt i.e. abandoned print(srdr.raw.decode("utf-8")) print() ``` -------------------------------- ### Run KERI Bob Demo in Zsh Source: https://github.com/weboftrust/keripy/blob/main/src/keri/demo/demo.md This command initiates the KERI Bob demo script. It starts Bob as an agent, listening on TCP port 5620, and prepares it to communicate with another agent on port 5621. The output shows Bob's identifier and its listening port. ```zsh % python3 -m keri.demo.demo_bob Direct Mode demo of bob as EH7Oq9oxCgYa-nnNLvwhp9sFZpALILlRYyB-6n4WDi7w on TCP port 5620 to port 5621. ``` -------------------------------- ### Rotate Self-Addressing Transferable Identifier (Python) Source: https://github.com/weboftrust/keripy/blob/main/ref/getting_started.md Demonstrates the rotation of a self-addressing transferable KERI identifier. It first creates a transferable identifier and then generates a rotation event, updating the keys and including the previous inception digest. ```python import keri.core.eventing as eventing import keri.core.coring as coring import keri.app.keeping as keeping import keri.db.dbing as dbing with dbing.openLMDB(name="edy") as db, keeping.openKS(name="edy") as kpr: # -------------------------------------------------------------------------- # --------------------------Transferable Identifiers------------------------ # -------------------------------------------------------------------------- # ------------------Self-Addressing Transferable Identifier----------------- salt = coring.Salter().qb64 # Init key pair manager mgr = keeping.Manager(ks=kpr, salt=salt) verfers, digers, _, _ = mgr.incept(icount=1, ncount=1, transferable=True) keys = [verfers[0].qb64] srdr = eventing.incept(keys=keys, ndigs=[digers[0].qb64], code=coring.MtrDex.Blake3_256) # code marks identifier as self-addressing print(srdr.raw.decode("utf-8")) print() # --------------------------Self-Addressing Rotation------------------------ verfers, digers, _, _ = mgr.rotate(verfers[0].qb64) # generate new keys # create rotation event identifier = srdr.pre keys = [verfers[0].qb64] icpDigest = srdr.saider.qb64 srdr = eventing.rotate(pre=identifier, keys=keys, dig=icpDigest, ndigs=[digers[0].qb64], sn=1) print(srdr.raw.decode("utf-8")) print() ``` -------------------------------- ### Initialize KERI Keystore Source: https://context7.com/weboftrust/keripy/llms.txt Initializes a new KERI keystore and database to store cryptographic keys and event logs. This can be done via the command line or the Python API. Options include specifying a name, passcode, salt for deterministic generation, and configuration directory for witnesses. ```bash # Initialize a new keystore with a name and optional passcode kli init --name my-keystore --nopasscode # Initialize with a salt for deterministic key generation kli init --name my-keystore --salt 0ACDEyMzQ1Njc4OWxtbm9aBc --nopasscode # Initialize with configuration directory for witnesses kli init --name my-keystore --nopasscode --config-dir /path/to/config --config-file demo-witness-oobis ``` -------------------------------- ### Create Non-Transferable Self-Addressing Identifier (Python) Source: https://github.com/weboftrust/keripy/blob/main/ref/getting_started.md Demonstrates the creation of a non-transferable, self-addressing identifier using the KERI Python library. It initializes a key pair manager and generates an inception event with a non-transferable derivation code. ```python import keri.core.eventing as eventing import keri.core.coring as coring import keri.app.keeping as keeping import keri.db.dbing as dbing with dbing.openLMDB(name="edy") as db, keeping.openKS(name="edy") as kpr: # -------------------------------------------------------------------------- # -----------------------Non Transferable Identifiers----------------------- # -------------------------------------------------------------------------- # -----------------Self-Addressing Non Transferable Identifier-------------- salt = coring.Salter().qb64 # Init key pair manager mgr = keeping.Manager(ks=kpr, salt=salt) verfers, _, _, _ = mgr.incept(icount=1, ncount=0, transferable=False) # set a non transferable derivation code srdr = eventing.incept(keys=[verfers[0].qb64], code=coring.MtrDex.Blake3_256) # code marks identifier as self-addressing print(srdr.raw.decode("utf-8")) print() ``` -------------------------------- ### Run Eve Demo with make Source: https://github.com/weboftrust/keripy/blob/main/interop/README.md Executes the demo for the 'Eve' participant using the make command. This is part of the interoperability testing for KERIpy. ```shell make demo-eve ``` -------------------------------- ### Run Bob Demo with make Source: https://github.com/weboftrust/keripy/blob/main/interop/README.md Executes the demo for the 'Bob' participant using the make command. This is part of the interoperability testing for KERIpy. ```shell make demo-bob ``` -------------------------------- ### Create Non-Transferable Self-Addressing Multisig Identifier (Python) Source: https://github.com/weboftrust/keripy/blob/main/ref/getting_started.md Initializes a key pair manager and creates a non-transferable self-addressing multisig identifier. It uses a salt for key derivation and specifies the number of signing keys and threshold for multisig. ```python import keri.core.eventing as eventing import keri.core.coring as coring import keri.app.keeping as keeping import keri.db.dbing as dbing with dbing.openLMDB(name="edy") as db, keeping.openKS(name="edy") as kpr: # ------------Self-Addressing Non Transferable Multisig Identifier---------- salt = coring.Salter().qb64 # Init key pair manager mgr = keeping.Manager(ks=kpr, salt=salt) verfers, _, _, _ = mgr.incept(icount=3, ncount=0, transferable=False) srdr = eventing.incept(keys=[verfer.qb64 for verfer in verfers], code=coring.MtrDex.Blake3_256) # code marks identifier as self-addressing print(srdr.raw.decode("utf-8")) print() ``` -------------------------------- ### Create Self-Addressing Transferable Identifier (Python) Source: https://github.com/weboftrust/keripy/blob/main/ref/getting_started.md Shows how to create a self-addressing, transferable KERI identifier. This involves initializing a key pair manager and generating an inception event that includes both public keys and next key digests. ```python import keri.core.eventing as eventing import keri.core.coring as coring import keri.app.keeping as keeping import keri.db.dbing as dbing with dbing.openLMDB(name="edy") as db, keeping.openKS(name="edy") as kpr: # -------------------------------------------------------------------------- # --------------------------Transferable Identifiers------------------------ # -------------------------------------------------------------------------- # ------------------Self-Addressing Transferable Identifier----------------- salt = coring.Salter().qb64 # Init key pair manager mgr = keeping.Manager(ks=kpr, salt=salt) verfers, digers, _, _ = mgr.incept(icount=1, ncount=1, transferable=True) keys = [verfers[0].qb64] srdr = eventing.incept(keys=keys, ndigs=[digers[0].qb64], code=coring.MtrDex.Blake3_256) # code marks identifier as self-addressing print(srdr.raw.decode("utf-8")) print() ``` -------------------------------- ### Run Sam Demo with make Source: https://github.com/weboftrust/keripy/blob/main/interop/README.md Executes the demo for the 'Sam' participant using the make command. This is part of the interoperability testing for KERIpy. ```shell make demo-sam ``` -------------------------------- ### Create Basic Non-Transferable Identifier (Python) Source: https://github.com/weboftrust/keripy/blob/main/ref/getting_started.md Generates a basic, non-transferable KERI identifier using the keripy library. This involves initializing a key pair manager and creating an inception event. The output is the raw inception event data. ```python import keri.core.eventing as eventing import keri.core.coring as coring import keri.app.keeping as keeping import keri.db.dbing as dbing with dbing.openLMDB(name="edy") as db, keeping.openKS(name="edy") as kpr: # -------------------------------------------------------------------------- # -----------------------Non Transferable Identifiers----------------------- # -------------------------------------------------------------------------- # ---------------------Basic Non Transferable Identifier-------------------- salt = coring.Salter().qb64 # Init key pair manager mgr = keeping.Manager(ks=kpr, salt=salt) verfers, _, _, _ = mgr.incept(icount=1, ncount=0) srdr = eventing.incept(keys=[verfers[0].qb64], code=coring.MtrDex.Ed25519) # code marks this identifier as basic print(srdr.raw.decode("utf-8")) print() ``` -------------------------------- ### Resolve OOBIs (Out-of-Band Introductions) with kli Source: https://context7.com/weboftrust/keripy/llms.txt Resolves Out-of-Band Introductions (OOBIs) to discover and verify remote identifiers, optionally using witnesses or specific endpoints. Requires the 'kli' command-line tool. Usage involves specifying keystore name and OOBI URLs. ```bash # Resolve a witness OOBI kli oobi resolve --name my-keystore \ --oobi http://127.0.0.1:5642/oobi/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha/controller \ --oobi-alias wan # Resolve an identifier OOBI through a witness kli oobi resolve --name my-keystore \ --oobi http://127.0.0.1:5642/oobi/ELjSFdrTdCebJlmvbFNX9-TLhR2PO0_60al1kQp5_e6k/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha \ --oobi-alias remote-party # Force re-resolution of previously resolved OOBI kli oobi resolve --name my-keystore --oobi http://example.com/oobi/... --force ``` -------------------------------- ### Rotate Transferable Self-Addressing Multisig Identifier (Python) Source: https://github.com/weboftrust/keripy/blob/main/ref/getting_started.md Performs a rotation on an existing transferable self-addressing multisig identifier. It first creates an inception event for a transferable identifier, then generates new keys and creates a rotation event with an updated sequence number. ```python import keri.core.eventing as eventing import keri.core.coring as coring import keri.app.keeping as keeping import keri.db.dbing as dbing with dbing.openLMDB(name="edy") as db, keeping.openKS(name="edy") as kpr: # --------------Self-Addressing Transferable Multisig Identifier------------ # ---------Self-Addressing Transferable Multisig Identifier Rotation-------- salt = coring.Salter().qb64 # Init key pair manager mgr = keeping.Manager(ks=kpr, salt=salt) verfers, digers, _, _ = mgr.incept(icount=3, ncount=3, transferable=True) keys = [verfer.qb64 for verfer in verfers] srdr = eventing.incept(keys=keys, ndigs=[diger.qb64 for diger in digers], code=coring.MtrDex.Blake3_256) # code marks identifier as self-addressing print(srdr.raw.decode("utf-8")) print() # ---------Self-Addressing Transferable Multisig Identifier Rotation-------- verfers, digers, _, _ = mgr.rotate(verfers[0].qb64, count=3) # generate 3 new keys # create rotation event identifier = srdr.pre keys = [verfer.qb64 for verfer in verfers] icpDigest = srdr.saider.qb64 srdr = eventing.rotate(pre=identifier, keys=keys, dig=icpDigest, ndigs=[digers[0].qb64], sn=1) print(srdr.raw.decode("utf-8")) print() ``` -------------------------------- ### Initialize KERI Keystore using Python API Source: https://context7.com/weboftrust/keripy/llms.txt Initializes a KERI keystore and database using Python context managers for temporary databases or the Habery for full habitat management. This involves opening LMDB and KeyStore, generating a salt, and creating a manager. The Habery provides a comprehensive environment for managing KERI habitats. ```python import keri.core.coring as coring import keri.app.keeping as keeping import keri.db.dbing as dbing from keri.app import habbing # Using context managers for temporary databases (testing) with dbing.openLMDB(name="test") as db, keeping.openKS(name="test") as kpr: salt = coring.Salter().qb64 mgr = keeping.Manager(ks=kpr, salt=salt) print(f"Keystore initialized with salt: {salt}") # Using Habery for full habitat management with habbing.openHby(name="my-habitat", temp=True) as hby: print(f"Habery initialized: {hby.name}") ``` -------------------------------- ### Create Transferable Self-Addressing Multisig Identifier (Python) Source: https://github.com/weboftrust/keripy/blob/main/ref/getting_started.md Initializes a key pair manager and creates a transferable self-addressing multisig identifier. It uses a salt for key derivation and specifies the number of signing keys and threshold for multisig, along with the number of other key digests. ```python import keri.core.eventing as eventing import keri.core.coring as coring import keri.app.keeping as keeping import keri.db.dbing as dbing with dbing.openLMDB(name="edy") as db, keeping.openKS(name="edy") as kpr: # --------------Self-Addressing Transferable Multisig Identifier------------ salt = coring.Salter().qb64 # Init key pair manager mgr = keeping.Manager(ks=kpr, salt=salt) verfers, digers, _, _ = mgr.incept(icount=3, ncount=3, transferable=True) keys = [verfer.qb64 for verfer in verfers] srdr = eventing.incept(keys=keys, ndigs=[diger.qb64 for diger in digers], code=coring.MtrDex.Blake3_256) # code marks identifier as self-addressing print(srdr.raw.decode("utf-8")) print() ```