#pragma once

/**
** \defgroup tls_js TLS Interface
** Exposes \ref tls to JS.
** @{
*/

#include "quickjs.h"

/**
** A TLS context instance.
*/
typedef struct _tf_tls_context_t tf_tls_context_t;

/**
** Register TLS script interface.
** @param context The TLS context.
** @return the TlsContext constructor.
*/
JSValue tf_tls_context_register(JSContext* context);

/**
** Get a TLS context instance from its JS object.
** @param value A TlsContext JS object.
** @return The corresponding instance.
*/
tf_tls_context_t* tf_tls_context_get(JSValue value);

/**
** Get the number of active TLS context instances.
** @return The number of TlsContext objects created that have not been
** finalized.
*/
int tf_tls_context_get_count();

/** @} */