Expand description
The utils module contains utility functions used internally by this library. They are exported for use in other libraries that depend on this one, or for advanced use cases that require custom logic.
Constants§
- EXACT_
PATH_ TERMINATOR - A terminator used to indicate the end of an exact path in an HTTP certification tree.
- EXACT_
PATH_ TERMINATOR_ BYTES - A terminator used to indicate the end of an exact path in an HTTP certification tree, as bytes.
- PATH_
DIR_ SEPARATOR - A trailing slash used to indicate a directory in an HTTP certification tree.
- PATH_
DIR_ SEPARATOR_ BYTES - A trailing slash used to indicate a directory in an HTTP certification tree, as bytes.
- PATH_
PREFIX - The prefix for all paths in an HTTP certification tree.
- PATH_
PREFIX_ BYTES - The prefix for all paths in an HTTP certification tree, as bytes.
- WILDCARD_
PATH_ TERMINATOR - A terminator used to indicate the end of a wildcard path in an HTTP certification tree.
- WILDCARD_
PATH_ TERMINATOR_ BYTES - A terminator used to indicate the end of a wildcard path in an HTTP certification tree, as bytes.
Functions§
- add_
skip_ certification_ header - Adds the
IC-CertificateandIC-Certificate-Expressionheaders to a givenHttpResponse. These headers are used by the HTTP Gateway to verify the authenticity of query call responses. In this case, the headers are pre-configured to instruct the HTTP Gateway to skip certification verification in a secure way. Secure in this context means that the decision to skip certification is made by the canister itself, and not by the replica, API boundary nodes or any other intermediate party. - add_
v2_ certificate_ header - Adds the
IC-Certificateheader to a givenHttpResponse. This header is used by the HTTP Gateway to verify the authenticity of query call responses made to thehttp_requestmethod of the target canister. - is_
wildcard_ path_ valid_ for_ request_ path - Returns whether the given wildcard path is valid for the given request path.
- more_
specific_ wildcards_ for - Returns a list of wildcard paths that are more specific than the responding wildcard path. A wildcard path is more specific than another if it has more segments and it contains the requested path as a prefix. The responding wildcard path is expected to be a prefix of the requested path.
- skip_
certification_ certified_ data - Returns the hash of the certified data that can be used to instruct HTTP Gateways to skip certification.