@azure/keyvault-keys 4.7.0-beta.1 → 4.7.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/README.md +8 -4
- package/dist/index.js +12 -40
- package/dist/index.js.map +1 -1
- package/dist-esm/keyvault-common/src/parseKeyVaultIdentifier.js +1 -2
- package/dist-esm/keyvault-common/src/parseKeyVaultIdentifier.js.map +1 -1
- package/dist-esm/keyvault-keys/src/constants.js +1 -1
- package/dist-esm/keyvault-keys/src/constants.js.map +1 -1
- package/dist-esm/keyvault-keys/src/cryptography/crypto.js +0 -1
- package/dist-esm/keyvault-keys/src/cryptography/crypto.js.map +1 -1
- package/dist-esm/keyvault-keys/src/generated/keyVaultClient.js +1 -1
- package/dist-esm/keyvault-keys/src/generated/keyVaultClient.js.map +1 -1
- package/dist-esm/keyvault-keys/src/generated/models/index.js +6 -14
- package/dist-esm/keyvault-keys/src/generated/models/index.js.map +1 -1
- package/dist-esm/keyvault-keys/src/index.js +1 -19
- package/dist-esm/keyvault-keys/src/index.js.map +1 -1
- package/dist-esm/keyvault-keys/src/keysModels.js +1 -1
- package/dist-esm/keyvault-keys/src/keysModels.js.map +1 -1
- package/package.json +5 -8
- package/types/keyvault-keys.d.ts +7 -41
package/README.md
CHANGED
|
@@ -421,14 +421,14 @@ In addition, KeyClient provides a method to rotate a key on-demand by creating a
|
|
|
421
421
|
const { DefaultAzureCredential } = require("@azure/identity");
|
|
422
422
|
const { KeyClient } = require("@azure/keyvault-keys");
|
|
423
423
|
|
|
424
|
-
const
|
|
424
|
+
const url = `https://<YOUR KEYVAULT NAME>.vault.azure.net`;
|
|
425
425
|
const client = new KeyClient(url, new DefaultAzureCredential());
|
|
426
426
|
|
|
427
427
|
async function main() {
|
|
428
428
|
const keyName = "MyKeyName";
|
|
429
429
|
|
|
430
430
|
// Set the key's automated rotation policy to rotate the key 30 days before expiry.
|
|
431
|
-
const policy = await client.updateKeyRotationPolicy(
|
|
431
|
+
const policy = await client.updateKeyRotationPolicy(keyName, {
|
|
432
432
|
lifetimeActions: [
|
|
433
433
|
{
|
|
434
434
|
action: "Rotate",
|
|
@@ -441,10 +441,10 @@ async function main() {
|
|
|
441
441
|
});
|
|
442
442
|
|
|
443
443
|
// You can get the current key rotation policy of a given key by calling the getKeyRotationPolicy method.
|
|
444
|
-
const currentPolicy = await client.getKeyRotationPolicy(
|
|
444
|
+
const currentPolicy = await client.getKeyRotationPolicy(keyName);
|
|
445
445
|
|
|
446
446
|
// Finally, you can rotate a key on-demand by creating a new version of the given key.
|
|
447
|
-
const rotatedKey = await client.rotateKey(
|
|
447
|
+
const rotatedKey = await client.rotateKey(keyName);
|
|
448
448
|
}
|
|
449
449
|
|
|
450
450
|
main();
|
|
@@ -527,6 +527,8 @@ async function main() {
|
|
|
527
527
|
}
|
|
528
528
|
}
|
|
529
529
|
}
|
|
530
|
+
|
|
531
|
+
main();
|
|
530
532
|
```
|
|
531
533
|
|
|
532
534
|
## Cryptography
|
|
@@ -560,6 +562,8 @@ async function main() {
|
|
|
560
562
|
// Lastly, create our cryptography client and connect to the service
|
|
561
563
|
const cryptographyClient = new CryptographyClient(myKey, credential);
|
|
562
564
|
}
|
|
565
|
+
|
|
566
|
+
main();
|
|
563
567
|
```
|
|
564
568
|
|
|
565
569
|
### Encrypt
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,6 @@ require('@azure/core-paging');
|
|
|
9
9
|
var coreClient = require('@azure/core-client');
|
|
10
10
|
var coreHttpCompat = require('@azure/core-http-compat');
|
|
11
11
|
var coreTracing = require('@azure/core-tracing');
|
|
12
|
-
var url = require('url');
|
|
13
12
|
var coreUtil = require('@azure/core-util');
|
|
14
13
|
var coreLro = require('@azure/core-lro');
|
|
15
14
|
var crypto = require('crypto');
|
|
@@ -36,7 +35,6 @@ function _interopNamespace(e) {
|
|
|
36
35
|
var coreRestPipeline__namespace = /*#__PURE__*/_interopNamespace(coreRestPipeline);
|
|
37
36
|
var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
|
|
38
37
|
var coreHttpCompat__namespace = /*#__PURE__*/_interopNamespace(coreHttpCompat);
|
|
39
|
-
var url__namespace = /*#__PURE__*/_interopNamespace(url);
|
|
40
38
|
var crypto__namespace = /*#__PURE__*/_interopNamespace(crypto);
|
|
41
39
|
|
|
42
40
|
// Copyright (c) Microsoft Corporation.
|
|
@@ -52,12 +50,12 @@ const logger = logger$1.createClientLogger("keyvault-keys");
|
|
|
52
50
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
53
51
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
54
52
|
*/
|
|
55
|
-
/** Known values of {@link
|
|
56
|
-
var
|
|
57
|
-
(function (
|
|
58
|
-
/** Api Version '7.4
|
|
59
|
-
|
|
60
|
-
})(
|
|
53
|
+
/** Known values of {@link ApiVersion74} that the service accepts. */
|
|
54
|
+
var KnownApiVersion74;
|
|
55
|
+
(function (KnownApiVersion74) {
|
|
56
|
+
/** Api Version '7.4' */
|
|
57
|
+
KnownApiVersion74["Seven4"] = "7.4";
|
|
58
|
+
})(KnownApiVersion74 || (KnownApiVersion74 = {}));
|
|
61
59
|
/** Known values of {@link JsonWebKeyType} that the service accepts. */
|
|
62
60
|
exports.KnownKeyTypes = void 0;
|
|
63
61
|
(function (KnownJsonWebKeyType) {
|
|
@@ -73,10 +71,6 @@ exports.KnownKeyTypes = void 0;
|
|
|
73
71
|
KnownJsonWebKeyType["Oct"] = "oct";
|
|
74
72
|
/** Octet sequence (used to represent symmetric keys) which is stored the HSM. */
|
|
75
73
|
KnownJsonWebKeyType["OctHSM"] = "oct-HSM";
|
|
76
|
-
/** Octet key pair (https://tools.ietf.org/html/rfc8037) */
|
|
77
|
-
KnownJsonWebKeyType["OKP"] = "OKP";
|
|
78
|
-
/** Octet key pair (https://tools.ietf.org/html/rfc8037) with a private key which is stored in the HSM. */
|
|
79
|
-
KnownJsonWebKeyType["OKPHSM"] = "OKP-HSM";
|
|
80
74
|
})(exports.KnownKeyTypes || (exports.KnownKeyTypes = {}));
|
|
81
75
|
/** Known values of {@link JsonWebKeyOperation} that the service accepts. */
|
|
82
76
|
var KnownJsonWebKeyOperation;
|
|
@@ -119,8 +113,6 @@ exports.KnownKeyCurveNames = void 0;
|
|
|
119
113
|
KnownJsonWebKeyCurveName["P521"] = "P-521";
|
|
120
114
|
/** The SECG SECP256K1 elliptic curve. */
|
|
121
115
|
KnownJsonWebKeyCurveName["P256K"] = "P-256K";
|
|
122
|
-
/** The Ed25519 Edwards curve. */
|
|
123
|
-
KnownJsonWebKeyCurveName["Ed25519"] = "Ed25519";
|
|
124
116
|
})(exports.KnownKeyCurveNames || (exports.KnownKeyCurveNames = {}));
|
|
125
117
|
/** Known values of {@link JsonWebKeyEncryptionAlgorithm} that the service accepts. */
|
|
126
118
|
var KnownJsonWebKeyEncryptionAlgorithm;
|
|
@@ -166,8 +158,6 @@ exports.KnownSignatureAlgorithms = void 0;
|
|
|
166
158
|
KnownJsonWebKeySignatureAlgorithm["ES512"] = "ES512";
|
|
167
159
|
/** ECDSA using P-256K and SHA-256, as described in https://tools.ietf.org/html/rfc7518 */
|
|
168
160
|
KnownJsonWebKeySignatureAlgorithm["ES256K"] = "ES256K";
|
|
169
|
-
/** Edwards-Curve Digital Signature Algorithm, as described in https://tools.ietf.org/html/rfc8032. */
|
|
170
|
-
KnownJsonWebKeySignatureAlgorithm["EdDSA"] = "EdDSA";
|
|
171
161
|
})(exports.KnownSignatureAlgorithms || (exports.KnownSignatureAlgorithms = {}));
|
|
172
162
|
/** Known values of {@link KeyEncryptionAlgorithm} that the service accepts. */
|
|
173
163
|
var KnownKeyEncryptionAlgorithm;
|
|
@@ -1374,7 +1364,7 @@ class KeyVaultClient extends coreHttpCompat__namespace.ExtendedServiceClient {
|
|
|
1374
1364
|
const defaults = {
|
|
1375
1365
|
requestContentType: "application/json; charset=utf-8"
|
|
1376
1366
|
};
|
|
1377
|
-
const packageDetails = `azsdk-js-keyvault-keys/4.7.0
|
|
1367
|
+
const packageDetails = `azsdk-js-keyvault-keys/4.7.0`;
|
|
1378
1368
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
1379
1369
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
1380
1370
|
: `${packageDetails}`;
|
|
@@ -2348,7 +2338,7 @@ const getDeletedKeysNextOperationSpec = {
|
|
|
2348
2338
|
|
|
2349
2339
|
// Copyright (c) Microsoft Corporation.
|
|
2350
2340
|
// Licensed under the MIT license.
|
|
2351
|
-
const SDK_VERSION = "4.7.0
|
|
2341
|
+
const SDK_VERSION = "4.7.0";
|
|
2352
2342
|
|
|
2353
2343
|
// Copyright (c) Microsoft Corporation.
|
|
2354
2344
|
// Licensed under the MIT license.
|
|
@@ -2496,6 +2486,7 @@ function createKeyVaultChallengeCallbacks(options = {}) {
|
|
|
2496
2486
|
}
|
|
2497
2487
|
|
|
2498
2488
|
// Copyright (c) Microsoft Corporation.
|
|
2489
|
+
// Licensed under the MIT license.
|
|
2499
2490
|
/**
|
|
2500
2491
|
* Parses a Key Vault identifier into its components.
|
|
2501
2492
|
*
|
|
@@ -2511,7 +2502,7 @@ function parseKeyVaultIdentifier(collection, identifier) {
|
|
|
2511
2502
|
}
|
|
2512
2503
|
let baseUri;
|
|
2513
2504
|
try {
|
|
2514
|
-
baseUri =
|
|
2505
|
+
baseUri = new URL(identifier);
|
|
2515
2506
|
}
|
|
2516
2507
|
catch (e) {
|
|
2517
2508
|
throw new Error(`Invalid ${collection} identifier: ${identifier}. Not a valid URI`);
|
|
@@ -2921,7 +2912,7 @@ class RecoverDeletedKeyPoller extends KeyVaultKeyPoller {
|
|
|
2921
2912
|
/**
|
|
2922
2913
|
* The latest supported Key Vault service API version
|
|
2923
2914
|
*/
|
|
2924
|
-
const LATEST_API_VERSION = "7.4
|
|
2915
|
+
const LATEST_API_VERSION = "7.4";
|
|
2925
2916
|
/** Known values of {@link KeyOperation} that the service accepts. */
|
|
2926
2917
|
exports.KnownKeyOperations = void 0;
|
|
2927
2918
|
(function (KnownKeyOperations) {
|
|
@@ -2967,7 +2958,6 @@ const algorithmToHashAlgorithm = {
|
|
|
2967
2958
|
ES512: "SHA512",
|
|
2968
2959
|
PS512: "SHA512",
|
|
2969
2960
|
RS512: "SHA512",
|
|
2970
|
-
EdDSA: "SHA256",
|
|
2971
2961
|
};
|
|
2972
2962
|
/**
|
|
2973
2963
|
* @internal
|
|
@@ -4001,7 +3991,7 @@ class KeyClient {
|
|
|
4001
3991
|
* ```
|
|
4002
3992
|
* Creates a new key, stores it, then returns key parameters and properties to the client.
|
|
4003
3993
|
* @param name - The name of the key.
|
|
4004
|
-
* @param keyType - The type of the key. One of the following: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct'
|
|
3994
|
+
* @param keyType - The type of the key. One of the following: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct'.
|
|
4005
3995
|
* @param options - The optional parameters.
|
|
4006
3996
|
*/
|
|
4007
3997
|
createKey(name, keyType, options) {
|
|
@@ -4020,24 +4010,6 @@ class KeyClient {
|
|
|
4020
4010
|
return getKeyFromKeyBundle(response);
|
|
4021
4011
|
});
|
|
4022
4012
|
}
|
|
4023
|
-
/**
|
|
4024
|
-
* The createOKPKey method creates a new OKP key in Azure Key Vault. If the named key
|
|
4025
|
-
* already exists, Azure Key Vault creates a new version of the key. It requires the keys/create
|
|
4026
|
-
* permission.
|
|
4027
|
-
*
|
|
4028
|
-
* Example usage:
|
|
4029
|
-
* ```ts
|
|
4030
|
-
* const client = new KeyClient(url, credentials);
|
|
4031
|
-
* let result = await client.createOkpKey("MyKey");
|
|
4032
|
-
* ```
|
|
4033
|
-
* Creates a new key, stores it, then returns key parameters and properties to the client.
|
|
4034
|
-
* @param name - The name of the key.
|
|
4035
|
-
* @param options - The optional parameters.
|
|
4036
|
-
*/
|
|
4037
|
-
createOkpKey(name, options) {
|
|
4038
|
-
const keyType = (options === null || options === void 0 ? void 0 : options.hsm) ? exports.KnownKeyTypes.OKPHSM : exports.KnownKeyTypes.OKP;
|
|
4039
|
-
return this.createKey(name, keyType, options);
|
|
4040
|
-
}
|
|
4041
4013
|
/**
|
|
4042
4014
|
* The createEcKey method creates a new elliptic curve key in Azure Key Vault. If the named key
|
|
4043
4015
|
* already exists, Azure Key Vault creates a new version of the key. It requires the keys/create
|