@aws-sdk/client-kms 3.67.0 → 3.74.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.
Files changed (64) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +4 -1
  3. package/dist-cjs/KMS.js +30 -0
  4. package/dist-cjs/commands/GenerateMacCommand.js +36 -0
  5. package/dist-cjs/commands/VerifyMacCommand.js +36 -0
  6. package/dist-cjs/commands/index.js +2 -0
  7. package/dist-cjs/models/models_0.js +60 -3
  8. package/dist-cjs/protocols/Aws_json1_1.js +194 -2
  9. package/dist-es/KMS.js +30 -0
  10. package/dist-es/commands/GenerateMacCommand.js +39 -0
  11. package/dist-es/commands/VerifyMacCommand.js +39 -0
  12. package/dist-es/commands/index.js +2 -0
  13. package/dist-es/models/models_0.js +46 -0
  14. package/dist-es/protocols/Aws_json1_1.js +225 -1
  15. package/dist-types/KMS.d.ts +256 -219
  16. package/dist-types/KMSClient.d.ts +8 -3
  17. package/dist-types/commands/CancelKeyDeletionCommand.d.ts +1 -1
  18. package/dist-types/commands/CreateAliasCommand.d.ts +2 -2
  19. package/dist-types/commands/CreateGrantCommand.d.ts +2 -2
  20. package/dist-types/commands/CreateKeyCommand.d.ts +44 -40
  21. package/dist-types/commands/DecryptCommand.d.ts +7 -7
  22. package/dist-types/commands/DeleteAliasCommand.d.ts +1 -1
  23. package/dist-types/commands/DeleteImportedKeyMaterialCommand.d.ts +1 -1
  24. package/dist-types/commands/DescribeKeyCommand.d.ts +6 -8
  25. package/dist-types/commands/DisableKeyCommand.d.ts +2 -3
  26. package/dist-types/commands/DisableKeyRotationCommand.d.ts +3 -3
  27. package/dist-types/commands/EnableKeyCommand.d.ts +1 -1
  28. package/dist-types/commands/EnableKeyRotationCommand.d.ts +3 -3
  29. package/dist-types/commands/EncryptCommand.d.ts +8 -26
  30. package/dist-types/commands/GenerateDataKeyCommand.d.ts +13 -15
  31. package/dist-types/commands/GenerateDataKeyPairCommand.d.ts +12 -11
  32. package/dist-types/commands/GenerateDataKeyPairWithoutPlaintextCommand.d.ts +10 -11
  33. package/dist-types/commands/GenerateDataKeyWithoutPlaintextCommand.d.ts +21 -24
  34. package/dist-types/commands/GenerateMacCommand.d.ts +55 -0
  35. package/dist-types/commands/GetKeyRotationStatusCommand.d.ts +2 -2
  36. package/dist-types/commands/GetParametersForImportCommand.d.ts +7 -7
  37. package/dist-types/commands/GetPublicKeyCommand.d.ts +2 -2
  38. package/dist-types/commands/ImportKeyMaterialCommand.d.ts +8 -8
  39. package/dist-types/commands/ListGrantsCommand.d.ts +1 -1
  40. package/dist-types/commands/ListRetirableGrantsCommand.d.ts +1 -1
  41. package/dist-types/commands/ReEncryptCommand.d.ts +8 -9
  42. package/dist-types/commands/ReplicateKeyCommand.d.ts +8 -4
  43. package/dist-types/commands/RetireGrantCommand.d.ts +4 -5
  44. package/dist-types/commands/RevokeGrantCommand.d.ts +1 -1
  45. package/dist-types/commands/ScheduleKeyDeletionCommand.d.ts +1 -1
  46. package/dist-types/commands/SignCommand.d.ts +3 -3
  47. package/dist-types/commands/TagResourceCommand.d.ts +2 -2
  48. package/dist-types/commands/UntagResourceCommand.d.ts +2 -2
  49. package/dist-types/commands/UpdateAliasCommand.d.ts +2 -2
  50. package/dist-types/commands/UpdateKeyDescriptionCommand.d.ts +1 -1
  51. package/dist-types/commands/UpdatePrimaryRegionCommand.d.ts +2 -3
  52. package/dist-types/commands/VerifyCommand.d.ts +2 -2
  53. package/dist-types/commands/VerifyMacCommand.d.ts +56 -0
  54. package/dist-types/commands/index.d.ts +2 -0
  55. package/dist-types/models/models_0.d.ts +323 -114
  56. package/dist-types/protocols/Aws_json1_1.d.ts +6 -0
  57. package/dist-types/ts3.4/KMS.d.ts +10 -0
  58. package/dist-types/ts3.4/KMSClient.d.ts +4 -2
  59. package/dist-types/ts3.4/commands/GenerateMacCommand.d.ts +17 -0
  60. package/dist-types/ts3.4/commands/VerifyMacCommand.d.ts +17 -0
  61. package/dist-types/ts3.4/commands/index.d.ts +2 -0
  62. package/dist-types/ts3.4/models/models_0.d.ts +81 -1
  63. package/dist-types/ts3.4/protocols/Aws_json1_1.d.ts +6 -0
  64. package/package.json +7 -7
package/dist-es/KMS.js CHANGED
@@ -21,6 +21,7 @@ import { GenerateDataKeyCommand, } from "./commands/GenerateDataKeyCommand";
21
21
  import { GenerateDataKeyPairCommand, } from "./commands/GenerateDataKeyPairCommand";
