No project description provided
Project description
IB1 Directory
A library to simplify working with the IB1 Trust Framework directory
Development
Setup
poetry install
Run tests
poetry run pytest
Usage
Encoding and decoding
from ib1.directory.extensions import encode_roles, decode_roles
...
cert_builder = (
x509.CertificateBuilder()
.subject_name(subject)
.issuer_name(issuer)
.public_key(private_key.public_key())
.serial_number(x509.random_serial_number())
.not_valid_before(datetime.utcnow())
.not_valid_after(datetime.utcnow() + timedelta(days=365))
)
cert_builder = encode_roles(cert_builder, roles)
cert = cert_builder.sign(private_key, hashes.SHA256(), default_backend())
roles = decode_roles(cert)
Require a role
from ib1 import directory
...
cert = directory.parse_cert(quoted_certificate_from_header)
try:
directory.require_role(
"https://registry.core.ib1.org/scheme/perseus/role/carbon-accounting",
cert,
)
except directory.CertificateRoleError as e:
raise HTTPException(
status_code=401,
detail=str(e),
)
...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ib1_directory-0.1.0.tar.gz
(3.9 kB
view details)
Built Distribution
File details
Details for the file ib1_directory-0.1.0.tar.gz
.
File metadata
- Download URL: ib1_directory-0.1.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.3 Darwin/24.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8d13c7e91cf4fedfba10e956c80fb0d79b29eb566c471d739558758c88e9615 |
|
MD5 | f6b555c291cc0f5f378d4f2b334b9feb |
|
BLAKE2b-256 | 75ff749cde546bdf6101afedfca7fb2dd29b4e1d9fc3496c3e0db9c053a0d983 |
File details
Details for the file ib1_directory-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: ib1_directory-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.3 Darwin/24.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1af0427292b17dfc1c4438eec39f15c37cc77d220a95648a13cfbad807264b1 |
|
MD5 | 59da33975c21d8b2cc64396699833d2f |
|
BLAKE2b-256 | b8972b50cadb725627721669eec8fe1f0f391d6206d8809e643001dd90a3ce69 |