Node.js HMKit

HMKit is the main class of the SDK and is also used for initialisation. The returned instance is used to access all subclasses, e.g. hmkit.telematics to access the Telematics features.

Methods

Constructor

Declaration

new HMKit(clientCertificate, clientPrivateKey)

Parameters

clientCertificate

(string) ClientCertificate retrieved from the DeveloperCenter

clientPrivateKey

(string) Private key (elliptic curve p256v1) for this client; must be 32 bytes and match the public key in ClientCertificate

Returns

HMKit

Discussion

The HMKit instance is the access point for all further operations with the SDK.
Head over to the Node.js Tutorial if there's any trouble finding the client certificate.

Example

import HMKit from 'hmkit';

const hmkit = new HMKit(
    "dGVzdB7ep5h7SLfibBXpdEXbG5rBwggRencZJOraGFr2UhuqsbvNP6bi7J0L2AVOEotHRmbEzlhvDMfj4u24b7cBOmYS+P8bQEL4J4ACODhd1xlg0WL7kvJXChBsBtRj7Lfd4QMSIt6tuTZVQO2TEZQQZAUz65MXPoMaGfy3xamN07wC2nHNmuJsibIKcIK2kgNZRXTh8JDJ",
    "OZurZt6RogBOrU4IDH/cVJGhV8Lz4y1BjMbldbbLoe0="
);

Download car access certificate with token

Declaration

hmkit.downloadAccessCertificate(accessToken)

Parameters

accessToken

(string) An access token that has been granted through the OAuth process

Returns

Promise

Discussion

When the request has finished an AccessCertificate class instance is returned. Read the OAuth2 API docs for instructions on how to get car access tokens.

Get an AccessCertificate instance from a raw access certificate object

Declaration

hmkit.accessCertificate(rawAccessCertificate)

Parameters

rawAccessCertificate

(object) Raw access certificate object

Returns

AccessCertificate

Discussion

The AccessCertificate is used for sending Telematics commands

Example

const accessCertificate = hmkit.accessCertificate({
    version: '01',
    issuer: '746D6373',
    accessProvidingSerialNumber: 'FC2E6591408076A340',
    accessGainingSerialNumber: 'A591328838870F6FF3',
    accessGainingPublicKey:
    '004523E33CE6954E39C257E96E10096C23AF10A029444766C0AE51AF36B1F79B1F32B97EA95B8122ABA64723278B676B597F55D6C4910BBA53A1DA0BE9EE0C8A',
    validityStartDate: '2020-04-09T05:41:00.000Z',
    validityEndDate: '2025-04-09T05:41:00.000Z',
    permissions: '1007FFFDFFEFFFFFFFFF1F0000000000'
});