22
22
  import { GenerateDataKeyPairWithoutPlaintextCommand, } from "./commands/GenerateDataKeyPairWithoutPlaintextCommand";
23
23
  import { GenerateDataKeyWithoutPlaintextCommand, } from "./commands/GenerateDataKeyWithoutPlaintextCommand";
24
+ import { GenerateMacCommand } from "./commands/GenerateMacCommand";
24
25
  import { GenerateRandomCommand, } from "./commands/GenerateRandomCommand";
25
26
  import { GetKeyPolicyCommand, } from "./commands/GetKeyPolicyCommand";
26
27
  import { GetKeyRotationStatusCommand, } from "./commands/GetKeyRotationStatusCommand";
@@ -47,6 +48,7 @@ import { UpdateCustomKeyStoreCommand, } from "./commands/UpdateCustomKeyStoreCom
47
48
  import { UpdateKeyDescriptionCommand, } from "./commands/UpdateKeyDescriptionCommand";
48
49
  import { UpdatePrimaryRegionCommand, } from "./commands/UpdatePrimaryRegionCommand";
49
50
  import { VerifyCommand } from "./commands/VerifyCommand";
51
+ import { VerifyMacCommand } from "./commands/VerifyMacCommand";
50
52
  import { KMSClient } from "./KMSClient";
51
53
  var KMS = (function (_super) {
52
54
  __extends(KMS, _super);
@@ -361,6 +363,20 @@ var KMS = (function (_super) {
361
363
  return this.send(command, optionsOrCb);
362
364
  }
363
365
  };
366
+ KMS.prototype.generateMac = function (args, optionsOrCb, cb) {
367
+ var command = new GenerateMacCommand(args);
368
+ if (typeof optionsOrCb === "function") {
369
+ this.send(command, optionsOrCb);
370
+ }
371
+ else if (typeof cb === "function") {
372
+ if (typeof optionsOrCb !== "object")
373
+ throw new Error("Expect http options but get ".concat(typeof optionsOrCb));
374
+ this.send(command, optionsOrCb || {}, cb);
375
+ }
376
+ else {
377
+ return this.send(command, optionsOrCb);
378
+ }
379
+ };
364
380
  KMS.prototype.generateRandom = function (args, optionsOrCb, cb) {
365
381
  var command = new GenerateRandomCommand(args);
366
382
  if (typeof optionsOrCb === "function") {
@@ -725,6 +741,20 @@ var KMS = (function (_super) {
725
741
  return this.send(command, optionsOrCb);
726
742
  }
727
743
  };
744
+ KMS.prototype.verifyMac = function (args, optionsOrCb, cb) {
745
+ var command = new VerifyMacCommand(args);
746
+ if (typeof optionsOrCb === "function") {
747
+ this.send(command, optionsOrCb);
748
+ }
749
+ else if (typeof cb === "function") {
750
+ if (typeof optionsOrCb !== "object")
751
+ throw new Error("Expect http options but get ".concat(typeof optionsOrCb));
752
+ this.send(command, optionsOrCb || {}, cb);
753
+ }
754
+ else {
755
+ return this.send(command, optionsOrCb);
756
+ }
757
+ };
728
758
  return KMS;
729
759
  }(KMSClient));
730
760
  export { KMS };
@@ -0,0 +1,39 @@
1
+ import { __extends } from "tslib";
2
+ import { getSerdePlugin } from "@aws-sdk/middleware-serde";
3
+ import { Command as $Command } from "@aws-sdk/smithy-client";
4
+ import { GenerateMacRequest, GenerateMacResponse } from "../models/models_0";
5
+ import { deserializeAws_json1_1GenerateMacCommand, serializeAws_json1_1GenerateMacCommand, } from "../protocols/Aws_json1_1";
6
+ var GenerateMacCommand = (function (_super) {
7
+ __extends(GenerateMacCommand, _super);
8
+ function GenerateMacCommand(input) {
9
+ var _this = _super.call(this) || this;
10
+ _this.input = input;
11
+ return _this;
12
+ }
13
+ GenerateMacCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
14
+ this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
15
+ var stack = clientStack.concat(this.middlewareStack);
16
+ var logger = configuration.logger;
17
+ var clientName = "KMSClient";
18
+ var commandName = "GenerateMacCommand";
19
+ var handlerExecutionContext = {
20
+ logger: logger,
21
+ clientName: clientName,
22
+ commandName: commandName,
23
+ inputFilterSensitiveLog: GenerateMacRequest.filterSensitiveLog,
24
+ outputFilterSensitiveLog: GenerateMacResponse.filterSensitiveLog,
25
+ };
26
+ var requestHandler = configuration.requestHandler;
27
+ return stack.resolve(function (request) {
28
+ return requestHandler.handle(request.request, options || {});
29
+ }, handlerExecutionContext);
30
+ };
31
+ GenerateMacCommand.prototype.serialize = function (input, context) {
32
+ return serializeAws_json1_1GenerateMacCommand(input, context);
33
+ };
34
+ GenerateMacCommand.prototype.deserialize = function (output, context) {
35
+ return deserializeAws_json1_1GenerateMacCommand(output, context);
36
+ };
37
+ return GenerateMacCommand;
38
+ }($Command));
39
+ export { GenerateMacCommand };
@@ -0,0 +1,39 @@
1
+ import { __extends } from "tslib";
2
+ import { getSerdePlugin } from "@aws-sdk/middleware-serde";
3
+ import { Command as $Command } from "@aws-sdk/smithy-client";
4
+ import { VerifyMacRequest, VerifyMacResponse } from "../models/models_0";
5
+ import { deserializeAws_json1_1VerifyMacCommand, serializeAws_json1_1VerifyMacCommand } from "../protocols/Aws_json1_1";
6
+ var VerifyMacCommand = (function (_super) {
7
+ __extends(VerifyMacCommand, _super);
8
+ function VerifyMacCommand(input) {
9
+ var _this = _super.call(this) || this;
10
+ _this.input = input;
11
+ return _this;
12
+ }
13
+ VerifyMacCommand.prototype.resolveMiddleware = function (clientStack, configuration, options) {
14
+ this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
15
+ var stack = clientStack.concat(this.middlewareStack);
16
+ var logger = configuration.logger;
17
+ var clientName = "KMSClient";
18
+ var commandName = "VerifyMacCommand";
19
+ var handlerExecutionContext = {
20
+ logger: logger,
21
+ clientName: clientName,
22
+ commandName: commandName,
23
+ inputFilterSensitiveLog: VerifyMacRequest.filterSensitiveLog,
24
+ outputFilterSensitiveLog: VerifyMacResponse.filterSensitiveLog,
25
+ };
26
+ var requestHandler = configuration.requestHandler;
27
+ return stack.resolve(function (request) {
28
+ return requestHandler.handle(request.request, options || {});
29
+ }, handlerExecutionContext);
30
+ };
31
+ VerifyMacCommand.prototype.serialize = function (input, context) {
32
+ return serializeAws_json1_1VerifyMacCommand(input, context);
33
+ };
34
+ VerifyMacCommand.prototype.deserialize = function (output, context) {
35
+ return deserializeAws_json1_1VerifyMacCommand(output, context);
36
+ };
37
+ return VerifyMacCommand;
38
+ }($Command));
39
+ export { VerifyMacCommand };
@@ -20,6 +20,7 @@ export * from "./GenerateDataKeyCommand";
20
20
  export * from "./GenerateDataKeyPairCommand";
21
21
  export * from "./GenerateDataKeyPairWithoutPlaintextCommand";
22
22
  export * from "./GenerateDataKeyWithoutPlaintextCommand";
23
+ export * from "./GenerateMacCommand";
23
24
  export * from "./GenerateRandomCommand";
24
25
  export * from "./GetKeyPolicyCommand";
25
26
  export * from "./GetKeyRotationStatusCommand";
@@ -46,3 +47,4 @@ export * from "./UpdateCustomKeyStoreCommand";
46
47
  export * from "./UpdateKeyDescriptionCommand";
47
48
  export * from "./UpdatePrimaryRegionCommand";
48
49
  export * from "./VerifyCommand";
50
+ export * from "./VerifyMacCommand";
@@ -277,12 +277,14 @@ export var GrantOperation;
277
277
  GrantOperation["GenerateDataKeyPair"] = "GenerateDataKeyPair";
278
278
  GrantOperation["GenerateDataKeyPairWithoutPlaintext"] = "GenerateDataKeyPairWithoutPlaintext";
279
279
  GrantOperation["GenerateDataKeyWithoutPlaintext"] = "GenerateDataKeyWithoutPlaintext";
280
+ GrantOperation["GenerateMac"] = "GenerateMac";
280
281
  GrantOperation["GetPublicKey"] = "GetPublicKey";
281
282
  GrantOperation["ReEncryptFrom"] = "ReEncryptFrom";
282
283
  GrantOperation["ReEncryptTo"] = "ReEncryptTo";
283
284
  GrantOperation["RetireGrant"] = "RetireGrant";
284
285
  GrantOperation["Sign"] = "Sign";
285
286
  GrantOperation["Verify"] = "Verify";
287
+ GrantOperation["VerifyMac"] = "VerifyMac";
286
288
  })(GrantOperation || (GrantOperation = {}));
