@azure/keyvault-keys 4.4.0-beta.4 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Release History
2
2
 
3
+ ## 4.4.0 (2022-03-24)
4
+
5
+ ### Features Added
6
+
7
+ - Added support for `KeyClient.getRandomBytes` which, when connected to a managed HSM, can be used to generate a byte array of a given length with random values.
8
+ - Added support for Secure key Release from a Managed HSM.
9
+ - Added `KeyClient.releaseKey` to release a key from a Managed HSM.
10
+ - Added `exportable` and `releasePolicy` to `KeyVaultKey.properties`, `createKeyOptions`, and `importKeyOptions` in order to specify whether the key is exportable and to associate a release policy to a given key.
11
+ - Added support for automated key rotation in Azure Key Vault and Managed HSM.
12
+ - Added `KeyClient.rotateKey` to rotate a key on-demand.
13
+ - Added `KeyClient.updateKeyRotationPolicy` to update a key's automated rotation policy.
14
+ - Added support for `KeyClient.getCryptographyClient(keyName, options)` which provides a simple way to create a `CryptographyClient` for a given key (identified by its name).
15
+ - An optional `keyVersion` property may be used in the `options` parameter to create a cryptography client targeting a specific key version. The latest version is used by default.
16
+
17
+ ### Other Changes
18
+
19
+ - This release updates `KeyClient` and `CryptographyClient` to support service version 7.3 by default.
20
+
3
21
  ## 4.4.0-beta.4 (2022-02-08)
4
22
 
5
23
  ### Features Added
package/README.md CHANGED
@@ -80,7 +80,6 @@ Use the [Azure CLI][azure-cli] snippet below to create/get client secret credent
80
80
  {
81
81
  "appId": "generated-app-ID",
82
82
  "displayName": "dummy-app-name",
83
- "name": "http://dummy-app-name",
84
83
  "password": "random-password",
85
84
  "tenant": "tenant-ID"
86
85
  }
@@ -206,7 +205,7 @@ const url = `https://${vaultName}.vault.azure.net`;
206
205
 
207
206
  // Change the Azure Key Vault service API version being used via the `serviceVersion` option
208
207
  const client = new KeyClient(url, credential, {
209
- serviceVersion: "7.0" // Or 7.1
208
+ serviceVersion: "7.0", // Or 7.1
210
209
  });
211
210
  ```
212
211
 
@@ -308,7 +307,7 @@ const keyName = "MyKeyName";
308
307
 
309
308
  async function main() {
310
309
  const result = await client.createKey(keyName, "RSA", {
311
- enabled: false
310
+ enabled: false,
312
311
  });
313
312
  console.log("result: ", result);
314
313
  }
@@ -338,7 +337,7 @@ const keyName = "MyKeyName";
338
337
  async function main() {
339
338
  const result = await client.createKey(keyName, "RSA");
340
339
  await client.updateKeyProperties(keyName, result.properties.version, {
341
- enabled: false
340
+ enabled: false,
342
341
  });
343
342
  }
344
343
 
@@ -501,12 +500,12 @@ async function main() {
501
500
  lifetimeActions: [
502
501
  {
503
502
  action: "Rotate",
504
- timeBeforeExpiry: "P30D"
505
- }
503
+ timeBeforeExpiry: "P30D",
504
+ },
506
505
  ],
507
506
  // You may also specify the duration after which any newly rotated key will expire.
508
507
  // In this case, any new key versions will expire after 90 days.
509
- expiresIn: "P90D"
508
+ expiresIn: "P90D",
510
509
  });
511
510
 
512
511
  // You can get the current key rotation policy of a given key by calling the getKeyRotationPolicy method.
@@ -652,7 +651,7 @@ async function main() {
652
651
 
653
652
  const encryptResult = await cryptographyClient.encrypt({
654
653
  algorithm: "RSA1_5",
655
- plaintext: Buffer.from("My Message")
654
+ plaintext: Buffer.from("My Message"),
656
655
  });
657
656
  console.log("encrypt result: ", encryptResult.result);
658
657
  }
@@ -681,13 +680,13 @@ async function main() {
681
680
 
682
681
  const encryptResult = await cryptographyClient.encrypt({
683
682
  algorithm: "RSA1_5",
684
- plaintext: Buffer.from("My Message")
683
+ plaintext: Buffer.from("My Message"),
685
684
  });
686
685
  console.log("encrypt result: ", encryptResult.result);
687
686
 
688
687
  const decryptResult = await cryptographyClient.decrypt({
689
688
  algorithm: "RSA1_5",
690
- ciphertext: encryptResult.result
689
+ ciphertext: encryptResult.result,
691
690
  });
692
691
  console.log("decrypt result: ", decryptResult.result.toString());
693
692
  }
@@ -876,6 +875,8 @@ main();
876
875
 
877
876
  ## Troubleshooting
878
877
 
878
+ See our [troubleshooting guide](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/keyvault/keyvault-keys/TROUBLESHOOTING.md) for details on how to diagnose various failure scenarios.
879
+
879
880
  Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
880
881
 
881
882
  ```javascript
