Generate or fetch a cryptographic key from ROFL's decentralized key management system.
All generated keys are deterministic and tied to the app's identity. They can only be generated inside properly attested app instances and will remain consistent across deployments or state resets.
Hex-encoded key material without 0x prefix. For cryptographic keys (ED25519, SECP256K1), returns the private key. For entropy types (RAW_256, RAW_384), returns raw random bytes
If key generation fails or response is invalid
// Generate a default SECP256K1 key
const key = await client.generateKey('my-signing-key');
// Generate an Ed25519 key for a specific purpose
const ed25519Key = await client.generateKey('my-ed25519-key', KeyKind.ED25519);
// Generate raw entropy for custom use
const entropy = await client.generateKey('my-entropy', KeyKind.RAW_256);
Retrieve the ROFL app identifier in bech32 format.
The app ID uniquely identifies this ROFL application on-chain and is used
for authentication and authorization. This is a convenience method that wraps
the /rofl/v1/app/id endpoint.
Bech32-encoded app ID (e.g., 'rofl1qqn9xndja7e2pnxhttktmecvwzz0yqwxsquqyxdf')
Retrieve all user-set metadata key-value pairs for this ROFL app instance.
Metadata is automatically namespaced with 'net.oasis.app.' when published in the on-chain ROFL replica registration, but this method returns the raw keys without the namespace prefix.
Dictionary of metadata key-value pairs
Execute a read-only runtime query via ROFL.
Query arguments and results follow the CBOR schema published by the Oasis runtime.
When using the Oasis TypeScript runtime SDK (@oasisprotocol/client-rt), pass the
generated types.* definitions as generics to get end-to-end typing:
Fully-qualified runtime method name (e.g., 'rofl.App')
Rest...argsTuple: QueryArgsTuple<TArgs>Decoded query response body
Set metadata key-value pairs for this ROFL app instance.
This replaces all existing app-provided metadata. If the metadata has changed, it will trigger an automatic on-chain registration refresh. Keys are automatically namespaced with 'net.oasis.app.' when published on-chain.
Metadata is validated against runtime-configured limits (typically max 64 pairs, max key size 1024 bytes, max value size 16KB).
Dictionary of metadata key-value pairs to set
Promise that resolves when metadata is successfully updated
Client for interacting with the ROFL application daemon REST API.
Provides methods for key generation, metadata management, and authenticated transaction submission to ROFL applications running in trusted execution environments.
Example