# Getting Started You always want to use `SodiumPlus` from within an asynchronous function. ```javascript const { SodiumPlus } = require('sodium-plus'); let sodium; async function myFunction() { if (!sodium) sodium = await SodiumPlus.auto(); // Now you can use sodium.FUNCTION_NAME_HERE() } ``` When you use `await SodiumPlus.auto()`, this will automatically load in the best backend available for your platform. This is the recommended way to use SodiumPlus. If you'd rather use a specific backend, you can do the following: ```javascript const { SodiumPlus, SodiumUtil, getBackendObject } = require('sodium-plus'); let sodium; async function myFunction() { if (!sodium) { let backend = getBackendObject('LibsodiumWrappers'); SodiumUtil.populateConstants(backend); sodium = new SodiumPlus(backend); } // Now you can use sodium.FUNCTION_NAME_HERE() } ``` To discover what backend you're using at runtime, invoke the `getBackendName()` method on the `SodiumPlus` object, like so: ```javascript const { SodiumPlus } = require('sodium-plus'); let sodium; async function whichBackend() { if (!sodium) sodium = await SodiumPlus.auto(); console.log(sodium.getBackendName()); } ``` ## CryptographyKey All cryptographic secrets are contained within a `CryptographyKey` object (or one of its derived classes). You can create and access them like so: ```javascript const { CryptographyKey } = require('sodium-plus'); let buf = Buffer.alloc(32); let key = new CryptographyKey(buf); // If you do this, the internal buffer will not be visible! console.log(key); // CryptographyKey {} // You'll need to do this instead: console.log(key.getBuffer()); // ``` The following classes inherit from `CryptographyKey`: * `Ed25519PublicKey` -- Ed25519 public key * `Ed25519SecretKey` -- Ed25519 secret key * `X25519PublicKey` -- X25519 public key * `X25519SecretKey` -- X25519 secret key ## Sodium-Plus in the Browser First, download [sodium-plus.min.js](../dist) (or find it on a CDN you trust). Next, include the following script tags in your web page: ```html5 ``` You can then use the `sodium` API as documented.