Methods
closeSession(sessionId) → {response}
Flush a given Session.
Parameters:
| Name | Type | Description |
|---|---|---|
sessionId |
string | A Session identifier |
Throws:
-
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:
A response object with Session Closed.
- Type
- response
decrypt(sessionId, keyId, data, IV) → {response}
Decrypt a data buffer.
Parameters:
| 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:
-
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:
A promise response object with the decrypted buffer.
- Type
- response
encrypt(sessionId, keyId, data, IV) → {response}
Encrypt a data buffer.
Parameters:
| 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:
-
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:
A promise response object with the encrypted buffer.
- Type
- response
getChallenge(sessionId) → {response}
Get the challenge associated to a Session.
Parameters:
| Name | Type | Description |
|---|---|---|
sessionId |
string | A Session identifier |
Throws:
Will throw an NV_DAS_ERROR_BAD_PARAMETER error in case of failure to retrieve the Session.
Returns:
A response object with the challenge.
- Type
- response
getKeys(sessionId) → {response}
Retrieve key ids and usages of a given license.
Parameters:
| Name | Type | Description |
|---|---|---|
sessionId |
string | A Session identifier |
Throws:
Will throw an NV_DAS_ERROR_BAD_PARAMETER error in case of failure to retrieve the Session.
Returns:
-
A response object containing Session keys.
- Type
- response
-
Session keys are returned as a stringified json list of "keyId":[keyId], "usage":[usage]
-
Where [usage] possible values are "Encryption key" and "Signing key"
importLicense(sessionId, license) → {response}
Import a license linked to the provided Session.
Parameters:
| Name | Type | Description |
|---|---|---|
sessionId |
string | A Session identifier |
license |
string | A signed license |
Throws:
Will throw an NV_DAS_ERROR_BAD_PARAMETER error in case of failure to retrieve the Session.
Returns:
A promise response object with OK/NOK.
- Type
- response
init(opvault_url) → {response}
Initialization of the DAS SDK.
Parameters:
| Name | Type | Description |
|---|---|---|
opvault_url |
string | The URI of a valid opvault certificate |
Throws:
-
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:
Response object with NV_DAS_SUCCESS, if the SDK was initialized correctly.
- Type
- response
openSession() → {response}
Open a new Session.
Throws:
-
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:
-
A promise response object with the sessionId.
- Type
- response
-
sessionId is a uint of 13 digits or less.
sign(sessionId, keyId, data, dataFormat) → {response}
Sign a data buffer.
Parameters:
| 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 | 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:
-
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:
A promise response object with the signature.
The signature will be returned as an array buffer, as in [1,2,3].
- Type
- response
verify(sessionId, keyId, data, signature, dataFormat) → {response}
Verify a data buffer.
Parameters:
| 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:
-
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:
A promise response object with the verification result.
- Type
- response
Type Definitions
response
Response Object for Das Web SDK.
Type:
- Object
Properties:
| Name | Type | Description |
|---|---|---|
status |
string | Indicates a One of these StatusCode result of the requested operation |
message |
string | Provides an error message in case of failure |
data |
object | Provides the requested data, where applicable, in case of a successful operation |
StatusCode
NV_DAS_SUCCESS : The device authentication client has been successful
NV_DAS_ERROR_BAD_PARAMETER : The device authentication client failed, One or more provided parameters are invalid
NV_DAS_ERROR_NO_KEY : The device authentication client failed, The related key cannot be found
NV_DAS_ERROR_NO_SESSION : The device authentication client failed, The related session identifier does not refer a valid DAS session
NV_DAS_ERROR_UNSUPPORTED_OPERATION : The device authentication client failed, Key referred by keyIdentifier cannot be used for desired crypto operation
NV_DAS_ERROR_CRYPTOENGINE : The device authentication client failed, Crypto operation failed due to error from crypto engine
NV_DAS_ERROR_INVALID_OPERATOR_CERTIFICATE : The device authentication client failed, The operator certificate is either invalid or corrupted
NV_DAS_ERROR : The device authentication client failed, An unexpected error occurred