287
289
  export var CreateGrantRequest;
288
290
  (function (CreateGrantRequest) {
@@ -322,6 +324,10 @@ export var CustomerMasterKeySpec;
322
324
  CustomerMasterKeySpec["ECC_NIST_P384"] = "ECC_NIST_P384";
323
325
  CustomerMasterKeySpec["ECC_NIST_P521"] = "ECC_NIST_P521";
324
326
  CustomerMasterKeySpec["ECC_SECG_P256K1"] = "ECC_SECG_P256K1";
327
+ CustomerMasterKeySpec["HMAC_224"] = "HMAC_224";
328
+ CustomerMasterKeySpec["HMAC_256"] = "HMAC_256";
329
+ CustomerMasterKeySpec["HMAC_384"] = "HMAC_384";
330
+ CustomerMasterKeySpec["HMAC_512"] = "HMAC_512";
325
331
  CustomerMasterKeySpec["RSA_2048"] = "RSA_2048";
326
332
  CustomerMasterKeySpec["RSA_3072"] = "RSA_3072";
327
333
  CustomerMasterKeySpec["RSA_4096"] = "RSA_4096";
@@ -333,6 +339,10 @@ export var KeySpec;
333
339
  KeySpec["ECC_NIST_P384"] = "ECC_NIST_P384";
334
340
  KeySpec["ECC_NIST_P521"] = "ECC_NIST_P521";
335
341
  KeySpec["ECC_SECG_P256K1"] = "ECC_SECG_P256K1";
342
+ KeySpec["HMAC_224"] = "HMAC_224";
343
+ KeySpec["HMAC_256"] = "HMAC_256";
344
+ KeySpec["HMAC_384"] = "HMAC_384";
345
+ KeySpec["HMAC_512"] = "HMAC_512";
336
346
  KeySpec["RSA_2048"] = "RSA_2048";
337
347
  KeySpec["RSA_3072"] = "RSA_3072";
338
348
  KeySpec["RSA_4096"] = "RSA_4096";
@@ -341,6 +351,7 @@ export var KeySpec;
341
351
  export var KeyUsageType;
342
352
  (function (KeyUsageType) {
343
353
  KeyUsageType["ENCRYPT_DECRYPT"] = "ENCRYPT_DECRYPT";
354
+ KeyUsageType["GENERATE_VERIFY_MAC"] = "GENERATE_VERIFY_MAC";
344
355
  KeyUsageType["SIGN_VERIFY"] = "SIGN_VERIFY";
345
356
  })(KeyUsageType || (KeyUsageType = {}));
346
357
  export var OriginType;
@@ -384,6 +395,13 @@ export var KeyState;
384
395
  KeyState["Unavailable"] = "Unavailable";
385
396
  KeyState["Updating"] = "Updating";
386
397
  })(KeyState || (KeyState = {}));
