1
0
mirror of https://github.com/taigrr/nats.docs synced 2025-01-18 04:03:23 -08:00

clarified some of the values in the examples

This commit is contained in:
Alberto Ricart 2019-05-31 10:48:57 -05:00
parent 48b583c57e
commit 9b464389eb
2 changed files with 22 additions and 10 deletions

View File

@ -49,17 +49,23 @@ nc.close();
</div>
<div class="tab__content">
<pre id="connect_creds_js_content"><a class="toolbar-icons pull-right" target="_blank" href="https://github.com/nats-io/node-nats-examples/blob/master/src/auth_examples.js#L190-195"><i class="mdi mdi-github-circle" title="View on GitHub"></i></a><a class="toolbar-icons pull-right"><i class="mdi mdi-content-copy js-copy" title="Copy to Clipboard"></i></a><span class="copy-msg pull-right"></span><code class="language-javascript">let nc = NATS.connect({
<pre id="connect_creds_js_content"><a class="toolbar-icons pull-right" target="_blank" href="https://github.com/nats-io/node-nats-examples/blob/master/src/auth_examples.js#L192-200"><i class="mdi mdi-github-circle" title="View on GitHub"></i></a><a class="toolbar-icons pull-right"><i class="mdi mdi-content-copy js-copy" title="Copy to Clipboard"></i></a><span class="copy-msg pull-right"></span><code class="language-javascript">// credentials file contains the JWT and the secret signing key
let credsFile = path.join(confDir, &#39;credsfile.creds&#39;);
let nc = NATS.connect({
url: server.nats,
userCreds: testCreds
userCreds: credsFile
});
</code></pre>
</div>
<div class="tab__content">
<pre id="connect_creds_ts_content"><a class="toolbar-icons pull-right" target="_blank" href="https://github.com/nats-io/ts-nats-examples/blob/master/src/auth_examples.ts#L156-161"><i class="mdi mdi-github-circle" title="View on GitHub"></i></a><a class="toolbar-icons pull-right"><i class="mdi mdi-content-copy js-copy" title="Copy to Clipboard"></i></a><span class="copy-msg pull-right"></span><code class="language-javascript">let nc = await connect({
<pre id="connect_creds_ts_content"><a class="toolbar-icons pull-right" target="_blank" href="https://github.com/nats-io/ts-nats-examples/blob/master/src/auth_examples.ts#L160-168"><i class="mdi mdi-github-circle" title="View on GitHub"></i></a><a class="toolbar-icons pull-right"><i class="mdi mdi-content-copy js-copy" title="Copy to Clipboard"></i></a><span class="copy-msg pull-right"></span><code class="language-javascript">// credentials file contains the JWT and the secret signing key
let credsFile = path.join(confDir, &#39;credsfile.creds&#39;);
let nc = await connect({
url: server.nats,
userCreds: testCreds
userCreds: credsFile
});
</code></pre>
</div>

View File

@ -74,11 +74,14 @@ nc.close();
</div>
<div class="tab__content">
<pre id="connect_nkey_js_content"><a class="toolbar-icons pull-right" target="_blank" href="https://github.com/nats-io/node-nats-examples/blob/master/src/auth_examples.js#L122-131"><i class="mdi mdi-github-circle" title="View on GitHub"></i></a><a class="toolbar-icons pull-right"><i class="mdi mdi-content-copy js-copy" title="Copy to Clipboard"></i></a><span class="copy-msg pull-right"></span><code class="language-javascript">let nc = NATS.connect({
<pre id="connect_nkey_js_content"><a class="toolbar-icons pull-right" target="_blank" href="https://github.com/nats-io/node-nats-examples/blob/master/src/auth_examples.js#L119-131"><i class="mdi mdi-github-circle" title="View on GitHub"></i></a><a class="toolbar-icons pull-right"><i class="mdi mdi-content-copy js-copy" title="Copy to Clipboard"></i></a><span class="copy-msg pull-right"></span><code class="language-javascript">// seed should be stored in a file and treated like a secret
const seed = &#39;SUAEL6GG2L2HIF7DUGZJGMRUFKXELGGYFMHF76UO2AYBG3K4YLWR3FKC2Q&#39;;
let nc = NATS.connect({
url: server.nats,
nkey: uPub,
nkey: &#39;UD6OU4D3CIOGIDZVL4ANXU3NWXOW5DCDE2YPZDBHPBXCVKHSODUA4FKI&#39;,
sigCB: function (nonce) {
const sk = nkeys.fromSeed(Buffer.from(uSeed));
const sk = nkeys.fromSeed(Buffer.from(seed));
return sk.sign(nonce);
}
});
@ -86,11 +89,14 @@ nc.close();
</div>
<div class="tab__content">
<pre id="connect_nkey_ts_content"><a class="toolbar-icons pull-right" target="_blank" href="https://github.com/nats-io/ts-nats-examples/blob/master/src/auth_examples.ts#L92-101"><i class="mdi mdi-github-circle" title="View on GitHub"></i></a><a class="toolbar-icons pull-right"><i class="mdi mdi-content-copy js-copy" title="Copy to Clipboard"></i></a><span class="copy-msg pull-right"></span><code class="language-javascript">let nc = await connect({
<pre id="connect_nkey_ts_content"><a class="toolbar-icons pull-right" target="_blank" href="https://github.com/nats-io/ts-nats-examples/blob/master/src/auth_examples.ts#L89-101"><i class="mdi mdi-github-circle" title="View on GitHub"></i></a><a class="toolbar-icons pull-right"><i class="mdi mdi-content-copy js-copy" title="Copy to Clipboard"></i></a><span class="copy-msg pull-right"></span><code class="language-javascript">// seed should be stored in a file and treated like a secret
const seed = &#39;SUAEL6GG2L2HIF7DUGZJGMRUFKXELGGYFMHF76UO2AYBG3K4YLWR3FKC2Q&#39;;
let nc = await connect({
url: server.nats,
nkey: uPub,
nkey: &#39;UD6OU4D3CIOGIDZVL4ANXU3NWXOW5DCDE2YPZDBHPBXCVKHSODUA4FKI&#39;,
nonceSigner: function (nonce) {
const sk = fromSeed(Buffer.from(uSeed));
const sk = fromSeed(Buffer.from(seed));
return sk.sign(Buffer.from(nonce));
}
});