未验证 提交 6b51c76f 编写于 作者: O openharmony_ci 提交者: Gitee

!16182 [翻译完成】#I6MRCK (15950+15865+15812+15692+15641+15638)

Merge pull request !16182 from Annie_wang/PR15905
...@@ -51,7 +51,7 @@ For details about the supported specifications, see [HMAC Algorithm Specificatio ...@@ -51,7 +51,7 @@ For details about the supported specifications, see [HMAC Algorithm Specificatio
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------ | ---- | ------------------------------------------------------------ | | ------- | ------ | ---- | ------------------------------------------------------------ |
| algName | string | Yes | Digest algorithm. For details about the supported algorithms, see [HMAC Algorithm Specifications](../../security/cryptoFramework-overview.md#hmac-algorithm-specifications). | | algName | string | Yes | Digest algorithm. For details about the supported algorithms, see [HMAC Algorithm Specifications](../../security/cryptoFramework-overview.md#hmac-algorithm-specifications).|
**Return value** **Return value**
...@@ -483,7 +483,7 @@ For details about the supported specifications, see [MD Algorithm Specifications ...@@ -483,7 +483,7 @@ For details about the supported specifications, see [MD Algorithm Specifications
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------ | ---- | ------------------------------------------------------------ | | ------- | ------ | ---- | ------------------------------------------------------------ |
| algName | string | Yes | Digest algorithm. For details about the supported algorithms, see [MD Algorithm Specifications](../../security/cryptoFramework-overview.md#md-algorithm-specifications). | | algName | string | Yes | Digest algorithm. For details about the supported algorithms, see [MD Algorithm Specifications](../../security/cryptoFramework-overview.md#md-algorithm-specifications).|
**Return value** **Return value**
...@@ -1852,7 +1852,7 @@ Updates the data to encrypt or decrypt by segment. This API uses a promise to re ...@@ -1852,7 +1852,7 @@ Updates the data to encrypt or decrypt by segment. This API uses a promise to re
| Type | Description | | Type | Description |
| ------------------------------- | ------------------------------------------------ | | ------------------------------- | ------------------------------------------------ |
| Promise\<[DataBlob](#datablob)> | Promise used to return the **DataBlob** (containing the encrypted or decrypted data). | | Promise\<[DataBlob](#datablob)> | Promise used to return the **DataBlob** (containing the encrypted or decrypted data).|
**Error codes** **Error codes**
...@@ -2174,7 +2174,7 @@ update(data : DataBlob, callback : AsyncCallback\<void>) : void ...@@ -2174,7 +2174,7 @@ update(data : DataBlob, callback : AsyncCallback\<void>) : void
Updates the data to be signed. This API uses an asynchronous callback to return the result. Updates the data to be signed. This API uses an asynchronous callback to return the result.
> **NOTE**<br> > **NOTE**<br>
> For details about the sample code for calling **update()** multiple times, see [Signing Data and Verifying Signatures](../../security/cryptoFramework-guidelines.md#signing-data-and-verifying-signatures). > For details about the sample code for calling **update()** multiple times, see [Generating and Verifying a Signature](../../security/cryptoFramework-guidelines.md#generating-and-verifying-a-signature).
**System capability**: SystemCapability.Security.CryptoFramework **System capability**: SystemCapability.Security.CryptoFramework
...@@ -2200,7 +2200,7 @@ update(data : DataBlob) : Promise\<void>; ...@@ -2200,7 +2200,7 @@ update(data : DataBlob) : Promise\<void>;
Updates the data to be signed. This API uses a promise to return the result. Updates the data to be signed. This API uses a promise to return the result.
> **NOTE**<br> > **NOTE**<br>
> For details about the sample code for calling **update()** multiple times, see [Signing Data and Verifying Signatures](../../security/cryptoFramework-guidelines.md#signing-data-and-verifying-signatures). > For details about the sample code for calling **update()** multiple times, see [Generating and Verifying a Signature](../../security/cryptoFramework-guidelines.md#generating-and-verifying-a-signature).
**System capability**: SystemCapability.Security.CryptoFramework **System capability**: SystemCapability.Security.CryptoFramework
...@@ -2267,6 +2267,8 @@ Signs the data. This API uses a promise to return the result. ...@@ -2267,6 +2267,8 @@ Signs the data. This API uses a promise to return the result.
| -------------- | ----------- | | -------------- | ----------- |
| Promise\<void> | Promise used to return the result.| | Promise\<void> | Promise used to return the result.|
**Error codes**
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------- | | -------- | ---------------------- |
| 17620001 | memory error. | | 17620001 | memory error. |
...@@ -2465,7 +2467,7 @@ update(data : DataBlob, callback : AsyncCallback\<void>) : void ...@@ -2465,7 +2467,7 @@ update(data : DataBlob, callback : AsyncCallback\<void>) : void
Updates the data for signature verification. This API uses an asynchronous callback to return the result. Updates the data for signature verification. This API uses an asynchronous callback to return the result.
> **NOTE** > **NOTE**
> For details about the sample code for calling **update()** multiple times, see [Signing Data and Verifying Signatures](../../security/cryptoFramework-guidelines.md#signing-data-and-verifying-signatures). > For details about the sample code for calling **update()** multiple times, see [Generating and Verifying a Signature](../../security/cryptoFramework-guidelines.md#generating-and-verifying-a-signature).
**System capability**: SystemCapability.Security.CryptoFramework **System capability**: SystemCapability.Security.CryptoFramework
...@@ -2491,7 +2493,7 @@ update(data : DataBlob) : Promise\<void>; ...@@ -2491,7 +2493,7 @@ update(data : DataBlob) : Promise\<void>;
Updates the data for signature verification. This API uses a promise to return the result. Updates the data for signature verification. This API uses a promise to return the result.
> **NOTE** > **NOTE**
> For details about the sample code for calling **update()** multiple times, see [Signing Data and Verifying Signatures](../../security/cryptoFramework-guidelines.md#signing-data-and-verifying-signatures). > For details about the sample code for calling **update()** multiple times, see [Generating and Verifying a Signature](../../security/cryptoFramework-guidelines.md#generating-and-verifying-a-signature).
**System capability**: SystemCapability.Security.CryptoFramework **System capability**: SystemCapability.Security.CryptoFramework
......
...@@ -67,7 +67,8 @@ Sets a security label for a file in asynchronous mode. This API uses a promise t ...@@ -67,7 +67,8 @@ Sets a security label for a file in asynchronous mode. This API uses a promise t
**Example** **Example**
```js ```js
securityLabel.setSecurityLabel(path, "s0").then(() => { let filePath = pathDir + '/test.txt';
securityLabel.setSecurityLabel(filePath, "s0").then(() => {
console.info("setSecurityLabel successfully"); console.info("setSecurityLabel successfully");
}).catch((err) => { }).catch((err) => {
console.info("setSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); console.info("setSecurityLabel failed with error message: " + err.message + ", error code: " + err.code);
...@@ -93,7 +94,8 @@ Sets a security label for a file in asynchronous mode. This API uses an asynchro ...@@ -93,7 +94,8 @@ Sets a security label for a file in asynchronous mode. This API uses an asynchro
**Example** **Example**
```js ```js
securityLabel.setSecurityLabel(path, "s0", (err) => { let filePath = pathDir + '/test.txt';
securityLabel.setSecurityLabel(filePath, "s0", (err) => {
if (err) { if (err) {
console.info("setSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); console.info("setSecurityLabel failed with error message: " + err.message + ", error code: " + err.code);
} else { } else {
...@@ -120,7 +122,8 @@ Sets a security label for a file in synchronous mode. ...@@ -120,7 +122,8 @@ Sets a security label for a file in synchronous mode.
**Example** **Example**
```js ```js
securityLabel.setSecurityLabelSync(path, "s0"); let filePath = pathDir + '/test.txt';
securityLabel.setSecurityLabelSync(filePath, "s0");
``` ```
## securityLabel.getSecurityLabel ## securityLabel.getSecurityLabel
...@@ -146,7 +149,8 @@ Obtains the security label of a file in asynchronous mode. This API uses a promi ...@@ -146,7 +149,8 @@ Obtains the security label of a file in asynchronous mode. This API uses a promi
**Example** **Example**
```js ```js
securityLabel.getSecurityLabel(path).then((type) => { let filePath = pathDir + '/test.txt';
securityLabel.getSecurityLabel(filePath).then((type) => {
console.log("getSecurityLabel successfully, Label: " + type); console.log("getSecurityLabel successfully, Label: " + type);
}).catch((err) => { }).catch((err) => {
console.log("getSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); console.log("getSecurityLabel failed with error message: " + err.message + ", error code: " + err.code);
...@@ -171,7 +175,8 @@ Obtains the security label of a file in asynchronous mode. This API uses a callb ...@@ -171,7 +175,8 @@ Obtains the security label of a file in asynchronous mode. This API uses a callb
**Example** **Example**
```js ```js
securityLabel.getSecurityLabel(path, (err, type) => { let filePath = pathDir + '/test.txt';
securityLabel.getSecurityLabel(filePath, (err, type) => {
if (err) { if (err) {
console.log("getSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); console.log("getSecurityLabel failed with error message: " + err.message + ", error code: " + err.code);
} else { } else {
...@@ -202,6 +207,7 @@ Obtains the security label of a file in synchronous mode. ...@@ -202,6 +207,7 @@ Obtains the security label of a file in synchronous mode.
**Example** **Example**
```js ```js
let type = securityLabel.getSecurityLabelSync(path); let filePath = pathDir + '/test.txt';
let type = securityLabel.getSecurityLabelSync(filePath);
console.log("getSecurityLabel successfully, Label: " + type); console.log("getSecurityLabel successfully, Label: " + type);
``` ```
# @system.bluetooth (Bluetooth) # @system.bluetooth (Bluetooth)
> **NOTE**<br/> > **NOTE**
> >
> - The APIs of this module are no longer maintained since API version 7. You are advised to use [`@ohos.bluetooth`](js-apis-bluetooth.md). > - The APIs of this module are no longer maintained since API version 7. You are advised to use [`@ohos.bluetooth`](js-apis-bluetooth.md).
> >
...@@ -19,11 +19,10 @@ import bluetooth from '@system.bluetooth'; ...@@ -19,11 +19,10 @@ import bluetooth from '@system.bluetooth';
Scans for Bluetooth Low Energy (BLE) devices nearby. This operation consumes system resources. Call [bluetooth.stopBLEScan](#bluetoothstopblescanobject) to stop the scan after a BLE device is detected and connected. Scans for Bluetooth Low Energy (BLE) devices nearby. This operation consumes system resources. Call [bluetooth.stopBLEScan](#bluetoothstopblescanobject) to stop the scan after a BLE device is detected and connected.
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION
**System capability**: SystemCapability.Communication.Bluetooth.Lite **System capability**: SystemCapability.Communication.Bluetooth.Lite
**Parameters** **Parameters**
**Table 1** StartBLEScanOptions **Table 1** StartBLEScanOptions
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -42,7 +41,7 @@ Scans for Bluetooth Low Energy (BLE) devices nearby. This operation consumes sys ...@@ -42,7 +41,7 @@ Scans for Bluetooth Low Energy (BLE) devices nearby. This operation consumes sys
console.log('call bluetooth.startBLEScan success.'); console.log('call bluetooth.startBLEScan success.');
}, },
fail(code, data) { fail(code, data) {
console.log('call bluetooth.startBLEScan failed, code: ${code}, data: ${data}.'); console.log('call bluetooth.startBLEScan failed, code:' + code + ', data:' + data);
}, },
complete() { complete() {
console.log('call bluetooth.startBLEScan complete.'); console.log('call bluetooth.startBLEScan complete.');
...@@ -55,11 +54,10 @@ Scans for Bluetooth Low Energy (BLE) devices nearby. This operation consumes sys ...@@ -55,11 +54,10 @@ Scans for Bluetooth Low Energy (BLE) devices nearby. This operation consumes sys
Stops scanning for BLE devices nearby. This API is used with [bluetooth.startBLEScan(OBJECT)](#bluetoothstartblescanobject) in pairs. Stops scanning for BLE devices nearby. This API is used with [bluetooth.startBLEScan(OBJECT)](#bluetoothstartblescanobject) in pairs.
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION
**System capability**: SystemCapability.Communication.Bluetooth.Lite **System capability**: SystemCapability.Communication.Bluetooth.Lite
**Parameters** **Parameters**
**Table 2** StopBLEScanOptions **Table 2** StopBLEScanOptions
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -76,7 +74,7 @@ Stops scanning for BLE devices nearby. This API is used with [bluetooth.startBLE ...@@ -76,7 +74,7 @@ Stops scanning for BLE devices nearby. This API is used with [bluetooth.startBLE
console.log('call bluetooth.stopBLEScan success.'); console.log('call bluetooth.stopBLEScan success.');
}, },
fail(data, code) { fail(data, code) {
console.log('call bluethooth.stopBLEScan fail, code: ${code}, data: ${data}.'); console.log('call bluethooth.stopBLEScan fail, code:' + code + ', data:' + data);
}, },
complete() { complete() {
console.log('call bluethooth.stopBLEScan complete.'); console.log('call bluethooth.stopBLEScan complete.');
...@@ -89,8 +87,6 @@ Stops scanning for BLE devices nearby. This API is used with [bluetooth.startBLE ...@@ -89,8 +87,6 @@ Stops scanning for BLE devices nearby. This API is used with [bluetooth.startBLE
Subscribes to the newly detected BLE device. If this API is called multiple times, the last call takes effect. Subscribes to the newly detected BLE device. If this API is called multiple times, the last call takes effect.
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION
**System capability**: SystemCapability.Communication.Bluetooth.Lite **System capability**: SystemCapability.Communication.Bluetooth.Lite
**Parameters** **Parameters**
...@@ -122,10 +118,10 @@ Subscribes to the newly detected BLE device. If this API is called multiple time ...@@ -122,10 +118,10 @@ Subscribes to the newly detected BLE device. If this API is called multiple time
``` ```
bluetooth.subscribeBLEFound({ bluetooth.subscribeBLEFound({
success(data) { success(data) {
console.log('Called bluetooth.subscribeBLEFound successsully, data: ${data}.'); console.log('call bluetooth.subscribeBLEFound success, data: ${data}.');
}, },
fail(data, code) { fail(data, code) {
console.log('Failed to call bluetooth.startBLEScan, data: ${data}, code: ${code}.'); console.log('call bluetooth.startBLEScan failed, code:' + code + ', data:' + data);
} }
}); });
``` ```
...@@ -135,8 +131,6 @@ Subscribes to the newly detected BLE device. If this API is called multiple time ...@@ -135,8 +131,6 @@ Subscribes to the newly detected BLE device. If this API is called multiple time
Unsubscribes from the newly detected devices. Unsubscribes from the newly detected devices.
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION
**System capability**: SystemCapability.Communication.Bluetooth.Lite **System capability**: SystemCapability.Communication.Bluetooth.Lite
**Example** **Example**
......
# @system.cipher (Cipher Algorithm) # @system.cipher (Cipher Algorithm)
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. > - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>- The APIs provided by this module are deprecated since API version 9. You are advised to use [cryptoFramework-Cipher](js-apis-cryptoFramework.md#Cipher).
## Modules to Import ## Modules to Import
...@@ -18,9 +18,10 @@ Defines the response to the cipher interface called. ...@@ -18,9 +18,10 @@ Defines the response to the cipher interface called.
**System capability**: SystemCapability.Security.Cipher **System capability**: SystemCapability.Security.Cipher
| Name| Type | Mandatory| Description | | Name| Type | Readable| Writable|Description |
| ------ | ------ | ---- | ------------ | | ------ | ------ | ---- | ---- | ------------ |
| text | string | Yes | Response content.| | text | string | Yes | No | Response content.|
## CipherRsaOptions ## CipherRsaOptions
...@@ -74,39 +75,39 @@ Encrypts or decrypts data using RSA. ...@@ -74,39 +75,39 @@ Encrypts or decrypts data using RSA.
**Example** **Example**
```js ```js
export default { export default {
rsa() { rsa() {
cipher.rsa({ cipher.rsa({
// Encrypt data. // Encrypt data.
action: 'encrypt', action: 'encrypt',
// Text to be encrypted. // Text to be encrypted.
text: 'hello', text: 'hello',
// Base64-encoded public key used for encryption. // Base64-encoded public key used for encryption.
key: key:
'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCx414QSP3RsYWYzf9mkBMiBAXo\n' + 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCx414QSP3RsYWYzf9mkBMiBAXo\n' +
'6S7Lpva1fKlcuVxjoFC1iMnzD4mC0uiL4k5MNi43J64c7dbqi3qAJjdAtuwQ6NZJ\n' + '6S7Lpva1fKlcuVxjoFC1iMnzD4mC0uiL4k5MNi43J64c7dbqi3qAJjdAtuwQ6NZJ\n' +
'+Enz0RzmVFh/4yk6lmqRzuEFQqhQqSZzaLq6sq2N2G0Sv2Xl3sLvqAfe2HNm2oBw\n' + '+Enz0RzmVFh/4yk6lmqRzuEFQqhQqSZzaLq6sq2N2G0Sv2Xl3sLvqAfe2HNm2oBw\n' +
'jBpApTJ3TeneOo6Z5QIDAQAB', 'jBpApTJ3TeneOo6Z5QIDAQAB',
success: function(data) { success: function(data) {
console.log(`Handling successful:${data.text}`); console.log(`handling success:${data.text}`);
}, },
fail: function(data, code) { fail: function(data, code) {
console.log(`### cipher.rsa encryption failed ### ${code}:${data}`); console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`);
}, },
complete: function() { complete: function() {
console.log(`operation complete!`); console.log(`operation complete!`);
} }
}); });
cipher.rsa({ cipher.rsa({
// Decrypt data. // Decrypt data.
action: 'decrypt', action: 'decrypt',
// Text to be decrypted, which is binary text encoded in Base64. The decrypted text is "hello". // Text to be decrypted, which is binary text encoded in Base64. The decrypted text is "hello".
text: text:
'EPeCFPib6ayKbA0M6oSywARvFZ8dFYfjQv3nY8ikZGtS9UHq2sLPvAfpeIzggSiCxqbWeCftP1XQ\n' + 'EPeCFPib6ayKbA0M6oSywARvFZ8dFYfjQv3nY8ikZGtS9UHq2sLPvAfpeIzggSiCxqbWeCftP1XQ\n' +
'Sa+jEpzFlT1qoSTunBbrYzugPTajIJDTg6R1IRsF/J+mmakn0POVPvi4jCo9wqavB324Bx0Wipnc\n' + 'Sa+jEpzFlT1qoSTunBbrYzugPTajIJDTg6R1IRsF/J+mmakn0POVPvi4jCo9wqavB324Bx0Wipnc\n' +
'EU5WO0oBHo5l4x6dTpU=', 'EU5WO0oBHo5l4x6dTpU=',
// Base64-encoded private key used for decryption. // Base64-encoded private key used for decryption.
key: key:
'MIICXgIBAAKBgQCx414QSP3RsYWYzf9mkBMiBAXo6S7Lpva1fKlcuVxjoFC1iMnz\n' + 'MIICXgIBAAKBgQCx414QSP3RsYWYzf9mkBMiBAXo6S7Lpva1fKlcuVxjoFC1iMnz\n' +
'D4mC0uiL4k5MNi43J64c7dbqi3qAJjdAtuwQ6NZJ+Enz0RzmVFh/4yk6lmqRzuEF\n' + 'D4mC0uiL4k5MNi43J64c7dbqi3qAJjdAtuwQ6NZJ+Enz0RzmVFh/4yk6lmqRzuEF\n' +
'QqhQqSZzaLq6sq2N2G0Sv2Xl3sLvqAfe2HNm2oBwjBpApTJ3TeneOo6Z5QIDAQAB\n' + 'QqhQqSZzaLq6sq2N2G0Sv2Xl3sLvqAfe2HNm2oBwjBpApTJ3TeneOo6Z5QIDAQAB\n' +
...@@ -118,18 +119,18 @@ export default { ...@@ -118,18 +119,18 @@ export default {
'PKoljdXmJeS6rGgzGibstuHLrP3tcIho4+0CQD3ZFWzF/xq0jxKlrpWhnJuNCRfE\n' + 'PKoljdXmJeS6rGgzGibstuHLrP3tcIho4+0CQD3ZFWzF/xq0jxKlrpWhnJuNCRfE\n' +
'oO6e9yNvVA8J/5oEDSOcmqSNIp4+RhbUx8InUxnCG6Ryv5aSFu71pYcKrPkCQQCL\n' + 'oO6e9yNvVA8J/5oEDSOcmqSNIp4+RhbUx8InUxnCG6Ryv5aSFu71pYcKrPkCQQCL\n' +
'RUGcm3ZGTnslduB0knNF+V2ndwzDUQ7P74UXT+PjurTPhujFYiuxCEd6ORVnEOzG\n' + 'RUGcm3ZGTnslduB0knNF+V2ndwzDUQ7P74UXT+PjurTPhujFYiuxCEd6ORVnEOzG\n' +
'M9TORIgdH8MjIbWsGnndAkEAw9yURDaorE8IYPLF2IEn09g1uzvWPs3phDb6smVx\n' + 'M9TORIgdH8MjIbWsGnndAkEAw9yURDaorE8IYPLF2IEn09g1uzvWPs3phDb6smVx\n' +
'8GfqIdUNf+aCG5TZK/kXBF1sqcsi7jXMAf4jBlejVbSVZg==', '8GfqIdUNf+aCG5TZK/kXBF1sqcsi7jXMAf4jBlejVbSVZg==',
success: function(data) { success: function(data) {
console.log(`Handling successful:${data.text}`); console.log(`handling success:${data.text}`);
}, },
fail: function(data, code) { fail: function(data, code) {
console.log(`### cipher.rsa encryption failed ### ${code}:${data}`); console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`);
}, },
complete: function() { complete: function() {
console.log(`operation complete!`); console.log(`operation complete!`);
} }
}); });
} }
} }
``` ```
...@@ -152,48 +153,48 @@ Encrypts or decrypts data using AES. ...@@ -152,48 +153,48 @@ Encrypts or decrypts data using AES.
**Example** **Example**
```js ```js
export default { export default {
aes() { aes() {
cipher.aes({ cipher.aes({
// Encrypt data. // Encrypt data.
action: 'encrypt', action: 'encrypt',
// Text to be encrypted. // Text to be encrypted.
text: 'hello', text: 'hello',
// Base64-encoded key. // Base64-encoded key.
key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=', key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=',
transformation: 'AES/CBC/PKCS5Padding', transformation: 'AES/CBC/PKCS5Padding',
ivOffset: '0', ivOffset: '0',
ivLen: '16', ivLen: '16',
success: function(data) { success: function(data) {
console.log(`Handling successful:${data.text}`); console.log(`handling success:${data.text}`);
}, },
fail: function(data, code) { fail: function(data, code) {
console.log(`### cipher.rsa encryption failed ### ${code}:${data}`); console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`);
}, },
complete: function() { complete: function() {
console.log(`operation complete!`); console.log(`operation complete!`);
} }
}); });
cipher.aes({ cipher.aes({
// Decrypt data. // Decrypt data.
action: 'decrypt', action: 'decrypt',
// Text to be decrypted, which is binary text encoded in Base64. // Text to be decrypted, which is binary text encoded in Base64.
text: '1o0kf2HXwLxHkSh5W5NhzA==', text: '1o0kf2HXwLxHkSh5W5NhzA==',
// Base64-encoded key. // Base64-encoded key.
key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=', key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=',
transformation: 'AES/CBC/PKCS5Padding', transformation: 'AES/CBC/PKCS5Padding',
ivOffset: '0', ivOffset: '0',
ivLen: '16', ivLen: '16',
success: function(data) { success: function(data) {
console.log(`Handling successful:${data.text}`); console.log(`handling success:${data.text}`);
}, },
fail: function(data, code) { fail: function(data, code) {
console.log(`### cipher.aes encryption failed ### ${code}:${data}`); console.log(`### cipher.aes encrypt fail ### ${code}:${data}`);
}, },
complete: function() { complete: function() {
console.log(`operation complete!`); console.log(`operation complete!`);
} }
}); });
} }
} }
......
...@@ -22,8 +22,8 @@ Defines the authentication result. ...@@ -22,8 +22,8 @@ Defines the authentication result.
| ------------ | ---------- | ---- | -------------------- | | ------------ | ---------- | ---- | -------------------- |
| result | number | Yes | Authentication result. | | result | number | Yes | Authentication result. |
| token | Uint8Array | No | Token that has passed the user identity authentication.| | token | Uint8Array | No | Token that has passed the user identity authentication.|
| remainAttempts | number | No | Number of remaining authentication times allowed.| | remainAttempts | number | No | Number of remaining authentication attempts.|
| lockoutDuration | number | No | Time for which the authentication operation is frozen.| | lockoutDuration | number | No | Lock duration of the authentication operation, in milliseconds.|
## TipInfo<sup>9+</sup> ## TipInfo<sup>9+</sup>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册