CCF
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
ccf::js::DynamicJSEndpointRegistry Class Reference

#include <registry.h>

Inherits ccf::js::BaseDynamicJSEndpointRegistry.

Inherited by programmabilityapp::ProgrammabilityHandlers.

Public Member Functions

 DynamicJSEndpointRegistry (ccf::AbstractNodeContext &context, const std::string &kv_prefix=default_js_registry_kv_prefix)
 
ccf::ApiResult record_action_for_audit_v1 (ccf::kv::Tx &tx, ccf::ActionFormat format, const std::string &user_id, const std::string &action_name, const std::vector< uint8_t > &action_body)
 
ccf::ApiResult check_action_not_replayed_v1 (ccf::kv::Tx &tx, uint64_t created_at, const std::span< const uint8_t > action, ccf::InvalidArgsReason &reason)
 
- Public Member Functions inherited from ccf::js::BaseDynamicJSEndpointRegistry
 BaseDynamicJSEndpointRegistry (ccf::AbstractNodeContext &context, const std::string &kv_prefix=default_js_registry_kv_prefix)
 
ccf::ApiResult install_custom_endpoints_v1 (ccf::kv::Tx &tx, const ccf::js::Bundle &bundle)
 
ccf::ApiResult get_custom_endpoints_v1 (ccf::js::Bundle &bundle, ccf::kv::ReadOnlyTx &tx)
 
ccf::ApiResult get_custom_endpoint_properties_v1 (ccf::endpoints::EndpointProperties &properties, ccf::kv::ReadOnlyTx &tx, const ccf::RESTVerb &verb, const ccf::endpoints::URI &uri)
 
ccf::ApiResult get_custom_endpoint_module_v1 (std::string &code, ccf::kv::ReadOnlyTx &tx, const std::string &module_name)
 
void set_js_kv_namespace_restriction (const ccf::js::NamespaceRestriction &restriction)
 
ccf::ApiResult set_js_runtime_options_v1 (ccf::kv::Tx &tx, const ccf::JSRuntimeOptions &options)
 
ccf::ApiResult get_js_runtime_options_v1 (ccf::JSRuntimeOptions &options, ccf::kv::ReadOnlyTx &tx)
 
ccf::endpoints::EndpointDefinitionPtr find_endpoint (ccf::kv::Tx &tx, ccf::RpcContext &rpc_ctx) override
 
void execute_endpoint (ccf::endpoints::EndpointDefinitionPtr e, ccf::endpoints::EndpointContext &endpoint_ctx) override
 
void execute_endpoint_locally_committed (ccf::endpoints::EndpointDefinitionPtr e, ccf::endpoints::CommandEndpointContext &endpoint_ctx, const ccf::TxID &tx_id) override
 
void build_api (nlohmann::json &document, ccf::kv::ReadOnlyTx &tx) override
 
std::set< RESTVerbget_allowed_verbs (ccf::kv::Tx &, const ccf::RpcContext &rpc_ctx) override
 
virtual ccf::js::extensions::Extensions get_extensions (const ccf::endpoints::EndpointContext &endpoint_ctx)
 
- Public Member Functions inherited from ccf::UserEndpointRegistry
 UserEndpointRegistry (ccf::AbstractNodeContext &context)
 
void handle_event_request_completed (const ccf::endpoints::RequestCompletedEvent &event) override
 
void handle_event_dispatch_failed (const ccf::endpoints::DispatchFailedEvent &event) override
 
- Public Member Functions inherited from ccf::CommonEndpointRegistry
 CommonEndpointRegistry (const std::string &method_prefix_, ccf::AbstractNodeContext &context_)
 
void init_handlers () override
 
- Public Member Functions inherited from ccf::BaseEndpointRegistry
 BaseEndpointRegistry (const std::string &method_prefix_, ccf::AbstractNodeContext &context_)
 
ApiResult get_view_history_v1 (std::vector< ccf::TxID > &history, ccf::View since=1)
 
ApiResult get_view_history_v2 (std::vector< ccf::TxID > &history, ccf::View since, ccf::InvalidArgsReason &reason)
 
ApiResult get_status_for_txid_v1 (ccf::View view, ccf::SeqNo seqno, ccf::TxStatus &tx_status)
 
ApiResult get_last_committed_txid_v1 (ccf::View &view, ccf::SeqNo &seqno)
 
ApiResult generate_openapi_document_v1 (ccf::kv::ReadOnlyTx &tx, const std::string &title, const std::string &description, const std::string &document_version, nlohmann::json &document)
 
ApiResult get_quote_for_this_node_v1 (ccf::kv::ReadOnlyTx &tx, QuoteInfo &quote_info)
 
ApiResult get_id_for_this_node_v1 (NodeId &node_id)
 
ApiResult get_quotes_for_all_trusted_nodes_v1 (ccf::kv::ReadOnlyTx &tx, std::map< NodeId, QuoteInfo > &quotes)
 
ApiResult get_view_for_seqno_v1 (ccf::SeqNo seqno, ccf::View &view)
 
ApiResult get_user_data_v1 (ccf::kv::ReadOnlyTx &tx, const UserId &user_id, nlohmann::json &user_data)
 
ApiResult get_member_data_v1 (ccf::kv::ReadOnlyTx &tx, const MemberId &member_id, nlohmann::json &member_data)
 
