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 disconnect 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 to 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)
 - Attach your 
sdk.keyfile 
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 for the API key file in the following order:
- Search for an 
app.keyfile - Search for a 
sdk.[serial].keyfile - This should be used when the application is developed using several developer kits (in that case you have several 
sdk.keyfiles) - Search for an 
sdk.keyfile 
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 Wear OS 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 to 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.keyfile in addition to thesdk.[glasses_serial].key. - Duplicate the 
sdk.keyfile 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 can 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 persists 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