| path | string | Yes | Absolute path of the target file. |
| algorithm | string | Yes | Algorithm used to calculate the hash value. The value can be **md5**, **sha1**, or **sha256**.**sha256** is recommended for security purposes.|
| algorithm | string | Yes | Algorithm used to calculate the hash value. The value can be **md5**, **sha1**, or **sha256**.**sha256** is recommended for security purposes.|
- Return value
| Type | Description |
...
...
@@ -991,14 +990,14 @@ Asynchronously calculates the hash value of a file. This method uses a callback
| path | string | Yes | Absolute path of the target file. |
| algorithm | string | Yes | Algorithm used to calculate the hash value. The value can be **md5**, **sha1**, or **sha256**.**sha256** is recommended for security purposes.|
| algorithm | string | Yes | Algorithm used to calculate the hash value. The value can be **md5**, **sha1**, or **sha256**.**sha256** is recommended for security purposes.|
| callback | AsyncCallback<string> | Yes | Callback used to return the hash value. The hash value is a hexadecimal string consisting of digits and uppercase letters.|
@@ -2407,14 +2408,14 @@ Provides detailed file information. Before calling a method of the **Stat** clas
isBlockDevice(): boolean
Checks whether the current directory entry is a block special file. A block special file supports access by block only, and it is cached when accessed.
Checks whether this file is a block special file. A block special file supports access by block only, and it is cached when accessed.
| boolean | Whether the directory entry is a block special file.|
| boolean | Whether the file is a block special file.|
- Example
```js
...
...
@@ -2426,14 +2427,14 @@ Checks whether the current directory entry is a block special file. A block spec
isCharacterDevice(): boolean
Checks whether the current directory entry is a character special file. A character special file supports random access, and it is not cached when accessed.
Checks whether this file is a character special file. A character special file supports random access, and it is not cached when accessed.
| options | [HuksOptions](#huksoptions) | Yes | Tags required for generating the key. |
| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback used to return the result. If the operation is successful, **HUKS_SUCCESS** will be returned. If the operation fails, an error code will be returned. For details about the error codes, see **HuksResult**.|
| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback used to return the result. If the operation is successful, **HUKS_SUCCESS** will be returned. If any other result is returned, see **HuksResult**.|
| Promise\<[HuksResult](#huksresult)> | Promise used to return the result. If the operation is successful, **HUKS_SUCCESS** will be returned. If the operation fails, an error code will be returned. For details about the error codes, see **HuksResult**.|
| Promise\<[HuksResult](#huksresult)> | Promise used to return the result. If the operation is successful, **HUKS_SUCCESS** will be returned. If the operation fails, an error code will be returned.|
| Promise\<[HuksResult](#huksresult)> | Promise used to return the result. If the operation is successful, **HUKS_SUCCESS** will be returned. If the operation fails, an error code will be returned. For details about the error codes, see **HuksResult**.|
| Promise\<[HuksResult](#huksresult)> | Promise used to return the result. If the operation is successful, **HUKS_SUCCESS** will be returned. If the operation fails, an error code will be returned.|
**Example**
```js
varalias='alias';
/* Set options to emptyOptions. */
varkeyAlias='keyAlias';
varemptyOptions={
properties:[]
};
varresult=huks.deleteKey(alias,emptyOptions);
varresult=huks.deleteKey(keyAlias,emptyOptions);
```
## huks.getSdkVersion
...
...
@@ -535,6 +531,7 @@ Obtains the SDK version of the current system.
**Example**
```js
/* Set options to emptyOptions. */
varemptyOptions={
properties:[]
};
...
...
@@ -560,31 +557,41 @@ Imports a key. This method uses an asynchronous callback to return the result.
| Promise\<[HuksResult](#huksresult)> | Promise used to return the result. If the operation is successful, **HUKS_SUCCESS** will be returned. If the operation fails, an error code will be returned. For details about the error codes, see **HuksResult**.|
| Promise\<[HuksResult](#huksresult)> | Promise used to return the result. If the operation is successful, **HUKS_SUCCESS** will be returned. If the operation fails, an error code will be returned.|
| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback used to return the result. If the operation is successful, **HUKS_SUCCESS** will be returned. If the operation fails, an error code will be returned. For details about the error codes, see **HuksResult**.<br/>**outData** contains the public key exported.|
| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback used to return the result. If the operation is successful, **HUKS_SUCCESS** will be returned. If the operation fails, an error code will be returned. **outData** contains the public key exported.|
**Example**
```js
/* Set options to emptyOptions. */
varkeyAlias='keyAlias';
varemptyOptions={
properties:[]
...
...
@@ -692,6 +712,7 @@ Exports a key. This method uses a promise to return the result.
**Example**
```js
/* Set options to emptyOptions. */
varkeyAlias='keyAlias';
varemptyOptions={
properties:[]
...
...
@@ -713,11 +734,12 @@ Obtains key properties. This method uses an asynchronous callback to return the
| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback used to return the result. In **errorCode**, **HUKS_SUCCESS** will be returned if the operation is successful; an error code will be returned otherwise. For details about the error codes, see **HuksResult**.|
| callback | AsyncCallback\<[HuksResult](#huksresult)> | Yes | Callback used to return the result. **HUKS_SUCCESS** will be returned if the operation is successful; an error code will be returned otherwise.|
**Example**
```js
/* Set options to emptyOptions. */
varkeyAlias='keyAlias';
varemptyOptions={
properties:[]
...
...
@@ -744,11 +766,12 @@ Obtains key properties. This method uses a promise to return the result.
| Promise\<[HuksResult](#huksoptions)> | Promise used to return the result. In **errorCode**, **HUKS_SUCCESS** will be returned if the operation is successful; an error code will be returned otherwise. For details about the error codes, see **HuksResult**.|
| Promise\<[HuksResult](#huksoptions)> | Promise used to return the result. In the return result, **HUKS_SUCCESS** will be returned for **errorCode** if the operation is successful; an error code will be returned otherwise. **properties** returns the parameters required for generating the key.|
**Example**
```js
/* Set options to emptyOptions. */
varkeyAlias='keyAlias';
varemptyOptions={
properties:[]
...
...
@@ -775,6 +798,7 @@ Checks whether a key exists. This method uses an asynchronous callback to return
**Example**
```js
/* Set options to emptyOptions. */
varkeyAlias='keyAlias';
varemptyOptions={
properties:[]
...
...
@@ -806,6 +830,7 @@ Checks whether a key exists. This method uses a promise to return the result.
**Example**
```js
/* Set options to emptyOptions. */
varkeyAlias='keyAlias';
varemptyOptions={
properties:[]
...
...
@@ -814,6 +839,7 @@ var result = huks.isKeyExist(keyAlias, emptyOptions);