Lightweight Python SDK for Content Endorsement

lyfeninja1 pts0 comments

GitHub - lyfeninja/lyfeninja_blkseal_python_sdk: Lightweight Python client for signing and verifying digital content using lyfe.ninja's BlkSeal product powered by BlkBolt™. Designed for zero dependencies, simple integration, and exact content verification. · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

Uh oh!

There was an error while loading. Please reload this page.

lyfeninja

lyfeninja_blkseal_python_sdk

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>9 Commits<br>9 Commits

LICENSE

LICENSE

README.md

README.md

lyfeninja_blkseal.py

lyfeninja_blkseal.py

setup.py

setup.py

View all files

Repository files navigation

lyfe.ninja BlkSeal Python SDK

Lightweight Python client for signing and verifying digital content using lyfe.ninja's BlkSeal product powered by BlkBolt™.

Designed for zero dependencies, simple integration, and exact content verification.

Learn more: https://lyfe.ninja/

Integration guide: https://lyfe.ninja/products/BlkSeal/integration_guide/

Overview

BlkSeal provides:

Deterministic hashing

Minimal, explicit canonicalization

Content signing (authenticated)

Content verification (public or authenticated)

Installation

Install from github

pip install git+https://github.com/lyfeninja/lyfeninja_blkseal_python_sdk.git

or just clone to working directory, sometimes I think this is easier

git clone https://github.com/lyfeninja/lyfeninja_blkseal_python_sdk.git

(Coming soon via PyPI)

Quick Start

import lyfeninja_blkseal

#####################################################################<br>#load environment variables<br>#####################################################################

import os

lyfeninja_client_id = os.getenv('LYFENINJA_CLIENT_ID')<br>lyfeninja_client_secret = os.getenv('LYFENINJA_CLIENT_SECRET')<br>lyfeninja_lease_id = os.getenv('LYFENINJA_LEASE_ID')

#####################################################################<br>#initiate client<br>#####################################################################

client = lyfeninja_blkseal.BlkSealClient(<br>client_id=lyfeninja_client_id,<br>client_secret=lyfeninja_client_secret,<br>default_scope="sign:content verify:content",

#####################################################################<br>#get access token<br>#####################################################################

token = client.get_token()<br>print(token)

#####################################################################<br># sign text<br>#####################################################################

#make request<br>response = client.sign_text(<br>lease_id=lyfeninja_lease_id,<br>text='Hello world!',

signature_b64 = response["signature_b64"]<br>print(signature_b64)

#####################################################################<br># verify using public endpoint<br>#####################################################################

#make request<br>result = client.verify_text(<br>text='Hello world!',<br>signature_b64=signature_b64,

#print result<br>print(result)

#try modifying text to see how result changes<br>result = client.verify_text(<br>text='Hello World',<br>signature_b64=signature_b64x,

#print result<br>print(result)

#####################################################################<br># verify using private endpoint (requires valid token)<br>#####################################################################

#make request<br>result = client.verify_text(<br>text="Hello world!",<br>signature_b64=signature_b64,<br>private=True,

#print result<br>print(result)

#####################################################################<br># sign bytes / file<br>#####################################################################

#open file<br>with open("tests.py", "rb") as f:<br>file_bytes = f.read()

#make request<br>response = client.sign_bytes(<br>lease_id=lyfeninja_lease_id,<br>data=file_bytes,

#get signature<br>signature_b64 = response["signature_b64"]

#####################################################################<br># verify bytes /...

content client signature_b64 result print sign

Related Articles