Skip to content

Commit

Permalink
trust-schema: Light VerSec compiler in Python
Browse files Browse the repository at this point in the history
  • Loading branch information
yoursunny committed Oct 12, 2024
1 parent 22074a3 commit c1f4a54
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/pyrepo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ To install and start the specified version, run:

```bash
# create Python virtual environment
python3 -m venv ~/pyrepo-venv
source ~/pyrepo-venv/bin/activate
python3 -m venv ~/pyrepo.venv
source ~/pyrepo.venv/bin/activate

# install ndn-python-repo
pip install git+https://github.com/UCLA-IRL/ndn-python-repo@2dcd229a4cb81927a52e8a8f1d963c55ee939ffa
Expand Down
21 changes: 21 additions & 0 deletions pkg/trust-schema/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,27 @@ await keyChain.insertCert(rootCert);
const schema = new TrustSchema(policy, [rootCert]);
```

## LVS Binary Format

This package intends to support importing [python-ndn Light VerSec (LVS)](https://python-ndn.readthedocs.io/en/latest/src/lvs/lvs.html) binary format.
This feature is still in design stage.

To compile LVS textual format to binary format, you need to use python-ndn:

```bash
# create Python virtual environment
python3.11 -m venv ~/lvs.venv
source ~/lvs.venv/bin/activate

# install python-ndn
pip install 'python-ndn[dev] @ git+https://github.com/named-data/python-ndn@177844e6142bd4616929bbbfa10a857569fbdf5b'

# run the compiler
python ./lvs/compile.py <~/lvs-model.txt >~/lvs-model.tlv
```

The compiled binary TLV will be importable into NDNts in the future.

## Trust Schema Signer

`TrustSchemaSigner` type can automatically select a signer among available certificates in the KeyChain.
Expand Down
8 changes: 8 additions & 0 deletions pkg/trust-schema/lvs/compile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env python
import sys

import ndn.app_support.light_versec

lvs_text = sys.stdin.read()
lvs_model = ndn.app_support.light_versec.compile_lvs(lvs_text)
sys.stdout.buffer.write(lvs_model.encode())

0 comments on commit c1f4a54

Please sign in to comment.