This section describes the requirements for using your own Custom UI for your Digital Hero’s conversational experiences.
NOTE: A core assumption for this section is that you already have familiarity with building a UI and/or backend orchestration server for your conversational experience. It also assumed that you have integrated our Web SDK into your website. If not, please refer to your technical kickoff documentation.
What is a Shared Secret Key
A Shared Secret Key (SSK) is a cryptographic key or data that is only known to the parties involved in a secured communication. The shared secret can be anything from passwords or passphrases to a random number or an array of randomly chosen data.
Why would I use a Shared Secret Key
Soul Machines uses an SSK to grant your UI access to our session servers. By signing a JSON Web Token with the SSK, our servers will grant you access. By accessing these servers, you will effectively be able to host our Digital Hero conversational experiences on your website and optionally connect the Digital Hero to a custom backend.
The DDNA Studio provides you with the three pieces of information that you need:
privateKey
keyName; this is called the “issuer” within the JWT
Session Server domain name also called the Persona Server or Digital Hero Server.
The private key must be used to sign the JWT using HMAC-SHA256 signing standard, as shown in the following architecture diagram.
Figure 10: Architecture Diagram
How would I use a Shared Secret Key
When deploying an experience through the Digital DNA Studio, be sure to:
Select the “I HAVE MY OWN” option from the Deployment Configuration screen. You will be provided with a privateKey and the keyName under the “Session Server” category.
Sign your JWT. Use these three values when you are signing your JSON Web Token (JWT) to authorize a connection to the Digital Hero.
NOTE: This is a token sent along with the connection request from a UI you are hosting yourself (your website) and tells our server to grant you access.
Sample Code
You can use our sample code for local development testing and as the basis of a production deployment if you wish.
Express Token Server
The express-token-server sample code generates signed JWTs. To use the values provided by DDNA Studio, copy the .env.template file to .env, then within that copied file:
Assign the SESSION_SERVER variable to the Session Server name provided by Studio.
Assign the JWT_PUBLIC_KEY variable to the Key Name provided by Studio.
Assign the JWT_PRIVATE_KEY variable to the Private Key provided by Studio.
React Templates
UI sample code such as react-template can now be pointed at the express-token-server to use it for JWT generation, which in turn enables the UI to connect to the video and audio streams associated with the Digital Hero running on Soul Machines' servers.
Connect to a Custom Back-end
If you wish to connect to a custom backend Orchestration Server to direct your Digital Hero, then the address of this server must be included in your signed JWT using the sm-control
field.
Refer to the Soul Machines Web Development Kit Reference Guide for more information on configuring your JWT.