tisura-light
v0.0.1-95
Published
A single package to interact with Tisura infrastructure
Readme
Sentinel SDK
This project contains the code for tisura npm package. It provides modules for parsing network packets, proving statements, managing connections, and handling TLS operations.
Build
Build Wasm files
Make sure to use rustc version of 1.82.0.
To install it, you can run:
# first install rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# then install rust
rustup install 1.82.0
rustup default 1.82.0Build Noir files
Make sure to install noir.
To install it, you can run:
# first install noirup
curl -L https://raw.githubusercontent.com/noir-lang/noirup/refs/heads/main/install | bash
# then install noir
noirup --version 1.0.0-beta.6Local SDK Development
The build-and-install.sh script builds the SDK as a .tgz (exactly as it would be published to npm) and installs it into a sibling consumer project.
./build-and-install.sh <mode> <dest><mode>(optional, defaultfull):fullbuilds with WASM + TS,lightproduces a slim ESM bundle (no TLS/circuit code, just stamping + provider requests).<dest>(optional, defaulttwallet): one ofextension,platform,airdrop,twallet,explorer.platformandairdropare installed viayarn, the others vianpm.
The script removes any existing tisura*.tgz and node_modules/tisura in the destination, clears the package manager's cache for tisura, and force-installs the new tarball — so re-running with the same version reliably picks up the new SDK code.
Examples:
./build-and-install.sh # full build → twallet (npm)
./build-and-install.sh light extension # light build → sentinel_extension (npm)
./build-and-install.sh full platform # full build → sentinel/platform (yarn)Installation
npm install tisuraUsage
Basic Setup
import { Tisura } from "tisura";
const client = new Tisura({
apiKey: "your-api-key", // Format: sk_dev_xxx key, sk_prod_xxx key, or simply sk_local for local development
});Sending a request to the server
const connectClient = client.connect;
const conn = await connectClient.sendRequest({
serverHost, // e.g. "api.github.com"
serverPort, // e.g. 443
endpoint, // e.g. "/users"
params, // e.g. [{ key: "since", value: "1" }]
method, // e.g. "POST"
body , // eg. [{ key: "name", value: "sherlock" }] - Optional
headers, // e.g. { key: "Authorization", value: `Bearer ${token}` } - Optional
}: SendRequestArgs);Generating a proof and verifying it
const proveClient = client.prove;
const proof = await proveClient.generateProof({
circuitName, // e.g. "ownership"
connectionId, // optional, defaults to the last connection
plaintext, // the data you want to prove in "substring" circuit - Optional
nodeId, // the github node ID to prove in "ownership" circuit - Optional
repoName, // the github repo name to prove in "contributions" circuit - Optional
repoOwner, // the github repo owner to prove in "contributions" circuit - Optional
count, // the number of contributions to prove in "contributions" circuit - Optional
}: GenerateProofArgs);
const isValid = await proveClient.verifyProof({
circuitName, // e.g. "ownership"
proof, // the proof above
}: VerifyProofArgs);Certifying a statement
const certifyClient = client.certify;
const cert = await certifyClient.certify({
inputBytes, // the data you want to certify (in bytes)
connectionId, // optional, defaults to the last connection
inputSessionKey, // optional, defaults to the last session key
}: CertifyArgs)Decrypting an encrypted statement
const certifyClient = client.certify;
const decrypted = await certifyClient.decrypt({
connectionId, // optional, defaults to the last connection
}: DecryptArgs);Available Modules
The SDK consists of several modules:
- Parse: Network packet parsing and analysis
- Prove: Statement proving and verification
- Certify: Statement certifying from client side
- Connect: Connection management
Module-specific Imports
You can import specific modules directly:
import { ParseClient } from "tisura/parse";
import { ProveClient } from "tisura/prove";
import { CertifyClient } from "tisura/certify";
import { ConnectClient } from "tisura/connect";Configuration
The SDK requires the following configuration parameters:
interface TisuraConfig {
proxyUrl: string;
storeUrl: string;
}Development
Install, build and run tests
# Install dependencies
npm install
# Build the package
npm run build
# Run tests
npm test