ApiResult get_user_cert_v1 (ccf::kv::ReadOnlyTx &tx, const UserId &user_id, ccf::crypto::Pem &user_cert_pem)
 
ApiResult get_member_cert_v1 (ccf::kv::ReadOnlyTx &tx, const MemberId &member_id, ccf::crypto::Pem &member_cert_pem)
 
ApiResult get_untrusted_host_time_v1 (::timespec &time)
 
- Public Member Functions inherited from ccf::endpoints::EndpointRegistry
template<typename T >
bool get_path_param (const ccf::PathParams &params, const std::string &param_name, T &value, std::string &error)
 
template<>
bool get_path_param (const ccf::PathParams &params, const std::string &param_name, std::string &value, std::string &error)
 
 EndpointRegistry (const std::string &method_prefix_)
 
virtual ~EndpointRegistry ()
 
virtual Endpoint make_endpoint (const std::string &method, RESTVerb verb, const EndpointFunction &f, const AuthnPolicies &ap)
 
virtual Endpoint make_read_only_endpoint (const std::string &method, RESTVerb verb, const ReadOnlyEndpointFunction &f, const AuthnPolicies &ap)
 
virtual Endpoint make_endpoint_with_local_commit_handler (const std::string &method, RESTVerb verb, const EndpointFunction &f, const LocallyCommittedEndpointFunction &l, const AuthnPolicies &ap)
 
virtual Endpoint make_read_only_endpoint_with_local_commit_handler (const std::string &method, RESTVerb verb, const ReadOnlyEndpointFunction &f, const LocallyCommittedEndpointFunction &l, const AuthnPolicies &ap)
 
virtual Endpoint make_command_endpoint (const std::string &method, RESTVerb verb, const CommandEndpointFunction &f, const AuthnPolicies &ap)
 
void install (Endpoint &endpoint) override
 
void set_default (EndpointFunction f, const AuthnPolicies &ap)
 
virtual bool request_needs_root (const ccf::RpcContext &rpc_ctx)
 
virtual void report_ambiguous_templated_path (const std::string &path, const std::vector< EndpointDefinitionPtr > &matches)
 
virtual void tick (std::chrono::milliseconds)
 
void set_consensus (ccf::kv::Consensus *c)
 
void set_history (ccf::kv::TxHistory *h)
 
virtual bool apply_uncommitted_tx_backpressure () const
 

Protected Attributes

std::string recent_actions_map
 
std::string audit_input_map
 
std::string audit_info_map
 
- Protected Attributes inherited from ccf::js::BaseDynamicJSEndpointRegistry
std::string modules_map
 
std::string metadata_map
 
std::string interpreter_flush_map
 
std::string modules_quickjs_version_map
 
std::string modules_quickjs_bytecode_map
 
std::string runtime_options_map
 
- Protected Attributes inherited from ccf::BaseEndpointRegistry
ccf::AbstractNodeContextcontext
 
- Protected Attributes inherited from ccf::endpoints::EndpointRegistry
EndpointPtr default_endpoint
 
std::map< std::string, std::map< RESTVerb, EndpointPtr > > fully_qualified_endpoints
 
std::map< std::string, std::map< RESTVerb, std::shared_ptr< PathTemplatedEndpoint > > > templated_endpoints
 
ccf::kv::Consensusconsensus = nullptr
 
ccf::kv::TxHistoryhistory = nullptr
 

Additional Inherited Members

- Public Types inherited from ccf::endpoints::EndpointRegistry
enum  ReadWrite { Read , Write }
 
- Public Attributes inherited from ccf::endpoints::EndpointRegistry
const std::string method_prefix
 
struct ccf::endpoints::EndpointRegistry::OpenApiInfo openapi_info
 
- Protected Member Functions inherited from ccf::CommonEndpointRegistry
virtual void api_endpoint (ccf::endpoints::ReadOnlyEndpointContext &ctx)
 

Constructor & Destructor Documentation

◆ DynamicJSEndpointRegistry()

ccf::js::DynamicJSEndpointRegistry::DynamicJSEndpointRegistry ( ccf::AbstractNodeContext context,
const std::string &  kv_prefix = default_js_registry_kv_prefix 
)
inline

Member Function Documentation

◆ check_action_not_replayed_v1()

ccf::ApiResult ccf::js::DynamicJSEndpointRegistry::check_action_not_replayed_v1 ( ccf::kv::Tx tx,
uint64_t  created_at,
const std::span< const uint8_t >  action,
ccf::InvalidArgsReason reason 
)

Check an action is not being replayed, by looking it up in the history of recent actions. To place an upper bound on the history size, an authenticated timestamp (created_at) is required.

◆ record_action_for_audit_v1()

ccf::ApiResult ccf::js::DynamicJSEndpointRegistry::record_action_for_audit_v1 ( ccf::kv::Tx tx,
ccf::ActionFormat  format,
const std::string &  user_id,
const std::string &  action_name,
const std::vector< uint8_t > &  action_body 
)

Record action details by storing them in KV maps using a common format, for the purposes of offline audit using the ledger.

Member Data Documentation

◆ audit_info_map

std::string ccf::js::DynamicJSEndpointRegistry::audit_info_map
protected

◆ audit_input_map

std::string ccf::js::DynamicJSEndpointRegistry::audit_input_map
protected

◆ recent_actions_map

std::string ccf::js::DynamicJSEndpointRegistry::recent_actions_map
protected

The documentation for this class was generated from the following files: