oasis_rofl_client package

Submodules

oasis_rofl_client.async_rofl_client module

Async ROFL client for interacting with ROFL appd REST API.

Provides native async python methods for the ROFL appd REST API endpoints.

class oasis_rofl_client.async_rofl_client.AsyncRoflClient(url: str = '')[source]

Bases: object

Async client for interacting with ROFL REST API.

Provides methods for key fetching through the ROFL REST API.

async generate_key(key_id: str, kind: KeyKind = KeyKind.SECP256K1) str[source]

Fetch or generate a cryptographic key from ROFL.

Parameters:
  • key_id – Identifier for the key

  • kind – Type of key to generate (default: SECP256K1)

Returns:

The private key as a hex string

Raises:

httpx.HTTPStatusError – If key fetch fails

async get_app_id() str[source]

Retrieve the app ID.

Returns:

The app ID as Bech32-encoded string

Raises:

httpx.HTTPStatusError – If key fetch fails

async get_metadata() dict[str, str][source]

Get all user-set metadata key-value pairs.

Returns:

Dictionary of metadata key-value pairs

Raises:

httpx.HTTPStatusError – If the request fails

async query(method: str, args: bytes) bytes[source]

Query the on-chain paratime state.

Parameters:
  • method – The query method name

  • args – CBOR-encoded query arguments

Returns:

CBOR-encoded response data

Raises:

httpx.HTTPStatusError – If the request fails

async set_metadata(metadata: dict[str, str]) None[source]

Set metadata key-value pairs.

This replaces all existing app-provided metadata. Will trigger a registration refresh if the metadata has changed.

Parameters:

metadata – Dictionary of metadata key-value pairs to set

Raises:

httpx.HTTPStatusError – If the request fails

async sign_submit(tx: TxParams, encrypt: bool = True) dict[str, Any][source]

Sign the given Ethereum transaction with an endorsed ephemeral key and submit it to Sapphire.

Note: Transaction nonce and gas price are ignored.

Parameters:
  • tx – Transaction parameters

  • encrypt – End-to-end encrypt the transaction before submitting (default: True)

Returns:

Deserialized response data object.

Raises:
  • httpx.HTTPStatusError – If the request fails

  • cbor2.CBORDecodeValueError – If the response data is invalid

oasis_rofl_client.common module

class oasis_rofl_client.common.KeyKind(*values)[source]

Bases: Enum

Supported key generation types for ROFL.

Variables:
  • RAW_256 – Generate 256 bits of entropy

  • RAW_384 – Generate 384 bits of entropy

  • ED25519 – Generate an Ed25519 private key

  • SECP256K1 – Generate a Secp256k1 private key

ED25519 = 'ed25519'
RAW_256 = 'raw-256'
RAW_384 = 'raw-384'
SECP256K1 = 'secp256k1'
oasis_rofl_client.common.get_tx_payload(tx: TxParams, encrypt: bool)[source]

Prepare the payload of the EVM transaction for the “tx/sign-submit” appd endpoint.

Parameters:
  • tx – Transaction parameters

  • encrypt – End-to-end encrypt the transaction before submitting (default: True)

Returns:

The payload object

oasis_rofl_client.rofl_client module

ROFL client for interacting with ROFL appd REST API.

Provides native python methods for the ROFL appd REST API endpoints.

class oasis_rofl_client.rofl_client.RoflClient(url: str = '')[source]

Bases: object

Client for interacting with ROFL REST API.

Provides methods for key fetching through the ROFL REST API.

generate_key(key_id: str, kind: KeyKind = KeyKind.SECP256K1) str[source]

Fetch or generate a cryptographic key from ROFL.

Parameters:
  • key_id – Identifier for the key

  • kind – Type of key to generate (default: SECP256K1)

Returns:

The private key as a hex string

Raises:

httpx.HTTPStatusError – If key fetch fails

get_app_id() str[source]

Retrieve the app ID.

Returns:

The app ID as Bech32-encoded string

Raises:

httpx.HTTPStatusError – If key fetch fails

get_metadata() dict[str, str][source]

Get all user-set metadata key-value pairs.

Returns:

Dictionary of metadata key-value pairs

Raises:

httpx.HTTPStatusError – If the request fails

query(method: str, args: bytes) bytes[source]

Query the on-chain paratime state.

Parameters:
  • method – The query method name

  • args – CBOR-encoded query arguments

Returns:

CBOR-encoded response data

Raises:

httpx.HTTPStatusError – If the request fails

set_metadata(metadata: dict[str, str]) None[source]

Set metadata key-value pairs.

This replaces all existing app-provided metadata. Will trigger a registration refresh if the metadata has changed.

Parameters:

metadata – Dictionary of metadata key-value pairs to set

Raises:

httpx.HTTPStatusError – If the request fails

sign_submit(tx: TxParams, encrypt: bool = True) dict[str, Any][source]

Sign the given Ethereum transaction with an endorsed ephemeral key and submit it to Sapphire.

Note: Transaction nonce and gas price are ignored.