398
+ export var MacAlgorithmSpec;
399
+ (function (MacAlgorithmSpec) {
400
+ MacAlgorithmSpec["HMAC_SHA_224"] = "HMAC_SHA_224";
401
+ MacAlgorithmSpec["HMAC_SHA_256"] = "HMAC_SHA_256";
402
+ MacAlgorithmSpec["HMAC_SHA_384"] = "HMAC_SHA_384";
403
+ MacAlgorithmSpec["HMAC_SHA_512"] = "HMAC_SHA_512";
404
+ })(MacAlgorithmSpec || (MacAlgorithmSpec = {}));
387
405
  export var MultiRegionKeyType;
388
406
  (function (MultiRegionKeyType) {
389
407
  MultiRegionKeyType["PRIMARY"] = "PRIMARY";
@@ -660,6 +678,14 @@ export var GenerateDataKeyWithoutPlaintextResponse;
660
678
  (function (GenerateDataKeyWithoutPlaintextResponse) {
661
679
  GenerateDataKeyWithoutPlaintextResponse.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };
662
680
  })(GenerateDataKeyWithoutPlaintextResponse || (GenerateDataKeyWithoutPlaintextResponse = {}));
681
+ export var GenerateMacRequest;
682
+ (function (GenerateMacRequest) {
683
+ GenerateMacRequest.filterSensitiveLog = function (obj) { return (__assign(__assign({}, obj), (obj.Message && { Message: SENSITIVE_STRING }))); };
684
+ })(GenerateMacRequest || (GenerateMacRequest = {}));
685
+ export var GenerateMacResponse;
686
+ (function (GenerateMacResponse) {
687
+ GenerateMacResponse.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };
688
+ })(GenerateMacResponse || (GenerateMacResponse = {}));
663
689
  export var GenerateRandomRequest;
664
690
  (function (GenerateRandomRequest) {
665
691
  GenerateRandomRequest.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };
@@ -756,6 +782,18 @@ export var KeyListEntry;
756
782
  (function (KeyListEntry) {
757
783
  KeyListEntry.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };
758
784
  })(KeyListEntry || (KeyListEntry = {}));
