Files

3 lines
4.5 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Id (capnp-rpc-net.Capnp_rpc_net.Restorer.Id)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../../odoc.support/odoc.css"/><meta name="generator" content="odoc 2.4.4"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../../odoc.support/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> – <a href="../../../index.html">capnp-rpc-net</a> &#x00BB; <a href="../../index.html">Capnp_rpc_net</a> &#x00BB; <a href="../index.html">Restorer</a> &#x00BB; Id</nav><header class="odoc-preamble"><h1>Module <code><span>Restorer.Id</span></code></h1></header><div class="odoc-content"><div class="odoc-spec"><div class="spec type anchored" id="type-t"><a href="#type-t" class="anchor"></a><code><span><span class="keyword">type</span> t</span></code></div><div class="spec-doc"><p>The object ID passed in the Cap'n Proto Bootstrap message.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-generate"><a href="#val-generate" class="anchor"></a><code><span><span class="keyword">val</span> generate : <span>unit <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p><code>generate ()</code> is a fresh unguessable service ID. Note: you must initialise `Nocrypto`'s entropy before calling this (you will get a runtime error if you forget).</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-derived"><a href="#val-derived" class="anchor"></a><code><span><span class="keyword">val</span> derived : <span><span class="label">secret</span>:string <span class="arrow">&#45;&gt;</span></span> <span>string <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p><code>derived ~secret name</code> is a service ID based on <code>secret</code> and <code>name</code>. It is calculated as <code>SHA256.hmac secret name</code>. <code>secret</code> could be the hash of a private key file, for example.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-public"><a href="#val-public" class="anchor"></a><code><span><span class="keyword">val</span> public : <span>string <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p><code>public name</code> is the service ID <code>name</code>. This may be useful for interoperability with non-secure clients that expect to use a plain-text service ID (e.g. &quot;calculator&quot;). It could also be useful if <code>name</code> is some unguessable token you have generated yourself.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-digest"><a href="#val-digest" class="anchor"></a><code><span><span class="keyword">val</span> digest : <span><a href="../../Auth/index.html#type-hash">Auth.hash</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p><code>digest h id</code> is the digest <code>h id</code>.</p><p>Since <code>id</code> is normally a secret token, we must be careful not to allow timing attacks (taking a slightly different amount of time to return an error depending on how much of the ID the caller guessed correctly). Taking a secure hash of the value first is one way to avoid this, since revealing the hash isn't helpful to the attacker.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-to_string"><a href="#val-to_string" class="anchor"></a><code><span><span class="keyword">val</span> to_string : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> string</span></code></div><div class="spec-doc"><p><code>to_string t</code> is the raw bytes of <code>t</code>.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-pp"><a href="#val-pp" class="anchor"></a><code><span><span class="keyword">val</span> pp : <span><a href="#type-t">t</a> <span class="xref-unresolved">Fmt</span>.t</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-equal"><a href="#val-equal" class="anchor"></a><code><span><span class="keyword">val</span> equal : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div></div></div></body></html>