@azure/keyvault-keys 4.4.0-beta.2 → 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 +37 -1
- package/README.md +11 -10
- package/dist/index.js +332 -295
- package/dist/index.js.map +1 -1
- package/dist-esm/keyvault-common/src/challengeBasedAuthenticationPolicy.js +14 -25
- package/dist-esm/keyvault-common/src/challengeBasedAuthenticationPolicy.js.map +1 -1
- package/dist-esm/keyvault-common/src/index.js +1 -0
- package/dist-esm/keyvault-common/src/index.js.map +1 -1
- package/dist-esm/keyvault-common/src/parseKeyvaultIdentifier.js +1 -1
- package/dist-esm/keyvault-common/src/parseKeyvaultIdentifier.js.map +1 -1
- package/dist-esm/keyvault-common/src/parseWWWAuthenticate.js +52 -0
- package/dist-esm/keyvault-common/src/parseWWWAuthenticate.js.map +1 -0
- package/dist-esm/keyvault-common/src/tracingHelpers.js +4 -4
- package/dist-esm/keyvault-common/src/tracingHelpers.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/aesCryptographyProvider.js +7 -7
- package/dist-esm/keyvault-keys/src/cryptography/aesCryptographyProvider.js.map +1 -1
- package/dist-esm/keyvault-keys/src/cryptography/crypto.js +2 -2
- package/dist-esm/keyvault-keys/src/cryptography/crypto.js.map +1 -1
- package/dist-esm/keyvault-keys/src/cryptography/models.js.map +1 -1
- package/dist-esm/keyvault-keys/src/cryptography/remoteCryptographyProvider.js +11 -12
- package/dist-esm/keyvault-keys/src/cryptography/remoteCryptographyProvider.js.map +1 -1
- package/dist-esm/keyvault-keys/src/cryptography/rsaCryptographyProvider.js +7 -9
- package/dist-esm/keyvault-keys/src/cryptography/rsaCryptographyProvider.js.map +1 -1
- package/dist-esm/keyvault-keys/src/cryptographyClient.js +10 -11
- package/dist-esm/keyvault-keys/src/cryptographyClient.js.map +1 -1
- package/dist-esm/keyvault-keys/src/cryptographyClientModels.js +36 -2
- package/dist-esm/keyvault-keys/src/cryptographyClientModels.js.map +1 -1
- package/dist-esm/keyvault-keys/src/generated/keyVaultClient.js +4 -50
- package/dist-esm/keyvault-keys/src/generated/keyVaultClient.js.map +1 -1
- package/dist-esm/keyvault-keys/src/generated/keyVaultClientContext.js +2 -2
- package/dist-esm/keyvault-keys/src/generated/keyVaultClientContext.js.map +1 -1
- package/dist-esm/keyvault-keys/src/generated/models/index.js +6 -21
- package/dist-esm/keyvault-keys/src/generated/models/index.js.map +1 -1
- package/dist-esm/keyvault-keys/src/generated/models/mappers.js +36 -29
- package/dist-esm/keyvault-keys/src/generated/models/mappers.js.map +1 -1
- package/dist-esm/keyvault-keys/src/generated/models/parameters.js +4 -16
- package/dist-esm/keyvault-keys/src/generated/models/parameters.js.map +1 -1
- package/dist-esm/keyvault-keys/src/identifier.js.map +1 -1
- package/dist-esm/keyvault-keys/src/index.js +32 -42
- package/dist-esm/keyvault-keys/src/index.js.map +1 -1
- package/dist-esm/keyvault-keys/src/keysModels.js +5 -2
- package/dist-esm/keyvault-keys/src/keysModels.js.map +1 -1
- package/dist-esm/keyvault-keys/src/lro/delete/poller.js.map +1 -1
- package/dist-esm/keyvault-keys/src/lro/keyVaultKeyPoller.js +1 -1
- package/dist-esm/keyvault-keys/src/lro/keyVaultKeyPoller.js.map +1 -1
- package/dist-esm/keyvault-keys/src/lro/recover/poller.js.map +1 -1
- package/dist-esm/keyvault-keys/src/transformations.js +12 -13
- package/dist-esm/keyvault-keys/src/transformations.js.map +1 -1
- package/package.json +16 -32
- package/types/keyvault-keys.d.ts +93 -36
package/dist/index.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License. See License.txt in the project root for
|
|
4
|
-
* license information.
|
|
5
|
-
*
|
|
6
|
-
* Azure KeyVault Keys SDK for JavaScript - 4.4.0-beta.2
|
|
7
|
-
*/
|
|
8
1
|
'use strict';
|
|
9
2
|
|
|
10
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -14,11 +7,33 @@ var coreHttp = require('@azure/core-http');
|
|
|
14
7
|
var logger$1 = require('@azure/logger');
|
|
15
8
|
require('@azure/core-paging');
|
|
16
9
|
var url = require('url');
|
|
17
|
-
var coreTracing = require('@azure/core-tracing');
|
|
18
10
|
var coreLro = require('@azure/core-lro');
|
|
11
|
+
var coreTracing = require('@azure/core-tracing');
|
|
19
12
|
var crypto = require('crypto');
|
|
20
13
|
var constants = require('constants');
|
|
21
14
|
|
|
15
|
+
function _interopNamespace(e) {
|
|
16
|
+
if (e && e.__esModule) return e;
|
|
17
|
+
var n = Object.create(null);
|
|
18
|
+
if (e) {
|
|
19
|
+
Object.keys(e).forEach(function (k) {
|
|
20
|
+
if (k !== 'default') {
|
|
21
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
22
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return e[k]; }
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
n["default"] = e;
|
|
30
|
+
return Object.freeze(n);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var coreHttp__namespace = /*#__PURE__*/_interopNamespace(coreHttp);
|
|
34
|
+
var url__namespace = /*#__PURE__*/_interopNamespace(url);
|
|
35
|
+
var crypto__namespace = /*#__PURE__*/_interopNamespace(crypto);
|
|
36
|
+
|
|
22
37
|
// Copyright (c) Microsoft Corporation.
|
|
23
38
|
/**
|
|
24
39
|
* The \@azure/logger configuration for this package.
|
|
@@ -32,12 +47,14 @@ const logger = logger$1.createClientLogger("keyvault-keys");
|
|
|
32
47
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
33
48
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
34
49
|
*/
|
|
35
|
-
/** Known values of {@link
|
|
36
|
-
var
|
|
37
|
-
(function (
|
|
38
|
-
/** Api Version '7.3
|
|
39
|
-
|
|
40
|
-
})(
|
|
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
|
+
/** Known values of {@link JsonWebKeyType} that the service accepts. */
|
|
57
|
+
exports.KnownKeyTypes = void 0;
|
|
41
58
|
(function (KnownJsonWebKeyType) {
|
|
42
59
|
/** Elliptic Curve. */
|
|
43
60
|
KnownJsonWebKeyType["EC"] = "EC";
|
|
@@ -64,6 +81,8 @@ var KnownJsonWebKeyOperation;
|
|
|
64
81
|
KnownJsonWebKeyOperation["Import"] = "import";
|
|
65
82
|
KnownJsonWebKeyOperation["Export"] = "export";
|
|
66
83
|
})(KnownJsonWebKeyOperation || (KnownJsonWebKeyOperation = {}));
|
|
84
|
+
/** Known values of {@link DeletionRecoveryLevel} that the service accepts. */
|
|
85
|
+
exports.KnownDeletionRecoveryLevel = void 0;
|
|
67
86
|
(function (KnownDeletionRecoveryLevel) {
|
|
68
87
|
/** Denotes a vault state in which deletion is an irreversible operation, without the possibility for recovery. This level corresponds to no protection being available against a Delete operation; the data is irretrievably lost upon accepting a Delete operation at the entity level or higher (vault, resource group, subscription etc.) */
|
|
69
88
|
KnownDeletionRecoveryLevel["Purgeable"] = "Purgeable";
|
|
@@ -80,6 +99,8 @@ var KnownJsonWebKeyOperation;
|
|
|
80
99
|
/** Denotes a vault and subscription state in which deletion is recoverable, immediate and permanent deletion (i.e. purge) is not permitted, and in which the subscription itself cannot be permanently canceled when 7<= SoftDeleteRetentionInDays < 90. This level guarantees the recoverability of the deleted entity during the retention interval, and also reflects the fact that the subscription itself cannot be cancelled. */
|
|
81
100
|
KnownDeletionRecoveryLevel["CustomizedRecoverableProtectedSubscription"] = "CustomizedRecoverable+ProtectedSubscription";
|
|
82
101
|
})(exports.KnownDeletionRecoveryLevel || (exports.KnownDeletionRecoveryLevel = {}));
|
|
102
|
+
/** Known values of {@link JsonWebKeyCurveName} that the service accepts. */
|
|
103
|
+
exports.KnownKeyCurveNames = void 0;
|
|
83
104
|
(function (KnownJsonWebKeyCurveName) {
|
|
84
105
|
/** The NIST P-256 elliptic curve, AKA SECG curve SECP256R1. */
|
|
85
106
|
KnownJsonWebKeyCurveName["P256"] = "P-256";
|
|
@@ -90,38 +111,27 @@ var KnownJsonWebKeyOperation;
|
|
|
90
111
|
/** The SECG SECP256K1 elliptic curve. */
|
|
91
112
|
KnownJsonWebKeyCurveName["P256K"] = "P-256K";
|
|
92
113
|
})(exports.KnownKeyCurveNames || (exports.KnownKeyCurveNames = {}));
|
|
114
|
+
/** Known values of {@link JsonWebKeyEncryptionAlgorithm} that the service accepts. */
|
|
115
|
+
var KnownJsonWebKeyEncryptionAlgorithm;
|
|
93
116
|
(function (KnownJsonWebKeyEncryptionAlgorithm) {
|
|
94
|
-
/** Encryption Algorithm - RSA-OAEP */
|
|
95
117
|
KnownJsonWebKeyEncryptionAlgorithm["RSAOaep"] = "RSA-OAEP";
|
|
96
|
-
/** Encryption Algorithm - RSA-OAEP-256 */
|
|
97
118
|
KnownJsonWebKeyEncryptionAlgorithm["RSAOaep256"] = "RSA-OAEP-256";
|
|
98
|
-
/** Encryption Algorithm - RSA1_5 */
|
|
99
119
|
KnownJsonWebKeyEncryptionAlgorithm["RSA15"] = "RSA1_5";
|
|
100
|
-
/** Encryption Algorithm - A128GCM */
|
|
101
120
|
KnownJsonWebKeyEncryptionAlgorithm["A128GCM"] = "A128GCM";
|
|
102
|
-
/** Encryption Algorithm - A192GCM */
|
|
103
121
|
KnownJsonWebKeyEncryptionAlgorithm["A192GCM"] = "A192GCM";
|
|
104
|
-
/** Encryption Algorithm - A256GCM */
|
|
105
122
|
KnownJsonWebKeyEncryptionAlgorithm["A256GCM"] = "A256GCM";
|
|
106
|
-
/** Encryption Algorithm - A128KW */
|
|
107
123
|
KnownJsonWebKeyEncryptionAlgorithm["A128KW"] = "A128KW";
|
|
108
|
-
/** Encryption Algorithm - A192KW */
|
|
109
124
|
KnownJsonWebKeyEncryptionAlgorithm["A192KW"] = "A192KW";
|
|
110
|
-
/** Encryption Algorithm - A256KW */
|
|
111
125
|
KnownJsonWebKeyEncryptionAlgorithm["A256KW"] = "A256KW";
|
|
112
|
-
/** Encryption Algorithm - A128CBC */
|
|
113
126
|
KnownJsonWebKeyEncryptionAlgorithm["A128CBC"] = "A128CBC";
|
|
114
|
-
/** Encryption Algorithm - A192CBC */
|
|
115
127
|
KnownJsonWebKeyEncryptionAlgorithm["A192CBC"] = "A192CBC";
|
|
116
|
-
/** Encryption Algorithm - A256CBC */
|
|
117
128
|
KnownJsonWebKeyEncryptionAlgorithm["A256CBC"] = "A256CBC";
|
|
118
|
-
/** Encryption Algorithm - A128CBCPAD */
|
|
119
129
|
KnownJsonWebKeyEncryptionAlgorithm["A128Cbcpad"] = "A128CBCPAD";
|
|
120
|
-
/** Encryption Algorithm - A192CBCPAD */
|
|
121
130
|
KnownJsonWebKeyEncryptionAlgorithm["A192Cbcpad"] = "A192CBCPAD";
|
|
122
|
-
/** Encryption Algorithm - A256CBCPAD */
|
|
123
131
|
KnownJsonWebKeyEncryptionAlgorithm["A256Cbcpad"] = "A256CBCPAD";
|
|
124
|
-
})(
|
|
132
|
+
})(KnownJsonWebKeyEncryptionAlgorithm || (KnownJsonWebKeyEncryptionAlgorithm = {}));
|
|
133
|
+
/** Known values of {@link JsonWebKeySignatureAlgorithm} that the service accepts. */
|
|
134
|
+
exports.KnownSignatureAlgorithms = void 0;
|
|
125
135
|
(function (KnownJsonWebKeySignatureAlgorithm) {
|
|
126
136
|
/** RSASSA-PSS using SHA-256 and MGF1 with SHA-256, as described in https://tools.ietf.org/html/rfc7518 */
|
|
127
137
|
KnownJsonWebKeySignatureAlgorithm["PS256"] = "PS256";
|
|
@@ -278,7 +288,13 @@ const KeyReleasePolicy = {
|
|
|
278
288
|
name: "String"
|
|
279
289
|
}
|
|
280
290
|
},
|
|
281
|
-
|
|
291
|
+
immutable: {
|
|
292
|
+
serializedName: "immutable",
|
|
293
|
+
type: {
|
|
294
|
+
name: "Boolean"
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
encodedPolicy: {
|
|
282
298
|
serializedName: "data",
|
|
283
299
|
type: {
|
|
284
300
|
name: "Base64Url"
|
|
@@ -807,39 +823,12 @@ const KeyVerifyResult = {
|
|
|
807
823
|
}
|
|
808
824
|
}
|
|
809
825
|
};
|
|
810
|
-
const KeyExportParameters = {
|
|
811
|
-
type: {
|
|
812
|
-
name: "Composite",
|
|
813
|
-
className: "KeyExportParameters",
|
|
814
|
-
modelProperties: {
|
|
815
|
-
wrappingKey: {
|
|
816
|
-
serializedName: "wrappingKey",
|
|
817
|
-
type: {
|
|
818
|
-
name: "Composite",
|
|
819
|
-
className: "JsonWebKey"
|
|
820
|
-
}
|
|
821
|
-
},
|
|
822
|
-
wrappingKid: {
|
|
823
|
-
serializedName: "wrappingKid",
|
|
824
|
-
type: {
|
|
825
|
-
name: "String"
|
|
826
|
-
}
|
|
827
|
-
},
|
|
828
|
-
enc: {
|
|
829
|
-
serializedName: "enc",
|
|
830
|
-
type: {
|
|
831
|
-
name: "String"
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
};
|
|
837
826
|
const KeyReleaseParameters = {
|
|
838
827
|
type: {
|
|
839
828
|
name: "Composite",
|
|
840
829
|
className: "KeyReleaseParameters",
|
|
841
830
|
modelProperties: {
|
|
842
|
-
|
|
831
|
+
targetAttestationToken: {
|
|
843
832
|
constraints: {
|
|
844
833
|
MinLength: 1
|
|
845
834
|
},
|
|
@@ -1052,6 +1041,7 @@ const RandomBytes = {
|
|
|
1052
1041
|
modelProperties: {
|
|
1053
1042
|
value: {
|
|
1054
1043
|
serializedName: "value",
|
|
1044
|
+
required: true,
|
|
1055
1045
|
type: {
|
|
1056
1046
|
name: "Base64Url"
|
|
1057
1047
|
}
|
|
@@ -1097,6 +1087,33 @@ const KeyProperties = {
|
|
|
1097
1087
|
}
|
|
1098
1088
|
}
|
|
1099
1089
|
};
|
|
1090
|
+
const KeyExportParameters = {
|
|
1091
|
+
type: {
|
|
1092
|
+
name: "Composite",
|
|
1093
|
+
className: "KeyExportParameters",
|
|
1094
|
+
modelProperties: {
|
|
1095
|
+
wrappingKey: {
|
|
1096
|
+
serializedName: "wrappingKey",
|
|
1097
|
+
type: {
|
|
1098
|
+
name: "Composite",
|
|
1099
|
+
className: "JsonWebKey"
|
|
1100
|
+
}
|
|
1101
|
+
},
|
|
1102
|
+
wrappingKid: {
|
|
1103
|
+
serializedName: "wrappingKid",
|
|
1104
|
+
type: {
|
|
1105
|
+
name: "String"
|
|
1106
|
+
}
|
|
1107
|
+
},
|
|
1108
|
+
enc: {
|
|
1109
|
+
serializedName: "enc",
|
|
1110
|
+
type: {
|
|
1111
|
+
name: "String"
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
};
|
|
1100
1117
|
const KeyAttributes = {
|
|
1101
1118
|
type: {
|
|
1102
1119
|
name: "Composite",
|
|
@@ -1190,7 +1207,6 @@ var Mappers = /*#__PURE__*/Object.freeze({
|
|
|
1190
1207
|
KeySignParameters: KeySignParameters,
|
|
1191
1208
|
KeyVerifyParameters: KeyVerifyParameters,
|
|
1192
1209
|
KeyVerifyResult: KeyVerifyResult,
|
|
1193
|
-
KeyExportParameters: KeyExportParameters,
|
|
1194
1210
|
KeyReleaseParameters: KeyReleaseParameters,
|
|
1195
1211
|
KeyReleaseResult: KeyReleaseResult,
|
|
1196
1212
|
DeletedKeyListResult: DeletedKeyListResult,
|
|
@@ -1202,6 +1218,7 @@ var Mappers = /*#__PURE__*/Object.freeze({
|
|
|
1202
1218
|
GetRandomBytesRequest: GetRandomBytesRequest,
|
|
1203
1219
|
RandomBytes: RandomBytes,
|
|
1204
1220
|
KeyProperties: KeyProperties,
|
|
1221
|
+
KeyExportParameters: KeyExportParameters,
|
|
1205
1222
|
KeyAttributes: KeyAttributes,
|
|
1206
1223
|
DeletedKeyBundle: DeletedKeyBundle,
|
|
1207
1224
|
DeletedKeyItem: DeletedKeyItem
|
|
@@ -1327,8 +1344,8 @@ const nextLink = {
|
|
|
1327
1344
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
1328
1345
|
*/
|
|
1329
1346
|
const packageName = "@azure/keyvault-keys";
|
|
1330
|
-
const packageVersion = "4.4.0
|
|
1331
|
-
class KeyVaultClientContext extends
|
|
1347
|
+
const packageVersion = "4.4.0";
|
|
1348
|
+
class KeyVaultClientContext extends coreHttp__namespace.ServiceClient {
|
|
1332
1349
|
/**
|
|
1333
1350
|
* Initializes a new instance of the KeyVaultClientContext class.
|
|
1334
1351
|
* @param apiVersion Api Version
|
|
@@ -1342,7 +1359,7 @@ class KeyVaultClientContext extends coreHttp.ServiceClient {
|
|
|
1342
1359
|
if (!options) {
|
|
1343
1360
|
options = {};
|
|
1344
1361
|
}
|
|
1345
|
-
const defaultUserAgent = `azsdk-js-${packageName.replace(
|
|
1362
|
+
const defaultUserAgent = `azsdk-js-${packageName.replace(/@.*\//, "")}/${packageVersion} ${coreHttp__namespace.getDefaultUserAgentValue()}`;
|
|
1346
1363
|
super(undefined, Object.assign(Object.assign({}, options), { userAgent: options.userAgent
|
|
1347
1364
|
? `${options.userAgent} ${defaultUserAgent}`
|
|
1348
1365
|
: `${defaultUserAgent}` }));
|
|
@@ -1383,7 +1400,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1383
1400
|
vaultBaseUrl,
|
|
1384
1401
|
keyName,
|
|
1385
1402
|
kty,
|
|
1386
|
-
options:
|
|
1403
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1387
1404
|
};
|
|
1388
1405
|
return this.sendOperationRequest(operationArguments, createKeyOperationSpec);
|
|
1389
1406
|
}
|
|
@@ -1398,7 +1415,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1398
1415
|
const operationArguments = {
|
|
1399
1416
|
vaultBaseUrl,
|
|
1400
1417
|
keyName,
|
|
1401
|
-
options:
|
|
1418
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1402
1419
|
};
|
|
1403
1420
|
return this.sendOperationRequest(operationArguments, rotateKeyOperationSpec);
|
|
1404
1421
|
}
|
|
@@ -1416,7 +1433,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1416
1433
|
vaultBaseUrl,
|
|
1417
1434
|
keyName,
|
|
1418
1435
|
key,
|
|
1419
|
-
options:
|
|
1436
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1420
1437
|
};
|
|
1421
1438
|
return this.sendOperationRequest(operationArguments, importKeyOperationSpec);
|
|
1422
1439
|
}
|
|
@@ -1433,7 +1450,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1433
1450
|
const operationArguments = {
|
|
1434
1451
|
vaultBaseUrl,
|
|
1435
1452
|
keyName,
|
|
1436
|
-
options:
|
|
1453
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1437
1454
|
};
|
|
1438
1455
|
return this.sendOperationRequest(operationArguments, deleteKeyOperationSpec);
|
|
1439
1456
|
}
|
|
@@ -1451,7 +1468,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1451
1468
|
vaultBaseUrl,
|
|
1452
1469
|
keyName,
|
|
1453
1470
|
keyVersion,
|
|
1454
|
-
options:
|
|
1471
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1455
1472
|
};
|
|
1456
1473
|
return this.sendOperationRequest(operationArguments, updateKeyOperationSpec);
|
|
1457
1474
|
}
|
|
@@ -1469,7 +1486,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1469
1486
|
vaultBaseUrl,
|
|
1470
1487
|
keyName,
|
|
1471
1488
|
keyVersion,
|
|
1472
|
-
options:
|
|
1489
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1473
1490
|
};
|
|
1474
1491
|
return this.sendOperationRequest(operationArguments, getKeyOperationSpec);
|
|
1475
1492
|
}
|
|
@@ -1484,7 +1501,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1484
1501
|
const operationArguments = {
|
|
1485
1502
|
vaultBaseUrl,
|
|
1486
1503
|
keyName,
|
|
1487
|
-
options:
|
|
1504
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1488
1505
|
};
|
|
1489
1506
|
return this.sendOperationRequest(operationArguments, getKeyVersionsOperationSpec);
|
|
1490
1507
|
}
|
|
@@ -1499,7 +1516,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1499
1516
|
getKeys(vaultBaseUrl, options) {
|
|
1500
1517
|
const operationArguments = {
|
|
1501
1518
|
vaultBaseUrl,
|
|
1502
|
-
options:
|
|
1519
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1503
1520
|
};
|
|
1504
1521
|
return this.sendOperationRequest(operationArguments, getKeysOperationSpec);
|
|
1505
1522
|
}
|
|
@@ -1522,7 +1539,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1522
1539
|
const operationArguments = {
|
|
1523
1540
|
vaultBaseUrl,
|
|
1524
1541
|
keyName,
|
|
1525
|
-
options:
|
|
1542
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1526
1543
|
};
|
|
1527
1544
|
return this.sendOperationRequest(operationArguments, backupKeyOperationSpec);
|
|
1528
1545
|
}
|
|
@@ -1545,7 +1562,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1545
1562
|
const operationArguments = {
|
|
1546
1563
|
vaultBaseUrl,
|
|
1547
1564
|
keyBundleBackup,
|
|
1548
|
-
options:
|
|
1565
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1549
1566
|
};
|
|
1550
1567
|
return this.sendOperationRequest(operationArguments, restoreKeyOperationSpec);
|
|
1551
1568
|
}
|
|
@@ -1571,7 +1588,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1571
1588
|
keyVersion,
|
|
1572
1589
|
algorithm,
|
|
1573
1590
|
value,
|
|
1574
|
-
options:
|
|
1591
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1575
1592
|
};
|
|
1576
1593
|
return this.sendOperationRequest(operationArguments, encryptOperationSpec);
|
|
1577
1594
|
}
|
|
@@ -1595,7 +1612,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1595
1612
|
keyVersion,
|
|
1596
1613
|
algorithm,
|
|
1597
1614
|
value,
|
|
1598
|
-
options:
|
|
1615
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1599
1616
|
};
|
|
1600
1617
|
return this.sendOperationRequest(operationArguments, decryptOperationSpec);
|
|
1601
1618
|
}
|
|
@@ -1618,7 +1635,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1618
1635
|
keyVersion,
|
|
1619
1636
|
algorithm,
|
|
1620
1637
|
value,
|
|
1621
|
-
options:
|
|
1638
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1622
1639
|
};
|
|
1623
1640
|
return this.sendOperationRequest(operationArguments, signOperationSpec);
|
|
1624
1641
|
}
|
|
@@ -1645,7 +1662,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1645
1662
|
algorithm,
|
|
1646
1663
|
digest,
|
|
1647
1664
|
signature,
|
|
1648
|
-
options:
|
|
1665
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1649
1666
|
};
|
|
1650
1667
|
return this.sendOperationRequest(operationArguments, verifyOperationSpec);
|
|
1651
1668
|
}
|
|
@@ -1670,7 +1687,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1670
1687
|
keyVersion,
|
|
1671
1688
|
algorithm,
|
|
1672
1689
|
value,
|
|
1673
|
-
options:
|
|
1690
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1674
1691
|
};
|
|
1675
1692
|
return this.sendOperationRequest(operationArguments, wrapKeyOperationSpec);
|
|
1676
1693
|
}
|
|
@@ -1693,43 +1710,26 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1693
1710
|
keyVersion,
|
|
1694
1711
|
algorithm,
|
|
1695
1712
|
value,
|
|
1696
|
-
options:
|
|
1713
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1697
1714
|
};
|
|
1698
1715
|
return this.sendOperationRequest(operationArguments, unwrapKeyOperationSpec);
|
|
1699
1716
|
}
|
|
1700
|
-
/**
|
|
1701
|
-
* The export key operation is applicable to all key types. The target key must be marked exportable.
|
|
1702
|
-
* This operation requires the keys/export permission.
|
|
1703
|
-
* @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
|
|
1704
|
-
* @param keyName The name of the key to get.
|
|
1705
|
-
* @param keyVersion Adding the version parameter retrieves a specific version of a key.
|
|
1706
|
-
* @param options The options parameters.
|
|
1707
|
-
*/
|
|
1708
|
-
export(vaultBaseUrl, keyName, keyVersion, options) {
|
|
1709
|
-
const operationArguments = {
|
|
1710
|
-
vaultBaseUrl,
|
|
1711
|
-
keyName,
|
|
1712
|
-
keyVersion,
|
|
1713
|
-
options: coreHttp.operationOptionsToRequestOptionsBase(options || {})
|
|
1714
|
-
};
|
|
1715
|
-
return this.sendOperationRequest(operationArguments, exportOperationSpec);
|
|
1716
|
-
}
|
|
1717
1717
|
/**
|
|
1718
1718
|
* The release key operation is applicable to all key types. The target key must be marked exportable.
|
|
1719
1719
|
* This operation requires the keys/release permission.
|
|
1720
1720
|
* @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
|
|
1721
1721
|
* @param keyName The name of the key to get.
|
|
1722
1722
|
* @param keyVersion Adding the version parameter retrieves a specific version of a key.
|
|
1723
|
-
* @param
|
|
1723
|
+
* @param targetAttestationToken The attestation assertion for the target of the key release.
|
|
1724
1724
|
* @param options The options parameters.
|
|
1725
1725
|
*/
|
|
1726
|
-
release(vaultBaseUrl, keyName, keyVersion,
|
|
1726
|
+
release(vaultBaseUrl, keyName, keyVersion, targetAttestationToken, options) {
|
|
1727
1727
|
const operationArguments = {
|
|
1728
1728
|
vaultBaseUrl,
|
|
1729
1729
|
keyName,
|
|
1730
1730
|
keyVersion,
|
|
1731
|
-
|
|
1732
|
-
options:
|
|
1731
|
+
targetAttestationToken,
|
|
1732
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1733
1733
|
};
|
|
1734
1734
|
return this.sendOperationRequest(operationArguments, releaseOperationSpec);
|
|
1735
1735
|
}
|
|
@@ -1745,7 +1745,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1745
1745
|
getDeletedKeys(vaultBaseUrl, options) {
|
|
1746
1746
|
const operationArguments = {
|
|
1747
1747
|
vaultBaseUrl,
|
|
1748
|
-
options:
|
|
1748
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1749
1749
|
};
|
|
1750
1750
|
return this.sendOperationRequest(operationArguments, getDeletedKeysOperationSpec);
|
|
1751
1751
|
}
|
|
@@ -1761,7 +1761,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1761
1761
|
const operationArguments = {
|
|
1762
1762
|
vaultBaseUrl,
|
|
1763
1763
|
keyName,
|
|
1764
|
-
options:
|
|
1764
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1765
1765
|
};
|
|
1766
1766
|
return this.sendOperationRequest(operationArguments, getDeletedKeyOperationSpec);
|
|
1767
1767
|
}
|
|
@@ -1777,7 +1777,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1777
1777
|
const operationArguments = {
|
|
1778
1778
|
vaultBaseUrl,
|
|
1779
1779
|
keyName,
|
|
1780
|
-
options:
|
|
1780
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1781
1781
|
};
|
|
1782
1782
|
return this.sendOperationRequest(operationArguments, purgeDeletedKeyOperationSpec);
|
|
1783
1783
|
}
|
|
@@ -1794,7 +1794,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1794
1794
|
const operationArguments = {
|
|
1795
1795
|
vaultBaseUrl,
|
|
1796
1796
|
keyName,
|
|
1797
|
-
options:
|
|
1797
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1798
1798
|
};
|
|
1799
1799
|
return this.sendOperationRequest(operationArguments, recoverDeletedKeyOperationSpec);
|
|
1800
1800
|
}
|
|
@@ -1809,7 +1809,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1809
1809
|
const operationArguments = {
|
|
1810
1810
|
vaultBaseUrl,
|
|
1811
1811
|
keyName,
|
|
1812
|
-
options:
|
|
1812
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1813
1813
|
};
|
|
1814
1814
|
return this.sendOperationRequest(operationArguments, getKeyRotationPolicyOperationSpec);
|
|
1815
1815
|
}
|
|
@@ -1826,7 +1826,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1826
1826
|
vaultBaseUrl,
|
|
1827
1827
|
keyName,
|
|
1828
1828
|
keyRotationPolicy,
|
|
1829
|
-
options:
|
|
1829
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1830
1830
|
};
|
|
1831
1831
|
return this.sendOperationRequest(operationArguments, updateKeyRotationPolicyOperationSpec);
|
|
1832
1832
|
}
|
|
@@ -1840,7 +1840,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1840
1840
|
const operationArguments = {
|
|
1841
1841
|
vaultBaseUrl,
|
|
1842
1842
|
count,
|
|
1843
|
-
options:
|
|
1843
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1844
1844
|
};
|
|
1845
1845
|
return this.sendOperationRequest(operationArguments, getRandomBytesOperationSpec);
|
|
1846
1846
|
}
|
|
@@ -1856,7 +1856,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1856
1856
|
vaultBaseUrl,
|
|
1857
1857
|
keyName,
|
|
1858
1858
|
nextLink,
|
|
1859
|
-
options:
|
|
1859
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1860
1860
|
};
|
|
1861
1861
|
return this.sendOperationRequest(operationArguments, getKeyVersionsNextOperationSpec);
|
|
1862
1862
|
}
|
|
@@ -1870,7 +1870,7 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1870
1870
|
const operationArguments = {
|
|
1871
1871
|
vaultBaseUrl,
|
|
1872
1872
|
nextLink,
|
|
1873
|
-
options:
|
|
1873
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1874
1874
|
};
|
|
1875
1875
|
return this.sendOperationRequest(operationArguments, getKeysNextOperationSpec);
|
|
1876
1876
|
}
|
|
@@ -1884,13 +1884,13 @@ class KeyVaultClient extends KeyVaultClientContext {
|
|
|
1884
1884
|
const operationArguments = {
|
|
1885
1885
|
vaultBaseUrl,
|
|
1886
1886
|
nextLink,
|
|
1887
|
-
options:
|
|
1887
|
+
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
1888
1888
|
};
|
|
1889
1889
|
return this.sendOperationRequest(operationArguments, getDeletedKeysNextOperationSpec);
|
|
1890
1890
|
}
|
|
1891
1891
|
}
|
|
1892
1892
|
// Operation Specifications
|
|
1893
|
-
const serializer = new
|
|
1893
|
+
const serializer = new coreHttp__namespace.Serializer(Mappers, /* isXml */ false);
|
|
1894
1894
|
const createKeyOperationSpec = {
|
|
1895
1895
|
path: "/keys/{key-name}/create",
|
|
1896
1896
|
httpMethod: "POST",
|
|
@@ -2277,35 +2277,6 @@ const unwrapKeyOperationSpec = {
|
|
|
2277
2277
|
mediaType: "json",
|
|
2278
2278
|
serializer
|
|
2279
2279
|
};
|
|
2280
|
-
const exportOperationSpec = {
|
|
2281
|
-
path: "/keys/{key-name}/{key-version}/export",
|
|
2282
|
-
httpMethod: "POST",
|
|
2283
|
-
responses: {
|
|
2284
|
-
200: {
|
|
2285
|
-
bodyMapper: KeyBundle
|
|
2286
|
-
},
|
|
2287
|
-
default: {
|
|
2288
|
-
bodyMapper: KeyVaultError
|
|
2289
|
-
}
|
|
2290
|
-
},
|
|
2291
|
-
requestBody: {
|
|
2292
|
-
parameterPath: {
|
|
2293
|
-
wrappingKey: ["options", "wrappingKey"],
|
|
2294
|
-
wrappingKid: ["options", "wrappingKid"],
|
|
2295
|
-
enc: ["options", "enc"]
|
|
2296
|
-
},
|
|
2297
|
-
mapper: Object.assign(Object.assign({}, KeyExportParameters), { required: true })
|
|
2298
|
-
},
|
|
2299
|
-
queryParameters: [apiVersion],
|
|
2300
|
-
urlParameters: [
|
|
2301
|
-
vaultBaseUrl,
|
|
2302
|
-
keyName1,
|
|
2303
|
-
keyVersion
|
|
2304
|
-
],
|
|
2305
|
-
headerParameters: [contentType, accept],
|
|
2306
|
-
mediaType: "json",
|
|
2307
|
-
serializer
|
|
2308
|
-
};
|
|
2309
2280
|
const releaseOperationSpec = {
|
|
2310
2281
|
path: "/keys/{key-name}/{key-version}/release",
|
|
2311
2282
|
httpMethod: "POST",
|
|
@@ -2319,7 +2290,7 @@ const releaseOperationSpec = {
|
|
|
2319
2290
|
},
|
|
2320
2291
|
requestBody: {
|
|
2321
2292
|
parameterPath: {
|
|
2322
|
-
|
|
2293
|
+
targetAttestationToken: ["targetAttestationToken"],
|
|
2323
2294
|
nonce: ["options", "nonce"],
|
|
2324
2295
|
enc: ["options", "enc"]
|
|
2325
2296
|
},
|
|
@@ -2507,16 +2478,69 @@ const getDeletedKeysNextOperationSpec = {
|
|
|
2507
2478
|
|
|
2508
2479
|
// Copyright (c) Microsoft Corporation.
|
|
2509
2480
|
// Licensed under the MIT license.
|
|
2510
|
-
const SDK_VERSION = "4.4.0
|
|
2481
|
+
const SDK_VERSION = "4.4.0";
|
|
2482
|
+
|
|
2483
|
+
// Copyright (c) Microsoft Corporation.
|
|
2484
|
+
// Licensed under the MIT license.
|
|
2485
|
+
/**
|
|
2486
|
+
* @internal
|
|
2487
|
+
*
|
|
2488
|
+
* Valid key names in WWW-Authenticate header.
|
|
2489
|
+
*/
|
|
2490
|
+
const validParsedWWWAuthenticateProperties = [
|
|
2491
|
+
"authorization",
|
|
2492
|
+
"authorization_url",
|
|
2493
|
+
"resource",
|
|
2494
|
+
"scope",
|
|
2495
|
+
"tenantId",
|
|
2496
|
+
];
|
|
2497
|
+
/**
|
|
2498
|
+
* Parses an WWW-Authenticate response.
|
|
2499
|
+
* This transforms a string value like:
|
|
2500
|
+
* `Bearer authorization="https://some.url/tenantId", resource="https://some.url"`
|
|
2501
|
+
* into an object like:
|
|
2502
|
+
* `{ authorization: "https://some.url/tenantId", resource: "https://some.url" }`
|
|
2503
|
+
* @param wwwAuthenticate - String value in the WWW-Authenticate header
|
|
2504
|
+
*/
|
|
2505
|
+
function parseWWWAuthenticate(wwwAuthenticate) {
|
|
2506
|
+
const pairDelimiter = /,? +/;
|
|
2507
|
+
const parsed = wwwAuthenticate
|
|
2508
|
+
.split(pairDelimiter)
|
|
2509
|
+
.reduce((kvPairs, p) => {
|
|
2510
|
+
if (p.match(/\w="/)) {
|
|
2511
|
+
// 'sampleKey="sample_value"' -> [sampleKey, "sample_value"] -> { sampleKey: sample_value }
|
|
2512
|
+
const [key, value] = p.split("=");
|
|
2513
|
+
if (validParsedWWWAuthenticateProperties.includes(key)) {
|
|
2514
|
+
// The values will be wrapped in quotes, which need to be stripped out.
|
|
2515
|
+
return Object.assign(Object.assign({}, kvPairs), { [key]: value.slice(1, -1) });
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
return kvPairs;
|
|
2519
|
+
}, {});
|
|
2520
|
+
// Finally, we pull the tenantId from the authorization header to support multi-tenant authentication.
|
|
2521
|
+
if (parsed.authorization) {
|
|
2522
|
+
try {
|
|
2523
|
+
const tenantId = new URL(parsed.authorization).pathname.substring(1);
|
|
2524
|
+
if (tenantId) {
|
|
2525
|
+
parsed.tenantId = tenantId;
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
catch (_) {
|
|
2529
|
+
throw new Error(`The challenge authorization URI '${parsed.authorization}' is invalid.`);
|
|
2530
|
+
}
|
|
2531
|
+
}
|
|
2532
|
+
return parsed;
|
|
2533
|
+
}
|
|
2511
2534
|
|
|
2512
2535
|
// Copyright (c) Microsoft Corporation.
|
|
2513
2536
|
/**
|
|
2514
2537
|
* Representation of the Authentication Challenge
|
|
2515
2538
|
*/
|
|
2516
2539
|
class AuthenticationChallenge {
|
|
2517
|
-
constructor(authorization, scope) {
|
|
2540
|
+
constructor(authorization, scope, tenantId) {
|
|
2518
2541
|
this.authorization = authorization;
|
|
2519
2542
|
this.scope = scope;
|
|
2543
|
+
this.tenantId = tenantId;
|
|
2520
2544
|
}
|
|
2521
2545
|
/**
|
|
2522
2546
|
* Checks that this AuthenticationChallenge is equal to another one given.
|
|
@@ -2526,9 +2550,11 @@ class AuthenticationChallenge {
|
|
|
2526
2550
|
* @param other - The other AuthenticationChallenge
|
|
2527
2551
|
*/
|
|
2528
2552
|
equalTo(other) {
|
|
2553
|
+
var _a, _b;
|
|
2529
2554
|
return other
|
|
2530
2555
|
? this.scope.toLowerCase() === other.scope.toLowerCase() &&
|
|
2531
|
-
this.authorization.toLowerCase() === other.authorization.toLowerCase()
|
|
2556
|
+
this.authorization.toLowerCase() === other.authorization.toLowerCase() &&
|
|
2557
|
+
((_a = this.tenantId) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_b = other.tenantId) === null || _b === void 0 ? void 0 : _b.toLowerCase())
|
|
2532
2558
|
: false;
|
|
2533
2559
|
}
|
|
2534
2560
|
}
|
|
@@ -2552,27 +2578,9 @@ function challengeBasedAuthenticationPolicy(credential) {
|
|
|
2552
2578
|
return {
|
|
2553
2579
|
create: (nextPolicy, options) => {
|
|
2554
2580
|
return new ChallengeBasedAuthenticationPolicy(nextPolicy, options, credential, tokenCache, challengeCache);
|
|
2555
|
-
}
|
|
2581
|
+
},
|
|
2556
2582
|
};
|
|
2557
2583
|
}
|
|
2558
|
-
/**
|
|
2559
|
-
* Parses an WWW-Authenticate response.
|
|
2560
|
-
* This transforms a string value like:
|
|
2561
|
-
* `Bearer authorization="some_authorization", resource="https://some.url"`
|
|
2562
|
-
* into an object like:
|
|
2563
|
-
* `{ authorization: "some_authorization", resource: "https://some.url" }`
|
|
2564
|
-
* @param wwwAuthenticate - String value in the WWW-Authenticate header
|
|
2565
|
-
*/
|
|
2566
|
-
function parseWWWAuthenticate(wwwAuthenticate) {
|
|
2567
|
-
// First we split the string by either `, ` or ` `.
|
|
2568
|
-
const parts = wwwAuthenticate.split(/,* +/);
|
|
2569
|
-
// Then we only keep the strings with an equal sign after a word and before a quote.
|
|
2570
|
-
// also splitting these sections by their equal sign
|
|
2571
|
-
const keyValues = parts.reduce((acc, str) => (str.match(/\w="/) ? [...acc, str.split("=")] : acc), []);
|
|
2572
|
-
// Then we transform these key-value pairs back into an object.
|
|
2573
|
-
const parsed = keyValues.reduce((result, [key, value]) => (Object.assign(Object.assign({}, result), { [key]: value.slice(1, -1) })), {});
|
|
2574
|
-
return parsed;
|
|
2575
|
-
}
|
|
2576
2584
|
/**
|
|
2577
2585
|
*
|
|
2578
2586
|
* Provides a RequestPolicy that can request a token from a TokenCredential
|
|
@@ -2603,7 +2611,9 @@ class ChallengeBasedAuthenticationPolicy extends coreHttp.BaseRequestPolicy {
|
|
|
2603
2611
|
let accessToken = this.tokenCache.getCachedToken();
|
|
2604
2612
|
// If there's no cached token in the cache, we try to get a new one.
|
|
2605
2613
|
if (accessToken === undefined) {
|
|
2606
|
-
const receivedToken = await this.credential.getToken(this.challengeCache.challenge.scope
|
|
2614
|
+
const receivedToken = await this.credential.getToken(this.challengeCache.challenge.scope, {
|
|
2615
|
+
tenantId: this.challengeCache.challenge.tenantId,
|
|
2616
|
+
});
|
|
2607
2617
|
accessToken = receivedToken || undefined;
|
|
2608
2618
|
this.tokenCache.setCachedToken(accessToken);
|
|
2609
2619
|
}
|
|
@@ -2626,10 +2636,11 @@ class ChallengeBasedAuthenticationPolicy extends coreHttp.BaseRequestPolicy {
|
|
|
2626
2636
|
const parsedWWWAuth = this.parseWWWAuthenticate(wwwAuthenticate);
|
|
2627
2637
|
const authorization = parsedWWWAuth.authorization;
|
|
2628
2638
|
const resource = parsedWWWAuth.resource || parsedWWWAuth.scope;
|
|
2639
|
+
const tenantId = parsedWWWAuth.tenantId;
|
|
2629
2640
|
if (!(authorization && resource)) {
|
|
2630
2641
|
return this._nextPolicy.sendRequest(webResource);
|
|
2631
2642
|
}
|
|
2632
|
-
const challenge = new AuthenticationChallenge(authorization, resource + "/.default");
|
|
2643
|
+
const challenge = new AuthenticationChallenge(authorization, resource + "/.default", tenantId);
|
|
2633
2644
|
// Either if there's no cached challenge at this point (could have happen in parallel),
|
|
2634
2645
|
// or if the cached challenge has a different scope,
|
|
2635
2646
|
// we store the just received challenge and reset the cached token, to force a re-authentication.
|
|
@@ -2694,7 +2705,7 @@ function parseKeyvaultIdentifier(collection, identifier) {
|
|
|
2694
2705
|
}
|
|
2695
2706
|
let baseUri;
|
|
2696
2707
|
try {
|
|
2697
|
-
baseUri =
|
|
2708
|
+
baseUri = url__namespace.parse(identifier, true, true);
|
|
2698
2709
|
}
|
|
2699
2710
|
catch (e) {
|
|
2700
2711
|
throw new Error(`Invalid ${collection} identifier: ${identifier}. Not a valid URI`);
|
|
@@ -2713,7 +2724,7 @@ function parseKeyvaultIdentifier(collection, identifier) {
|
|
|
2713
2724
|
return {
|
|
2714
2725
|
vaultUrl,
|
|
2715
2726
|
name,
|
|
2716
|
-
version
|
|
2727
|
+
version,
|
|
2717
2728
|
};
|
|
2718
2729
|
}
|
|
2719
2730
|
|
|
@@ -2730,7 +2741,7 @@ function parseKeyvaultIdentifier(collection, identifier) {
|
|
|
2730
2741
|
function createTraceFunction(prefix) {
|
|
2731
2742
|
const createSpan = coreTracing.createSpanFunction({
|
|
2732
2743
|
namespace: "Microsoft.KeyVault",
|
|
2733
|
-
packagePrefix: prefix
|
|
2744
|
+
packagePrefix: prefix,
|
|
2734
2745
|
});
|
|
2735
2746
|
return async function (operationName, options, cb) {
|
|
2736
2747
|
const { updatedOptions, span } = createSpan(operationName, options);
|
|
@@ -2740,14 +2751,14 @@ function createTraceFunction(prefix) {
|
|
|
2740
2751
|
const result = await cb(updatedOptions, span);
|
|
2741
2752
|
// otel 0.16+ needs this or else the code ends up being set as UNSET
|
|
2742
2753
|
span.setStatus({
|
|
2743
|
-
code: coreTracing.SpanStatusCode.OK
|
|
2754
|
+
code: coreTracing.SpanStatusCode.OK,
|
|
2744
2755
|
});
|
|
2745
2756
|
return result;
|
|
2746
2757
|
}
|
|
2747
2758
|
catch (err) {
|
|
2748
2759
|
span.setStatus({
|
|
2749
2760
|
code: coreTracing.SpanStatusCode.ERROR,
|
|
2750
|
-
message: err.message
|
|
2761
|
+
message: err.message,
|
|
2751
2762
|
});
|
|
2752
2763
|
throw err;
|
|
2753
2764
|
}
|
|
@@ -2786,14 +2797,13 @@ function parseKeyVaultKeyIdentifier(id) {
|
|
|
2786
2797
|
* Shapes the exposed {@link KeyVaultKey} based on either a received key bundle or deleted key bundle.
|
|
2787
2798
|
*/
|
|
2788
2799
|
function getKeyFromKeyBundle(bundle) {
|
|
2789
|
-
var _a;
|
|
2790
2800
|
const keyBundle = bundle;
|
|
2791
2801
|
const deletedKeyBundle = bundle;
|
|
2792
2802
|
const parsedId = parseKeyVaultKeyIdentifier(keyBundle.key.kid);
|
|
2793
2803
|
const attributes = keyBundle.attributes || {};
|
|
2794
2804
|
delete keyBundle.attributes;
|
|
2795
2805
|
const resultObject = {
|
|
2796
|
-
key:
|
|
2806
|
+
key: keyBundle.key,
|
|
2797
2807
|
id: keyBundle.key ? keyBundle.key.kid : undefined,
|
|
2798
2808
|
name: parsedId.name,
|
|
2799
2809
|
keyOperations: keyBundle.key ? keyBundle.key.keyOps : undefined,
|
|
@@ -2813,8 +2823,8 @@ function getKeyFromKeyBundle(bundle) {
|
|
|
2813
2823
|
version: parsedId.version,
|
|
2814
2824
|
name: parsedId.name,
|
|
2815
2825
|
managed: keyBundle.managed,
|
|
2816
|
-
id: keyBundle.key ? keyBundle.key.kid : undefined
|
|
2817
|
-
}
|
|
2826
|
+
id: keyBundle.key ? keyBundle.key.kid : undefined,
|
|
2827
|
+
},
|
|
2818
2828
|
};
|
|
2819
2829
|
if (deletedKeyBundle.recoveryId) {
|
|
2820
2830
|
resultObject.properties.recoveryId = deletedKeyBundle.recoveryId;
|
|
@@ -2831,11 +2841,11 @@ function getDeletedKeyFromDeletedKeyItem(keyItem) {
|
|
|
2831
2841
|
const commonProperties = getKeyPropertiesFromKeyItem(keyItem);
|
|
2832
2842
|
return {
|
|
2833
2843
|
key: {
|
|
2834
|
-
kid: keyItem.kid
|
|
2844
|
+
kid: keyItem.kid,
|
|
2835
2845
|
},
|
|
2836
2846
|
id: keyItem.kid,
|
|
2837
2847
|
name: commonProperties.name,
|
|
2838
|
-
properties: Object.assign(Object.assign({}, commonProperties), { recoveryId: keyItem.recoveryId, scheduledPurgeDate: keyItem.scheduledPurgeDate, deletedOn: keyItem.deletedDate })
|
|
2848
|
+
properties: Object.assign(Object.assign({}, commonProperties), { recoveryId: keyItem.recoveryId, scheduledPurgeDate: keyItem.scheduledPurgeDate, deletedOn: keyItem.deletedDate }),
|
|
2839
2849
|
};
|
|
2840
2850
|
}
|
|
2841
2851
|
/**
|
|
@@ -2858,7 +2868,7 @@ function getKeyPropertiesFromKeyItem(keyItem) {
|
|
|
2858
2868
|
tags: keyItem.tags,
|
|
2859
2869
|
updatedOn: attributes.updated,
|
|
2860
2870
|
vaultUrl: parsedId.vaultUrl,
|
|
2861
|
-
version: parsedId.version
|
|
2871
|
+
version: parsedId.version,
|
|
2862
2872
|
};
|
|
2863
2873
|
return resultObject;
|
|
2864
2874
|
}
|
|
@@ -2870,12 +2880,12 @@ const keyRotationTransformations = {
|
|
|
2870
2880
|
var _a;
|
|
2871
2881
|
const policy = {
|
|
2872
2882
|
attributes: {
|
|
2873
|
-
expiryTime: parameters.expiresIn
|
|
2883
|
+
expiryTime: parameters.expiresIn,
|
|
2874
2884
|
},
|
|
2875
2885
|
lifetimeActions: (_a = parameters.lifetimeActions) === null || _a === void 0 ? void 0 : _a.map((action) => {
|
|
2876
2886
|
const generatedAction = {
|
|
2877
2887
|
action: { type: action.action },
|
|
2878
|
-
trigger: {}
|
|
2888
|
+
trigger: {},
|
|
2879
2889
|
};
|
|
2880
2890
|
if (action.timeAfterCreate) {
|
|
2881
2891
|
generatedAction.trigger.timeAfterCreate = action.timeAfterCreate;
|
|
@@ -2884,7 +2894,7 @@ const keyRotationTransformations = {
|
|
|
2884
2894
|
generatedAction.trigger.timeBeforeExpiry = action.timeBeforeExpiry;
|
|
2885
2895
|
}
|
|
2886
2896
|
return generatedAction;
|
|
2887
|
-
})
|
|
2897
|
+
}),
|
|
2888
2898
|
};
|
|
2889
2899
|
return policy;
|
|
2890
2900
|
},
|
|
@@ -2900,12 +2910,12 @@ const keyRotationTransformations = {
|
|
|
2900
2910
|
return {
|
|
2901
2911
|
action: action.action.type,
|
|
2902
2912
|
timeAfterCreate: (_a = action.trigger) === null || _a === void 0 ? void 0 : _a.timeAfterCreate,
|
|
2903
|
-
timeBeforeExpiry: (_b = action.trigger) === null || _b === void 0 ? void 0 : _b.timeBeforeExpiry
|
|
2913
|
+
timeBeforeExpiry: (_b = action.trigger) === null || _b === void 0 ? void 0 : _b.timeBeforeExpiry,
|
|
2904
2914
|
};
|
|
2905
|
-
})
|
|
2915
|
+
}),
|
|
2906
2916
|
};
|
|
2907
2917
|
return policy;
|
|
2908
|
-
}
|
|
2918
|
+
},
|
|
2909
2919
|
};
|
|
2910
2920
|
|
|
2911
2921
|
// Copyright (c) Microsoft Corporation.
|
|
@@ -2955,7 +2965,7 @@ class KeyVaultKeyPollOperation {
|
|
|
2955
2965
|
*/
|
|
2956
2966
|
toString() {
|
|
2957
2967
|
return JSON.stringify({
|
|
2958
|
-
state: this.state
|
|
2968
|
+
state: this.state,
|
|
2959
2969
|
});
|
|
2960
2970
|
}
|
|
2961
2971
|
}
|
|
@@ -2964,7 +2974,7 @@ class KeyVaultKeyPollOperation {
|
|
|
2964
2974
|
/**
|
|
2965
2975
|
* @internal
|
|
2966
2976
|
*/
|
|
2967
|
-
const withTrace = createTraceFunction("Azure.KeyVault.Keys.DeleteKeyPoller");
|
|
2977
|
+
const withTrace$4 = createTraceFunction("Azure.KeyVault.Keys.DeleteKeyPoller");
|
|
2968
2978
|
class DeleteKeyPollOperation extends KeyVaultKeyPollOperation {
|
|
2969
2979
|
constructor(state, vaultUrl, client, operationOptions = {}) {
|
|
2970
2980
|
super(state, { cancelMessage: "Canceling the deletion of a key is not supported." });
|
|
@@ -2978,7 +2988,7 @@ class DeleteKeyPollOperation extends KeyVaultKeyPollOperation {
|
|
|
2978
2988
|
* Since the Key Vault Key won't be immediately deleted, we have {@link beginDeleteKey}.
|
|
2979
2989
|
*/
|
|
2980
2990
|
deleteKey(name, options = {}) {
|
|
2981
|
-
return withTrace("deleteKey", options, async (updatedOptions) => {
|
|
2991
|
+
return withTrace$4("deleteKey", options, async (updatedOptions) => {
|
|
2982
2992
|
const response = await this.client.deleteKey(this.vaultUrl, name, updatedOptions);
|
|
2983
2993
|
return getKeyFromKeyBundle(response);
|
|
2984
2994
|
});
|
|
@@ -2988,7 +2998,7 @@ class DeleteKeyPollOperation extends KeyVaultKeyPollOperation {
|
|
|
2988
2998
|
* This operation requires the keys/get permission.
|
|
2989
2999
|
*/
|
|
2990
3000
|
getDeletedKey(name, options = {}) {
|
|
2991
|
-
return withTrace("getDeletedKey", options, async (updatedOptions) => {
|
|
3001
|
+
return withTrace$4("getDeletedKey", options, async (updatedOptions) => {
|
|
2992
3002
|
const response = await this.client.getDeletedKey(this.vaultUrl, name, updatedOptions);
|
|
2993
3003
|
return getKeyFromKeyBundle(response);
|
|
2994
3004
|
});
|
|
@@ -3052,7 +3062,7 @@ class DeleteKeyPoller extends KeyVaultKeyPoller {
|
|
|
3052
3062
|
/**
|
|
3053
3063
|
* @internal
|
|
3054
3064
|
*/
|
|
3055
|
-
const withTrace$
|
|
3065
|
+
const withTrace$3 = createTraceFunction("Azure.KeyVault.Keys.RecoverDeletedKeyPoller");
|
|
3056
3066
|
class RecoverDeletedKeyPollOperation extends KeyVaultKeyPollOperation {
|
|
3057
3067
|
constructor(state, vaultUrl, client, operationOptions = {}) {
|
|
3058
3068
|
super(state, { cancelMessage: "Canceling the recovery of a deleted key is not supported." });
|
|
@@ -3066,7 +3076,7 @@ class RecoverDeletedKeyPollOperation extends KeyVaultKeyPollOperation {
|
|
|
3066
3076
|
* This operation requires the keys/get permission.
|
|
3067
3077
|
*/
|
|
3068
3078
|
getKey(name, options = {}) {
|
|
3069
|
-
return withTrace$
|
|
3079
|
+
return withTrace$3("generatedClient.getKey", options, async (updatedOptions) => {
|
|
3070
3080
|
const response = await this.client.getKey(this.vaultUrl, name, (updatedOptions === null || updatedOptions === void 0 ? void 0 : updatedOptions.version) || "", updatedOptions);
|
|
3071
3081
|
return getKeyFromKeyBundle(response);
|
|
3072
3082
|
});
|
|
@@ -3076,7 +3086,7 @@ class RecoverDeletedKeyPollOperation extends KeyVaultKeyPollOperation {
|
|
|
3076
3086
|
* Since the Key Vault Key won't be immediately recover the deleted key, we have {@link beginRecoverDeletedKey}.
|
|
3077
3087
|
*/
|
|
3078
3088
|
async recoverDeletedKey(name, options = {}) {
|
|
3079
|
-
return withTrace$
|
|
3089
|
+
return withTrace$3("generatedClient.recoverDeleteKey", options, async (updatedOptions) => {
|
|
3080
3090
|
const response = await this.client.recoverDeletedKey(this.vaultUrl, name, updatedOptions);
|
|
3081
3091
|
return getKeyFromKeyBundle(response);
|
|
3082
3092
|
});
|
|
@@ -3146,7 +3156,9 @@ class RecoverDeletedKeyPoller extends KeyVaultKeyPoller {
|
|
|
3146
3156
|
/**
|
|
3147
3157
|
* The latest supported Key Vault service API version
|
|
3148
3158
|
*/
|
|
3149
|
-
const LATEST_API_VERSION = "7.3
|
|
3159
|
+
const LATEST_API_VERSION = "7.3";
|
|
3160
|
+
/** Known values of {@link KeyOperation} that the service accepts. */
|
|
3161
|
+
exports.KnownKeyOperations = void 0;
|
|
3150
3162
|
(function (KnownKeyOperations) {
|
|
3151
3163
|
/** Key operation - encrypt */
|
|
3152
3164
|
KnownKeyOperations["Encrypt"] = "encrypt";
|
|
@@ -3164,12 +3176,15 @@ const LATEST_API_VERSION = "7.3-preview";
|
|
|
3164
3176
|
KnownKeyOperations["Import"] = "import";
|
|
3165
3177
|
})(exports.KnownKeyOperations || (exports.KnownKeyOperations = {}));
|
|
3166
3178
|
/** Known values of {@link KeyExportEncryptionAlgorithm} that the service accepts. */
|
|
3167
|
-
|
|
3179
|
+
exports.KnownKeyExportEncryptionAlgorithm = void 0;
|
|
3168
3180
|
(function (KnownKeyExportEncryptionAlgorithm) {
|
|
3181
|
+
/** CKM_RSA_AES_KEY_WRAP Key Export Encryption Algorithm */
|
|
3169
3182
|
KnownKeyExportEncryptionAlgorithm["CkmRsaAesKeyWrap"] = "CKM_RSA_AES_KEY_WRAP";
|
|
3183
|
+
/** RSA_AES_KEY_WRAP_256 Key Export Encryption Algorithm */
|
|
3170
3184
|
KnownKeyExportEncryptionAlgorithm["RsaAesKeyWrap256"] = "RSA_AES_KEY_WRAP_256";
|
|
3185
|
+
/** RSA_AES_KEY_WRAP_384 Key Export Encryption Algorithm */
|
|
3171
3186
|
KnownKeyExportEncryptionAlgorithm["RsaAesKeyWrap384"] = "RSA_AES_KEY_WRAP_384";
|
|
3172
|
-
})(KnownKeyExportEncryptionAlgorithm || (KnownKeyExportEncryptionAlgorithm = {}));
|
|
3187
|
+
})(exports.KnownKeyExportEncryptionAlgorithm || (exports.KnownKeyExportEncryptionAlgorithm = {}));
|
|
3173
3188
|
|
|
3174
3189
|
// Copyright (c) Microsoft Corporation.
|
|
3175
3190
|
/**
|
|
@@ -3186,7 +3201,7 @@ const algorithmToHashAlgorithm = {
|
|
|
3186
3201
|
RS384: "SHA384",
|
|
3187
3202
|
ES512: "SHA512",
|
|
3188
3203
|
PS512: "SHA512",
|
|
3189
|
-
RS512: "SHA512"
|
|
3204
|
+
RS512: "SHA512",
|
|
3190
3205
|
};
|
|
3191
3206
|
/**
|
|
3192
3207
|
* @internal
|
|
@@ -3274,7 +3289,7 @@ class RemoteCryptographyProvider {
|
|
|
3274
3289
|
keyID: this.getKeyID(),
|
|
3275
3290
|
additionalAuthenticatedData: result.additionalAuthenticatedData,
|
|
3276
3291
|
authenticationTag: result.authenticationTag,
|
|
3277
|
-
iv: result.iv
|
|
3292
|
+
iv: result.iv,
|
|
3278
3293
|
};
|
|
3279
3294
|
});
|
|
3280
3295
|
}
|
|
@@ -3286,7 +3301,7 @@ class RemoteCryptographyProvider {
|
|
|
3286
3301
|
return {
|
|
3287
3302
|
result: result.result,
|
|
3288
3303
|
keyID: this.getKeyID(),
|
|
3289
|
-
algorithm
|
|
3304
|
+
algorithm,
|
|
3290
3305
|
};
|
|
3291
3306
|
});
|
|
3292
3307
|
}
|
|
@@ -3296,7 +3311,7 @@ class RemoteCryptographyProvider {
|
|
|
3296
3311
|
return {
|
|
3297
3312
|
result: result.result,
|
|
3298
3313
|
algorithm,
|
|
3299
|
-
keyID: this.getKeyID()
|
|
3314
|
+
keyID: this.getKeyID(),
|
|
3300
3315
|
};
|
|
3301
3316
|
});
|
|
3302
3317
|
}
|
|
@@ -3306,7 +3321,7 @@ class RemoteCryptographyProvider {
|
|
|
3306
3321
|
return {
|
|
3307
3322
|
result: result.result,
|
|
3308
3323
|
algorithm,
|
|
3309
|
-
keyID: this.getKeyID()
|
|
3324
|
+
keyID: this.getKeyID(),
|
|
3310
3325
|
};
|
|
3311
3326
|
});
|
|
3312
3327
|
}
|
|
@@ -3327,7 +3342,7 @@ class RemoteCryptographyProvider {
|
|
|
3327
3342
|
const response = await this.client.verify(this.vaultUrl, this.name, this.version, algorithm, digest, signature, updatedOptions);
|
|
3328
3343
|
return {
|
|
3329
3344
|
result: response.value ? response.value : false,
|
|
3330
|
-
keyID: this.getKeyID()
|
|
3345
|
+
keyID: this.getKeyID(),
|
|
3331
3346
|
};
|
|
3332
3347
|
});
|
|
3333
3348
|
}
|
|
@@ -3363,7 +3378,6 @@ class RemoteCryptographyProvider {
|
|
|
3363
3378
|
}
|
|
3364
3379
|
/**
|
|
3365
3380
|
* Attempts to retrieve the ID of the key.
|
|
3366
|
-
* @internal
|
|
3367
3381
|
*/
|
|
3368
3382
|
getKeyID() {
|
|
3369
3383
|
let kid;
|
|
@@ -3394,7 +3408,7 @@ function getOrInitializeClient(credential, options) {
|
|
|
3394
3408
|
options.userAgentOptions = {
|
|
3395
3409
|
userAgentPrefix: userAgentOptions && userAgentOptions.userAgentPrefix
|
|
3396
3410
|
? `${userAgentOptions.userAgentPrefix} ${libInfo}`
|
|
3397
|
-
: libInfo
|
|
3411
|
+
: libInfo,
|
|
3398
3412
|
};
|
|
3399
3413
|
const authPolicy = coreHttp.isTokenCredential(credential)
|
|
3400
3414
|
? challengeBasedAuthenticationPolicy(credential)
|
|
@@ -3404,8 +3418,8 @@ function getOrInitializeClient(credential, options) {
|
|
|
3404
3418
|
allowedHeaderNames: [
|
|
3405
3419
|
"x-ms-keyvault-region",
|
|
3406
3420
|
"x-ms-keyvault-network-info",
|
|
3407
|
-
"x-ms-keyvault-service-version"
|
|
3408
|
-
]
|
|
3421
|
+
"x-ms-keyvault-service-version",
|
|
3422
|
+
],
|
|
3409
3423
|
} });
|
|
3410
3424
|
return new KeyVaultClient(options.serviceVersion || LATEST_API_VERSION, coreHttp.createPipelineFromOptions(internalPipelineOptions, authPolicy));
|
|
3411
3425
|
}
|
|
@@ -3522,7 +3536,6 @@ class RsaCryptographyProvider {
|
|
|
3522
3536
|
constructor(key) {
|
|
3523
3537
|
/**
|
|
3524
3538
|
* The set of algorithms this provider supports
|
|
3525
|
-
* @internal
|
|
3526
3539
|
*/
|
|
3527
3540
|
this.applicableAlgorithms = [
|
|
3528
3541
|
"RSA1_5",
|
|
@@ -3532,16 +3545,15 @@ class RsaCryptographyProvider {
|
|
|
3532
3545
|
"PS384",
|
|
3533
3546
|
"RS384",
|
|
3534
3547
|
"PS512",
|
|
3535
|
-
"RS512"
|
|
3548
|
+
"RS512",
|
|
3536
3549
|
];
|
|
3537
3550
|
/**
|
|
3538
3551
|
* The set of operations this provider supports
|
|
3539
|
-
* @internal
|
|
3540
3552
|
*/
|
|
3541
3553
|
this.applicableOperations = [
|
|
3542
3554
|
"encrypt",
|
|
3543
3555
|
"wrapKey",
|
|
3544
|
-
"verifyData"
|
|
3556
|
+
"verifyData",
|
|
3545
3557
|
];
|
|
3546
3558
|
/**
|
|
3547
3559
|
* Mapping between signature algorithms and their corresponding hash algorithms. Externally used for testing.
|
|
@@ -3553,7 +3565,7 @@ class RsaCryptographyProvider {
|
|
|
3553
3565
|
PS384: "SHA384",
|
|
3554
3566
|
RS384: "SHA384",
|
|
3555
3567
|
PS512: "SHA512",
|
|
3556
|
-
RS512: "SHA512"
|
|
3568
|
+
RS512: "SHA512",
|
|
3557
3569
|
};
|
|
3558
3570
|
this.key = key;
|
|
3559
3571
|
}
|
|
@@ -3567,7 +3579,7 @@ class RsaCryptographyProvider {
|
|
|
3567
3579
|
return Promise.resolve({
|
|
3568
3580
|
algorithm: encryptParameters.algorithm,
|
|
3569
3581
|
keyID: this.key.kid,
|
|
3570
|
-
result: crypto.publicEncrypt({ key: keyPEM, padding: padding }, Buffer.from(encryptParameters.plaintext))
|
|
3582
|
+
result: crypto.publicEncrypt({ key: keyPEM, padding: padding }, Buffer.from(encryptParameters.plaintext)),
|
|
3571
3583
|
});
|
|
3572
3584
|
}
|
|
3573
3585
|
decrypt(_decryptParameters, _options) {
|
|
@@ -3580,7 +3592,7 @@ class RsaCryptographyProvider {
|
|
|
3580
3592
|
return Promise.resolve({
|
|
3581
3593
|
algorithm: algorithm,
|
|
3582
3594
|
result: crypto.publicEncrypt({ key: keyPEM, padding }, Buffer.from(keyToWrap)),
|
|
3583
|
-
keyID: this.key.kid
|
|
3595
|
+
keyID: this.key.kid,
|
|
3584
3596
|
});
|
|
3585
3597
|
}
|
|
3586
3598
|
unwrapKey(_algorithm, _encryptedKey, _options) {
|
|
@@ -3601,7 +3613,7 @@ class RsaCryptographyProvider {
|
|
|
3601
3613
|
const verifier = createVerify(algorithm, data);
|
|
3602
3614
|
return Promise.resolve({
|
|
3603
3615
|
result: verifier.verify(keyPEM, Buffer.from(signature)),
|
|
3604
|
-
keyID: this.key.kid
|
|
3616
|
+
keyID: this.key.kid,
|
|
3605
3617
|
});
|
|
3606
3618
|
}
|
|
3607
3619
|
ensureValid() {
|
|
@@ -3631,42 +3643,42 @@ class AesCryptographyProvider {
|
|
|
3631
3643
|
this.supportedAlgorithms = {
|
|
3632
3644
|
A128CBCPAD: {
|
|
3633
3645
|
algorithm: "aes-128-cbc",
|
|
3634
|
-
keySizeInBytes: 128 >> 3
|
|
3646
|
+
keySizeInBytes: 128 >> 3,
|
|
3635
3647
|
},
|
|
3636
3648
|
A192CBCPAD: {
|
|
3637
3649
|
algorithm: "aes-192-cbc",
|
|
3638
|
-
keySizeInBytes: 192 >> 3
|
|
3650
|
+
keySizeInBytes: 192 >> 3,
|
|
3639
3651
|
},
|
|
3640
3652
|
A256CBCPAD: {
|
|
3641
3653
|
algorithm: "aes-256-cbc",
|
|
3642
|
-
keySizeInBytes: 256 >> 3
|
|
3643
|
-
}
|
|
3654
|
+
keySizeInBytes: 256 >> 3,
|
|
3655
|
+
},
|
|
3644
3656
|
};
|
|
3645
3657
|
this.supportedOperations = ["encrypt", "decrypt"];
|
|
3646
3658
|
this.key = key;
|
|
3647
3659
|
}
|
|
3648
3660
|
encrypt(encryptParameters, _options) {
|
|
3649
3661
|
const { algorithm, keySizeInBytes } = this.supportedAlgorithms[encryptParameters.algorithm];
|
|
3650
|
-
const iv = encryptParameters.iv ||
|
|
3662
|
+
const iv = encryptParameters.iv || crypto__namespace.randomBytes(16);
|
|
3651
3663
|
this.ensureValid(keySizeInBytes);
|
|
3652
|
-
const cipher =
|
|
3664
|
+
const cipher = crypto__namespace.createCipheriv(algorithm, this.key.k.subarray(0, keySizeInBytes), iv);
|
|
3653
3665
|
let encrypted = cipher.update(Buffer.from(encryptParameters.plaintext));
|
|
3654
3666
|
encrypted = Buffer.concat([encrypted, cipher.final()]);
|
|
3655
3667
|
return Promise.resolve({
|
|
3656
3668
|
algorithm: encryptParameters.algorithm,
|
|
3657
3669
|
result: encrypted,
|
|
3658
|
-
iv: iv
|
|
3670
|
+
iv: iv,
|
|
3659
3671
|
});
|
|
3660
3672
|
}
|
|
3661
3673
|
decrypt(decryptParameters, _options) {
|
|
3662
3674
|
const { algorithm, keySizeInBytes } = this.supportedAlgorithms[decryptParameters.algorithm];
|
|
3663
3675
|
this.ensureValid(keySizeInBytes);
|
|
3664
|
-
const decipher =
|
|
3676
|
+
const decipher = crypto__namespace.createDecipheriv(algorithm, this.key.k.subarray(0, keySizeInBytes), decryptParameters.iv);
|
|
3665
3677
|
let dec = decipher.update(Buffer.from(decryptParameters.ciphertext));
|
|
3666
3678
|
dec = Buffer.concat([dec, decipher.final()]);
|
|
3667
3679
|
return Promise.resolve({
|
|
3668
3680
|
algorithm: decryptParameters.algorithm,
|
|
3669
|
-
result: dec
|
|
3681
|
+
result: dec,
|
|
3670
3682
|
});
|
|
3671
3683
|
}
|
|
3672
3684
|
isSupported(algorithm, operation) {
|
|
@@ -3716,7 +3728,7 @@ class AesCryptographyProvider {
|
|
|
3716
3728
|
}
|
|
3717
3729
|
|
|
3718
3730
|
// Copyright (c) Microsoft Corporation.
|
|
3719
|
-
const withTrace$
|
|
3731
|
+
const withTrace$1 = createTraceFunction("Azure.KeyVault.Keys.CryptographyClient");
|
|
3720
3732
|
/**
|
|
3721
3733
|
* A client used to perform cryptographic operations on an Azure Key vault key
|
|
3722
3734
|
* or a local {@link JsonWebKey}.
|
|
@@ -3732,7 +3744,7 @@ class CryptographyClient {
|
|
|
3732
3744
|
// Key URL for remote-local operations.
|
|
3733
3745
|
this.key = {
|
|
3734
3746
|
kind: "identifier",
|
|
3735
|
-
value: key
|
|
3747
|
+
value: key,
|
|
3736
3748
|
};
|
|
3737
3749
|
this.remoteProvider = new RemoteCryptographyProvider(key, credential, pipelineOptions);
|
|
3738
3750
|
}
|
|
@@ -3740,7 +3752,7 @@ class CryptographyClient {
|
|
|
3740
3752
|
// KeyVault key for remote-local operations.
|
|
3741
3753
|
this.key = {
|
|
3742
3754
|
kind: "KeyVaultKey",
|
|
3743
|
-
value: key
|
|
3755
|
+
value: key,
|
|
3744
3756
|
};
|
|
3745
3757
|
this.remoteProvider = new RemoteCryptographyProvider(key, credential, pipelineOptions);
|
|
3746
3758
|
}
|
|
@@ -3748,7 +3760,7 @@ class CryptographyClient {
|
|
|
3748
3760
|
// JsonWebKey for local-only operations.
|
|
3749
3761
|
this.key = {
|
|
3750
3762
|
kind: "JsonWebKey",
|
|
3751
|
-
value: key
|
|
3763
|
+
value: key,
|
|
3752
3764
|
};
|
|
3753
3765
|
}
|
|
3754
3766
|
}
|
|
@@ -3775,7 +3787,7 @@ class CryptographyClient {
|
|
|
3775
3787
|
}
|
|
3776
3788
|
encrypt(...args) {
|
|
3777
3789
|
const [parameters, options] = this.disambiguateEncryptArguments(args);
|
|
3778
|
-
return withTrace$
|
|
3790
|
+
return withTrace$1("encrypt", options, async (updatedOptions) => {
|
|
3779
3791
|
this.ensureValid(await this.fetchKey(updatedOptions), exports.KnownKeyOperations.Encrypt);
|
|
3780
3792
|
this.initializeIV(parameters);
|
|
3781
3793
|
const provider = await this.getProvider("encrypt", parameters.algorithm, updatedOptions);
|
|
@@ -3798,7 +3810,7 @@ class CryptographyClient {
|
|
|
3798
3810
|
"A192CBC",
|
|
3799
3811
|
"A192CBCPAD",
|
|
3800
3812
|
"A256CBC",
|
|
3801
|
-
"A256CBCPAD"
|
|
3813
|
+
"A256CBCPAD",
|
|
3802
3814
|
];
|
|
3803
3815
|
if (parameters.algorithm in algorithmsRequiringIV) {
|
|
3804
3816
|
try {
|
|
@@ -3822,9 +3834,9 @@ class CryptographyClient {
|
|
|
3822
3834
|
return [
|
|
3823
3835
|
{
|
|
3824
3836
|
algorithm: args[0],
|
|
3825
|
-
plaintext: args[1]
|
|
3837
|
+
plaintext: args[1],
|
|
3826
3838
|
},
|
|
3827
|
-
args[2] || {}
|
|
3839
|
+
args[2] || {},
|
|
3828
3840
|
];
|
|
3829
3841
|
}
|
|
3830
3842
|
else {
|
|
@@ -3834,7 +3846,7 @@ class CryptographyClient {
|
|
|
3834
3846
|
}
|
|
3835
3847
|
decrypt(...args) {
|
|
3836
3848
|
const [parameters, options] = this.disambiguateDecryptArguments(args);
|
|
3837
|
-
return withTrace$
|
|
3849
|
+
return withTrace$1("decrypt", options, async (updatedOptions) => {
|
|
3838
3850
|
this.ensureValid(await this.fetchKey(updatedOptions), exports.KnownKeyOperations.Decrypt);
|
|
3839
3851
|
const provider = await this.getProvider("decrypt", parameters.algorithm, updatedOptions);
|
|
3840
3852
|
try {
|
|
@@ -3858,9 +3870,9 @@ class CryptographyClient {
|
|
|
3858
3870
|
return [
|
|
3859
3871
|
{
|
|
3860
3872
|
algorithm: args[0],
|
|
3861
|
-
ciphertext: args[1]
|
|
3873
|
+
ciphertext: args[1],
|
|
3862
3874
|
},
|
|
3863
|
-
args[2] || {}
|
|
3875
|
+
args[2] || {},
|
|
3864
3876
|
];
|
|
3865
3877
|
}
|
|
3866
3878
|
else {
|
|
@@ -3881,7 +3893,7 @@ class CryptographyClient {
|
|
|
3881
3893
|
* @param options - Additional options.
|
|
3882
3894
|
*/
|
|
3883
3895
|
wrapKey(algorithm, key, options = {}) {
|
|
3884
|
-
return withTrace$
|
|
3896
|
+
return withTrace$1("wrapKey", options, async (updatedOptions) => {
|
|
3885
3897
|
this.ensureValid(await this.fetchKey(updatedOptions), exports.KnownKeyOperations.WrapKey);
|
|
3886
3898
|
const provider = await this.getProvider("wrapKey", algorithm, updatedOptions);
|
|
3887
3899
|
try {
|
|
@@ -3908,7 +3920,7 @@ class CryptographyClient {
|
|
|
3908
3920
|
* @param options - Additional options.
|
|
3909
3921
|
*/
|
|
3910
3922
|
unwrapKey(algorithm, encryptedKey, options = {}) {
|
|
3911
|
-
return withTrace$
|
|
3923
|
+
return withTrace$1("unwrapKey", options, async (updatedOptions) => {
|
|
3912
3924
|
this.ensureValid(await this.fetchKey(updatedOptions), exports.KnownKeyOperations.UnwrapKey);
|
|
3913
3925
|
const provider = await this.getProvider("unwrapKey", algorithm, updatedOptions);
|
|
3914
3926
|
try {
|
|
@@ -3935,7 +3947,7 @@ class CryptographyClient {
|
|
|
3935
3947
|
* @param options - Additional options.
|
|
3936
3948
|
*/
|
|
3937
3949
|
sign(algorithm, digest, options = {}) {
|
|
3938
|
-
return withTrace$
|
|
3950
|
+
return withTrace$1("sign", options, async (updatedOptions) => {
|
|
3939
3951
|
this.ensureValid(await this.fetchKey(updatedOptions), exports.KnownKeyOperations.Sign);
|
|
3940
3952
|
const provider = await this.getProvider("sign", algorithm, updatedOptions);
|
|
3941
3953
|
try {
|
|
@@ -3963,7 +3975,7 @@ class CryptographyClient {
|
|
|
3963
3975
|
* @param options - Additional options.
|
|
3964
3976
|
*/
|
|
3965
3977
|
verify(algorithm, digest, signature, options = {}) {
|
|
3966
|
-
return withTrace$
|
|
3978
|
+
return withTrace$1("verify", options, async (updatedOptions) => {
|
|
3967
3979
|
this.ensureValid(await this.fetchKey(updatedOptions), exports.KnownKeyOperations.Verify);
|
|
3968
3980
|
const provider = await this.getProvider("verify", algorithm, updatedOptions);
|
|
3969
3981
|
try {
|
|
@@ -3990,7 +4002,7 @@ class CryptographyClient {
|
|
|
3990
4002
|
* @param options - Additional options.
|
|
3991
4003
|
*/
|
|
3992
4004
|
signData(algorithm, data, options = {}) {
|
|
3993
|
-
return withTrace$
|
|
4005
|
+
return withTrace$1("signData", options, async (updatedOptions) => {
|
|
3994
4006
|
this.ensureValid(await this.fetchKey(updatedOptions), exports.KnownKeyOperations.Sign);
|
|
3995
4007
|
const provider = await this.getProvider("signData", algorithm, updatedOptions);
|
|
3996
4008
|
try {
|
|
@@ -4018,7 +4030,7 @@ class CryptographyClient {
|
|
|
4018
4030
|
* @param options - Additional options.
|
|
4019
4031
|
*/
|
|
4020
4032
|
verifyData(algorithm, data, signature, options = {}) {
|
|
4021
|
-
return withTrace$
|
|
4033
|
+
return withTrace$1("verifyData", options, async (updatedOptions) => {
|
|
4022
4034
|
this.ensureValid(await this.fetchKey(updatedOptions), exports.KnownKeyOperations.Verify);
|
|
4023
4035
|
const provider = await this.getProvider("verifyData", algorithm, updatedOptions);
|
|
4024
4036
|
try {
|
|
@@ -4033,7 +4045,6 @@ class CryptographyClient {
|
|
|
4033
4045
|
});
|
|
4034
4046
|
}
|
|
4035
4047
|
/**
|
|
4036
|
-
* @internal
|
|
4037
4048
|
* Retrieves the {@link JsonWebKey} from the Key Vault.
|
|
4038
4049
|
*
|
|
4039
4050
|
* Example usage:
|
|
@@ -4079,7 +4090,7 @@ class CryptographyClient {
|
|
|
4079
4090
|
// Add local crypto providers as needed
|
|
4080
4091
|
this.providers = [
|
|
4081
4092
|
new RsaCryptographyProvider(keyMaterial),
|
|
4082
|
-
new AesCryptographyProvider(keyMaterial)
|
|
4093
|
+
new AesCryptographyProvider(keyMaterial),
|
|
4083
4094
|
];
|
|
4084
4095
|
// If the remote provider exists, we're in hybrid-mode. Otherwise we're in local-only mode.
|
|
4085
4096
|
// If we're in hybrid mode the remote provider is used as a catch-all and should be last in the list.
|
|
@@ -4122,7 +4133,43 @@ class CryptographyClient {
|
|
|
4122
4133
|
}
|
|
4123
4134
|
|
|
4124
4135
|
// Copyright (c) Microsoft Corporation.
|
|
4125
|
-
|
|
4136
|
+
/** Known values of {@link EncryptionAlgorithm} that the service accepts. */
|
|
4137
|
+
exports.KnownEncryptionAlgorithms = void 0;
|
|
4138
|
+
(function (KnownEncryptionAlgorithms) {
|
|
4139
|
+
/** Encryption Algorithm - RSA-OAEP */
|
|
4140
|
+
KnownEncryptionAlgorithms["RSAOaep"] = "RSA-OAEP";
|
|
4141
|
+
/** Encryption Algorithm - RSA-OAEP-256 */
|
|
4142
|
+
KnownEncryptionAlgorithms["RSAOaep256"] = "RSA-OAEP-256";
|
|
4143
|
+
/** Encryption Algorithm - RSA1_5 */
|
|
4144
|
+
KnownEncryptionAlgorithms["RSA15"] = "RSA1_5";
|
|
4145
|
+
/** Encryption Algorithm - A128GCM */
|
|
4146
|
+
KnownEncryptionAlgorithms["A128GCM"] = "A128GCM";
|
|
4147
|
+
/** Encryption Algorithm - A192GCM */
|
|
4148
|
+
KnownEncryptionAlgorithms["A192GCM"] = "A192GCM";
|
|
4149
|
+
/** Encryption Algorithm - A256GCM */
|
|
4150
|
+
KnownEncryptionAlgorithms["A256GCM"] = "A256GCM";
|
|
4151
|
+
/** Encryption Algorithm - A128KW */
|
|
4152
|
+
KnownEncryptionAlgorithms["A128KW"] = "A128KW";
|
|
4153
|
+
/** Encryption Algorithm - A192KW */
|
|
4154
|
+
KnownEncryptionAlgorithms["A192KW"] = "A192KW";
|
|
4155
|
+
/** Encryption Algorithm - A256KW */
|
|
4156
|
+
KnownEncryptionAlgorithms["A256KW"] = "A256KW";
|
|
4157
|
+
/** Encryption Algorithm - A128CBC */
|
|
4158
|
+
KnownEncryptionAlgorithms["A128CBC"] = "A128CBC";
|
|
4159
|
+
/** Encryption Algorithm - A192CBC */
|
|
4160
|
+
KnownEncryptionAlgorithms["A192CBC"] = "A192CBC";
|
|
4161
|
+
/** Encryption Algorithm - A256CBC */
|
|
4162
|
+
KnownEncryptionAlgorithms["A256CBC"] = "A256CBC";
|
|
4163
|
+
/** Encryption Algorithm - A128CBCPAD */
|
|
4164
|
+
KnownEncryptionAlgorithms["A128Cbcpad"] = "A128CBCPAD";
|
|
4165
|
+
/** Encryption Algorithm - A192CBCPAD */
|
|
4166
|
+
KnownEncryptionAlgorithms["A192Cbcpad"] = "A192CBCPAD";
|
|
4167
|
+
/** Encryption Algorithm - A256CBCPAD */
|
|
4168
|
+
KnownEncryptionAlgorithms["A256Cbcpad"] = "A256CBCPAD";
|
|
4169
|
+
})(exports.KnownEncryptionAlgorithms || (exports.KnownEncryptionAlgorithms = {}));
|
|
4170
|
+
|
|
4171
|
+
// Copyright (c) Microsoft Corporation.
|
|
4172
|
+
const withTrace = createTraceFunction("Azure.KeyVault.Keys.KeyClient");
|
|
4126
4173
|
/**
|
|
4127
4174
|
* The KeyClient provides methods to manage {@link KeyVaultKey} in the
|
|
4128
4175
|
* Azure Key Vault. The client supports creating, retrieving, updating,
|
|
@@ -4155,7 +4202,7 @@ class KeyClient {
|
|
|
4155
4202
|
pipelineOptions.userAgentOptions = {
|
|
4156
4203
|
userAgentPrefix: userAgentOptions && userAgentOptions.userAgentPrefix
|
|
4157
4204
|
? `${userAgentOptions.userAgentPrefix} ${libInfo}`
|
|
4158
|
-
: libInfo
|
|
4205
|
+
: libInfo,
|
|
4159
4206
|
};
|
|
4160
4207
|
const authPolicy = coreHttp.isTokenCredential(credential)
|
|
4161
4208
|
? challengeBasedAuthenticationPolicy(credential)
|
|
@@ -4165,8 +4212,8 @@ class KeyClient {
|
|
|
4165
4212
|
allowedHeaderNames: [
|
|
4166
4213
|
"x-ms-keyvault-region",
|
|
4167
4214
|
"x-ms-keyvault-network-info",
|
|
4168
|
-
"x-ms-keyvault-service-version"
|
|
4169
|
-
]
|
|
4215
|
+
"x-ms-keyvault-service-version",
|
|
4216
|
+
],
|
|
4170
4217
|
} });
|
|
4171
4218
|
this.credential = credential;
|
|
4172
4219
|
this.client = new KeyVaultClient(pipelineOptions.serviceVersion || LATEST_API_VERSION, coreHttp.createPipelineFromOptions(internalPipelineOptions, authPolicy));
|
|
@@ -4195,10 +4242,10 @@ class KeyClient {
|
|
|
4195
4242
|
enabled,
|
|
4196
4243
|
notBefore,
|
|
4197
4244
|
expires,
|
|
4198
|
-
exportable
|
|
4245
|
+
exportable,
|
|
4199
4246
|
} });
|
|
4200
4247
|
}
|
|
4201
|
-
return withTrace
|
|
4248
|
+
return withTrace("createKey", unflattenedOptions, async (updatedOptions) => {
|
|
4202
4249
|
const response = await this.client.createKey(this.vaultUrl, name, keyType, updatedOptions);
|
|
4203
4250
|
return getKeyFromKeyBundle(response);
|
|
4204
4251
|
});
|
|
@@ -4283,10 +4330,10 @@ class KeyClient {
|
|
|
4283
4330
|
notBefore,
|
|
4284
4331
|
expires,
|
|
4285
4332
|
hsm,
|
|
4286
|
-
exportable
|
|
4333
|
+
exportable,
|
|
4287
4334
|
} });
|
|
4288
4335
|
}
|
|
4289
|
-
return withTrace
|
|
4336
|
+
return withTrace(`importKey`, unflattenedOptions, async (updatedOptions) => {
|
|
4290
4337
|
const response = await this.client.importKey(this.vaultUrl, name, key, updatedOptions);
|
|
4291
4338
|
return getKeyFromKeyBundle(response);
|
|
4292
4339
|
});
|
|
@@ -4311,7 +4358,7 @@ class KeyClient {
|
|
|
4311
4358
|
// In order to avoid publicly exposing the pipeline we will pass in the underlying client as an undocumented
|
|
4312
4359
|
// property to the constructor so that crypto providers downstream can use it.
|
|
4313
4360
|
const constructorOptions = {
|
|
4314
|
-
generatedClient: this.client
|
|
4361
|
+
generatedClient: this.client,
|
|
4315
4362
|
};
|
|
4316
4363
|
const cryptoClient = new CryptographyClient(keyUrl.toString(), this.credential, constructorOptions);
|
|
4317
4364
|
return cryptoClient;
|
|
@@ -4350,7 +4397,7 @@ class KeyClient {
|
|
|
4350
4397
|
client: this.client,
|
|
4351
4398
|
intervalInMs: options.intervalInMs,
|
|
4352
4399
|
resumeFrom: options.resumeFrom,
|
|
4353
|
-
operationOptions: options
|
|
4400
|
+
operationOptions: options,
|
|
4354
4401
|
});
|
|
4355
4402
|
// This will initialize the poller's operation (the deletion of the key).
|
|
4356
4403
|
await poller.poll();
|
|
@@ -4358,12 +4405,12 @@ class KeyClient {
|
|
|
4358
4405
|
}
|
|
4359
4406
|
updateKeyProperties(...args) {
|
|
4360
4407
|
const [name, keyVersion, options] = this.disambiguateUpdateKeyPropertiesArgs(args);
|
|
4361
|
-
return withTrace
|
|
4408
|
+
return withTrace(`updateKeyProperties`, options, async (updatedOptions) => {
|
|
4362
4409
|
const { enabled, notBefore, expiresOn: expires } = updatedOptions, remainingOptions = tslib.__rest(updatedOptions, ["enabled", "notBefore", "expiresOn"]);
|
|
4363
4410
|
const unflattenedOptions = Object.assign(Object.assign({}, remainingOptions), { keyAttributes: {
|
|
4364
4411
|
enabled,
|
|
4365
4412
|
notBefore,
|
|
4366
|
-
expires
|
|
4413
|
+
expires,
|
|
4367
4414
|
} });
|
|
4368
4415
|
const response = await this.client.updateKey(this.vaultUrl, name, keyVersion, unflattenedOptions);
|
|
4369
4416
|
return getKeyFromKeyBundle(response);
|
|
@@ -4374,7 +4421,6 @@ class KeyClient {
|
|
|
4374
4421
|
*
|
|
4375
4422
|
* @param args - The arguments collection.
|
|
4376
4423
|
* @returns - The standardized arguments collection.
|
|
4377
|
-
* @internal
|
|
4378
4424
|
*/
|
|
4379
4425
|
disambiguateUpdateKeyPropertiesArgs(args) {
|
|
4380
4426
|
if (typeof args[1] === "string") {
|
|
@@ -4400,7 +4446,7 @@ class KeyClient {
|
|
|
4400
4446
|
* @param options - The optional parameters.
|
|
4401
4447
|
*/
|
|
4402
4448
|
getKey(name, options = {}) {
|
|
4403
|
-
return withTrace
|
|
4449
|
+
return withTrace(`getKey`, options, async (updatedOptions) => {
|
|
4404
4450
|
const response = await this.client.getKey(this.vaultUrl, name, options && options.version ? options.version : "", updatedOptions);
|
|
4405
4451
|
return getKeyFromKeyBundle(response);
|
|
4406
4452
|
});
|
|
@@ -4419,7 +4465,7 @@ class KeyClient {
|
|
|
4419
4465
|
* @param options - The optional parameters.
|
|
4420
4466
|
*/
|
|
4421
4467
|
getDeletedKey(name, options = {}) {
|
|
4422
|
-
return withTrace
|
|
4468
|
+
return withTrace(`getDeletedKey`, options, async (updatedOptions) => {
|
|
4423
4469
|
const response = await this.client.getDeletedKey(this.vaultUrl, name, updatedOptions);
|
|
4424
4470
|
return getKeyFromKeyBundle(response);
|
|
4425
4471
|
});
|
|
@@ -4441,7 +4487,7 @@ class KeyClient {
|
|
|
4441
4487
|
* @param options - The optional parameters.
|
|
4442
4488
|
*/
|
|
4443
4489
|
purgeDeletedKey(name, options = {}) {
|
|
4444
|
-
return withTrace
|
|
4490
|
+
return withTrace(`purgeDeletedKey`, options, async (updatedOptions) => {
|
|
4445
4491
|
await this.client.purgeDeletedKey(this.vaultUrl, name, updatedOptions);
|
|
4446
4492
|
});
|
|
4447
4493
|
}
|
|
@@ -4481,7 +4527,7 @@ class KeyClient {
|
|
|
4481
4527
|
client: this.client,
|
|
4482
4528
|
intervalInMs: options.intervalInMs,
|
|
4483
4529
|
resumeFrom: options.resumeFrom,
|
|
4484
|
-
operationOptions: options
|
|
4530
|
+
operationOptions: options,
|
|
4485
4531
|
});
|
|
4486
4532
|
// This will initialize the poller's operation (the deletion of the key).
|
|
4487
4533
|
await poller.poll();
|
|
@@ -4501,7 +4547,7 @@ class KeyClient {
|
|
|
4501
4547
|
* @param options - The optional parameters.
|
|
4502
4548
|
*/
|
|
4503
4549
|
backupKey(name, options = {}) {
|
|
4504
|
-
return withTrace
|
|
4550
|
+
return withTrace(`backupKey`, options, async (updatedOptions) => {
|
|
4505
4551
|
const response = await this.client.backupKey(this.vaultUrl, name, updatedOptions);
|
|
4506
4552
|
return response.value;
|
|
4507
4553
|
});
|
|
@@ -4522,13 +4568,14 @@ class KeyClient {
|
|
|
4522
4568
|
* @param options - The optional parameters.
|
|
4523
4569
|
*/
|
|
4524
4570
|
async restoreKeyBackup(backup, options = {}) {
|
|
4525
|
-
return withTrace
|
|
4571
|
+
return withTrace(`restoreKeyBackup`, options, async (updatedOptions) => {
|
|
4526
4572
|
const response = await this.client.restoreKey(this.vaultUrl, backup, updatedOptions);
|
|
4527
4573
|
return getKeyFromKeyBundle(response);
|
|
4528
4574
|
});
|
|
4529
4575
|
}
|
|
4530
4576
|
/**
|
|
4531
4577
|
* Gets the requested number of bytes containing random values from a managed HSM.
|
|
4578
|
+
* This operation requires the managedHsm/rng permission.
|
|
4532
4579
|
*
|
|
4533
4580
|
* Example usage:
|
|
4534
4581
|
* ```ts
|
|
@@ -4539,9 +4586,9 @@ class KeyClient {
|
|
|
4539
4586
|
* @param options - The optional parameters.
|
|
4540
4587
|
*/
|
|
4541
4588
|
getRandomBytes(count, options = {}) {
|
|
4542
|
-
return withTrace
|
|
4589
|
+
return withTrace("getRandomBytes", options, async (updatedOptions) => {
|
|
4543
4590
|
const response = await this.client.getRandomBytes(this.vaultUrl, count, updatedOptions);
|
|
4544
|
-
return
|
|
4591
|
+
return response.value;
|
|
4545
4592
|
});
|
|
4546
4593
|
}
|
|
4547
4594
|
/**
|
|
@@ -4557,7 +4604,7 @@ class KeyClient {
|
|
|
4557
4604
|
* @param options - The optional parameters.
|
|
4558
4605
|
*/
|
|
4559
4606
|
rotateKey(name, options = {}) {
|
|
4560
|
-
return withTrace
|
|
4607
|
+
return withTrace("rotateKey", options, async (updatedOptions) => {
|
|
4561
4608
|
const key = await this.client.rotateKey(this.vaultUrl, name, updatedOptions);
|
|
4562
4609
|
return getKeyFromKeyBundle(key);
|
|
4563
4610
|
});
|
|
@@ -4574,37 +4621,39 @@ class KeyClient {
|
|
|
4574
4621
|
* ```
|
|
4575
4622
|
*
|
|
4576
4623
|
* @param name - The name of the key.
|
|
4577
|
-
* @param
|
|
4624
|
+
* @param targetAttestationToken - The attestation assertion for the target of the key release.
|
|
4578
4625
|
* @param options - The optional parameters.
|
|
4579
4626
|
*/
|
|
4580
|
-
releaseKey(name,
|
|
4581
|
-
return withTrace
|
|
4627
|
+
releaseKey(name, targetAttestationToken, options = {}) {
|
|
4628
|
+
return withTrace("releaseKey", options, async (updatedOptions) => {
|
|
4582
4629
|
const { nonce, algorithm } = updatedOptions, rest = tslib.__rest(updatedOptions, ["nonce", "algorithm"]);
|
|
4583
|
-
const result = await this.client.release(this.vaultUrl, name, (options === null || options === void 0 ? void 0 : options.version) || "",
|
|
4630
|
+
const result = await this.client.release(this.vaultUrl, name, (options === null || options === void 0 ? void 0 : options.version) || "", targetAttestationToken, Object.assign({ enc: algorithm, nonce }, rest));
|
|
4584
4631
|
return { value: result.value };
|
|
4585
4632
|
});
|
|
4586
4633
|
}
|
|
4587
4634
|
/**
|
|
4588
4635
|
* Gets the rotation policy of a Key Vault Key.
|
|
4636
|
+
* By default, all keys have a policy that will notify 30 days before expiry.
|
|
4589
4637
|
*
|
|
4638
|
+
* This operation requires the keys/get permission.
|
|
4590
4639
|
* Example usage:
|
|
4591
4640
|
* ```ts
|
|
4592
4641
|
* let client = new KeyClient(vaultUrl, credentials);
|
|
4593
|
-
* await client.updateKeyRotationPolicy("MyKey", myPolicy);
|
|
4594
4642
|
* let result = await client.getKeyRotationPolicy("myKey");
|
|
4595
4643
|
* ```
|
|
4596
4644
|
*
|
|
4597
|
-
* @param
|
|
4645
|
+
* @param keyName - The name of the key.
|
|
4598
4646
|
* @param options - The optional parameters.
|
|
4599
4647
|
*/
|
|
4600
|
-
getKeyRotationPolicy(
|
|
4601
|
-
return withTrace
|
|
4602
|
-
const policy = await this.client.getKeyRotationPolicy(this.vaultUrl,
|
|
4648
|
+
getKeyRotationPolicy(keyName, options = {}) {
|
|
4649
|
+
return withTrace("getKeyRotationPolicy", options, async () => {
|
|
4650
|
+
const policy = await this.client.getKeyRotationPolicy(this.vaultUrl, keyName);
|
|
4603
4651
|
return keyRotationTransformations.generatedToPublic(policy);
|
|
4604
4652
|
});
|
|
4605
4653
|
}
|
|
4606
4654
|
/**
|
|
4607
4655
|
* Updates the rotation policy of a Key Vault Key.
|
|
4656
|
+
* This operation requires the keys/update permission.
|
|
4608
4657
|
*
|
|
4609
4658
|
* Example usage:
|
|
4610
4659
|
* ```ts
|
|
@@ -4612,19 +4661,17 @@ class KeyClient {
|
|
|
4612
4661
|
* const setPolicy = await client.updateKeyRotationPolicy("MyKey", myPolicy);
|
|
4613
4662
|
* ```
|
|
4614
4663
|
*
|
|
4615
|
-
* @param
|
|
4664
|
+
* @param keyName - The name of the key.
|
|
4616
4665
|
* @param policyProperties - The {@link KeyRotationPolicyProperties} for the policy.
|
|
4617
4666
|
* @param options - The optional parameters.
|
|
4618
4667
|
*/
|
|
4619
|
-
updateKeyRotationPolicy(
|
|
4620
|
-
return withTrace
|
|
4621
|
-
const result = await this.client.updateKeyRotationPolicy(this.vaultUrl,
|
|
4668
|
+
updateKeyRotationPolicy(keyName, policy, options = {}) {
|
|
4669
|
+
return withTrace("updateKeyRotationPolicy", options, async (updatedOptions) => {
|
|
4670
|
+
const result = await this.client.updateKeyRotationPolicy(this.vaultUrl, keyName, keyRotationTransformations.propertiesToGenerated(policy), updatedOptions);
|
|
4622
4671
|
return keyRotationTransformations.generatedToPublic(result);
|
|
4623
4672
|
});
|
|
4624
4673
|
}
|
|
4625
4674
|
/**
|
|
4626
|
-
* @internal
|
|
4627
|
-
* @hidden
|
|
4628
4675
|
* Deals with the pagination of {@link listPropertiesOfKeyVersions}.
|
|
4629
4676
|
* @param name - The name of the Key Vault Key.
|
|
4630
4677
|
* @param continuationState - An object that indicates the position of the paginated request.
|
|
@@ -4634,14 +4681,14 @@ class KeyClient {
|
|
|
4634
4681
|
return tslib.__asyncGenerator(this, arguments, function* listPropertiesOfKeyVersionsPage_1() {
|
|
4635
4682
|
if (continuationState.continuationToken == null) {
|
|
4636
4683
|
const optionsComplete = Object.assign({ maxresults: continuationState.maxPageSize }, options);
|
|
4637
|
-
const currentSetResponse = yield tslib.__await(withTrace
|
|
4684
|
+
const currentSetResponse = yield tslib.__await(withTrace("listPropertiesOfKeyVersionsPage", optionsComplete, async (updatedOptions) => this.client.getKeyVersions(this.vaultUrl, name, updatedOptions)));
|
|
4638
4685
|
continuationState.continuationToken = currentSetResponse.nextLink;
|
|
4639
4686
|
if (currentSetResponse.value) {
|
|
4640
4687
|
yield yield tslib.__await(currentSetResponse.value.map(getKeyPropertiesFromKeyItem, this));
|
|
4641
4688
|
}
|
|
4642
4689
|
}
|
|
4643
4690
|
while (continuationState.continuationToken) {
|
|
4644
|
-
const currentSetResponse = yield tslib.__await(withTrace
|
|
4691
|
+
const currentSetResponse = yield tslib.__await(withTrace("listPropertiesOfKeyVersionsPage", options || {}, async (updatedOptions) => this.client.getKeyVersions(continuationState.continuationToken, name, updatedOptions)));
|
|
4645
4692
|
continuationState.continuationToken = currentSetResponse.nextLink;
|
|
4646
4693
|
if (currentSetResponse.value) {
|
|
4647
4694
|
yield yield tslib.__await(currentSetResponse.value.map(getKeyPropertiesFromKeyItem, this));
|
|
@@ -4653,8 +4700,6 @@ class KeyClient {
|
|
|
4653
4700
|
});
|
|
4654
4701
|
}
|
|
4655
4702
|
/**
|
|
4656
|
-
* @internal
|
|
4657
|
-
* @hidden
|
|
4658
4703
|
* Deals with the iteration of all the available results of {@link listPropertiesOfKeyVersions}.
|
|
4659
4704
|
* @param name - The name of the Key Vault Key.
|
|
4660
4705
|
* @param options - Common options for the iterative endpoints.
|
|
@@ -4704,12 +4749,10 @@ class KeyClient {
|
|
|
4704
4749
|
[Symbol.asyncIterator]() {
|
|
4705
4750
|
return this;
|
|
4706
4751
|
},
|
|
4707
|
-
byPage: (settings = {}) => this.listPropertiesOfKeyVersionsPage(name, settings, options)
|
|
4752
|
+
byPage: (settings = {}) => this.listPropertiesOfKeyVersionsPage(name, settings, options),
|
|
4708
4753
|
};
|
|
4709
4754
|
}
|
|
4710
4755
|
/**
|
|
4711
|
-
* @internal
|
|
4712
|
-
* @hidden
|
|
4713
4756
|
* Deals with the pagination of {@link listPropertiesOfKeys}.
|
|
4714
4757
|
* @param continuationState - An object that indicates the position of the paginated request.
|
|
4715
4758
|
* @param options - Common options for the iterative endpoints.
|
|
@@ -4718,14 +4761,14 @@ class KeyClient {
|
|
|
4718
4761
|
return tslib.__asyncGenerator(this, arguments, function* listPropertiesOfKeysPage_1() {
|
|
4719
4762
|
if (continuationState.continuationToken == null) {
|
|
4720
4763
|
const optionsComplete = Object.assign({ maxresults: continuationState.maxPageSize }, options);
|
|
4721
|
-
const currentSetResponse = yield tslib.__await(withTrace
|
|
4764
|
+
const currentSetResponse = yield tslib.__await(withTrace("listPropertiesOfKeysPage", optionsComplete, async (updatedOptions) => this.client.getKeys(this.vaultUrl, updatedOptions)));
|
|
4722
4765
|
continuationState.continuationToken = currentSetResponse.nextLink;
|
|
4723
4766
|
if (currentSetResponse.value) {
|
|
4724
4767
|
yield yield tslib.__await(currentSetResponse.value.map(getKeyPropertiesFromKeyItem, this));
|
|
4725
4768
|
}
|
|
4726
4769
|
}
|
|
4727
4770
|
while (continuationState.continuationToken) {
|
|
4728
|
-
const currentSetResponse = yield tslib.__await(withTrace
|
|
4771
|
+
const currentSetResponse = yield tslib.__await(withTrace("KeysClient.listPropertiesOfKeysPage", options || {}, async (updatedOptions) => this.client.getKeys(continuationState.continuationToken, updatedOptions)));
|
|
4729
4772
|
continuationState.continuationToken = currentSetResponse.nextLink;
|
|
4730
4773
|
if (currentSetResponse.value) {
|
|
4731
4774
|
yield yield tslib.__await(currentSetResponse.value.map(getKeyPropertiesFromKeyItem, this));
|
|
@@ -4737,8 +4780,6 @@ class KeyClient {
|
|
|
4737
4780
|
});
|
|
4738
4781
|
}
|
|
4739
4782
|
/**
|
|
4740
|
-
* @internal
|
|
4741
|
-
* @hidden
|
|
4742
4783
|
* Deals with the iteration of all the available results of {@link listPropertiesOfKeys}.
|
|
4743
4784
|
* @param options - Common options for the iterative endpoints.
|
|
4744
4785
|
*/
|
|
@@ -4787,12 +4828,10 @@ class KeyClient {
|
|
|
4787
4828
|
[Symbol.asyncIterator]() {
|
|
4788
4829
|
return this;
|
|
4789
4830
|
},
|
|
4790
|
-
byPage: (settings = {}) => this.listPropertiesOfKeysPage(settings, options)
|
|
4831
|
+
byPage: (settings = {}) => this.listPropertiesOfKeysPage(settings, options),
|
|
4791
4832
|
};
|
|
4792
4833
|
}
|
|
4793
4834
|
/**
|
|
4794
|
-
* @internal
|
|
4795
|
-
* @hidden
|
|
4796
4835
|
* Deals with the pagination of {@link listDeletedKeys}.
|
|
4797
4836
|
* @param continuationState - An object that indicates the position of the paginated request.
|
|
4798
4837
|
* @param options - Common options for the iterative endpoints.
|
|
@@ -4801,14 +4840,14 @@ class KeyClient {
|
|
|
4801
4840
|
return tslib.__asyncGenerator(this, arguments, function* listDeletedKeysPage_1() {
|
|
4802
4841
|
if (continuationState.continuationToken == null) {
|
|
4803
4842
|
const optionsComplete = Object.assign({ maxresults: continuationState.maxPageSize }, options);
|
|
4804
|
-
const currentSetResponse = yield tslib.__await(withTrace
|
|
4843
|
+
const currentSetResponse = yield tslib.__await(withTrace("listDeletedKeysPage", optionsComplete, async (updatedOptions) => this.client.getDeletedKeys(this.vaultUrl, updatedOptions)));
|
|
4805
4844
|
continuationState.continuationToken = currentSetResponse.nextLink;
|
|
4806
4845
|
if (currentSetResponse.value) {
|
|
4807
4846
|
yield yield tslib.__await(currentSetResponse.value.map(getDeletedKeyFromDeletedKeyItem, this));
|
|
4808
4847
|
}
|
|
4809
4848
|
}
|
|
4810
4849
|
while (continuationState.continuationToken) {
|
|
4811
|
-
const currentSetResponse = yield tslib.__await(withTrace
|
|
4850
|
+
const currentSetResponse = yield tslib.__await(withTrace("listDeletedKeysPage", options || {}, async (updatedOptions) => this.client.getDeletedKeys(continuationState.continuationToken, updatedOptions)));
|
|
4812
4851
|
continuationState.continuationToken = currentSetResponse.nextLink;
|
|
4813
4852
|
if (currentSetResponse.value) {
|
|
4814
4853
|
yield yield tslib.__await(currentSetResponse.value.map(getDeletedKeyFromDeletedKeyItem, this));
|
|
@@ -4820,8 +4859,6 @@ class KeyClient {
|
|
|
4820
4859
|
});
|
|
4821
4860
|
}
|
|
4822
4861
|
/**
|
|
4823
|
-
* @internal
|
|
4824
|
-
* @hidden
|
|
4825
4862
|
* Deals with the iteration of all the available results of {@link listDeletedKeys}.
|
|
4826
4863
|
* @param options - Common options for the iterative endpoints.
|
|
4827
4864
|
*/
|
|
@@ -4869,7 +4906,7 @@ class KeyClient {
|
|
|
4869
4906
|
[Symbol.asyncIterator]() {
|
|
4870
4907
|
return this;
|
|
4871
4908
|
},
|
|
4872
|
-
byPage: (settings = {}) => this.listDeletedKeysPage(settings, options)
|
|
4909
|
+
byPage: (settings = {}) => this.listDeletedKeysPage(settings, options),
|
|
4873
4910
|
};
|
|
4874
4911
|
}
|
|
4875
4912
|
}
|