785
+ var KMSInvalidMacException = (function (_super) {
786
+ __extends(KMSInvalidMacException, _super);
787
+ function KMSInvalidMacException(opts) {
788
+ var _this = _super.call(this, __assign({ name: "KMSInvalidMacException", $fault: "client" }, opts)) || this;
789
+ _this.name = "KMSInvalidMacException";
790
+ _this.$fault = "client";
791
+ Object.setPrototypeOf(_this, KMSInvalidMacException.prototype);
792
+ return _this;
793
+ }
794
+ return KMSInvalidMacException;
795
+ }(__BaseException));
796
+ export { KMSInvalidMacException };
759
797
  var KMSInvalidSignatureException = (function (_super) {
760
798
  __extends(KMSInvalidSignatureException, _super);
761
799
  function KMSInvalidSignatureException(opts) {
@@ -897,3 +935,11 @@ export var VerifyResponse;
897
935
  (function (VerifyResponse) {
898
936
  VerifyResponse.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };
899
937
  })(VerifyResponse || (VerifyResponse = {}));
938
+ export var VerifyMacRequest;
939
+ (function (VerifyMacRequest) {
940
+ VerifyMacRequest.filterSensitiveLog = function (obj) { return (__assign(__assign({}, obj), (obj.Message && { Message: SENSITIVE_STRING }))); };
941
+ })(VerifyMacRequest || (VerifyMacRequest = {}));
942
+ export var VerifyMacResponse;
943
+ (function (VerifyMacResponse) {
944
+ VerifyMacResponse.filterSensitiveLog = function (obj) { return (__assign({}, obj)); };
945
+ })(VerifyMacResponse || (VerifyMacResponse = {}));
@@ -2,7 +2,7 @@ import { __assign, __awaiter, __generator, __read } from "tslib";
2
2
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
3
3
  import { decorateServiceException as __decorateServiceException, expectBoolean as __expectBoolean, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectString as __expectString, parseEpochTimestamp as __parseEpochTimestamp, } from "@aws-sdk/smithy-client";
4
4
  import { KMSServiceException as __BaseException } from "../models/KMSServiceException";
5
- import { AlreadyExistsException, CloudHsmClusterInUseException, CloudHsmClusterInvalidConfigurationException, CloudHsmClusterNotActiveException, CloudHsmClusterNotFoundException, CloudHsmClusterNotRelatedException, CustomKeyStoreHasCMKsException, CustomKeyStoreInvalidStateException, CustomKeyStoreNameInUseException, CustomKeyStoreNotFoundException, DependencyTimeoutException, DisabledException, ExpiredImportTokenException, IncorrectKeyException, IncorrectKeyMaterialException, IncorrectTrustAnchorException, InvalidAliasNameException, InvalidArnException, InvalidCiphertextException, InvalidGrantIdException, InvalidGrantTokenException, InvalidImportTokenException, InvalidKeyUsageException, InvalidMarkerException, KeyUnavailableException, KMSInternalException, KMSInvalidSignatureException, KMSInvalidStateException, LimitExceededException, MalformedPolicyDocumentException, NotFoundException, TagException, UnsupportedOperationException, } from "../models/models_0";
5
+ import { AlreadyExistsException, CloudHsmClusterInUseException, CloudHsmClusterInvalidConfigurationException, CloudHsmClusterNotActiveException, CloudHsmClusterNotFoundException, CloudHsmClusterNotRelatedException, CustomKeyStoreHasCMKsException, CustomKeyStoreInvalidStateException, CustomKeyStoreNameInUseException, CustomKeyStoreNotFoundException, DependencyTimeoutException, DisabledException, ExpiredImportTokenException, IncorrectKeyException, IncorrectKeyMaterialException, IncorrectTrustAnchorException, InvalidAliasNameException, InvalidArnException, InvalidCiphertextException, InvalidGrantIdException, InvalidGrantTokenException, InvalidImportTokenException, InvalidKeyUsageException, InvalidMarkerException, KeyUnavailableException, KMSInternalException, KMSInvalidMacException, KMSInvalidSignatureException, KMSInvalidStateException, LimitExceededException, MalformedPolicyDocumentException, NotFoundException, TagException, UnsupportedOperationException, } from "../models/models_0";
6
6
  export var serializeAws_json1_1CancelKeyDeletionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
7
7
  var headers, body;
8
8
  return __generator(this, function (_a) {
@@ -245,6 +245,17 @@ export var serializeAws_json1_1GenerateDataKeyWithoutPlaintextCommand = function
245
245
  return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
246
246
  });
247
247
  }); };
248
+ export var serializeAws_json1_1GenerateMacCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
249
+ var headers, body;
250
+ return __generator(this, function (_a) {
251
+ headers = {
252
+ "content-type": "application/x-amz-json-1.1",
253
+ "x-amz-target": "TrentService.GenerateMac",
254
+ };
255
+ body = JSON.stringify(serializeAws_json1_1GenerateMacRequest(input, context));
256
+ return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
257
+ });
258
+ }); };
248
259
  export var serializeAws_json1_1GenerateRandomCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
249
260
  var headers, body;
250
261
  return __generator(this, function (_a) {
@@ -531,6 +542,17 @@ export var serializeAws_json1_1VerifyCommand = function (input, context) { retur
531
542
  return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
532
543
  });
533
544
  }); };
545
+ export var serializeAws_json1_1VerifyMacCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
546
+ var headers, body;
547
+ return __generator(this, function (_a) {
548
+ headers = {
549
+ "content-type": "application/x-amz-json-1.1",
550
+ "x-amz-target": "TrentService.VerifyMac",
551
+ };
552
+ body = JSON.stringify(serializeAws_json1_1VerifyMacRequest(input, context));
553
+ return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
554
+ });
555
+ }); };
534
556
  export var deserializeAws_json1_1CancelKeyDeletionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
535
557
  var data, contents, response;
536
558
  return __generator(this, function (_a) {
@@ -2115,6 +2137,80 @@ var deserializeAws_json1_1GenerateDataKeyWithoutPlaintextCommandError = function
2115
2137
  }
2116
2138
  });
2117
2139
  }); };
