DAS Web SDK

Module: dasWebSDK

dasWebSDK

Utility functions for the DAS WEB Client.

Version:
  • 5.4.0.1765981380
Author:
  • Nagravision

Methods

innercloseSession(sessionId){response}

Flush a given Session.

Name Type Description
sessionId string

A Session identifier

Throws:
Type When

Will throw an NV_DAS_ERROR_BAD_PARAMETER error in case of not passing Session.

Will throw an NV_DAS_ERROR_NO_SESSION error in case of failure to retrieve the Session.

Will throw an NV_DAS_ERROR error in case of failure to close the Session.

Returns:
Type Description
response A response object with Session Closed.

innerdecrypt(sessionId, keyId, data, IV){response}

Decrypt a data buffer.

Name Type Description
sessionId string

A Session identifier

keyId string

A key idendifier

data Buffer

The data buffer to be decrypted

IV Buffer

The IV buffer to be used for decryption

Throws:
Type When

Will throw an NV_DAS_ERROR_BAD_PARAMETER error in case of not passing session Id,KeyId,data,IV.

Will throw an NV_DAS_ERROR_CRYPTOENGINE error in case of decryption failure.

Will throw an NV_DAS_ERROR_UNSUPPORTED_OPERATION error in case of passing incorrect key.

Returns:
Type Description
response A promise response object with the decrypted buffer.

innerencrypt(sessionId, keyId, data, IV){response}

Encrypt a data buffer.

Name Type Description
sessionId string

A Session identifier

keyId string

A key idendifier

data Buffer

The data buffer to be encrypted

IV Buffer

The IV buffer to be used for encryption

Throws:
Type When

Will throw an NV_DAS_ERROR_BAD_PARAMETER error in case of not passing session Id,KeyId,data,IV.

Will throw an NV_DAS_ERROR_CRYPTOENGINE error in case of encryption failure.

Will throw an NV_DAS_ERROR_UNSUPPORTED_OPERATION error in case of passing incorrect key.

Returns:
Type Description
response A promise response object with the encrypted buffer.

innergetChallenge(sessionId){response}

Get the challenge associated to a Session.

Name Type Description
sessionId string

A Session identifier

Throws:
Type When

Will throw an NV_DAS_ERROR_BAD_PARAMETER error in case of failure to retrieve the Session.

Returns:
Type Description
response A response object with the challenge.

innergetKeys(sessionId){response}

Retrieve key ids and usages of a given license.

Name Type Description
sessionId string

A Session identifier

Throws:
Type When

Will throw an NV_DAS_ERROR_BAD_PARAMETER error in case of failure to retrieve the Session.

Returns:
Type Description
response A response object containing Session keys.
Session keys are returned as a stringified json list of "keyId":[keyId], "usage":[usage]
Where [usage] possible values are "Encryption key" and "Signing key"

innerimportLicense(sessionId, license){response}

Import a license linked to the provided Session.

Name Type Description
sessionId string

A Session identifier

license string

A signed license

Throws:
Type When

Will throw an NV_DAS_ERROR_BAD_PARAMETER error in case of failure to retrieve the Session.

Returns:
Type Description
response A promise response object with OK/NOK.

innerinit(operatorData){response}

Initialization of the DAS SDK.

Name Type Description
operatorData string

The JSON data or the URI of a valid opvault certificate

Throws:
Type When

Will throw an NV_DAS_ERROR_BAD_PARAMETER error in case of not passing Url.

Will throw an NV_DAS_ERROR_INVALID_OPERATOR_CERTIFICATE error in case of passing incorrect Url.

Returns:
Type Description
response Response object with NV_DAS_SUCCESS, if the SDK was initialized correctly.

inneropenSession(){response}

Open a new Session.

Throws:
Type When

Will throw an NV_DAS_ERROR_NO_SESSION error in case of failure to create a new Session.

Will throw an NV_DAS_ERROR_BAD_PARAMETER error in case of invalid opvault url.

Returns:
Type Description
response A promise response object with the sessionId.
sessionId is a uint of 13 digits or less.

innersetOperatorUUID(the)

Set the UUID of the operator for TV Key. This method must be called before initialization of the DAS SDK.

Name Type Description
the string

UUID of the operator.

innersign(sessionId, keyId, data, dataFormat){response}

Sign a data buffer.

Name Type Description
sessionId string

A Session identifier

keyId string

A key identifier

data string | arraystring | arraybuffer

The data buffer to be signed

The buffer format can be one of the following:

string, as in "hello"

arraystring, as in "1,2,3"

arraybuffer, as in [1,2,3]

See dataFormat parameter to specify the data buffer format.

dataFormat string

optional and can take the following values:

"String", data is assumed to be a string as in "hello"

"ArrayString", data is assumed to be an array string as in "1,2,3"

"ArrayBuffer", data is assumed to be an array buffer as in [1,2,3]

When dataFormat is not specified, default value is "ArrayString"

Throws:
Type When

Will throw an NV_DAS_ERROR_BAD_PARAMETER error in case of failure to retrieve the Session.

Will throw an NV_DAS_ERROR_CRYPTOENGINE error in case of signature failure.

Will throw an NV_DAS_ERROR_UNSUPPORTED_OPERATION error in case of passing incorrect key.

Returns:
Type Description
response A promise response object with the signature.
The signature will be returned as an array buffer, as in [1,2,3].

innerverify(sessionId, keyId, data, signature, dataFormat){response}

Verify a data buffer.

Name Type Description
sessionId string

A Session identifier

keyId string

A key identifier

data string | arraystring | arraybuffer

The data buffer to be signed

The buffer format can be one of the following:

string, as in "hello"

arraystring, as in "1,2,3"

arraybuffer, as in [1,2,3]

See dataFormat parameter to specify the data buffer format.

signature ArrayString

The signature of the data buffer

dataFormat string

dataFormat parameter is optional and can take the following values:

"String", data is assumed to be a string as in "hello"

"ArrayString", data is assumed to be an array string as in "1,2,3"

"ArrayBuffer", data is assumed to be an array buffer as in [1,2,3]

When dataFormat is not specified, default value is "ArrayString"

Throws:
Type When

Will throw an NV_DAS_ERROR_BAD_PARAMETER error in case of failure to retrieve the Session.

Will throw an NV_DAS_ERROR_CRYPTOENGINE error in case of verification failure.

Will throw an NV_DAS_ERROR_UNSUPPORTED_OPERATION error in case of passing incorrect key.

Returns:
Type Description
response A promise response object with the verification result.