Parameters:
  • tx – Transaction parameters

  • encrypt – End-to-end encrypt the transaction before submitting (default: True)

Returns:

Deserialized response data object.

Raises:
  • httpx.HTTPStatusError – If the request fails

  • cbor2.CBORDecodeValueError – If the response data is invalid

Module contents

Oasis ROFL Python client SDK.

This package provides a Python client SDK for interacting with Oasis ROFL services, including key generation and transaction submission.

class oasis_rofl_client.AsyncRoflClient(url: str = '')[source]

Bases: object

Async client for interacting with ROFL REST API.

Provides methods for key fetching through the ROFL REST API.

async generate_key(key_id: str, kind: KeyKind = KeyKind.SECP256K1) str[source]

Fetch or generate a cryptographic key from ROFL.

Parameters:
  • key_id – Identifier for the key

  • kind – Type of key to generate (default: SECP256K1)

Returns:

The private key as a hex string

Raises:

httpx.HTTPStatusError – If key fetch fails

async get_app_id() str[source]

Retrieve the app ID.

Returns:

The app ID as Bech32-encoded string

Raises:

httpx.HTTPStatusError – If key fetch fails

async get_metadata() dict[str, str][source]

Get all user-set metadata key-value pairs.

Returns:

Dictionary of metadata key-value pairs

Raises:

httpx.HTTPStatusError – If the request fails

async query(method: str, args: bytes) bytes[source]

Query the on-chain paratime state.

Parameters:
  • method – The query method name

  • args – CBOR-encoded query arguments

Returns:

CBOR-encoded response data

Raises:

httpx.HTTPStatusError – If the request fails

async set_metadata(metadata: dict[str, str]) None[source]

Set metadata key-value pairs.

This replaces all existing app-provided metadata. Will trigger a registration refresh if the metadata has changed.

Parameters:

metadata – Dictionary of metadata key-value pairs to set

Raises:

httpx.HTTPStatusError – If the request fails

async sign_submit(tx: TxParams, encrypt: bool = True) dict[str, Any][source]

Sign the given Ethereum transaction with an endorsed ephemeral key and submit it to Sapphire.

Note: Transaction nonce and gas price are ignored.

Parameters:
  • tx – Transaction parameters

  • encrypt – End-to-end encrypt the transaction before submitting (default: True)

Returns:

Deserialized response data object.

Raises:
  • httpx.HTTPStatusError – If the request fails

  • cbor2.CBORDecodeValueError – If the response data is invalid

class oasis_rofl_client.KeyKind(*values)[source]

Bases: Enum

Supported key generation types for ROFL.

Variables:
  • RAW_256 – Generate 256 bits of entropy

  • RAW_384 – Generate 384 bits of entropy

  • ED25519 – Generate an Ed25519 private key

  • SECP256K1 – Generate a Secp256k1 private key

ED25519 = 'ed25519'
RAW_256 = 'raw-256'
RAW_384 = 'raw-384'
SECP256K1 = 'secp256k1'
class oasis_rofl_client.RoflClient(url: str = '')[source]

Bases: object

Client for interacting with ROFL REST API.

Provides methods for key fetching through the ROFL REST API.

generate_key(key_id: str, kind: KeyKind = KeyKind.SECP256K1) str[source]

Fetch or generate a cryptographic key from ROFL.

Parameters:
  • key_id – Identifier for the key

  • kind – Type of key to generate (default: SECP256K1)

Returns:

The private key as a hex string

Raises:

httpx.HTTPStatusError – If key fetch fails

get_app_id() str[source]

Retrieve the app ID.

Returns:

The app ID as Bech32-encoded string

Raises:

httpx.HTTPStatusError – If key fetch fails

get_metadata() dict[str, str][source]

Get all user-set metadata key-value pairs.

Returns:

Dictionary of metadata key-value pairs

Raises:

httpx.HTTPStatusError – If the request fails

query(method: str, args: bytes) bytes[source]

Query the on-chain paratime state.

Parameters:
  • method – The query method name

  • args – CBOR-encoded query arguments

Returns:

CBOR-encoded response data

Raises:

httpx.HTTPStatusError – If the request fails

set_metadata(metadata: dict[str, str]) None[source]

Set metadata key-value pairs.

This replaces all existing app-provided metadata. Will trigger a registration refresh if the metadata has changed.

Parameters:

metadata – Dictionary of metadata key-value pairs to set

Raises:

httpx.HTTPStatusError – If the request fails

sign_submit(tx: TxParams, encrypt: bool = True) dict[str, Any][source]

Sign the given Ethereum transaction with an endorsed ephemeral key and submit it to Sapphire.

Note: Transaction nonce and gas price are ignored.

Parameters:
  • tx – Transaction parameters

  • encrypt – End-to-end encrypt the transaction before submitting (default: True)

Returns:

Deserialized response data object.

Raises:
  • httpx.HTTPStatusError – If the request fails

  • cbor2.CBORDecodeValueError – If the response data is invalid