2140
+ export var deserializeAws_json1_1GenerateMacCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
2141
+ var data, contents, response;
2142
+ return __generator(this, function (_a) {
2143
+ switch (_a.label) {
2144
+ case 0:
2145
+ if (output.statusCode >= 300) {
2146
+ return [2, deserializeAws_json1_1GenerateMacCommandError(output, context)];
2147
+ }
2148
+ return [4, parseBody(output.body, context)];
2149
+ case 1:
2150
+ data = _a.sent();
2151
+ contents = {};
2152
+ contents = deserializeAws_json1_1GenerateMacResponse(data, context);
2153
+ response = __assign({ $metadata: deserializeMetadata(output) }, contents);
2154
+ return [2, Promise.resolve(response)];
2155
+ }
2156
+ });
2157
+ }); };
2158
+ var deserializeAws_json1_1GenerateMacCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
2159
+ var parsedOutput, _a, response, errorCode, _b, parsedBody;
2160
+ var _c;
2161
+ return __generator(this, function (_d) {
2162
+ switch (_d.label) {
2163
+ case 0:
2164
+ _a = [__assign({}, output)];
2165
+ _c = {};
2166
+ return [4, parseBody(output.body, context)];
2167
+ case 1:
2168
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
2169
+ errorCode = "UnknownError";
2170
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2171
+ _b = errorCode;
2172
+ switch (_b) {
2173
+ case "DisabledException": return [3, 2];
2174
+ case "com.amazonaws.kms#DisabledException": return [3, 2];
2175
+ case "InvalidGrantTokenException": return [3, 4];
2176
+ case "com.amazonaws.kms#InvalidGrantTokenException": return [3, 4];
2177
+ case "InvalidKeyUsageException": return [3, 6];
2178
+ case "com.amazonaws.kms#InvalidKeyUsageException": return [3, 6];
2179
+ case "KeyUnavailableException": return [3, 8];
2180
+ case "com.amazonaws.kms#KeyUnavailableException": return [3, 8];
2181
+ case "KMSInternalException": return [3, 10];
2182
+ case "com.amazonaws.kms#KMSInternalException": return [3, 10];
2183
+ case "KMSInvalidStateException": return [3, 12];
2184
+ case "com.amazonaws.kms#KMSInvalidStateException": return [3, 12];
2185
+ case "NotFoundException": return [3, 14];
2186
+ case "com.amazonaws.kms#NotFoundException": return [3, 14];
2187
+ }
2188
+ return [3, 16];
2189
+ case 2: return [4, deserializeAws_json1_1DisabledExceptionResponse(parsedOutput, context)];
2190
+ case 3: throw _d.sent();
2191
+ case 4: return [4, deserializeAws_json1_1InvalidGrantTokenExceptionResponse(parsedOutput, context)];
2192
+ case 5: throw _d.sent();
2193
+ case 6: return [4, deserializeAws_json1_1InvalidKeyUsageExceptionResponse(parsedOutput, context)];
2194
+ case 7: throw _d.sent();
2195
+ case 8: return [4, deserializeAws_json1_1KeyUnavailableExceptionResponse(parsedOutput, context)];
2196
+ case 9: throw _d.sent();
2197
+ case 10: return [4, deserializeAws_json1_1KMSInternalExceptionResponse(parsedOutput, context)];
2198
+ case 11: throw _d.sent();
2199
+ case 12: return [4, deserializeAws_json1_1KMSInvalidStateExceptionResponse(parsedOutput, context)];
2200
+ case 13: throw _d.sent();
2201
+ case 14: return [4, deserializeAws_json1_1NotFoundExceptionResponse(parsedOutput, context)];
2202
+ case 15: throw _d.sent();
2203
+ case 16:
2204
+ parsedBody = parsedOutput.body;
2205
+ response = new __BaseException({
2206
+ name: parsedBody.code || parsedBody.Code || errorCode,
2207
+ $fault: "client",
2208
+ $metadata: deserializeMetadata(output),
2209
+ });
2210
+ throw __decorateServiceException(response, parsedBody);
2211
+ }
2212
+ });
2213
+ }); };
2118
2214
  export var deserializeAws_json1_1GenerateRandomCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
2119
2215
  var data, contents, response;
2120
2216
  return __generator(this, function (_a) {
@@ -3983,6 +4079,84 @@ var deserializeAws_json1_1VerifyCommandError = function (output, context) { retu
3983
4079
  }
3984
4080
  });
3985
4081
  }); };
4082
+ export var deserializeAws_json1_1VerifyMacCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
4083
+ var data, contents, response;
4084
+ return __generator(this, function (_a) {
4085
+ switch (_a.label) {
4086
+ case 0:
4087
+ if (output.statusCode >= 300) {
4088
+ return [2, deserializeAws_json1_1VerifyMacCommandError(output, context)];
4089
+ }
4090
+ return [4, parseBody(output.body, context)];
4091
+ case 1:
4092
+ data = _a.sent();
4093
+ contents = {};
4094
+ contents = deserializeAws_json1_1VerifyMacResponse(data, context);
4095
+ response = __assign({ $metadata: deserializeMetadata(output) }, contents);
4096
+ return [2, Promise.resolve(response)];
4097
+ }
4098
+ });
4099
+ }); };
4100
+ var deserializeAws_json1_1VerifyMacCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
4101
+ var parsedOutput, _a, response, errorCode, _b, parsedBody;
4102
+ var _c;
4103
+ return __generator(this, function (_d) {
4104
+ switch (_d.label) {
4105
+ case 0:
4106
+ _a = [__assign({}, output)];
4107
+ _c = {};
4108
+ return [4, parseBody(output.body, context)];
4109
+ case 1:
4110
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
4111
+ errorCode = "UnknownError";
4112
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4113
+ _b = errorCode;
4114
+ switch (_b) {
4115
+ case "DisabledException": return [3, 2];
4116
+ case "com.amazonaws.kms#DisabledException": return [3, 2];
4117
+ case "InvalidGrantTokenException": return [3, 4];
4118
+ case "com.amazonaws.kms#InvalidGrantTokenException": return [3, 4];
4119
+ case "InvalidKeyUsageException": return [3, 6];
4120
+ case "com.amazonaws.kms#InvalidKeyUsageException": return [3, 6];
4121
+ case "KeyUnavailableException": return [3, 8];
4122
+ case "com.amazonaws.kms#KeyUnavailableException": return [3, 8];
4123
+ case "KMSInternalException": return [3, 10];
4124
+ case "com.amazonaws.kms#KMSInternalException": return [3, 10];
4125
+ case "KMSInvalidMacException": return [3, 12];
4126
+ case "com.amazonaws.kms#KMSInvalidMacException": return [3, 12];
4127
+ case "KMSInvalidStateException": return [3, 14];
4128
+ case "com.amazonaws.kms#KMSInvalidStateException": return [3, 14];
4129
+ case "NotFoundException": return [3, 16];
4130
+ case "com.amazonaws.kms#NotFoundException": return [3, 16];
4131
+ }
4132
+ return [3, 18];
4133
+ case 2: return [4, deserializeAws_json1_1DisabledExceptionResponse(parsedOutput, context)];
4134
+ case 3: throw _d.sent();
4135
+ case 4: return [4, deserializeAws_json1_1InvalidGrantTokenExceptionResponse(parsedOutput, context)];
4136
+ case 5: throw _d.sent();
4137
+ case 6: return [4, deserializeAws_json1_1InvalidKeyUsageExceptionResponse(parsedOutput, context)];
4138
+ case 7: throw _d.sent();
4139
+ case 8: return [4, deserializeAws_json1_1KeyUnavailableExceptionResponse(parsedOutput, context)];
4140
+ case 9: throw _d.sent();
4141
+ case 10: return [4, deserializeAws_json1_1KMSInternalExceptionResponse(parsedOutput, context)];
4142
+ case 11: throw _d.sent();
4143
+ case 12: return [4, deserializeAws_json1_1KMSInvalidMacExceptionResponse(parsedOutput, context)];
4144
+ case 13: throw _d.sent();
4145
+ case 14: return [4, deserializeAws_json1_1KMSInvalidStateExceptionResponse(parsedOutput, context)];
4146
+ case 15: throw _d.sent();
4147
+ case 16: return [4, deserializeAws_json1_1NotFoundExceptionResponse(parsedOutput, context)];
4148
+ case 17: throw _d.sent();
4149
+ case 18:
4150
+ parsedBody = parsedOutput.body;
4151
+ response = new __BaseException({
4152
+ name: parsedBody.code || parsedBody.Code || errorCode,
4153
+ $fault: "client",
4154
+ $metadata: deserializeMetadata(output),
4155
+ });
4156
+ throw __decorateServiceException(response, parsedBody);
4157
+ }
4158
+ });
4159
+ }); };
3986
4160
  var deserializeAws_json1_1AlreadyExistsExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
