Search documentation of jhn_stdlib

# jhn_cacerts (jhn_stdlib v5.10.3)

View Source

A cacerts utility lib: This lib will download cacerts from https://mkcert.org/generate/, if not possible it will use a list provided in the application priv-dir.

To get the list call fetch/0 and the list will the first downloaded the the first time and then stored a presistent term for speedy retrieval.

To trigger a download when/storage the actual list is not needed use the load/0 function.

If you want to have regular updated of the list call the start_link/0 or start_link/1 functions that will start a jhn_server and update the list at regular intervalls, once every 24 hours for start_link/0 and every interval milli-seconds for start_link(Interval).

The CaCerts list is comppatible with the cacerts option of the ssl libs.

# Summary

## Functions

fetch()

Provides the cacert list, takes longer time on firs invvocation.

init(Interval)
load()

Downloads and stores the cacert list.

message(Msg, State)
request(Req, State)
start_link()

Starts a linked jhn_server that updates the cacert list every 24 hours, equivalent to start_link(86_400_000).

start_link(Interval)

Starts a linked jhn_server that updates the cacert list every Interval milli-seconds,

# Functions

# fetch()

    -spec fetch() -> [binary()] | {error, _}.

Provides the cacert list, takes longer time on firs invvocation.

# init(Interval)

# load()

    -spec load() -> ok | {error, _}.

Downloads and stores the cacert list.

# message(Msg, State)

# request(Req, State)

# start_link()

    -spec start_link() -> {ok, pid()} | ignore | {error, _}.

Starts a linked jhn_server that updates the cacert list every 24 hours, equivalent to start_link(86_400_000).

# start_link(Interval)

    -spec start_link(pos_integer()) -> {ok, pid()} | ignore | {error, _}.

Starts a linked jhn_server that updates the cacert list every Interval milli-seconds,