package/dist/index.js CHANGED
@@ -47,12 +47,12 @@ const logger = logger$1.createClientLogger("keyvault-keys");
47
47
  * Code generated by Microsoft (R) AutoRest Code Generator.
48
48
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
49
49
  */
50
- /** Known values of {@link ApiVersion73Preview} that the service accepts. */
51
- var KnownApiVersion73Preview;
52
- (function (KnownApiVersion73Preview) {
53
- /** Api Version '7.3-preview' */
54
- KnownApiVersion73Preview["Seven3Preview"] = "7.3-preview";
55
- })(KnownApiVersion73Preview || (KnownApiVersion73Preview = {}));
50
+ /** Known values of {@link ApiVersion73} that the service accepts. */
51
+ var KnownApiVersion73;
52
+ (function (KnownApiVersion73) {
53
+ /** Api Version '7.3' */
54
+ KnownApiVersion73["Seven3"] = "7.3";
55
+ })(KnownApiVersion73 || (KnownApiVersion73 = {}));
56
56
  /** Known values of {@link JsonWebKeyType} that the service accepts. */
57
57
  exports.KnownKeyTypes = void 0;
58
58
  (function (KnownJsonWebKeyType) {
@@ -1344,7 +1344,7 @@ const nextLink = {
1344
1344
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
1345
1345
  */
1346
1346
  const packageName = "@azure/keyvault-keys";
1347
- const packageVersion = "4.4.0-beta.4";
1347
+ const packageVersion = "4.4.0";
1348
1348
  class KeyVaultClientContext extends coreHttp__namespace.ServiceClient {
1349
1349
  /**
1350
1350
  * Initializes a new instance of the KeyVaultClientContext class.
@@ -2478,7 +2478,7 @@ const getDeletedKeysNextOperationSpec = {
2478
2478
 
2479
2479
  // Copyright (c) Microsoft Corporation.
2480
2480
  // Licensed under the MIT license.
2481
- const SDK_VERSION = "4.4.0-beta.4";
2481
+ const SDK_VERSION = "4.4.0";
2482
2482
 
2483
2483
  // Copyright (c) Microsoft Corporation.
2484
2484
  // Licensed under the MIT license.
@@ -3156,7 +3156,7 @@ class RecoverDeletedKeyPoller extends KeyVaultKeyPoller {
3156
3156
  /**
3157
3157
  * The latest supported Key Vault service API version
3158
3158
  */
3159
- const LATEST_API_VERSION = "7.3-preview";
3159
+ const LATEST_API_VERSION = "7.3";
3160
3160
  /** Known values of {@link KeyOperation} that the service accepts. */
3161
3161
  exports.KnownKeyOperations = void 0;
3162
3162
  (function (KnownKeyOperations) {
@@ -4642,12 +4642,12 @@ class KeyClient {
4642
4642
  * let result = await client.getKeyRotationPolicy("myKey");
4643
4643
  * ```
4644
4644
  *
4645
- * @param name - The name of the key.
4645
+ * @param keyName - The name of the key.
4646
4646
  * @param options - The optional parameters.
4647
4647
  */
4648
- getKeyRotationPolicy(name, options = {}) {
4648
+ getKeyRotationPolicy(keyName, options = {}) {
4649
4649
  return withTrace("getKeyRotationPolicy", options, async () => {
4650
- const policy = await this.client.getKeyRotationPolicy(this.vaultUrl, name);
4650
+ const policy = await this.client.getKeyRotationPolicy(this.vaultUrl, keyName);
4651
4651
  return keyRotationTransformations.generatedToPublic(policy);
4652
4652
  });
4653
4653
  }
@@ -4661,13 +4661,13 @@ class KeyClient {
4661
4661
  * const setPolicy = await client.updateKeyRotationPolicy("MyKey", myPolicy);
4662
4662
  * ```
4663
4663
  *
4664
- * @param name - The name of the key.
4664
+ * @param keyName - The name of the key.
4665
4665
  * @param policyProperties - The {@link KeyRotationPolicyProperties} for the policy.
4666
4666
  * @param options - The optional parameters.
4667
4667
  */
4668
- updateKeyRotationPolicy(name, policy, options = {}) {
4668
+ updateKeyRotationPolicy(keyName, policy, options = {}) {
4669
4669
  return withTrace("updateKeyRotationPolicy", options, async (updatedOptions) => {
4670
- const result = await this.client.updateKeyRotationPolicy(this.vaultUrl, name, keyRotationTransformations.propertiesToGenerated(policy), updatedOptions);
4670
+ const result = await this.client.updateKeyRotationPolicy(this.vaultUrl, keyName, keyRotationTransformations.propertiesToGenerated(policy), updatedOptions);
4671
4671
  return keyRotationTransformations.generatedToPublic(result);
4672
4672
  });
4673
4673
  }