3987
4161
  var body, deserialized, exception;
3988
4162
  return __generator(this, function (_a) {
@@ -4217,6 +4391,15 @@ var deserializeAws_json1_1KMSInternalExceptionResponse = function (parsedOutput,
4217
4391
  return [2, __decorateServiceException(exception, body)];
4218
4392
  });
4219
4393
  }); };
4394
+ var deserializeAws_json1_1KMSInvalidMacExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
4395
+ var body, deserialized, exception;
4396
+ return __generator(this, function (_a) {
4397
+ body = parsedOutput.body;
4398
+ deserialized = deserializeAws_json1_1KMSInvalidMacException(body, context);
4399
+ exception = new KMSInvalidMacException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, deserialized));
4400
+ return [2, __decorateServiceException(exception, body)];
4401
+ });
4402
+ }); };
4220
4403
  var deserializeAws_json1_1KMSInvalidSignatureExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
4221
4404
  var body, deserialized, exception;
4222
4405
  return __generator(this, function (_a) {
@@ -4404,6 +4587,10 @@ var serializeAws_json1_1GenerateDataKeyWithoutPlaintextRequest = function (input
4404
4587
  })), (input.GrantTokens !== undefined &&
4405
4588
  input.GrantTokens !== null && { GrantTokens: serializeAws_json1_1GrantTokenList(input.GrantTokens, context) })), (input.KeyId !== undefined && input.KeyId !== null && { KeyId: input.KeyId })), (input.KeySpec !== undefined && input.KeySpec !== null && { KeySpec: input.KeySpec })), (input.NumberOfBytes !== undefined && input.NumberOfBytes !== null && { NumberOfBytes: input.NumberOfBytes }));
4406
4589
  };
