API Keys
Overview
The connection between the SDK and the glasses involves a handshake process.
During this process a signed digital glasses certificate is transferred from the SDK to the glasses to be validated by the glasses.
If valid - the connection is approved, otherwise the glasses disconnected the application.
In order to generate the glasses certificate and to enable connection to the glasses, the SDK needs an API Key.
There are 2 types of API Keys to be used:
Name | Key file | Usage | When we provide this key? |
---|---|---|---|
Developer key | sdk.key |
When developing your application using the SDK | Upon purchasing the sdk kit or extending existing developer license |
Runtime key | app.key |
When publishing your application to the AppStore\GooglePlay | Upon approving your runtime key request |
The api keys are sent by the SDK to the Everysight server when a new glasses certificate generation is required
Note
When developing your application, ensure that you have the sdk.key
provided with your Maverick Developer Edition.
Developer Key
The developer key, sdk.key
, enables your application to connect the glasses during the development process.
The server, upon glasses certificate generation request, verifies that the developer license is valid for your glasses and generates the glasses certificate.
The sdk.key
also enables the sdk to connect the simulator.
Runtime Key
The application runtime key, app.key
, is a runtime key that enables your application, when published to the AppStore\GooglePlay, to connect the glasses.
The server, upon glasses certificate generation request, verifies that the application is approved by Everysight to connect the Maverick glasses and generates the glasses certificate.
Unlike the sdk.key
, the runtime app.key
will enable your application to connect any glasses, even when your developer license is expired.
Runtime Key Request
Application runtime app.key
request is done by sending an email to support@everysight.com, and supplying the following information:
- Your application AppStore or GooglePlay URL
- Your contact information (full name, country, email, phone number)
- Attache your
sdk.key
file
Our support team will review the request and contact you afterwards.
Using the api key
The api key file should be added to the application resources, as a regular resource (see the Managing Resources documentation)
The SDK searches the api key file in the following order:
- Search an
app.key
file - Search for
sdk.[serial].key
file- Should be used when the application is developed using several developer kits (in that case you have several
sdk.key
files)
- Should be used when the application is developed using several developer kits (in that case you have several
- Search an
sdk.key
file
Note
In most cases, the api key file name should not be changed, and should be either sdk.key
or app.key
Required Permissions
Android and WearOS applications must have the internet permission in the AndroidManifest.xml
to enable receiving the glasses certificate from the server
Simulator & sdk.key
The sdk.key
also enables connecting the simulator.
If you've renamed your sdk.key
to sdk.[glasses_serial].key
, connecting to the simulator may encounter issues since the simulator has its own distinct serial number. To resolve this, consider one of the following options:
- Keep the
sdk.key
file in addition to thesdk.[glasses_serial].key
. - Duplicate the
sdk.key
file and rename it to include the simulator serial:sdk.[sim_serial].key
Manually set the API Key
In rare cases, when the api key file can't be added to the application resources, or a different naming is required, it can be set to the SDK via the SDK API:
// In this example, the application is registered to the IEvsAppEvents interface
// Upon receiving the onBeginAuth,
override fun onBeginAuth(serial: String, fwVersion: Int) {
super.onBeginAuth(serial, fwVersion)
var fileNameWithoutExt = "my-key-name"
Evs.instance().auth().setApiKeyName(fileNameWithoutExt)
// You ban also set the sdk.key\app.key file content via
// Evs.instance().auth().setApiKey(apiKey: ByteArray)
}
Glasses Certificate
As stated, the glasses certificate is generated by the Everysight server.
The SDK, when the SDK detects that the glasses certificate is missing or expired, requests the Everysight server to generate a new certificate.
The server, upon validating the api.key
, generates the glasses certificate to be used by the SDK.
The certificate generation process is transparent to the application and\or the developer, but requires the application to have internet access.
Info
To reduce the need to access the everysight server, the SDK persist the glasses certificate.
Since the glasses certificate is generated with 30 days expiration, the server access is performed only once in a while.
Read Next
- Deep dive into the SDK functionality by reading the SDK Engine documentation
- Learn how to create a better UI for the glasses by reading our UI Kit documentation