add function to get cert bundle

This commit is contained in:
ading2210 2024-03-05 21:48:35 -05:00
parent 96ff9c337a
commit c681e21777
3 changed files with 11 additions and 1 deletions

View file

@ -4,6 +4,7 @@ tick_request
active_requests
get_version
get_cacert
recv_from_websocket
send_to_websocket

View file

@ -252,6 +252,10 @@ function get_version() {
return version_dict;
}
function get_cacert() {
return UTF8ToString(_get_cacert());
}
function main() {
wasm_ready = true;
_init_curl();
@ -277,6 +281,7 @@ api = {
load_wasm: load_wasm,
WebSocket: CurlWebSocket,
TLSSocket: TLSSocket,
get_cacert: get_cacert,
wisp_connections: _wisp_connections,
WispConnection: WispConnection,

View file

@ -7,9 +7,9 @@
#include "curl/easy.h"
#include "curl/header.h"
#include "cjson/cJSON.h"
#include "cacert.h"
#include "curl/multi.h"
#include "cacert.h"
#include "util.h"
#include "types.h"
@ -196,6 +196,10 @@ void finish_request(CURLMsg *curl_msg) {
free(request_info);
}
unsigned char* get_cacert() {
return _cacert_pem;
}
void init_curl() {
curl_global_init(CURL_GLOBAL_DEFAULT);
multi_handle = curl_multi_init();