4590
+ var serializeAws_json1_1GenerateMacRequest = function (input, context) {
4591
+ return __assign(__assign(__assign(__assign({}, (input.GrantTokens !== undefined &&
4592
+ input.GrantTokens !== null && { GrantTokens: serializeAws_json1_1GrantTokenList(input.GrantTokens, context) })), (input.KeyId !== undefined && input.KeyId !== null && { KeyId: input.KeyId })), (input.MacAlgorithm !== undefined && input.MacAlgorithm !== null && { MacAlgorithm: input.MacAlgorithm })), (input.Message !== undefined && input.Message !== null && { Message: context.base64Encoder(input.Message) }));
4593
+ };
4407
4594
  var serializeAws_json1_1GenerateRandomRequest = function (input, context) {
4408
4595
  return __assign(__assign({}, (input.CustomKeyStoreId !== undefined &&
4409
4596
  input.CustomKeyStoreId !== null && { CustomKeyStoreId: input.CustomKeyStoreId })), (input.NumberOfBytes !== undefined && input.NumberOfBytes !== null && { NumberOfBytes: input.NumberOfBytes }));
@@ -4570,6 +4757,10 @@ var serializeAws_json1_1UpdateKeyDescriptionRequest = function (input, context)
4570
4757
  var serializeAws_json1_1UpdatePrimaryRegionRequest = function (input, context) {
4571
4758
  return __assign(__assign({}, (input.KeyId !== undefined && input.KeyId !== null && { KeyId: input.KeyId })), (input.PrimaryRegion !== undefined && input.PrimaryRegion !== null && { PrimaryRegion: input.PrimaryRegion }));
4572
4759
  };
4760
+ var serializeAws_json1_1VerifyMacRequest = function (input, context) {
4761
+ return __assign(__assign(__assign(__assign(__assign({}, (input.GrantTokens !== undefined &&
4762
+ input.GrantTokens !== null && { GrantTokens: serializeAws_json1_1GrantTokenList(input.GrantTokens, context) })), (input.KeyId !== undefined && input.KeyId !== null && { KeyId: input.KeyId })), (input.Mac !== undefined && input.Mac !== null && { Mac: context.base64Encoder(input.Mac) })), (input.MacAlgorithm !== undefined && input.MacAlgorithm !== null && { MacAlgorithm: input.MacAlgorithm })), (input.Message !== undefined && input.Message !== null && { Message: context.base64Encoder(input.Message) }));
4763
+ };
4573
4764
  var serializeAws_json1_1VerifyRequest = function (input, context) {
4574
4765
  return __assign(__assign(__assign(__assign(__assign(__assign({}, (input.GrantTokens !== undefined &&
4575
4766
  input.GrantTokens !== null && { GrantTokens: serializeAws_json1_1GrantTokenList(input.GrantTokens, context) })), (input.KeyId !== undefined && input.KeyId !== null && { KeyId: input.KeyId })), (input.Message !== undefined && input.Message !== null && { Message: context.base64Encoder(input.Message) })), (input.MessageType !== undefined && input.MessageType !== null && { MessageType: input.MessageType })), (input.Signature !== undefined &&
@@ -4814,6 +5005,13 @@ var deserializeAws_json1_1GenerateDataKeyWithoutPlaintextResponse = function (ou
4814
5005
  KeyId: __expectString(output.KeyId),
4815
5006
  };
4816
5007
  };
5008
+ var deserializeAws_json1_1GenerateMacResponse = function (output, context) {
5009
+ return {
5010
+ KeyId: __expectString(output.KeyId),
5011
+ Mac: output.Mac !== undefined && output.Mac !== null ? context.base64Decoder(output.Mac) : undefined,
5012
+ MacAlgorithm: __expectString(output.MacAlgorithm),
5013
+ };
5014
+ };
4817
5015
  var deserializeAws_json1_1GenerateRandomResponse = function (output, context) {
4818
5016
  return {
4819
5017
  Plaintext: output.Plaintext !== undefined && output.Plaintext !== null ? context.base64Decoder(output.Plaintext) : undefined,
@@ -5006,6 +5204,9 @@ var deserializeAws_json1_1KeyMetadata = function (output, context) {
5006
5204
  KeySpec: __expectString(output.KeySpec),
5007
5205
  KeyState: __expectString(output.KeyState),
5008
5206
  KeyUsage: __expectString(output.KeyUsage),
5207
+ MacAlgorithms: output.MacAlgorithms !== undefined && output.MacAlgorithms !== null
5208
+ ? deserializeAws_json1_1MacAlgorithmSpecList(output.MacAlgorithms, context)
5209
+ : undefined,
5009
5210
  MultiRegion: __expectBoolean(output.MultiRegion),
5010
5211
  MultiRegionConfiguration: output.MultiRegionConfiguration !== undefined && output.MultiRegionConfiguration !== null
5011
5212
  ? deserializeAws_json1_1MultiRegionConfiguration(output.MultiRegionConfiguration, context)
@@ -5030,6 +5231,11 @@ var deserializeAws_json1_1KMSInternalException = function (output, context) {
5030
5231
  message: __expectString(output.message),
5031
5232
  };
5032
5233
  };
5234
+ var deserializeAws_json1_1KMSInvalidMacException = function (output, context) {
5235
+ return {
5236
+ message: __expectString(output.message),
5237
+ };
5238
+ };
5033
5239
  var deserializeAws_json1_1KMSInvalidSignatureException = function (output, context) {
5034
5240
  return {
5035
5241
  message: __expectString(output.message),
@@ -5090,6 +5296,17 @@ var deserializeAws_json1_1ListResourceTagsResponse = function (output, context)
5090
5296
  Truncated: __expectBoolean(output.Truncated),
5091
5297
  };
5092
5298
  };
5299
+ var deserializeAws_json1_1MacAlgorithmSpecList = function (output, context) {
5300
+ var retVal = (output || [])
5301
+ .filter(function (e) { return e != null; })
5302
+ .map(function (entry) {
5303
+ if (entry === null) {
5304
+ return null;
5305
+ }
5306
+ return __expectString(entry);
5307
+ });
5308
+ return retVal;
5309
+ };
5093
5310
  var deserializeAws_json1_1MalformedPolicyDocumentException = function (output, context) {
5094
5311
  return {
5095
5312
  message: __expectString(output.message),
@@ -5219,6 +5436,13 @@ var deserializeAws_json1_1UnsupportedOperationException = function (output, cont
5219
5436
  var deserializeAws_json1_1UpdateCustomKeyStoreResponse = function (output, context) {
5220
5437
  return {};
5221
5438
  };
5439
+ var deserializeAws_json1_1VerifyMacResponse = function (output, context) {
5440
+ return {
5441
+ KeyId: __expectString(output.KeyId),
5442
+ MacAlgorithm: __expectString(output.MacAlgorithm),
5443
+ MacValid: __expectBoolean(output.MacValid),
5444
+ };
5445
+ };
5222
5446
  var deserializeAws_json1_1VerifyResponse = function (output, context) {
5223
5447
  return {
5224
5448
  KeyId: __expectString(output.KeyId),