import * as event from './event'; import * as transaction from './transaction'; import * as types from './types'; import * as wrapper from './wrapper'; /** * Unique module name. */ export declare const MODULE_NAME = "rofl"; export declare const ERR_INVALID_ARGUMENT_CODE = 1; export declare const ERR_UNKNOWN_APP_CODE = 2; export declare const ERR_NOT_SIGNED_BY_RAK_CODE = 3; export declare const ERR_NOT_SIGNED_BY_EXTRA_KEY_CODE = 4; export declare const ERR_UNKNOWN_ENCLAVE_CODE = 5; export declare const ERR_UNKNOWN_NODE_CODE = 6; export declare const ERR_NODE_NOT_ALLOWED_CODE = 7; export declare const ERR_REGISTRATION_EXPIRED_CODE = 8; export declare const ERR_EXTRA_KEY_UPDATE_NOT_ALLOWED_CODE = 9; export declare const ERR_APP_ALREADY_EXISTS_CODE = 10; export declare const ERR_FORBIDDEN_CODE = 11; export declare const ERR_UNKNOWN_INSTANCE_CODE = 12; export declare const ERR_PLAIN_CALL_FORMAT_NOT_ALLOWED_CODE = 13; export declare const ERR_ENDORSEMENT_POLICY_TOO_DEEP_CODE = 14; export declare const ERR_ENDORSEMENT_POLICY_TOO_MANY_ATOMS_CODE = 15; export declare const ERR_POLICY_MAX_EXPIRATION_TOO_HIGH_CODE = 16; export declare const METHOD_CREATE = "rofl.Create"; export declare const METHOD_UPDATE = "rofl.Update"; export declare const METHOD_REMOVE = "rofl.Remove"; export declare const METHOD_REGISTER = "rofl.Register"; export declare const METHOD_APP = "rofl.App"; export declare const METHOD_APPS = "rofl.Apps"; export declare const METHOD_APP_INSTANCE = "rofl.AppInstance"; export declare const METHOD_APP_INSTANCES = "rofl.AppInstances"; export declare const METHOD_PARAMETERS = "rofl.Parameters"; export declare const METHOD_STAKE_THRESHOLDS = "rofl.StakeThresholds"; export declare const EVENT_APP_CREATED_CODE = 1; export declare const EVENT_APP_UPDATED_CODE = 2; export declare const EVENT_APP_REMOVED_CODE = 3; export declare const EVENT_INSTANCE_REGISTERED_CODE = 4; export declare const ADDRESS_PREFIX = "rofl"; export declare function toBech32(appID: types.AppID): string; export declare function fromBech32(str: string): types.AppID; export declare class Wrapper extends wrapper.Base { constructor(runtimeID: Uint8Array); /** Create a new ROFL application. */ callCreate(): wrapper.TransactionWrapper; /** Update a ROFL application. */ callUpdate(): wrapper.TransactionWrapper; /** Remove a ROFL application. */ callRemove(): wrapper.TransactionWrapper; /** Register a new ROFL App instance replica. */ callRegister(): wrapper.TransactionWrapper; /** Returns the configuration for the given ROFL application. */ queryApp(): wrapper.QueryWrapper; /** Returns all ROFL app configurations. */ queryApps(): wrapper.QueryWrapper; /** Returns a specific registered instance replica for the given ROFL application. */ queryAppInstance(): wrapper.QueryWrapper; /** Returns a list of all registered instances replicas for the given ROFL application. */ queryAppInstances(): wrapper.QueryWrapper; /** Returns the minimum stake thresholds for managing ROFL. */ queryStakeThresholds(): wrapper.QueryWrapper; /** Queries the module parameters */ queryParameters(): wrapper.QueryWrapper; } export declare function moduleEventHandler(codes: { [EVENT_APP_CREATED_CODE]?: event.Handler; [EVENT_APP_UPDATED_CODE]?: event.Handler; [EVENT_APP_REMOVED_CODE]?: event.Handler; [EVENT_INSTANCE_REGISTERED_CODE]?: event.Handler; }): event.ModuleHandler; export type TransactionCallHandlers = { [METHOD_CREATE]?: transaction.CallHandler; [METHOD_UPDATE]?: transaction.CallHandler; [METHOD_REMOVE]?: transaction.CallHandler; [METHOD_REGISTER]?: transaction.CallHandler; }; /** SecretEnvelope is the envelope used for storing encrypted secrets. */ export interface SecretEnvelope { /** Pk is the ephemeral public key used for X25519. */ pk: Uint8Array; /** Nonce. */ nonce: Uint8Array; /** Name is the encrypted secret name. */ name: Uint8Array; /** Value is the encrypted secret value. */ value: Uint8Array; } /** * EncryptSecret encrypts the given secret given its plain-text name and value together with the * secrets encryption key (SEK) obtained for the given application. Returns the Base64-encoded * value that can be used in the configuration. * * Based on https://github.com/oasisprotocol/cli/blob/1fd79c1/build/rofl/secrets.go#L57 * and https://github.com/oasisprotocol/oasis-sdk/blob/3177bbc/client-sdk/ts-web/rt/src/callformat.ts#L52 */ export declare function encryptSecret(name: string, value: Uint8Array, app_sek: types.RoflAppConfig['sek']): string;