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:
parent
48b583c57e
commit
9b464389eb
@ -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, 'credsfile.creds');
|
||||
|
||||
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, 'credsfile.creds');
|
||||
|
||||
let nc = await connect({
|
||||
url: server.nats,
|
||||
userCreds: testCreds
|
||||
userCreds: credsFile
|
||||
});
|
||||
</code></pre>
|
||||
</div>
|
||||
|
@ -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 = 'SUAEL6GG2L2HIF7DUGZJGMRUFKXELGGYFMHF76UO2AYBG3K4YLWR3FKC2Q';
|
||||
|
||||
let nc = NATS.connect({
|
||||
url: server.nats,
|
||||
nkey: uPub,
|
||||
nkey: 'UD6OU4D3CIOGIDZVL4ANXU3NWXOW5DCDE2YPZDBHPBXCVKHSODUA4FKI',
|
||||
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 = 'SUAEL6GG2L2HIF7DUGZJGMRUFKXELGGYFMHF76UO2AYBG3K4YLWR3FKC2Q';
|
||||
|
||||
let nc = await connect({
|
||||
url: server.nats,
|
||||
nkey: uPub,
|
||||
nkey: 'UD6OU4D3CIOGIDZVL4ANXU3NWXOW5DCDE2YPZDBHPBXCVKHSODUA4FKI',
|
||||
nonceSigner: function (nonce) {
|
||||
const sk = fromSeed(Buffer.from(uSeed));
|
||||
const sk = fromSeed(Buffer.from(seed));
|
||||
return sk.sign(Buffer.from(nonce));
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user