@azure/keyvault-keys 4.10.1-alpha.20250702.2 → 4.10.1-alpha.20250722.2

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 (100) hide show
  1. package/dist/browser/cryptography/remoteCryptographyProvider.js +34 -11
  2. package/dist/browser/cryptography/remoteCryptographyProvider.js.map +1 -1
  3. package/dist/browser/cryptographyClient.js +12 -5
  4. package/dist/browser/cryptographyClient.js.map +1 -1
  5. package/dist/browser/generated/src/api/keyVaultContext.js +12 -9
  6. package/dist/browser/generated/src/api/keyVaultContext.js.map +1 -1
  7. package/dist/browser/generated/src/api/operations.js +229 -78
  8. package/dist/browser/generated/src/api/operations.js.map +1 -1
  9. package/dist/browser/generated/src/keyVaultClient.js +8 -3
  10. package/dist/browser/generated/src/keyVaultClient.js.map +1 -1
  11. package/dist/browser/generated/src/static-helpers/pagingHelpers.js +31 -50
  12. package/dist/browser/generated/src/static-helpers/pagingHelpers.js.map +1 -1
  13. package/dist/browser/generated/src/static-helpers/urlTemplate.js +2 -2
  14. package/dist/browser/generated/src/static-helpers/urlTemplate.js.map +1 -1
  15. package/dist/browser/identifier.js +4 -1
  16. package/dist/browser/identifier.js.map +1 -1
  17. package/dist/browser/index.js +43 -29
  18. package/dist/browser/index.js.map +1 -1
  19. package/dist/browser/lro/delete/operation.js +3 -0
  20. package/dist/browser/lro/delete/operation.js.map +1 -1
  21. package/dist/browser/lro/delete/poller.js +4 -1
  22. package/dist/browser/lro/delete/poller.js.map +1 -1
  23. package/dist/browser/lro/keyVaultKeyPoller.js +6 -8
  24. package/dist/browser/lro/keyVaultKeyPoller.js.map +1 -1
  25. package/dist/browser/lro/recover/operation.js +5 -2
  26. package/dist/browser/lro/recover/operation.js.map +1 -1
  27. package/dist/browser/lro/recover/poller.js +4 -1
  28. package/dist/browser/lro/recover/poller.js.map +1 -1
  29. package/dist/browser/transformations.js +30 -41
  30. package/dist/browser/transformations.js.map +1 -1
  31. package/dist/commonjs/cryptography/aesCryptographyProvider.js +29 -29
  32. package/dist/commonjs/cryptography/aesCryptographyProvider.js.map +1 -1
  33. package/dist/commonjs/cryptography/remoteCryptographyProvider.js +34 -11
  34. package/dist/commonjs/cryptography/remoteCryptographyProvider.js.map +1 -1
  35. package/dist/commonjs/cryptography/rsaCryptographyProvider.js +39 -36
  36. package/dist/commonjs/cryptography/rsaCryptographyProvider.js.map +1 -1
  37. package/dist/commonjs/cryptographyClient.js +12 -5
  38. package/dist/commonjs/cryptographyClient.js.map +1 -1
  39. package/dist/commonjs/generated/src/api/keyVaultContext.js +12 -9
  40. package/dist/commonjs/generated/src/api/keyVaultContext.js.map +1 -1
  41. package/dist/commonjs/generated/src/api/operations.js +229 -78
  42. package/dist/commonjs/generated/src/api/operations.js.map +1 -1
  43. package/dist/commonjs/generated/src/keyVaultClient.js +8 -3
  44. package/dist/commonjs/generated/src/keyVaultClient.js.map +1 -1
  45. package/dist/commonjs/generated/src/static-helpers/pagingHelpers.js +31 -50
  46. package/dist/commonjs/generated/src/static-helpers/pagingHelpers.js.map +1 -1
  47. package/dist/commonjs/generated/src/static-helpers/urlTemplate.js +2 -2
  48. package/dist/commonjs/generated/src/static-helpers/urlTemplate.js.map +1 -1
  49. package/dist/commonjs/identifier.js +4 -1
  50. package/dist/commonjs/identifier.js.map +1 -1
  51. package/dist/commonjs/index.js +43 -29
  52. package/dist/commonjs/index.js.map +1 -1
  53. package/dist/commonjs/lro/delete/operation.js +3 -0
  54. package/dist/commonjs/lro/delete/operation.js.map +1 -1
  55. package/dist/commonjs/lro/delete/poller.js +4 -1
  56. package/dist/commonjs/lro/delete/poller.js.map +1 -1
  57. package/dist/commonjs/lro/keyVaultKeyPoller.js +6 -8
  58. package/dist/commonjs/lro/keyVaultKeyPoller.js.map +1 -1
  59. package/dist/commonjs/lro/recover/operation.js +5 -2
  60. package/dist/commonjs/lro/recover/operation.js.map +1 -1
  61. package/dist/commonjs/lro/recover/poller.js +4 -1
  62. package/dist/commonjs/lro/recover/poller.js.map +1 -1
  63. package/dist/commonjs/transformations.js +30 -41
  64. package/dist/commonjs/transformations.js.map +1 -1
  65. package/dist/commonjs/tsdoc-metadata.json +11 -11
  66. package/dist/esm/cryptography/aesCryptographyProvider.js +26 -26
  67. package/dist/esm/cryptography/aesCryptographyProvider.js.map +1 -1
  68. package/dist/esm/cryptography/remoteCryptographyProvider.js +34 -11
  69. package/dist/esm/cryptography/remoteCryptographyProvider.js.map +1 -1
  70. package/dist/esm/cryptography/rsaCryptographyProvider.js +39 -36
  71. package/dist/esm/cryptography/rsaCryptographyProvider.js.map +1 -1
  72. package/dist/esm/cryptographyClient.js +12 -5
  73. package/dist/esm/cryptographyClient.js.map +1 -1
  74. package/dist/esm/generated/src/api/keyVaultContext.js +12 -9
  75. package/dist/esm/generated/src/api/keyVaultContext.js.map +1 -1
  76. package/dist/esm/generated/src/api/operations.js +229 -78
  77. package/dist/esm/generated/src/api/operations.js.map +1 -1
  78. package/dist/esm/generated/src/keyVaultClient.js +8 -3
  79. package/dist/esm/generated/src/keyVaultClient.js.map +1 -1
  80. package/dist/esm/generated/src/static-helpers/pagingHelpers.js +31 -50
  81. package/dist/esm/generated/src/static-helpers/pagingHelpers.js.map +1 -1
  82. package/dist/esm/generated/src/static-helpers/urlTemplate.js +2 -2
  83. package/dist/esm/generated/src/static-helpers/urlTemplate.js.map +1 -1
  84. package/dist/esm/identifier.js +4 -1
  85. package/dist/esm/identifier.js.map +1 -1
  86. package/dist/esm/index.js +43 -29
  87. package/dist/esm/index.js.map +1 -1
  88. package/dist/esm/lro/delete/operation.js +3 -0
  89. package/dist/esm/lro/delete/operation.js.map +1 -1
  90. package/dist/esm/lro/delete/poller.js +4 -1
  91. package/dist/esm/lro/delete/poller.js.map +1 -1
  92. package/dist/esm/lro/keyVaultKeyPoller.js +6 -8
  93. package/dist/esm/lro/keyVaultKeyPoller.js.map +1 -1
  94. package/dist/esm/lro/recover/operation.js +5 -2
  95. package/dist/esm/lro/recover/operation.js.map +1 -1
  96. package/dist/esm/lro/recover/poller.js +4 -1
  97. package/dist/esm/lro/recover/poller.js.map +1 -1
  98. package/dist/esm/transformations.js +30 -41
  99. package/dist/esm/transformations.js.map +1 -1
  100. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,4CAA4C;;AAG5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO,EAAyB,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAEpG,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAgCL,kBAAkB,EAClB,kBAAkB,GAWnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAgBL,iCAAiC,EACjC,yBAAyB,EACzB,aAAa,EACb,kBAAkB,EAClB,wBAAwB,GAczB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAyB,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AACpF,OAAO,EACL,+BAA+B,EAC/B,mBAAmB,EACnB,2BAA2B,EAC3B,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,mCAAmC,EAAE,MAAM,2BAA2B,CAAC;AAEhF,OAAO,EAQL,kBAAkB,EAalB,0BAA0B,EAe1B,kBAAkB,EAClB,iCAAiC,EAEjC,yBAAyB,EAEz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I,CAAC,MAAM,CAAC,uBAAuB,CACtD,OAAO,EACP,0BAA0B,CAAC,qBAAqB,CAAC,MAAM,CAAC,EACxD,cAAc,CACf,CAAC;YACF,OAAO,0BAA0B,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAC9D,CAAC,CACF,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACI,2BAA2B,CAChC,IAAY,EACZ,UAA8C,EAAE;QAEhD,OAAO,qBAAqB,CAC1B,OAAO,EACP,CAAC,aAAa,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,EAClE,2BAA2B,CAC5B,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACI,oBAAoB,CACzB,UAAuC,EAAE;QAEzC,OAAO,qBAAqB,CAC1B,OAAO,EACP,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EACrC,2BAA2B,CAC5B,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACI,eAAe,CACpB,UAAkC,EAAE;QAEpC,OAAO,qBAAqB,CAC1B,OAAO,EACP,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAC5C,+BAA+B,CAChC,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/// <reference lib=\"esnext.asynciterable\" />\n\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { logger } from \"./log.js\";\nimport { PageSettings, PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { PollOperationState, PollerLike } from \"@azure/core-lro\";\nimport { DeletionRecoveryLevel, KnownDeletionRecoveryLevel } from \"./generated/src/models/index.js\";\nimport type { KeyVaultClientOptionalParams } from \"./generated/src/keyVaultClient.js\";\nimport { KeyVaultClient } from \"./generated/src/keyVaultClient.js\";\nimport { SDK_VERSION } from \"./constants.js\";\nimport { keyVaultAuthenticationPolicy } from \"@azure/keyvault-common\";\nimport { DeleteKeyPoller } from \"./lro/delete/poller.js\";\nimport { RecoverDeletedKeyPoller } from \"./lro/recover/poller.js\";\nimport {\n BackupKeyOptions,\n BeginDeleteKeyOptions,\n BeginRecoverDeletedKeyOptions,\n CreateEcKeyOptions,\n CreateKeyOptions,\n CreateOctKeyOptions,\n CreateRsaKeyOptions,\n CryptographyClientOptions,\n CryptographyOptions,\n DeletedKey,\n GetCryptographyClientOptions,\n GetDeletedKeyOptions,\n GetKeyAttestationOptions,\n GetKeyOptions,\n GetKeyRotationPolicyOptions,\n GetRandomBytesOptions,\n ImportKeyOptions,\n JsonWebKey,\n KeyAttestation,\n KeyClientOptions,\n KeyExportEncryptionAlgorithm,\n KeyOperation,\n KeyPollerOptions,\n KeyProperties,\n KeyReleasePolicy,\n KeyRotationLifetimeAction,\n KeyRotationPolicy,\n KeyRotationPolicyAction,\n KeyRotationPolicyProperties,\n KeyType,\n KeyVaultKey,\n KnownKeyOperations,\n LATEST_API_VERSION,\n ListDeletedKeysOptions,\n ListPropertiesOfKeyVersionsOptions,\n ListPropertiesOfKeysOptions,\n PurgeDeletedKeyOptions,\n ReleaseKeyOptions,\n ReleaseKeyResult,\n RestoreKeyBackupOptions,\n RotateKeyOptions,\n UpdateKeyPropertiesOptions,\n UpdateKeyRotationPolicyOptions,\n} from \"./keysModels.js\";\nimport { CryptographyClient } from \"./cryptographyClient.js\";\nimport {\n AesCbcDecryptParameters,\n AesCbcEncryptParameters,\n AesCbcEncryptionAlgorithm,\n AesGcmDecryptParameters,\n AesGcmEncryptParameters,\n AesGcmEncryptionAlgorithm,\n DecryptOptions,\n DecryptParameters,\n DecryptResult,\n EncryptOptions,\n EncryptParameters,\n EncryptResult,\n EncryptionAlgorithm,\n KeyCurveName,\n KeyWrapAlgorithm,\n KnownKeyExportEncryptionAlgorithm,\n KnownEncryptionAlgorithms,\n KnownKeyTypes,\n KnownKeyCurveNames,\n KnownSignatureAlgorithms,\n RsaDecryptParameters,\n RsaEncryptParameters,\n RsaEncryptionAlgorithm,\n SignOptions,\n SignResult,\n SignatureAlgorithm,\n UnwrapKeyOptions,\n UnwrapResult,\n VerifyDataOptions,\n VerifyOptions,\n VerifyResult,\n WrapKeyOptions,\n WrapResult,\n} from \"./cryptographyClientModels.js\";\nimport { KeyVaultKeyIdentifier, parseKeyVaultKeyIdentifier } from \"./identifier.js\";\nimport {\n getDeletedKeyFromDeletedKeyItem,\n getKeyFromKeyBundle,\n getKeyPropertiesFromKeyItem,\n keyRotationTransformations,\n mapPagedAsyncIterable,\n} from \"./transformations.js\";\nimport { tracingClient } from \"./tracing.js\";\nimport { bearerTokenAuthenticationPolicyName } from \"@azure/core-rest-pipeline\";\n\nexport {\n CryptographyClientOptions,\n KeyClientOptions,\n BackupKeyOptions,\n CreateEcKeyOptions,\n CreateKeyOptions,\n CreateRsaKeyOptions,\n CreateOctKeyOptions,\n CryptographyClient,\n CryptographyOptions,\n RsaEncryptionAlgorithm,\n RsaDecryptParameters,\n AesGcmEncryptionAlgorithm,\n AesGcmDecryptParameters,\n AesCbcEncryptionAlgorithm,\n AesCbcDecryptParameters,\n DecryptParameters,\n DecryptOptions,\n DecryptResult,\n DeletedKey,\n DeletionRecoveryLevel,\n KnownDeletionRecoveryLevel,\n RsaEncryptParameters,\n AesGcmEncryptParameters,\n AesCbcEncryptParameters,\n EncryptParameters,\n EncryptOptions,\n EncryptResult,\n GetDeletedKeyOptions,\n GetKeyAttestationOptions,\n GetKeyOptions,\n GetRandomBytesOptions,\n ImportKeyOptions,\n JsonWebKey,\n KeyAttestation,\n KeyCurveName,\n KnownKeyCurveNames,\n KnownKeyExportEncryptionAlgorithm,\n EncryptionAlgorithm,\n KnownEncryptionAlgorithms,\n KeyOperation,\n KnownKeyOperations,\n KeyType,\n KnownKeyTypes,\n KeyPollerOptions,\n BeginDeleteKeyOptions,\n BeginRecoverDeletedKeyOptions,\n KeyProperties,\n SignatureAlgorithm,\n KnownSignatureAlgorithms,\n KeyVaultKey,\n KeyWrapAlgorithm,\n ListPropertiesOfKeysOptions,\n ListPropertiesOfKeyVersionsOptions,\n ListDeletedKeysOptions,\n PageSettings,\n PagedAsyncIterableIterator,\n KeyVaultKeyIdentifier,\n parseKeyVaultKeyIdentifier,\n PollOperationState,\n PollerLike,\n PurgeDeletedKeyOptions,\n RestoreKeyBackupOptions,\n RotateKeyOptions,\n SignOptions,\n SignResult,\n UnwrapKeyOptions,\n UnwrapResult,\n UpdateKeyPropertiesOptions,\n VerifyOptions,\n VerifyDataOptions,\n VerifyResult,\n WrapKeyOptions,\n WrapResult,\n ReleaseKeyOptions,\n ReleaseKeyResult,\n KeyReleasePolicy,\n KeyExportEncryptionAlgorithm,\n GetCryptographyClientOptions,\n KeyRotationPolicyAction,\n KeyRotationPolicyProperties,\n KeyRotationPolicy,\n KeyRotationLifetimeAction,\n UpdateKeyRotationPolicyOptions,\n GetKeyRotationPolicyOptions,\n logger,\n};\n\n/**\n * The KeyClient provides methods to manage {@link KeyVaultKey} in the\n * Azure Key Vault. The client supports creating, retrieving, updating,\n * deleting, purging, backing up, restoring and listing KeyVaultKeys. The\n * client also supports listing {@link DeletedKey} for a soft-delete enabled Azure Key\n * Vault.\n */\nexport class KeyClient {\n /**\n * The base URL to the vault\n */\n public readonly vaultUrl: string;\n\n /**\n * A reference to the auto-generated Key Vault HTTP client.\n */\n private readonly client: KeyVaultClient;\n\n /**\n * A reference to the credential that was used to construct this client.\n * Later used to instantiate a {@link CryptographyClient} with the same credential.\n */\n private readonly credential: TokenCredential;\n\n /**\n * Creates an instance of KeyClient.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleCreateClient\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * // Build the URL to reach your key vault\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`; // or `https://${vaultName}.managedhsm.azure.net` for managed HSM.\n *\n * // Lastly, create our keys client and connect to the service\n * const client = new KeyClient(url, credential);\n * ```\n * @param vaultUrl - the URL of the Key Vault. It should have this shape: `https://${your-key-vault-name}.vault.azure.net`. You should validate that this URL references a valid Key Vault or Managed HSM resource. See https://aka.ms/azsdk/blog/vault-uri for details.\n * @param credential - An object that implements the `TokenCredential` interface used to authenticate requests to the service. Use the \\@azure/identity package to create a credential that suits your needs.\n * @param pipelineOptions - Pipeline options used to configure Key Vault API requests. Omit this parameter to use the default pipeline configuration.\n */\n constructor(\n vaultUrl: string,\n credential: TokenCredential,\n pipelineOptions: KeyClientOptions = {},\n ) {\n this.vaultUrl = vaultUrl;\n\n const libInfo = `azsdk-js-keyvault-keys/${SDK_VERSION}`;\n\n const userAgentOptions = pipelineOptions.userAgentOptions;\n\n pipelineOptions.userAgentOptions = {\n userAgentPrefix:\n userAgentOptions && userAgentOptions.userAgentPrefix\n ? `${userAgentOptions.userAgentPrefix} ${libInfo}`\n : libInfo,\n };\n\n const internalPipelineOptions: KeyVaultClientOptionalParams = {\n ...pipelineOptions,\n apiVersion: pipelineOptions.serviceVersion || LATEST_API_VERSION,\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\n \"x-ms-keyvault-region\",\n \"x-ms-keyvault-network-info\",\n \"x-ms-keyvault-service-version\",\n ],\n },\n };\n\n this.credential = credential;\n this.client = new KeyVaultClient(vaultUrl, credential, internalPipelineOptions);\n\n this.client.pipeline.removePolicy({ name: bearerTokenAuthenticationPolicyName });\n this.client.pipeline.addPolicy(keyVaultAuthenticationPolicy(credential, pipelineOptions));\n // Workaround for: https://github.com/Azure/azure-sdk-for-js/issues/31843\n this.client.pipeline.addPolicy({\n name: \"ContentTypePolicy\",\n sendRequest(request, next) {\n const contentType = request.headers.get(\"Content-Type\") ?? \"\";\n if (contentType.startsWith(\"application/json\")) {\n request.headers.set(\"Content-Type\", \"application/json\");\n }\n return next(request);\n },\n });\n }\n\n /**\n * The create key operation can be used to create any key type in Azure Key Vault. If the named key\n * already exists, Azure Key Vault creates a new version of the key. It requires the keys/create\n * permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleCreateKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n * const result = await client.createKey(keyName, \"RSA\");\n * console.log(\"result: \", result);\n * ```\n * Creates a new key, stores it, then returns key parameters and properties to the client.\n * @param name - The name of the key.\n * @param keyType - The type of the key. One of the following: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct'.\n * @param options - The optional parameters.\n */\n public createKey(\n name: string,\n keyType: KeyType,\n options: CreateKeyOptions = {},\n ): Promise<KeyVaultKey> {\n return tracingClient.withSpan(\"KeyClient.createKey\", options, async (updatedOptions) => {\n const response = await this.client.createKey(\n name,\n {\n kty: keyType,\n curve: options?.curve,\n keyAttributes: {\n enabled: options?.enabled,\n notBefore: options?.notBefore,\n expires: options?.expiresOn,\n exportable: options?.exportable,\n },\n keyOps: options?.keyOps,\n keySize: options?.keySize,\n releasePolicy: options?.releasePolicy,\n tags: options?.tags,\n },\n updatedOptions,\n );\n return getKeyFromKeyBundle(response);\n });\n }\n\n /**\n * The createEcKey method creates a new elliptic curve key in Azure Key Vault. If the named key\n * already exists, Azure Key Vault creates a new version of the key. It requires the keys/create\n * permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleCreateEcKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n * const result = await client.createEcKey(keyName, { curve: \"P-256\" });\n * console.log(\"result: \", result);\n * ```\n * Creates a new key, stores it, then returns key parameters and properties to the client.\n * @param name - The name of the key.\n * @param options - The optional parameters.\n */\n public async createEcKey(name: string, options?: CreateEcKeyOptions): Promise<KeyVaultKey> {\n const keyType = options?.hsm ? KnownKeyTypes.ECHSM : KnownKeyTypes.EC;\n return this.createKey(name, keyType, options);\n }\n\n /**\n * The createRSAKey method creates a new RSA key in Azure Key Vault. If the named key\n * already exists, Azure Key Vault creates a new version of the key. It requires the keys/create\n * permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleCreateRsaKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n * const result = await client.createRsaKey(\"MyKey\", { keySize: 2048 });\n * console.log(\"result: \", result);\n * ```\n * Creates a new key, stores it, then returns key parameters and properties to the client.\n * @param name - The name of the key.\n * @param options - The optional parameters.\n */\n public async createRsaKey(name: string, options?: CreateRsaKeyOptions): Promise<KeyVaultKey> {\n const keyType = options?.hsm ? KnownKeyTypes.RSAHSM : KnownKeyTypes.RSA;\n return this.createKey(name, keyType, options);\n }\n\n /**\n * The createOctKey method creates a new OCT key in Azure Key Vault. If the named key\n * already exists, Azure Key Vault creates a new version of the key. It requires the keys/create\n * permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleCreateOctKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n * const result = await client.createOctKey(\"MyKey\", { hsm: true });\n * console.log(\"result: \", result);\n * ```\n * Creates a new key, stores it, then returns key parameters and properties to the client.\n * @param name - The name of the key.\n * @param options - The optional parameters.\n */\n public async createOctKey(name: string, options?: CreateOctKeyOptions): Promise<KeyVaultKey> {\n const keyType = options?.hsm ? KnownKeyTypes.OctHSM : KnownKeyTypes.Oct;\n return this.createKey(name, keyType, options);\n }\n\n /**\n * The import key operation may be used to import any key type into an Azure Key Vault. If the\n * named key already exists, Azure Key Vault creates a new version of the key. This operation\n * requires the keys/import permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleImportKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const jsonWebKey = {\n * kty: \"RSA\",\n * kid: \"test-key-123\",\n * use: \"sig\",\n * alg: \"RS256\",\n * n: new Uint8Array([112, 34, 56, 98, 123, 244, 200, 99]),\n * e: new Uint8Array([1, 0, 1]),\n * d: new Uint8Array([45, 67, 89, 23, 144, 200, 76, 233]),\n * p: new Uint8Array([34, 89, 100, 77, 204, 56, 29, 77]),\n * q: new Uint8Array([78, 99, 201, 45, 188, 34, 67, 90]),\n * dp: new Uint8Array([23, 45, 78, 56, 200, 144, 32, 67]),\n * dq: new Uint8Array([12, 67, 89, 144, 99, 56, 23, 45]),\n * qi: new Uint8Array([78, 90, 45, 201, 34, 67, 120, 55]),\n * };\n *\n * const result = await client.importKey(\"MyKey\", jsonWebKey);\n * ```\n * Imports an externally created key, stores it, and returns key parameters and properties\n * to the client.\n * @param name - Name for the imported key.\n * @param key - The JSON web key.\n * @param options - The optional parameters.\n */\n public importKey(\n name: string,\n key: JsonWebKey,\n options: ImportKeyOptions = {},\n ): Promise<KeyVaultKey> {\n return tracingClient.withSpan(`KeyClient.importKey`, options, async (updatedOptions) => {\n const { enabled, notBefore, expiresOn: expires, exportable, releasePolicy, tags } = options;\n const keyAttributes = {\n enabled,\n notBefore,\n expires,\n exportable,\n };\n const parameters = {\n key,\n hsm: options?.hardwareProtected,\n keyAttributes,\n releasePolicy,\n tags,\n };\n const response = await this.client.importKey(name, parameters, updatedOptions);\n return getKeyFromKeyBundle(response);\n });\n }\n\n /**\n * Gets a {@link CryptographyClient} for the given key.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleGetCryptographyClient\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * // Get a cryptography client for a given key\n * const cryptographyClient = client.getCryptographyClient(\"MyKey\");\n * ```\n * @param name - The name of the key used to perform cryptographic operations.\n * @param version - Optional version of the key used to perform cryptographic operations.\n * @returns - A {@link CryptographyClient} using the same options, credentials, and http client as this {@link KeyClient}\n */\n public getCryptographyClient(\n keyName: string,\n options?: GetCryptographyClientOptions,\n ): CryptographyClient {\n const keyUrl = new URL(\n [\"keys\", keyName, options?.keyVersion].filter(Boolean).join(\"/\"),\n this.vaultUrl,\n );\n\n // The goals of this method are discoverability and performance (by sharing a client and pipeline).\n // The existing cryptography client does not accept a pipeline as an argument, nor does it expose it.\n // In order to avoid publicly exposing the pipeline we will pass in the underlying client as an undocumented\n // property to the constructor so that crypto providers downstream can use it.\n const constructorOptions: CryptographyClientOptions & { generatedClient: KeyVaultClient } = {\n generatedClient: this.client,\n };\n const cryptoClient = new CryptographyClient(\n keyUrl.toString(),\n this.credential,\n constructorOptions,\n );\n return cryptoClient;\n }\n\n /**\n * The delete operation applies to any key stored in Azure Key Vault. Individual versions\n * of a key can not be deleted, only all versions of a given key at once.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the key is deleted.\n *\n * This operation requires the keys/delete permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleDeleteKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const poller = await client.beginDeleteKey(keyName);\n * await poller.pollUntilDone();\n * ```\n * Deletes a key from a specified key vault.\n * @param name - The name of the key.\n * @param options - The optional parameters.\n */\n public async beginDeleteKey(\n name: string,\n options: BeginDeleteKeyOptions = {},\n ): Promise<PollerLike<PollOperationState<DeletedKey>, DeletedKey>> {\n const poller = new DeleteKeyPoller({\n name,\n client: this.client,\n intervalInMs: options.intervalInMs,\n resumeFrom: options.resumeFrom,\n operationOptions: options,\n });\n\n // This will initialize the poller's operation (the deletion of the key).\n await poller.poll();\n\n return poller;\n }\n\n /**\n * The updateKeyProperties method changes specified properties of an existing stored key. Properties that\n * are not specified in the request are left unchanged. The value of a key itself cannot be\n * changed. This operation requires the keys/set permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleUpdateKeyProperties\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const result = await client.createKey(keyName, \"RSA\");\n * await client.updateKeyProperties(keyName, result.properties.version, {\n * enabled: false,\n * });\n * ```\n * Updates the properties associated with a specified key in a given key vault.\n * @param name - The name of the key.\n * @param keyVersion - The version of the key.\n * @param options - The optional parameters.\n */\n public updateKeyProperties(\n name: string,\n keyVersion: string,\n options?: UpdateKeyPropertiesOptions,\n ): Promise<KeyVaultKey>;\n /**\n * The updateKeyProperties method changes specified properties of the latest version of an existing stored key. Properties that\n * are not specified in the request are left unchanged. The value of a key itself cannot be\n * changed. This operation requires the keys/set permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleUpdateKeyProperties\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const result = await client.createKey(keyName, \"RSA\");\n * await client.updateKeyProperties(keyName, result.properties.version, {\n * enabled: false,\n * });\n * ```\n * Updates the properties associated with a specified key in a given key vault.\n * @param name - The name of the key.\n * @param keyVersion - The version of the key.\n * @param options - The optional parameters.\n */\n public updateKeyProperties(\n name: string,\n options?: UpdateKeyPropertiesOptions,\n ): Promise<KeyVaultKey>;\n public updateKeyProperties(\n ...args: [string, string, UpdateKeyPropertiesOptions?] | [string, UpdateKeyPropertiesOptions?]\n ): Promise<KeyVaultKey> {\n const [name, keyVersion, options] = this.disambiguateUpdateKeyPropertiesArgs(args);\n return tracingClient.withSpan(\n `KeyClient.updateKeyProperties`,\n options,\n async (updatedOptions) => {\n const response = await this.client.updateKey(\n name,\n keyVersion,\n {\n keyAttributes: {\n enabled: options?.enabled,\n notBefore: options?.notBefore,\n expires: options?.expiresOn,\n },\n keyOps: options?.keyOps,\n releasePolicy: options?.releasePolicy,\n tags: options?.tags,\n },\n updatedOptions,\n );\n return getKeyFromKeyBundle(response);\n },\n );\n }\n\n /**\n * Standardizes an overloaded arguments collection for the updateKeyProperties method.\n *\n * @param args - The arguments collection.\n * @returns - The standardized arguments collection.\n */\n private disambiguateUpdateKeyPropertiesArgs(\n args: [string, string, UpdateKeyPropertiesOptions?] | [string, UpdateKeyPropertiesOptions?],\n ): [string, string, UpdateKeyPropertiesOptions] {\n if (typeof args[1] === \"string\") {\n // [name, keyVersion, options?] => [name, keyVersion, options || {}]\n return [args[0], args[1], args[2] || {}];\n } else {\n // [name, options?] => [name , \"\", options || {}]\n return [args[0], \"\", args[1] || {}];\n }\n }\n\n /**\n * The getKey method gets a specified key and is applicable to any key stored in Azure Key Vault.\n * This operation requires the keys/get permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleGetKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const latestKey = await client.getKey(keyName);\n * console.log(`Latest version of the key ${keyName}: `, latestKey);\n *\n * const specificKey = await client.getKey(keyName, { version: latestKey.properties.version! });\n * console.log(`The key ${keyName} at the version ${latestKey.properties.version!}: `, specificKey);\n * ```\n * Get a specified key from a given key vault.\n * @param name - The name of the key.\n * @param options - The optional parameters.\n */\n public getKey(name: string, options: GetKeyOptions = {}): Promise<KeyVaultKey> {\n return tracingClient.withSpan(`KeyClient.getKey`, options, async (updatedOptions) => {\n const response = await this.client.getKey(name, options.version || \"\", updatedOptions);\n return getKeyFromKeyBundle(response);\n });\n }\n\n /**\n * The getKeyAttestation method gets a specified key and its attestation blob and is applicable to any key stored in Azure Key Vault Managed HSM.\n * This operation requires the keys/get permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleGetKeyAttestation\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT MANAGED HSM NAME>\";\n * const url = `https://${vaultName}.managedhsm.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const latestKey = await client.getKeyAttestation(keyName);\n * console.log(`Latest version of the key ${keyName}: `, latestKey);\n *\n * const specificKey = await client.getKeyAttestation(keyName, {\n * version: latestKey.properties.version!,\n * });\n * console.log(`The key ${keyName} at the version ${latestKey.properties.version!}: `, specificKey);\n * ```\n * Get a specified key from a given key vault.\n * @param name - The name of the key.\n * @param options - The optional parameters.\n */\n public getKeyAttestation(\n name: string,\n options: GetKeyAttestationOptions = {},\n ): Promise<KeyVaultKey> {\n return tracingClient.withSpan(\n `KeyClient.getKeyAttestation`,\n options,\n async (updatedOptions) => {\n const response = await this.client.getKeyAttestation(\n name,\n updatedOptions.version ?? \"\",\n updatedOptions,\n );\n return getKeyFromKeyBundle(response);\n },\n );\n }\n\n /**\n * The getDeletedKey method returns the specified deleted key along with its properties.\n * This operation requires the keys/get permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleGetDeletedKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * await client.getDeletedKey(keyName);\n * ```\n * Gets the specified deleted key.\n * @param name - The name of the key.\n * @param options - The optional parameters.\n */\n public getDeletedKey(name: string, options: GetDeletedKeyOptions = {}): Promise<DeletedKey> {\n return tracingClient.withSpan(`KeyClient.getDeletedKey`, options, async (updatedOptions) => {\n const response = await this.client.getDeletedKey(name, updatedOptions);\n return getKeyFromKeyBundle(response);\n });\n }\n\n /**\n * The purge deleted key operation removes the key permanently, without the possibility of\n * recovery. This operation can only be enabled on a soft-delete enabled vault. This operation\n * requires the keys/purge permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSamplePurgeDeletedKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const deletePoller = await client.beginDeleteKey(keyName);\n * await deletePoller.pollUntilDone();\n *\n * await client.purgeDeletedKey(keyName);\n * ```\n * Permanently deletes the specified key.\n * @param name - The name of the key.\n * @param options - The optional parameters.\n */\n public purgeDeletedKey(name: string, options: PurgeDeletedKeyOptions = {}): Promise<void> {\n return tracingClient.withSpan(`KeyClient.purgeDeletedKey`, options, async (updatedOptions) => {\n await this.client.purgeDeletedKey(name, updatedOptions);\n });\n }\n\n /**\n * Recovers the deleted key in the specified vault. This operation can only be performed on a\n * soft-delete enabled vault.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the deleted key is recovered.\n *\n * This operation requires the keys/recover permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleRecoverDeletedKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const deletePoller = await client.beginDeleteKey(keyName);\n * await deletePoller.pollUntilDone();\n *\n * const recoverPoller = await client.beginRecoverDeletedKey(keyName);\n * const recoveredKey = await recoverPoller.pollUntilDone();\n * ```\n * Recovers the deleted key to the latest version.\n * @param name - The name of the deleted key.\n * @param options - The optional parameters.\n */\n public async beginRecoverDeletedKey(\n name: string,\n options: BeginRecoverDeletedKeyOptions = {},\n ): Promise<PollerLike<PollOperationState<DeletedKey>, DeletedKey>> {\n const poller = new RecoverDeletedKeyPoller({\n name,\n client: this.client,\n intervalInMs: options.intervalInMs,\n resumeFrom: options.resumeFrom,\n operationOptions: options,\n });\n // This will initialize the poller's operation (the deletion of the key).\n await poller.poll();\n return poller;\n }\n\n /**\n * Requests that a backup of the specified key be downloaded to the client. All versions of the\n * key will be downloaded. This operation requires the keys/backup permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleBackupKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const backupContents = await client.backupKey(keyName);\n * ```\n * Backs up the specified key.\n * @param name - The name of the key.\n * @param options - The optional parameters.\n */\n public backupKey(name: string, options: BackupKeyOptions = {}): Promise<Uint8Array | undefined> {\n return tracingClient.withSpan(`KeyClient.backupKey`, options, async (updatedOptions) => {\n const response = await this.client.backupKey(name, updatedOptions);\n return response.value;\n });\n }\n\n /**\n * Restores a backed up key, and all its versions, to a vault. This operation requires the\n * keys/restore permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleRestoreKeyBackup\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const backupContents = await client.backupKey(keyName);\n *\n * const key = await client.restoreKeyBackup(backupContents);\n * ```\n * Restores a backed up key to a vault.\n * @param backup - The backup blob associated with a key bundle.\n * @param options - The optional parameters.\n */\n public async restoreKeyBackup(\n backup: Uint8Array,\n options: RestoreKeyBackupOptions = {},\n ): Promise<KeyVaultKey> {\n return tracingClient.withSpan(`KeyClient.restoreKeyBackup`, options, async (updatedOptions) => {\n const response = await this.client.restoreKey({ keyBundleBackup: backup }, updatedOptions);\n return getKeyFromKeyBundle(response);\n });\n }\n\n /**\n * Gets the requested number of bytes containing random values from a managed HSM.\n * This operation requires the managedHsm/rng permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleGetRandomBytes\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const bytes = await client.getRandomBytes(10);\n * ```\n * @param count - The number of bytes to generate between 1 and 128 inclusive.\n * @param options - The optional parameters.\n */\n public getRandomBytes(count: number, options: GetRandomBytesOptions = {}): Promise<Uint8Array> {\n return tracingClient.withSpan(\"KeyClient.getRandomBytes\", options, async (updatedOptions) => {\n const response = await this.client.getRandomBytes({ count }, updatedOptions);\n return response.value!;\n });\n }\n\n /**\n * Rotates the key based on the key policy by generating a new version of the key. This operation requires the keys/rotate permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleKeyRotation\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * // Set the key's automated rotation policy to rotate the key 30 days before expiry.\n * const policy = await client.updateKeyRotationPolicy(keyName, {\n * lifetimeActions: [\n * {\n * action: \"Rotate\",\n * timeBeforeExpiry: \"P30D\",\n * },\n * ],\n * // You may also specify the duration after which any newly rotated key will expire.\n * // In this case, any new key versions will expire after 90 days.\n * expiresIn: \"P90D\",\n * });\n *\n * // You can get the current key rotation policy of a given key by calling the getKeyRotationPolicy method.\n * const currentPolicy = await client.getKeyRotationPolicy(keyName);\n *\n * // Finally, you can rotate a key on-demand by creating a new version of the given key.\n * const rotatedKey = await client.rotateKey(keyName);\n * ```\n *\n * @param name - The name of the key to rotate.\n * @param options - The optional parameters.\n */\n public rotateKey(name: string, options: RotateKeyOptions = {}): Promise<KeyVaultKey> {\n return tracingClient.withSpan(\"KeyClient.rotateKey\", options, async (updatedOptions) => {\n const key = await this.client.rotateKey(name, updatedOptions);\n return getKeyFromKeyBundle(key);\n });\n }\n\n /**\n * Releases a key from a managed HSM.\n *\n * The release key operation is applicable to all key types. The operation requires the key to be marked exportable and the keys/release permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleReleaseKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const result = await client.releaseKey(\"myKey\", \"<attestation-target>\");\n * ```\n *\n * @param name - The name of the key.\n * @param targetAttestationToken - The attestation assertion for the target of the key release.\n * @param options - The optional parameters.\n */\n public releaseKey(\n name: string,\n targetAttestationToken: string,\n options: ReleaseKeyOptions = {},\n ): Promise<ReleaseKeyResult> {\n return tracingClient.withSpan(\"KeyClient.releaseKey\", options, async (updatedOptions) => {\n const { nonce, algorithm, ...rest } = updatedOptions;\n const result = await this.client.release(\n name,\n options?.version || \"\",\n {\n targetAttestationToken,\n enc: algorithm,\n nonce,\n },\n rest,\n );\n\n return { value: result.value! };\n });\n }\n\n /**\n * Gets the rotation policy of a Key Vault Key.\n * By default, all keys have a policy that will notify 30 days before expiry.\n *\n * This operation requires the keys/get permission.\n * Example usage:\n * ```ts snippet:ReadmeSampleGetKeyRotationPolicy\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const result = await client.getKeyRotationPolicy(keyName);\n * ```\n *\n * @param keyName - The name of the key.\n * @param options - The optional parameters.\n */\n public getKeyRotationPolicy(\n keyName: string,\n options: GetKeyRotationPolicyOptions = {},\n ): Promise<KeyRotationPolicy> {\n return tracingClient.withSpan(\"KeyClient.getKeyRotationPolicy\", options, async () => {\n const policy = await this.client.getKeyRotationPolicy(keyName);\n return keyRotationTransformations.generatedToPublic(policy);\n });\n }\n\n /**\n * Updates the rotation policy of a Key Vault Key.\n * This operation requires the keys/update permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleUpdateKeyRotationPolicy\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const myPolicy = await client.getKeyRotationPolicy(keyName);\n *\n * const setPolicy = await client.updateKeyRotationPolicy(keyName, myPolicy);\n * ```\n *\n * @param keyName - The name of the key.\n * @param policyProperties - The {@link KeyRotationPolicyProperties} for the policy.\n * @param options - The optional parameters.\n */\n public updateKeyRotationPolicy(\n keyName: string,\n policy: KeyRotationPolicyProperties,\n options: UpdateKeyRotationPolicyOptions = {},\n ): Promise<KeyRotationPolicy> {\n return tracingClient.withSpan(\n \"KeyClient.updateKeyRotationPolicy\",\n options,\n async (updatedOptions) => {\n const result = await this.client.updateKeyRotationPolicy(\n keyName,\n keyRotationTransformations.propertiesToGenerated(policy),\n updatedOptions,\n );\n return keyRotationTransformations.generatedToPublic(result);\n },\n );\n }\n\n /**\n * Iterates all versions of the given key in the vault. The full key identifier, properties, and tags are provided\n * in the response. This operation requires the keys/list permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleListKeys\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * for await (const keyProperties of client.listPropertiesOfKeys()) {\n * console.log(\"Key properties: \", keyProperties);\n * }\n *\n * for await (const deletedKey of client.listDeletedKeys()) {\n * console.log(\"Deleted: \", deletedKey);\n * }\n *\n * for await (const versionProperties of client.listPropertiesOfKeyVersions(keyName)) {\n * console.log(\"Version properties: \", versionProperties);\n * }\n * ```\n * @param name - Name of the key to fetch versions for\n * @param options - The optional parameters.\n */\n public listPropertiesOfKeyVersions(\n name: string,\n options: ListPropertiesOfKeyVersionsOptions = {},\n ): PagedAsyncIterableIterator<KeyProperties> {\n return mapPagedAsyncIterable(\n options,\n (mappedOptions) => this.client.getKeyVersions(name, mappedOptions),\n getKeyPropertiesFromKeyItem,\n );\n }\n\n /**\n * Iterates the latest version of all keys in the vault. The full key identifier and properties are provided\n * in the response. No values are returned for the keys. This operations requires the keys/list permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleListKeys\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * for await (const keyProperties of client.listPropertiesOfKeys()) {\n * console.log(\"Key properties: \", keyProperties);\n * }\n *\n * for await (const deletedKey of client.listDeletedKeys()) {\n * console.log(\"Deleted: \", deletedKey);\n * }\n *\n * for await (const versionProperties of client.listPropertiesOfKeyVersions(keyName)) {\n * console.log(\"Version properties: \", versionProperties);\n * }\n * ```\n * List all keys in the vault\n * @param options - The optional parameters.\n */\n public listPropertiesOfKeys(\n options: ListPropertiesOfKeysOptions = {},\n ): PagedAsyncIterableIterator<KeyProperties> {\n return mapPagedAsyncIterable(\n options,\n this.client.getKeys.bind(this.client),\n getKeyPropertiesFromKeyItem,\n );\n }\n\n /**\n * Iterates the deleted keys in the vault. The full key identifier and properties are provided\n * in the response. No values are returned for the keys. This operations requires the keys/list permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleListKeys\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * for await (const keyProperties of client.listPropertiesOfKeys()) {\n * console.log(\"Key properties: \", keyProperties);\n * }\n *\n * for await (const deletedKey of client.listDeletedKeys()) {\n * console.log(\"Deleted: \", deletedKey);\n * }\n *\n * for await (const versionProperties of client.listPropertiesOfKeyVersions(keyName)) {\n * console.log(\"Version properties: \", versionProperties);\n * }\n * ```\n * List all keys in the vault\n * @param options - The optional parameters.\n */\n public listDeletedKeys(\n options: ListDeletedKeysOptions = {},\n ): PagedAsyncIterableIterator<DeletedKey> {\n return mapPagedAsyncIterable(\n options,\n this.client.getDeletedKeys.bind(this.client),\n getDeletedKeyFromDeletedKeyItem,\n );\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,4CAA4C;AAG5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,OAAO,EAAyB,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAEpG,OAAO,EAAE,cAAc,EAAE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C5C,+BAA+B,CAChC,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n/// <reference lib=\"esnext.asynciterable\" />\n\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { logger } from \"./log.js\";\nimport { PageSettings, PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { PollOperationState, PollerLike } from \"@azure/core-lro\";\nimport { DeletionRecoveryLevel, KnownDeletionRecoveryLevel } from \"./generated/src/models/index.js\";\nimport type { KeyVaultClientOptionalParams } from \"./generated/src/keyVaultClient.js\";\nimport { KeyVaultClient } from \"./generated/src/keyVaultClient.js\";\nimport { SDK_VERSION } from \"./constants.js\";\nimport { keyVaultAuthenticationPolicy } from \"@azure/keyvault-common\";\nimport { DeleteKeyPoller } from \"./lro/delete/poller.js\";\nimport { RecoverDeletedKeyPoller } from \"./lro/recover/poller.js\";\nimport {\n BackupKeyOptions,\n BeginDeleteKeyOptions,\n BeginRecoverDeletedKeyOptions,\n CreateEcKeyOptions,\n CreateKeyOptions,\n CreateOctKeyOptions,\n CreateRsaKeyOptions,\n CryptographyClientOptions,\n CryptographyOptions,\n DeletedKey,\n GetCryptographyClientOptions,\n GetDeletedKeyOptions,\n GetKeyAttestationOptions,\n GetKeyOptions,\n GetKeyRotationPolicyOptions,\n GetRandomBytesOptions,\n ImportKeyOptions,\n JsonWebKey,\n KeyAttestation,\n KeyClientOptions,\n KeyExportEncryptionAlgorithm,\n KeyOperation,\n KeyPollerOptions,\n KeyProperties,\n KeyReleasePolicy,\n KeyRotationLifetimeAction,\n KeyRotationPolicy,\n KeyRotationPolicyAction,\n KeyRotationPolicyProperties,\n KeyType,\n KeyVaultKey,\n KnownKeyOperations,\n LATEST_API_VERSION,\n ListDeletedKeysOptions,\n ListPropertiesOfKeyVersionsOptions,\n ListPropertiesOfKeysOptions,\n PurgeDeletedKeyOptions,\n ReleaseKeyOptions,\n ReleaseKeyResult,\n RestoreKeyBackupOptions,\n RotateKeyOptions,\n UpdateKeyPropertiesOptions,\n UpdateKeyRotationPolicyOptions,\n} from \"./keysModels.js\";\nimport { CryptographyClient } from \"./cryptographyClient.js\";\nimport {\n AesCbcDecryptParameters,\n AesCbcEncryptParameters,\n AesCbcEncryptionAlgorithm,\n AesGcmDecryptParameters,\n AesGcmEncryptParameters,\n AesGcmEncryptionAlgorithm,\n DecryptOptions,\n DecryptParameters,\n DecryptResult,\n EncryptOptions,\n EncryptParameters,\n EncryptResult,\n EncryptionAlgorithm,\n KeyCurveName,\n KeyWrapAlgorithm,\n KnownKeyExportEncryptionAlgorithm,\n KnownEncryptionAlgorithms,\n KnownKeyTypes,\n KnownKeyCurveNames,\n KnownSignatureAlgorithms,\n RsaDecryptParameters,\n RsaEncryptParameters,\n RsaEncryptionAlgorithm,\n SignOptions,\n SignResult,\n SignatureAlgorithm,\n UnwrapKeyOptions,\n UnwrapResult,\n VerifyDataOptions,\n VerifyOptions,\n VerifyResult,\n WrapKeyOptions,\n WrapResult,\n} from \"./cryptographyClientModels.js\";\nimport { KeyVaultKeyIdentifier, parseKeyVaultKeyIdentifier } from \"./identifier.js\";\nimport {\n getDeletedKeyFromDeletedKeyItem,\n getKeyFromKeyBundle,\n getKeyPropertiesFromKeyItem,\n keyRotationTransformations,\n mapPagedAsyncIterable,\n} from \"./transformations.js\";\nimport { tracingClient } from \"./tracing.js\";\nimport { bearerTokenAuthenticationPolicyName } from \"@azure/core-rest-pipeline\";\n\nexport {\n CryptographyClientOptions,\n KeyClientOptions,\n BackupKeyOptions,\n CreateEcKeyOptions,\n CreateKeyOptions,\n CreateRsaKeyOptions,\n CreateOctKeyOptions,\n CryptographyClient,\n CryptographyOptions,\n RsaEncryptionAlgorithm,\n RsaDecryptParameters,\n AesGcmEncryptionAlgorithm,\n AesGcmDecryptParameters,\n AesCbcEncryptionAlgorithm,\n AesCbcDecryptParameters,\n DecryptParameters,\n DecryptOptions,\n DecryptResult,\n DeletedKey,\n DeletionRecoveryLevel,\n KnownDeletionRecoveryLevel,\n RsaEncryptParameters,\n AesGcmEncryptParameters,\n AesCbcEncryptParameters,\n EncryptParameters,\n EncryptOptions,\n EncryptResult,\n GetDeletedKeyOptions,\n GetKeyAttestationOptions,\n GetKeyOptions,\n GetRandomBytesOptions,\n ImportKeyOptions,\n JsonWebKey,\n KeyAttestation,\n KeyCurveName,\n KnownKeyCurveNames,\n KnownKeyExportEncryptionAlgorithm,\n EncryptionAlgorithm,\n KnownEncryptionAlgorithms,\n KeyOperation,\n KnownKeyOperations,\n KeyType,\n KnownKeyTypes,\n KeyPollerOptions,\n BeginDeleteKeyOptions,\n BeginRecoverDeletedKeyOptions,\n KeyProperties,\n SignatureAlgorithm,\n KnownSignatureAlgorithms,\n KeyVaultKey,\n KeyWrapAlgorithm,\n ListPropertiesOfKeysOptions,\n ListPropertiesOfKeyVersionsOptions,\n ListDeletedKeysOptions,\n PageSettings,\n PagedAsyncIterableIterator,\n KeyVaultKeyIdentifier,\n parseKeyVaultKeyIdentifier,\n PollOperationState,\n PollerLike,\n PurgeDeletedKeyOptions,\n RestoreKeyBackupOptions,\n RotateKeyOptions,\n SignOptions,\n SignResult,\n UnwrapKeyOptions,\n UnwrapResult,\n UpdateKeyPropertiesOptions,\n VerifyOptions,\n VerifyDataOptions,\n VerifyResult,\n WrapKeyOptions,\n WrapResult,\n ReleaseKeyOptions,\n ReleaseKeyResult,\n KeyReleasePolicy,\n KeyExportEncryptionAlgorithm,\n GetCryptographyClientOptions,\n KeyRotationPolicyAction,\n KeyRotationPolicyProperties,\n KeyRotationPolicy,\n KeyRotationLifetimeAction,\n UpdateKeyRotationPolicyOptions,\n GetKeyRotationPolicyOptions,\n logger,\n};\n\n/**\n * The KeyClient provides methods to manage {@link KeyVaultKey} in the\n * Azure Key Vault. The client supports creating, retrieving, updating,\n * deleting, purging, backing up, restoring and listing KeyVaultKeys. The\n * client also supports listing {@link DeletedKey} for a soft-delete enabled Azure Key\n * Vault.\n */\nexport class KeyClient {\n /**\n * The base URL to the vault\n */\n public readonly vaultUrl: string;\n\n /**\n * A reference to the auto-generated Key Vault HTTP client.\n */\n private readonly client: KeyVaultClient;\n\n /**\n * A reference to the credential that was used to construct this client.\n * Later used to instantiate a {@link CryptographyClient} with the same credential.\n */\n private readonly credential: TokenCredential;\n\n /**\n * Creates an instance of KeyClient.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleCreateClient\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * // Build the URL to reach your key vault\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`; // or `https://${vaultName}.managedhsm.azure.net` for managed HSM.\n *\n * // Lastly, create our keys client and connect to the service\n * const client = new KeyClient(url, credential);\n * ```\n * @param vaultUrl - the URL of the Key Vault. It should have this shape: `https://${your-key-vault-name}.vault.azure.net`. You should validate that this URL references a valid Key Vault or Managed HSM resource. See https://aka.ms/azsdk/blog/vault-uri for details.\n * @param credential - An object that implements the `TokenCredential` interface used to authenticate requests to the service. Use the \\@azure/identity package to create a credential that suits your needs.\n * @param pipelineOptions - Pipeline options used to configure Key Vault API requests. Omit this parameter to use the default pipeline configuration.\n */\n constructor(\n vaultUrl: string,\n credential: TokenCredential,\n pipelineOptions: KeyClientOptions = {},\n ) {\n this.vaultUrl = vaultUrl;\n\n const libInfo = `azsdk-js-keyvault-keys/${SDK_VERSION}`;\n\n const userAgentOptions = pipelineOptions.userAgentOptions;\n\n pipelineOptions.userAgentOptions = {\n userAgentPrefix:\n userAgentOptions && userAgentOptions.userAgentPrefix\n ? `${userAgentOptions.userAgentPrefix} ${libInfo}`\n : libInfo,\n };\n\n const internalPipelineOptions: KeyVaultClientOptionalParams = {\n ...pipelineOptions,\n apiVersion: pipelineOptions.serviceVersion || LATEST_API_VERSION,\n loggingOptions: {\n logger: logger.info,\n additionalAllowedHeaderNames: [\n \"x-ms-keyvault-region\",\n \"x-ms-keyvault-network-info\",\n \"x-ms-keyvault-service-version\",\n ],\n },\n };\n\n this.credential = credential;\n this.client = new KeyVaultClient(vaultUrl, credential, internalPipelineOptions);\n\n this.client.pipeline.removePolicy({ name: bearerTokenAuthenticationPolicyName });\n this.client.pipeline.addPolicy(keyVaultAuthenticationPolicy(credential, pipelineOptions));\n // Workaround for: https://github.com/Azure/azure-sdk-for-js/issues/31843\n this.client.pipeline.addPolicy({\n name: \"ContentTypePolicy\",\n sendRequest(request, next) {\n const contentType = request.headers.get(\"Content-Type\") ?? \"\";\n if (contentType.startsWith(\"application/json\")) {\n request.headers.set(\"Content-Type\", \"application/json\");\n }\n return next(request);\n },\n });\n }\n\n /**\n * The create key operation can be used to create any key type in Azure Key Vault. If the named key\n * already exists, Azure Key Vault creates a new version of the key. It requires the keys/create\n * permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleCreateKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n * const result = await client.createKey(keyName, \"RSA\");\n * console.log(\"result: \", result);\n * ```\n * Creates a new key, stores it, then returns key parameters and properties to the client.\n * @param name - The name of the key.\n * @param keyType - The type of the key. One of the following: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct'.\n * @param options - The optional parameters.\n */\n public createKey(\n name: string,\n keyType: KeyType,\n options: CreateKeyOptions = {},\n ): Promise<KeyVaultKey> {\n return tracingClient.withSpan(\"KeyClient.createKey\", options, async (updatedOptions) => {\n const response = await this.client.createKey(\n name,\n {\n kty: keyType,\n curve: options?.curve,\n keyAttributes: {\n enabled: options?.enabled,\n notBefore: options?.notBefore,\n expires: options?.expiresOn,\n exportable: options?.exportable,\n },\n keyOps: options?.keyOps,\n keySize: options?.keySize,\n releasePolicy: options?.releasePolicy,\n tags: options?.tags,\n },\n updatedOptions,\n );\n return getKeyFromKeyBundle(response);\n });\n }\n\n /**\n * The createEcKey method creates a new elliptic curve key in Azure Key Vault. If the named key\n * already exists, Azure Key Vault creates a new version of the key. It requires the keys/create\n * permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleCreateEcKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n * const result = await client.createEcKey(keyName, { curve: \"P-256\" });\n * console.log(\"result: \", result);\n * ```\n * Creates a new key, stores it, then returns key parameters and properties to the client.\n * @param name - The name of the key.\n * @param options - The optional parameters.\n */\n public async createEcKey(name: string, options?: CreateEcKeyOptions): Promise<KeyVaultKey> {\n const keyType = options?.hsm ? KnownKeyTypes.ECHSM : KnownKeyTypes.EC;\n return this.createKey(name, keyType, options);\n }\n\n /**\n * The createRSAKey method creates a new RSA key in Azure Key Vault. If the named key\n * already exists, Azure Key Vault creates a new version of the key. It requires the keys/create\n * permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleCreateRsaKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n * const result = await client.createRsaKey(\"MyKey\", { keySize: 2048 });\n * console.log(\"result: \", result);\n * ```\n * Creates a new key, stores it, then returns key parameters and properties to the client.\n * @param name - The name of the key.\n * @param options - The optional parameters.\n */\n public async createRsaKey(name: string, options?: CreateRsaKeyOptions): Promise<KeyVaultKey> {\n const keyType = options?.hsm ? KnownKeyTypes.RSAHSM : KnownKeyTypes.RSA;\n return this.createKey(name, keyType, options);\n }\n\n /**\n * The createOctKey method creates a new OCT key in Azure Key Vault. If the named key\n * already exists, Azure Key Vault creates a new version of the key. It requires the keys/create\n * permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleCreateOctKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n * const result = await client.createOctKey(\"MyKey\", { hsm: true });\n * console.log(\"result: \", result);\n * ```\n * Creates a new key, stores it, then returns key parameters and properties to the client.\n * @param name - The name of the key.\n * @param options - The optional parameters.\n */\n public async createOctKey(name: string, options?: CreateOctKeyOptions): Promise<KeyVaultKey> {\n const keyType = options?.hsm ? KnownKeyTypes.OctHSM : KnownKeyTypes.Oct;\n return this.createKey(name, keyType, options);\n }\n\n /**\n * The import key operation may be used to import any key type into an Azure Key Vault. If the\n * named key already exists, Azure Key Vault creates a new version of the key. This operation\n * requires the keys/import permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleImportKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const jsonWebKey = {\n * kty: \"RSA\",\n * kid: \"test-key-123\",\n * use: \"sig\",\n * alg: \"RS256\",\n * n: new Uint8Array([112, 34, 56, 98, 123, 244, 200, 99]),\n * e: new Uint8Array([1, 0, 1]),\n * d: new Uint8Array([45, 67, 89, 23, 144, 200, 76, 233]),\n * p: new Uint8Array([34, 89, 100, 77, 204, 56, 29, 77]),\n * q: new Uint8Array([78, 99, 201, 45, 188, 34, 67, 90]),\n * dp: new Uint8Array([23, 45, 78, 56, 200, 144, 32, 67]),\n * dq: new Uint8Array([12, 67, 89, 144, 99, 56, 23, 45]),\n * qi: new Uint8Array([78, 90, 45, 201, 34, 67, 120, 55]),\n * };\n *\n * const result = await client.importKey(\"MyKey\", jsonWebKey);\n * ```\n * Imports an externally created key, stores it, and returns key parameters and properties\n * to the client.\n * @param name - Name for the imported key.\n * @param key - The JSON web key.\n * @param options - The optional parameters.\n */\n public importKey(\n name: string,\n key: JsonWebKey,\n options: ImportKeyOptions = {},\n ): Promise<KeyVaultKey> {\n return tracingClient.withSpan(`KeyClient.importKey`, options, async (updatedOptions) => {\n const { enabled, notBefore, expiresOn: expires, exportable, releasePolicy, tags } = options;\n const keyAttributes = {\n enabled,\n notBefore,\n expires,\n exportable,\n };\n const parameters = {\n key,\n hsm: options?.hardwareProtected,\n keyAttributes,\n releasePolicy,\n tags,\n };\n const response = await this.client.importKey(name, parameters, updatedOptions);\n return getKeyFromKeyBundle(response);\n });\n }\n\n /**\n * Gets a {@link CryptographyClient} for the given key.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleGetCryptographyClient\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * // Get a cryptography client for a given key\n * const cryptographyClient = client.getCryptographyClient(\"MyKey\");\n * ```\n * @param name - The name of the key used to perform cryptographic operations.\n * @param version - Optional version of the key used to perform cryptographic operations.\n * @returns - A {@link CryptographyClient} using the same options, credentials, and http client as this {@link KeyClient}\n */\n public getCryptographyClient(\n keyName: string,\n options?: GetCryptographyClientOptions,\n ): CryptographyClient {\n const keyUrl = new URL(\n [\"keys\", keyName, options?.keyVersion].filter(Boolean).join(\"/\"),\n this.vaultUrl,\n );\n\n // The goals of this method are discoverability and performance (by sharing a client and pipeline).\n // The existing cryptography client does not accept a pipeline as an argument, nor does it expose it.\n // In order to avoid publicly exposing the pipeline we will pass in the underlying client as an undocumented\n // property to the constructor so that crypto providers downstream can use it.\n const constructorOptions: CryptographyClientOptions & { generatedClient: KeyVaultClient } = {\n generatedClient: this.client,\n };\n const cryptoClient = new CryptographyClient(\n keyUrl.toString(),\n this.credential,\n constructorOptions,\n );\n return cryptoClient;\n }\n\n /**\n * The delete operation applies to any key stored in Azure Key Vault. Individual versions\n * of a key can not be deleted, only all versions of a given key at once.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the key is deleted.\n *\n * This operation requires the keys/delete permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleDeleteKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const poller = await client.beginDeleteKey(keyName);\n * await poller.pollUntilDone();\n * ```\n * Deletes a key from a specified key vault.\n * @param name - The name of the key.\n * @param options - The optional parameters.\n */\n public async beginDeleteKey(\n name: string,\n options: BeginDeleteKeyOptions = {},\n ): Promise<PollerLike<PollOperationState<DeletedKey>, DeletedKey>> {\n const poller = new DeleteKeyPoller({\n name,\n client: this.client,\n intervalInMs: options.intervalInMs,\n resumeFrom: options.resumeFrom,\n operationOptions: options,\n });\n\n // This will initialize the poller's operation (the deletion of the key).\n await poller.poll();\n\n return poller;\n }\n\n /**\n * The updateKeyProperties method changes specified properties of an existing stored key. Properties that\n * are not specified in the request are left unchanged. The value of a key itself cannot be\n * changed. This operation requires the keys/set permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleUpdateKeyProperties\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const result = await client.createKey(keyName, \"RSA\");\n * await client.updateKeyProperties(keyName, result.properties.version, {\n * enabled: false,\n * });\n * ```\n * Updates the properties associated with a specified key in a given key vault.\n * @param name - The name of the key.\n * @param keyVersion - The version of the key.\n * @param options - The optional parameters.\n */\n public updateKeyProperties(\n name: string,\n keyVersion: string,\n options?: UpdateKeyPropertiesOptions,\n ): Promise<KeyVaultKey>;\n /**\n * The updateKeyProperties method changes specified properties of the latest version of an existing stored key. Properties that\n * are not specified in the request are left unchanged. The value of a key itself cannot be\n * changed. This operation requires the keys/set permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleUpdateKeyProperties\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const result = await client.createKey(keyName, \"RSA\");\n * await client.updateKeyProperties(keyName, result.properties.version, {\n * enabled: false,\n * });\n * ```\n * Updates the properties associated with a specified key in a given key vault.\n * @param name - The name of the key.\n * @param keyVersion - The version of the key.\n * @param options - The optional parameters.\n */\n public updateKeyProperties(\n name: string,\n options?: UpdateKeyPropertiesOptions,\n ): Promise<KeyVaultKey>;\n public updateKeyProperties(\n ...args: [string, string, UpdateKeyPropertiesOptions?] | [string, UpdateKeyPropertiesOptions?]\n ): Promise<KeyVaultKey> {\n const [name, keyVersion, options] = this.disambiguateUpdateKeyPropertiesArgs(args);\n return tracingClient.withSpan(\n `KeyClient.updateKeyProperties`,\n options,\n async (updatedOptions) => {\n const response = await this.client.updateKey(\n name,\n keyVersion,\n {\n keyAttributes: {\n enabled: options?.enabled,\n notBefore: options?.notBefore,\n expires: options?.expiresOn,\n },\n keyOps: options?.keyOps,\n releasePolicy: options?.releasePolicy,\n tags: options?.tags,\n },\n updatedOptions,\n );\n return getKeyFromKeyBundle(response);\n },\n );\n }\n\n /**\n * Standardizes an overloaded arguments collection for the updateKeyProperties method.\n *\n * @param args - The arguments collection.\n * @returns - The standardized arguments collection.\n */\n private disambiguateUpdateKeyPropertiesArgs(\n args: [string, string, UpdateKeyPropertiesOptions?] | [string, UpdateKeyPropertiesOptions?],\n ): [string, string, UpdateKeyPropertiesOptions] {\n if (typeof args[1] === \"string\") {\n // [name, keyVersion, options?] => [name, keyVersion, options || {}]\n return [args[0], args[1], args[2] || {}];\n } else {\n // [name, options?] => [name , \"\", options || {}]\n return [args[0], \"\", args[1] || {}];\n }\n }\n\n /**\n * The getKey method gets a specified key and is applicable to any key stored in Azure Key Vault.\n * This operation requires the keys/get permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleGetKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const latestKey = await client.getKey(keyName);\n * console.log(`Latest version of the key ${keyName}: `, latestKey);\n *\n * const specificKey = await client.getKey(keyName, { version: latestKey.properties.version! });\n * console.log(`The key ${keyName} at the version ${latestKey.properties.version!}: `, specificKey);\n * ```\n * Get a specified key from a given key vault.\n * @param name - The name of the key.\n * @param options - The optional parameters.\n */\n public getKey(name: string, options: GetKeyOptions = {}): Promise<KeyVaultKey> {\n return tracingClient.withSpan(`KeyClient.getKey`, options, async (updatedOptions) => {\n const response = await this.client.getKey(name, options.version || \"\", updatedOptions);\n return getKeyFromKeyBundle(response);\n });\n }\n\n /**\n * The getKeyAttestation method gets a specified key and its attestation blob and is applicable to any key stored in Azure Key Vault Managed HSM.\n * This operation requires the keys/get permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleGetKeyAttestation\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT MANAGED HSM NAME>\";\n * const url = `https://${vaultName}.managedhsm.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const latestKey = await client.getKeyAttestation(keyName);\n * console.log(`Latest version of the key ${keyName}: `, latestKey);\n *\n * const specificKey = await client.getKeyAttestation(keyName, {\n * version: latestKey.properties.version!,\n * });\n * console.log(`The key ${keyName} at the version ${latestKey.properties.version!}: `, specificKey);\n * ```\n * Get a specified key from a given key vault.\n * @param name - The name of the key.\n * @param options - The optional parameters.\n */\n public getKeyAttestation(\n name: string,\n options: GetKeyAttestationOptions = {},\n ): Promise<KeyVaultKey> {\n return tracingClient.withSpan(\n `KeyClient.getKeyAttestation`,\n options,\n async (updatedOptions) => {\n const response = await this.client.getKeyAttestation(\n name,\n updatedOptions.version ?? \"\",\n updatedOptions,\n );\n return getKeyFromKeyBundle(response);\n },\n );\n }\n\n /**\n * The getDeletedKey method returns the specified deleted key along with its properties.\n * This operation requires the keys/get permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleGetDeletedKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * await client.getDeletedKey(keyName);\n * ```\n * Gets the specified deleted key.\n * @param name - The name of the key.\n * @param options - The optional parameters.\n */\n public getDeletedKey(name: string, options: GetDeletedKeyOptions = {}): Promise<DeletedKey> {\n return tracingClient.withSpan(`KeyClient.getDeletedKey`, options, async (updatedOptions) => {\n const response = await this.client.getDeletedKey(name, updatedOptions);\n return getKeyFromKeyBundle(response);\n });\n }\n\n /**\n * The purge deleted key operation removes the key permanently, without the possibility of\n * recovery. This operation can only be enabled on a soft-delete enabled vault. This operation\n * requires the keys/purge permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSamplePurgeDeletedKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const deletePoller = await client.beginDeleteKey(keyName);\n * await deletePoller.pollUntilDone();\n *\n * await client.purgeDeletedKey(keyName);\n * ```\n * Permanently deletes the specified key.\n * @param name - The name of the key.\n * @param options - The optional parameters.\n */\n public purgeDeletedKey(name: string, options: PurgeDeletedKeyOptions = {}): Promise<void> {\n return tracingClient.withSpan(`KeyClient.purgeDeletedKey`, options, async (updatedOptions) => {\n await this.client.purgeDeletedKey(name, updatedOptions);\n });\n }\n\n /**\n * Recovers the deleted key in the specified vault. This operation can only be performed on a\n * soft-delete enabled vault.\n *\n * This function returns a Long Running Operation poller that allows you to wait indefinitely until the deleted key is recovered.\n *\n * This operation requires the keys/recover permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleRecoverDeletedKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const deletePoller = await client.beginDeleteKey(keyName);\n * await deletePoller.pollUntilDone();\n *\n * const recoverPoller = await client.beginRecoverDeletedKey(keyName);\n * const recoveredKey = await recoverPoller.pollUntilDone();\n * ```\n * Recovers the deleted key to the latest version.\n * @param name - The name of the deleted key.\n * @param options - The optional parameters.\n */\n public async beginRecoverDeletedKey(\n name: string,\n options: BeginRecoverDeletedKeyOptions = {},\n ): Promise<PollerLike<PollOperationState<DeletedKey>, DeletedKey>> {\n const poller = new RecoverDeletedKeyPoller({\n name,\n client: this.client,\n intervalInMs: options.intervalInMs,\n resumeFrom: options.resumeFrom,\n operationOptions: options,\n });\n // This will initialize the poller's operation (the deletion of the key).\n await poller.poll();\n return poller;\n }\n\n /**\n * Requests that a backup of the specified key be downloaded to the client. All versions of the\n * key will be downloaded. This operation requires the keys/backup permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleBackupKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const backupContents = await client.backupKey(keyName);\n * ```\n * Backs up the specified key.\n * @param name - The name of the key.\n * @param options - The optional parameters.\n */\n public backupKey(name: string, options: BackupKeyOptions = {}): Promise<Uint8Array | undefined> {\n return tracingClient.withSpan(`KeyClient.backupKey`, options, async (updatedOptions) => {\n const response = await this.client.backupKey(name, updatedOptions);\n return response.value;\n });\n }\n\n /**\n * Restores a backed up key, and all its versions, to a vault. This operation requires the\n * keys/restore permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleRestoreKeyBackup\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const backupContents = await client.backupKey(keyName);\n *\n * const key = await client.restoreKeyBackup(backupContents);\n * ```\n * Restores a backed up key to a vault.\n * @param backup - The backup blob associated with a key bundle.\n * @param options - The optional parameters.\n */\n public async restoreKeyBackup(\n backup: Uint8Array,\n options: RestoreKeyBackupOptions = {},\n ): Promise<KeyVaultKey> {\n return tracingClient.withSpan(`KeyClient.restoreKeyBackup`, options, async (updatedOptions) => {\n const response = await this.client.restoreKey({ keyBundleBackup: backup }, updatedOptions);\n return getKeyFromKeyBundle(response);\n });\n }\n\n /**\n * Gets the requested number of bytes containing random values from a managed HSM.\n * This operation requires the managedHsm/rng permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleGetRandomBytes\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const bytes = await client.getRandomBytes(10);\n * ```\n * @param count - The number of bytes to generate between 1 and 128 inclusive.\n * @param options - The optional parameters.\n */\n public getRandomBytes(count: number, options: GetRandomBytesOptions = {}): Promise<Uint8Array> {\n return tracingClient.withSpan(\"KeyClient.getRandomBytes\", options, async (updatedOptions) => {\n const response = await this.client.getRandomBytes({ count }, updatedOptions);\n return response.value!;\n });\n }\n\n /**\n * Rotates the key based on the key policy by generating a new version of the key. This operation requires the keys/rotate permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleKeyRotation\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * // Set the key's automated rotation policy to rotate the key 30 days before expiry.\n * const policy = await client.updateKeyRotationPolicy(keyName, {\n * lifetimeActions: [\n * {\n * action: \"Rotate\",\n * timeBeforeExpiry: \"P30D\",\n * },\n * ],\n * // You may also specify the duration after which any newly rotated key will expire.\n * // In this case, any new key versions will expire after 90 days.\n * expiresIn: \"P90D\",\n * });\n *\n * // You can get the current key rotation policy of a given key by calling the getKeyRotationPolicy method.\n * const currentPolicy = await client.getKeyRotationPolicy(keyName);\n *\n * // Finally, you can rotate a key on-demand by creating a new version of the given key.\n * const rotatedKey = await client.rotateKey(keyName);\n * ```\n *\n * @param name - The name of the key to rotate.\n * @param options - The optional parameters.\n */\n public rotateKey(name: string, options: RotateKeyOptions = {}): Promise<KeyVaultKey> {\n return tracingClient.withSpan(\"KeyClient.rotateKey\", options, async (updatedOptions) => {\n const key = await this.client.rotateKey(name, updatedOptions);\n return getKeyFromKeyBundle(key);\n });\n }\n\n /**\n * Releases a key from a managed HSM.\n *\n * The release key operation is applicable to all key types. The operation requires the key to be marked exportable and the keys/release permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleReleaseKey\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const result = await client.releaseKey(\"myKey\", \"<attestation-target>\");\n * ```\n *\n * @param name - The name of the key.\n * @param targetAttestationToken - The attestation assertion for the target of the key release.\n * @param options - The optional parameters.\n */\n public releaseKey(\n name: string,\n targetAttestationToken: string,\n options: ReleaseKeyOptions = {},\n ): Promise<ReleaseKeyResult> {\n return tracingClient.withSpan(\"KeyClient.releaseKey\", options, async (updatedOptions) => {\n const { nonce, algorithm, ...rest } = updatedOptions;\n const result = await this.client.release(\n name,\n options?.version || \"\",\n {\n targetAttestationToken,\n enc: algorithm,\n nonce,\n },\n rest,\n );\n\n return { value: result.value! };\n });\n }\n\n /**\n * Gets the rotation policy of a Key Vault Key.\n * By default, all keys have a policy that will notify 30 days before expiry.\n *\n * This operation requires the keys/get permission.\n * Example usage:\n * ```ts snippet:ReadmeSampleGetKeyRotationPolicy\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const result = await client.getKeyRotationPolicy(keyName);\n * ```\n *\n * @param keyName - The name of the key.\n * @param options - The optional parameters.\n */\n public getKeyRotationPolicy(\n keyName: string,\n options: GetKeyRotationPolicyOptions = {},\n ): Promise<KeyRotationPolicy> {\n return tracingClient.withSpan(\"KeyClient.getKeyRotationPolicy\", options, async () => {\n const policy = await this.client.getKeyRotationPolicy(keyName);\n return keyRotationTransformations.generatedToPublic(policy);\n });\n }\n\n /**\n * Updates the rotation policy of a Key Vault Key.\n * This operation requires the keys/update permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleUpdateKeyRotationPolicy\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * const myPolicy = await client.getKeyRotationPolicy(keyName);\n *\n * const setPolicy = await client.updateKeyRotationPolicy(keyName, myPolicy);\n * ```\n *\n * @param keyName - The name of the key.\n * @param policyProperties - The {@link KeyRotationPolicyProperties} for the policy.\n * @param options - The optional parameters.\n */\n public updateKeyRotationPolicy(\n keyName: string,\n policy: KeyRotationPolicyProperties,\n options: UpdateKeyRotationPolicyOptions = {},\n ): Promise<KeyRotationPolicy> {\n return tracingClient.withSpan(\n \"KeyClient.updateKeyRotationPolicy\",\n options,\n async (updatedOptions) => {\n const result = await this.client.updateKeyRotationPolicy(\n keyName,\n keyRotationTransformations.propertiesToGenerated(policy),\n updatedOptions,\n );\n return keyRotationTransformations.generatedToPublic(result);\n },\n );\n }\n\n /**\n * Iterates all versions of the given key in the vault. The full key identifier, properties, and tags are provided\n * in the response. This operation requires the keys/list permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleListKeys\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * for await (const keyProperties of client.listPropertiesOfKeys()) {\n * console.log(\"Key properties: \", keyProperties);\n * }\n *\n * for await (const deletedKey of client.listDeletedKeys()) {\n * console.log(\"Deleted: \", deletedKey);\n * }\n *\n * for await (const versionProperties of client.listPropertiesOfKeyVersions(keyName)) {\n * console.log(\"Version properties: \", versionProperties);\n * }\n * ```\n * @param name - Name of the key to fetch versions for\n * @param options - The optional parameters.\n */\n public listPropertiesOfKeyVersions(\n name: string,\n options: ListPropertiesOfKeyVersionsOptions = {},\n ): PagedAsyncIterableIterator<KeyProperties> {\n return mapPagedAsyncIterable(\n options,\n (mappedOptions) => this.client.getKeyVersions(name, mappedOptions),\n getKeyPropertiesFromKeyItem,\n );\n }\n\n /**\n * Iterates the latest version of all keys in the vault. The full key identifier and properties are provided\n * in the response. No values are returned for the keys. This operations requires the keys/list permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleListKeys\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * for await (const keyProperties of client.listPropertiesOfKeys()) {\n * console.log(\"Key properties: \", keyProperties);\n * }\n *\n * for await (const deletedKey of client.listDeletedKeys()) {\n * console.log(\"Deleted: \", deletedKey);\n * }\n *\n * for await (const versionProperties of client.listPropertiesOfKeyVersions(keyName)) {\n * console.log(\"Version properties: \", versionProperties);\n * }\n * ```\n * List all keys in the vault\n * @param options - The optional parameters.\n */\n public listPropertiesOfKeys(\n options: ListPropertiesOfKeysOptions = {},\n ): PagedAsyncIterableIterator<KeyProperties> {\n return mapPagedAsyncIterable(\n options,\n this.client.getKeys.bind(this.client),\n getKeyPropertiesFromKeyItem,\n );\n }\n\n /**\n * Iterates the deleted keys in the vault. The full key identifier and properties are provided\n * in the response. No values are returned for the keys. This operations requires the keys/list permission.\n *\n * Example usage:\n * ```ts snippet:ReadmeSampleListKeys\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import { KeyClient } from \"@azure/keyvault-keys\";\n *\n * const credential = new DefaultAzureCredential();\n *\n * const vaultName = \"<YOUR KEYVAULT NAME>\";\n * const url = `https://${vaultName}.vault.azure.net`;\n *\n * const client = new KeyClient(url, credential);\n *\n * const keyName = \"MyKeyName\";\n *\n * for await (const keyProperties of client.listPropertiesOfKeys()) {\n * console.log(\"Key properties: \", keyProperties);\n * }\n *\n * for await (const deletedKey of client.listDeletedKeys()) {\n * console.log(\"Deleted: \", deletedKey);\n * }\n *\n * for await (const versionProperties of client.listPropertiesOfKeyVersions(keyName)) {\n * console.log(\"Version properties: \", versionProperties);\n * }\n * ```\n * List all keys in the vault\n * @param options - The optional parameters.\n */\n public listDeletedKeys(\n options: ListDeletedKeysOptions = {},\n ): PagedAsyncIterableIterator<DeletedKey> {\n return mapPagedAsyncIterable(\n options,\n this.client.getDeletedKeys.bind(this.client),\n getDeletedKeyFromDeletedKeyItem,\n );\n }\n}\n"]}
@@ -4,6 +4,9 @@ import { tracingClient } from "../../tracing.js";
4
4
  import { getKeyFromKeyBundle } from "../../transformations.js";
5
5
  import { KeyVaultKeyPollOperation } from "../keyVaultKeyPoller.js";
6
6
  export class DeleteKeyPollOperation extends KeyVaultKeyPollOperation {
7
+ state;
8
+ client;
9
+ operationOptions;
7
10
  constructor(state, client, operationOptions = {}) {
8
11
  super(state, { cancelMessage: "Canceling the deletion of a key is not supported." });
9
12
  this.state = state;
@@ -1 +1 @@
1
- {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../../src/lro/delete/operation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAOnE,MAAM,OAAO,sBAAuB,SAAQ,wBAG3C;IACC,YACS,KAAkC,EACjC,MAAsB,EACtB,mBAAqC,EAAE;QAE/C,KAAK,CAAC,KAAK,EAAE,EAAE,aAAa,EAAE,mDAAmD,EAAE,CAAC,CAAC;QAJ9E,UAAK,GAAL,KAAK,CAA6B;QACjC,WAAM,GAAN,MAAM,CAAgB;QACtB,qBAAgB,GAAhB,gBAAgB,CAAuB;IAGjD,CAAC;IAED;;;OAGG;IACK,SAAS,CAAC,IAAY,EAAE,UAA4B,EAAE;QAC5D,OAAO,aAAa,CAAC,QAAQ,CAAC,2BAA2B,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE;YAC3F,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;YACnE,OAAO,mBAAmB,CAAC,QAAQ,CA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YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;oBAC7B,6EAA6E;oBAC7E,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;gBAC3B,CAAC;qBAAM,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;oBACpC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;oBACpB,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;oBACzB,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type { OperationOptions } from \"@azure-rest/core-client\";\nimport type { KeyVaultClient } from \"../../generated/src/keyVaultClient.js\";\nimport type { DeleteKeyOptions, DeletedKey, GetDeletedKeyOptions } from \"../../keysModels.js\";\nimport { tracingClient } from \"../../tracing.js\";\nimport { getKeyFromKeyBundle } from \"../../transformations.js\";\nimport type { KeyVaultKeyPollOperationState } from \"../keyVaultKeyPoller.js\";\nimport { KeyVaultKeyPollOperation } from \"../keyVaultKeyPoller.js\";\n\n/**\n * An interface representing the state of a delete key's poll operation\n */\nexport interface DeleteKeyPollOperationState extends KeyVaultKeyPollOperationState<DeletedKey> {}\n\nexport class DeleteKeyPollOperation extends KeyVaultKeyPollOperation<\n DeleteKeyPollOperationState,\n DeletedKey\n> {\n constructor(\n public state: DeleteKeyPollOperationState,\n private client: KeyVaultClient,\n private operationOptions: OperationOptions = {},\n ) {\n super(state, { cancelMessage: \"Canceling the deletion of a key is not supported.\" });\n }\n\n /**\n * Sends a delete request for the given Key Vault Key's name to the Key Vault service.\n * Since the Key Vault Key won't be immediately deleted, we have {@link beginDeleteKey}.\n */\n private deleteKey(name: string, options: DeleteKeyOptions = {}): Promise<DeletedKey> {\n return tracingClient.withSpan(\"DeleteKeyPoller.deleteKey\", options, async (updatedOptions) => {\n const response = await this.client.deleteKey(name, updatedOptions);\n return getKeyFromKeyBundle(response);\n });\n }\n\n /**\n * The getDeletedKey method returns the specified deleted key along with its properties.\n * This operation requires the keys/get permission.\n */\n private getDeletedKey(name: string, options: GetDeletedKeyOptions = {}): Promise<DeletedKey> {\n return tracingClient.withSpan(\n \"DeleteKeyPoller.getDeletedKey\",\n options,\n async (updatedOptions) => {\n const response = await this.client.getDeletedKey(name, updatedOptions);\n return getKeyFromKeyBundle(response);\n },\n );\n }\n\n /**\n * Reaches to the service and updates the delete key's poll operation.\n */\n public async update(\n options: {\n abortSignal?: AbortSignalLike;\n fireProgress?: (state: DeleteKeyPollOperationState) => void;\n } = {},\n ): Promise<DeleteKeyPollOperation> {\n const state = this.state;\n const { name } = state;\n\n if (options.abortSignal) {\n this.operationOptions.abortSignal = options.abortSignal;\n }\n\n if (!state.isStarted) {\n const deletedKey = await this.deleteKey(name, this.operationOptions);\n state.isStarted = true;\n state.result = deletedKey;\n if (!deletedKey.properties.recoveryId) {\n state.isCompleted = true;\n }\n }\n\n if (!state.isCompleted) {\n try {\n state.result = await this.getDeletedKey(name, this.operationOptions);\n state.isCompleted = true;\n } catch (error: any) {\n if (error.statusCode === 403) {\n // At this point, the resource exists but the user doesn't have access to it.\n state.isCompleted = true;\n } else if (error.statusCode !== 404) {\n state.error = error;\n state.isCompleted = true;\n throw error;\n }\n }\n }\n\n return this;\n }\n}\n"]}
1
+ {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../../src/lro/delete/operation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAOnE,MAAM,OAAO,sBAAuB,SAAQ,wBAG3C;IAEU;IAC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rB,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACrE,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;YACvB,KAAK,CAAC,MAAM,GAAG,UAAU,CAAC;YAC1B,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;gBACtC,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;YAC3B,CAAC;QACH,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;YACvB,IAAI,CAAC;gBACH,KAAK,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;gBACrE,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;YAC3B,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;oBAC7B,6EAA6E;oBAC7E,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;gBAC3B,CAAC;qBAAM,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;oBACpC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;oBACpB,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;oBACzB,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type { OperationOptions } from \"@azure-rest/core-client\";\nimport type { KeyVaultClient } from \"../../generated/src/keyVaultClient.js\";\nimport type { DeleteKeyOptions, DeletedKey, GetDeletedKeyOptions } from \"../../keysModels.js\";\nimport { tracingClient } from \"../../tracing.js\";\nimport { getKeyFromKeyBundle } from \"../../transformations.js\";\nimport type { KeyVaultKeyPollOperationState } from \"../keyVaultKeyPoller.js\";\nimport { KeyVaultKeyPollOperation } from \"../keyVaultKeyPoller.js\";\n\n/**\n * An interface representing the state of a delete key's poll operation\n */\nexport interface DeleteKeyPollOperationState extends KeyVaultKeyPollOperationState<DeletedKey> {}\n\nexport class DeleteKeyPollOperation extends KeyVaultKeyPollOperation<\n DeleteKeyPollOperationState,\n DeletedKey\n> {\n constructor(\n public state: DeleteKeyPollOperationState,\n private client: KeyVaultClient,\n private operationOptions: OperationOptions = {},\n ) {\n super(state, { cancelMessage: \"Canceling the deletion of a key is not supported.\" });\n }\n\n /**\n * Sends a delete request for the given Key Vault Key's name to the Key Vault service.\n * Since the Key Vault Key won't be immediately deleted, we have {@link beginDeleteKey}.\n */\n private deleteKey(name: string, options: DeleteKeyOptions = {}): Promise<DeletedKey> {\n return tracingClient.withSpan(\"DeleteKeyPoller.deleteKey\", options, async (updatedOptions) => {\n const response = await this.client.deleteKey(name, updatedOptions);\n return getKeyFromKeyBundle(response);\n });\n }\n\n /**\n * The getDeletedKey method returns the specified deleted key along with its properties.\n * This operation requires the keys/get permission.\n */\n private getDeletedKey(name: string, options: GetDeletedKeyOptions = {}): Promise<DeletedKey> {\n return tracingClient.withSpan(\n \"DeleteKeyPoller.getDeletedKey\",\n options,\n async (updatedOptions) => {\n const response = await this.client.getDeletedKey(name, updatedOptions);\n return getKeyFromKeyBundle(response);\n },\n );\n }\n\n /**\n * Reaches to the service and updates the delete key's poll operation.\n */\n public async update(\n options: {\n abortSignal?: AbortSignalLike;\n fireProgress?: (state: DeleteKeyPollOperationState) => void;\n } = {},\n ): Promise<DeleteKeyPollOperation> {\n const state = this.state;\n const { name } = state;\n\n if (options.abortSignal) {\n this.operationOptions.abortSignal = options.abortSignal;\n }\n\n if (!state.isStarted) {\n const deletedKey = await this.deleteKey(name, this.operationOptions);\n state.isStarted = true;\n state.result = deletedKey;\n if (!deletedKey.properties.recoveryId) {\n state.isCompleted = true;\n }\n }\n\n if (!state.isCompleted) {\n try {\n state.result = await this.getDeletedKey(name, this.operationOptions);\n state.isCompleted = true;\n } catch (error: any) {\n if (error.statusCode === 403) {\n // At this point, the resource exists but the user doesn't have access to it.\n state.isCompleted = true;\n } else if (error.statusCode !== 404) {\n state.error = error;\n state.isCompleted = true;\n throw error;\n }\n }\n }\n\n return this;\n }\n}\n"]}
@@ -12,7 +12,10 @@ export class DeleteKeyPoller extends KeyVaultKeyPoller {
12
12
  if (resumeFrom) {
13
13
  state = JSON.parse(resumeFrom).state;
14
14
  }
15
- const operation = new DeleteKeyPollOperation(Object.assign(Object.assign({}, state), { name }), client, operationOptions);
15
+ const operation = new DeleteKeyPollOperation({
16
+ ...state,
17
+ name,
18
+ }, client, operationOptions);
16
19
  super(operation);
17
20
  this.intervalInMs = intervalInMs;
18
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"poller.js","sourceRoot":"","sources":["../../../../src/lro/delete/poller.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAGxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,iBAA0D;IAC7F,YAAY,OAAiC;QAC3C,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,YAAY,GAAG,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QAEpF,IAAI,KAA8C,CAAC;QAEnD,IAAI,UAAU,EAAE,CAAC;YACf,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC;QACvC,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,sBAAsB,iCAErC,KAAK,KACR,IAAI,KAEN,MAAM,EACN,gBAAgB,CACjB,CAAC;QAEF,KAAK,CAAC,SAAS,CAAC,CAAC;QAEjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { DeleteKeyPollOperationState } from \"./operation.js\";\nimport { DeleteKeyPollOperation } from \"./operation.js\";\nimport type { DeletedKey } from \"../../keysModels.js\";\nimport type { KeyVaultKeyPollerOptions } from \"../keyVaultKeyPoller.js\";\nimport { KeyVaultKeyPoller } from \"../keyVaultKeyPoller.js\";\n\n/**\n * Class that creates a poller that waits until a key finishes being deleted.\n */\nexport class DeleteKeyPoller extends KeyVaultKeyPoller<DeleteKeyPollOperationState, DeletedKey> {\n constructor(options: KeyVaultKeyPollerOptions) {\n const { client, name, operationOptions, intervalInMs = 2000, resumeFrom } = options;\n\n let state: DeleteKeyPollOperationState | undefined;\n\n if (resumeFrom) {\n state = JSON.parse(resumeFrom).state;\n }\n\n const operation = new DeleteKeyPollOperation(\n {\n ...state,\n name,\n },\n client,\n operationOptions,\n );\n\n super(operation);\n\n this.intervalInMs = intervalInMs;\n }\n}\n"]}
1
+ {"version":3,"file":"poller.js","sourceRoot":"","sources":["../../../../src/lro/delete/poller.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAGxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,iBAA0D;IAC7F,YAAY,OAAiC;QAC3C,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,YAAY,GAAG,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QAEpF,IAAI,KAA8C,CAAC;QAEnD,IAAI,UAAU,EAAE,CAAC;YACf,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC;QACvC,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,sBAAsB,CAC1C;YACE,GAAG,KAAK;YACR,IAAI;SACL,EACD,MAAM,EACN,gBAAgB,CACjB,CAAC;QAEF,KAAK,CAAC,SAAS,CAAC,CAAC;QAEjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { DeleteKeyPollOperationState } from \"./operation.js\";\nimport { DeleteKeyPollOperation } from \"./operation.js\";\nimport type { DeletedKey } from \"../../keysModels.js\";\nimport type { KeyVaultKeyPollerOptions } from \"../keyVaultKeyPoller.js\";\nimport { KeyVaultKeyPoller } from \"../keyVaultKeyPoller.js\";\n\n/**\n * Class that creates a poller that waits until a key finishes being deleted.\n */\nexport class DeleteKeyPoller extends KeyVaultKeyPoller<DeleteKeyPollOperationState, DeletedKey> {\n constructor(options: KeyVaultKeyPollerOptions) {\n const { client, name, operationOptions, intervalInMs = 2000, resumeFrom } = options;\n\n let state: DeleteKeyPollOperationState | undefined;\n\n if (resumeFrom) {\n state = JSON.parse(resumeFrom).state;\n }\n\n const operation = new DeleteKeyPollOperation(\n {\n ...state,\n name,\n },\n client,\n operationOptions,\n );\n\n super(operation);\n\n this.intervalInMs = intervalInMs;\n }\n}\n"]}
@@ -6,13 +6,10 @@ import { Poller } from "@azure/core-lro";
6
6
  * Common properties and methods of the Key Vault Key Pollers.
7
7
  */
8
8
  export class KeyVaultKeyPoller extends Poller {
9
- constructor() {
10
- super(...arguments);
11
- /**
12
- * Defines how much time the poller is going to wait before making a new request to the service.
13
- */
14
- this.intervalInMs = 2000;
15
- }
9
+ /**
10
+ * Defines how much time the poller is going to wait before making a new request to the service.
11
+ */
12
+ intervalInMs = 2000;
16
13
  /**
17
14
  * The method used by the poller to wait before attempting to update its operation.
18
15
  */
@@ -24,9 +21,10 @@ export class KeyVaultKeyPoller extends Poller {
24
21
  * Common properties and methods of the Key Vault Key Poller operations.
25
22
  */
26
23
  export class KeyVaultKeyPollOperation {
24
+ state;
25
+ cancelMessage = "";
27
26
  constructor(state, options = {}) {
28
27
  this.state = state;
29
- this.cancelMessage = "";
30
28
  if (options.cancelMessage) {
31
29
  this.cancelMessage = options.cancelMessage;
32
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"keyVaultKeyPoller.js","sourceRoot":"","sources":["../../../src/lro/keyVaultKeyPoller.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAwBzC;;GAEG;AACH,MAAM,OAAgB,iBAGpB,SAAQ,MAAuB;IAHjC;;QAIE;;WAEG;QACI,iBAAY,GAAW,IAAI,CAAC;IAQrC,CAAC;IANC;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC;CACF;AASD;;GAEG;AACH,MAAM,OAAO,wBAAwB;IAGnC,YACS,KAAa,EACpB,UAA2C,EAAE;QADtC,UAAK,GAAL,KAAK,CAAQ;QAHd,kBAAa,GAAW,EAAE,CAAC;QAMjC,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;YAC1B,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC7C,CAAC;IACH,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,MAAM;QACjB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,MAAM;QACjB,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,QAAQ;QACb,OAAO,IAAI,CAAC,SAAS,CAAC;YACpB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OperationOptions } from \"@azure-rest/core-client\";\nimport { delay } from \"@azure/core-util\";\nimport type { PollOperation, PollOperationState } from \"@azure/core-lro\";\nimport { Poller } from \"@azure/core-lro\";\nimport type { KeyVaultClient } from \"../generated/src/keyVaultClient.js\";\n\n/**\n * Common parameters to a Key Vault Key Poller.\n */\nexport interface KeyVaultKeyPollerOptions {\n client: KeyVaultClient;\n name: string;\n operationOptions?: OperationOptions;\n intervalInMs?: number;\n resumeFrom?: string;\n}\n\n/**\n * An interface representing the state of a Key Vault Key Poller's operation.\n */\nexport interface KeyVaultKeyPollOperationState<TResult> extends PollOperationState<TResult> {\n /**\n * The name of the key.\n */\n name: string;\n}\n\n/**\n * Common properties and methods of the Key Vault Key Pollers.\n */\nexport abstract class KeyVaultKeyPoller<\n TState extends KeyVaultKeyPollOperationState<TResult>,\n TResult,\n> extends Poller<TState, TResult> {\n /**\n * Defines how much time the poller is going to wait before making a new request to the service.\n */\n public intervalInMs: number = 2000;\n\n /**\n * The method used by the poller to wait before attempting to update its operation.\n */\n async delay(): Promise<void> {\n return delay(this.intervalInMs);\n }\n}\n\n/**\n * Optional parameters to the KeyVaultKeyPollOperation\n */\nexport interface KeyVaultKeyPollOperationOptions {\n cancelMessage?: string;\n}\n\n/**\n * Common properties and methods of the Key Vault Key Poller operations.\n */\nexport class KeyVaultKeyPollOperation<TState, TResult> implements PollOperation<TState, TResult> {\n private cancelMessage: string = \"\";\n\n constructor(\n public state: TState,\n options: KeyVaultKeyPollOperationOptions = {},\n ) {\n if (options.cancelMessage) {\n this.cancelMessage = options.cancelMessage;\n }\n }\n\n /**\n * Meant to reach to the service and update the Poller operation.\n */\n public async update(): Promise<PollOperation<TState, TResult>> {\n throw new Error(\"Operation not supported.\");\n }\n\n /**\n * Meant to reach to the service and cancel the Poller operation.\n */\n public async cancel(): Promise<PollOperation<TState, TResult>> {\n throw new Error(this.cancelMessage);\n }\n\n /**\n * Serializes the Poller operation.\n */\n public toString(): string {\n return JSON.stringify({\n state: this.state,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"keyVaultKeyPoller.js","sourceRoot":"","sources":["../../../src/lro/keyVaultKeyPoller.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAwBzC;;GAEG;AACH,MAAM,OAAgB,iBAGpB,SAAQ,MAAuB;IAC/B;;OAEG;IACI,YAAY,GAAW,IAAI,CAAC;IAEnC;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC;CACF;AASD;;GAEG;AACH,MAAM,OAAO,wBAAwB;IAI1B;IAHD,aAAa,GAAW,EAAE,CAAC;IAEnC,YACS,KAAa,EACpB,UAA2C,EAAE;QADtC,UAAK,GAAL,KAAK,CAAQ;QAGpB,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;YAC1B,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC7C,CAAC;IACH,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,MAAM;QACjB,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,MAAM;QACjB,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,QAAQ;QACb,OAAO,IAAI,CAAC,SAAS,CAAC;YACpB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { OperationOptions } from \"@azure-rest/core-client\";\nimport { delay } from \"@azure/core-util\";\nimport type { PollOperation, PollOperationState } from \"@azure/core-lro\";\nimport { Poller } from \"@azure/core-lro\";\nimport type { KeyVaultClient } from \"../generated/src/keyVaultClient.js\";\n\n/**\n * Common parameters to a Key Vault Key Poller.\n */\nexport interface KeyVaultKeyPollerOptions {\n client: KeyVaultClient;\n name: string;\n operationOptions?: OperationOptions;\n intervalInMs?: number;\n resumeFrom?: string;\n}\n\n/**\n * An interface representing the state of a Key Vault Key Poller's operation.\n */\nexport interface KeyVaultKeyPollOperationState<TResult> extends PollOperationState<TResult> {\n /**\n * The name of the key.\n */\n name: string;\n}\n\n/**\n * Common properties and methods of the Key Vault Key Pollers.\n */\nexport abstract class KeyVaultKeyPoller<\n TState extends KeyVaultKeyPollOperationState<TResult>,\n TResult,\n> extends Poller<TState, TResult> {\n /**\n * Defines how much time the poller is going to wait before making a new request to the service.\n */\n public intervalInMs: number = 2000;\n\n /**\n * The method used by the poller to wait before attempting to update its operation.\n */\n async delay(): Promise<void> {\n return delay(this.intervalInMs);\n }\n}\n\n/**\n * Optional parameters to the KeyVaultKeyPollOperation\n */\nexport interface KeyVaultKeyPollOperationOptions {\n cancelMessage?: string;\n}\n\n/**\n * Common properties and methods of the Key Vault Key Poller operations.\n */\nexport class KeyVaultKeyPollOperation<TState, TResult> implements PollOperation<TState, TResult> {\n private cancelMessage: string = \"\";\n\n constructor(\n public state: TState,\n options: KeyVaultKeyPollOperationOptions = {},\n ) {\n if (options.cancelMessage) {\n this.cancelMessage = options.cancelMessage;\n }\n }\n\n /**\n * Meant to reach to the service and update the Poller operation.\n */\n public async update(): Promise<PollOperation<TState, TResult>> {\n throw new Error(\"Operation not supported.\");\n }\n\n /**\n * Meant to reach to the service and cancel the Poller operation.\n */\n public async cancel(): Promise<PollOperation<TState, TResult>> {\n throw new Error(this.cancelMessage);\n }\n\n /**\n * Serializes the Poller operation.\n */\n public toString(): string {\n return JSON.stringify({\n state: this.state,\n });\n }\n}\n"]}
@@ -4,6 +4,9 @@ import { tracingClient } from "../../tracing.js";
4
4
  import { getKeyFromKeyBundle } from "../../transformations.js";
5
5
  import { KeyVaultKeyPollOperation } from "../keyVaultKeyPoller.js";
6
6
  export class RecoverDeletedKeyPollOperation extends KeyVaultKeyPollOperation {
7
+ state;
8
+ client;
9
+ operationOptions;
7
10
  constructor(state, client, operationOptions = {}) {
8
11
  super(state, { cancelMessage: "Canceling the recovery of a deleted key is not supported." });
9
12
  this.state = state;
@@ -16,7 +19,7 @@ export class RecoverDeletedKeyPollOperation extends KeyVaultKeyPollOperation {
16
19
  */
17
20
  getKey(name, options = {}) {
18
21
  return tracingClient.withSpan("RecoverDeleteKeyPoller.getKey", options, async (updatedOptions) => {
19
- const response = await this.client.getKey(name, (updatedOptions === null || updatedOptions === void 0 ? void 0 : updatedOptions.version) || "", updatedOptions);
22
+ const response = await this.client.getKey(name, updatedOptions?.version || "", updatedOptions);
20
23
  return getKeyFromKeyBundle(response);
21
24
  });
22
25
  }
@@ -45,7 +48,7 @@ export class RecoverDeletedKeyPollOperation extends KeyVaultKeyPollOperation {
45
48
  state.result = await this.getKey(name, operationOptions);
46
49
  state.isCompleted = true;
47
50
  }
48
- catch (_a) {
51
+ catch {
49
52
  // Nothing to do here.
50
53
  }
51
54
  if (!state.isCompleted) {
@@ -1 +1 @@
1
- {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../../src/lro/recover/operation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAQnE,MAAM,OAAO,8BAA+B,SAAQ,wBAGnD;IACC,YACS,KAA0C,EACzC,MAAsB,EACtB,mBAAqC,EAAE;QAE/C,KAAK,CAAC,KAAK,EAAE,EAAE,aAAa,EAAE,2DAA2D,EAAE,CAAC,CAAC;QAJtF,UAAK,GAAL,KAAK,CAAqC;QACzC,WAAM,GAAN,MAAM,CAAgB;QACtB,qBAAgB,GAAhB,gBAAgB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CAAC;gBACzD,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;YAC3B,CAAC;YAAC,WAAM,CAAC;gBACP,sBAAsB;YACxB,CAAC;YACD,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;gBACvB,KAAK,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;gBACpE,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;YACzB,CAAC;QACH,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;YACvB,IAAI,CAAC;gBACH,KAAK,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;gBACzD,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;YAC3B,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;oBAC7B,6EAA6E;oBAC7E,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;gBAC3B,CAAC;qBAAM,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;oBACpC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;oBACpB,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;oBACzB,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type { OperationOptions } from \"@azure-rest/core-client\";\nimport type { KeyVaultClient } from \"../../generated/src/keyVaultClient.js\";\nimport type { GetKeyOptions, KeyVaultKey, RecoverDeletedKeyOptions } from \"../../keysModels.js\";\nimport { tracingClient } from \"../../tracing.js\";\nimport { getKeyFromKeyBundle } from \"../../transformations.js\";\nimport type { KeyVaultKeyPollOperationState } from \"../keyVaultKeyPoller.js\";\nimport { KeyVaultKeyPollOperation } from \"../keyVaultKeyPoller.js\";\n\n/**\n * An interface representing the state of a delete key's poll operation\n */\nexport interface RecoverDeletedKeyPollOperationState\n extends KeyVaultKeyPollOperationState<KeyVaultKey> {}\n\nexport class RecoverDeletedKeyPollOperation extends KeyVaultKeyPollOperation<\n RecoverDeletedKeyPollOperationState,\n KeyVaultKey\n> {\n constructor(\n public state: RecoverDeletedKeyPollOperationState,\n private client: KeyVaultClient,\n private operationOptions: OperationOptions = {},\n ) {\n super(state, { cancelMessage: \"Canceling the recovery of a deleted key is not supported.\" });\n }\n\n /**\n * The getKey method gets a specified key and is applicable to any key stored in Azure Key Vault.\n * This operation requires the keys/get permission.\n */\n private getKey(name: string, options: GetKeyOptions = {}): Promise<KeyVaultKey> {\n return tracingClient.withSpan(\n \"RecoverDeleteKeyPoller.getKey\",\n options,\n async (updatedOptions) => {\n const response = await this.client.getKey(\n name,\n updatedOptions?.version || \"\",\n updatedOptions,\n );\n return getKeyFromKeyBundle(response);\n },\n );\n }\n\n /**\n * Sends a request to recover a deleted Key Vault Key based on the given name.\n * Since the Key Vault Key won't be immediately recover the deleted key, we have {@link beginRecoverDeletedKey}.\n */\n private async recoverDeletedKey(\n name: string,\n options: RecoverDeletedKeyOptions = {},\n ): Promise<KeyVaultKey> {\n return tracingClient.withSpan(\n \"RecoverDeletedKeyPoller.recoverDeleteKey\",\n options,\n async (updatedOptions) => {\n const response = await this.client.recoverDeletedKey(name, updatedOptions);\n return getKeyFromKeyBundle(response);\n },\n );\n }\n\n /**\n * Reaches to the service and updates the delete key's poll operation.\n */\n public async update(\n options: {\n abortSignal?: AbortSignalLike;\n fireProgress?: (state: RecoverDeletedKeyPollOperationState) => void;\n } = {},\n ): Promise<RecoverDeletedKeyPollOperation> {\n const state = this.state;\n const { name } = state;\n\n const operationOptions = this.operationOptions;\n if (options.abortSignal) {\n operationOptions.abortSignal = options.abortSignal;\n }\n\n if (!state.isStarted) {\n try {\n state.result = await this.getKey(name, operationOptions);\n state.isCompleted = true;\n } catch {\n // Nothing to do here.\n }\n if (!state.isCompleted) {\n state.result = await this.recoverDeletedKey(name, operationOptions);\n state.isStarted = true;\n }\n }\n\n if (!state.isCompleted) {\n try {\n state.result = await this.getKey(name, operationOptions);\n state.isCompleted = true;\n } catch (error: any) {\n if (error.statusCode === 403) {\n // At this point, the resource exists but the user doesn't have access to it.\n state.isCompleted = true;\n } else if (error.statusCode !== 404) {\n state.error = error;\n state.isCompleted = true;\n throw error;\n }\n }\n }\n\n return this;\n }\n}\n"]}
1
+ {"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../../src/lro/recover/operation.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAQnE,MAAM,OAAO,8BAA+B,SAAQ,wBAGnD;IAEU;IACC;IACA;IAHV,YACS,KAA0C,EACzC,MAAsB,EACtB,mBAAqC,EAAE;QAE/C,KAAK,CAAC,KAAK,EAAE,EAAE,aAAa,EAAE,2DAA2D,EAAE,CAAC,CAAC;QAJtF,UAAK,GAAL,KAAK,CAAqC;QACzC,WAAM,GAAN,MAAM,CAAgB;QACtB,qBAAgB,GAAhB,gBAAgB,CAAuB;IAGjD,CAAC;IAED;;;OAGG;IACK,MAAM,CAAC,IAAY,EAAE,UAAyB,EAAE;QACtD,OAAO,aAAa,CAAC,QAAQ,CAC3B,+BAA+B,EAC/B,OAAO,EACP,KAAK,EAAE,cAAc,EAAE,EAAE;YACvB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CACvC,IAAI,EACJ,cAAc,EAAE,OAAO,IAAI,EAAE,EAC7B,cAAc,CACf,CAAC;YACF,OAA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WAAW,EAAE,CAAC;YACvB,IAAI,CAAC;gBACH,KAAK,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;gBACzD,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;YAC3B,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;oBAC7B,6EAA6E;oBAC7E,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;gBAC3B,CAAC;qBAAM,IAAI,KAAK,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;oBACpC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;oBACpB,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;oBACzB,MAAM,KAAK,CAAC;gBACd,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type { OperationOptions } from \"@azure-rest/core-client\";\nimport type { KeyVaultClient } from \"../../generated/src/keyVaultClient.js\";\nimport type { GetKeyOptions, KeyVaultKey, RecoverDeletedKeyOptions } from \"../../keysModels.js\";\nimport { tracingClient } from \"../../tracing.js\";\nimport { getKeyFromKeyBundle } from \"../../transformations.js\";\nimport type { KeyVaultKeyPollOperationState } from \"../keyVaultKeyPoller.js\";\nimport { KeyVaultKeyPollOperation } from \"../keyVaultKeyPoller.js\";\n\n/**\n * An interface representing the state of a delete key's poll operation\n */\nexport interface RecoverDeletedKeyPollOperationState\n extends KeyVaultKeyPollOperationState<KeyVaultKey> {}\n\nexport class RecoverDeletedKeyPollOperation extends KeyVaultKeyPollOperation<\n RecoverDeletedKeyPollOperationState,\n KeyVaultKey\n> {\n constructor(\n public state: RecoverDeletedKeyPollOperationState,\n private client: KeyVaultClient,\n private operationOptions: OperationOptions = {},\n ) {\n super(state, { cancelMessage: \"Canceling the recovery of a deleted key is not supported.\" });\n }\n\n /**\n * The getKey method gets a specified key and is applicable to any key stored in Azure Key Vault.\n * This operation requires the keys/get permission.\n */\n private getKey(name: string, options: GetKeyOptions = {}): Promise<KeyVaultKey> {\n return tracingClient.withSpan(\n \"RecoverDeleteKeyPoller.getKey\",\n options,\n async (updatedOptions) => {\n const response = await this.client.getKey(\n name,\n updatedOptions?.version || \"\",\n updatedOptions,\n );\n return getKeyFromKeyBundle(response);\n },\n );\n }\n\n /**\n * Sends a request to recover a deleted Key Vault Key based on the given name.\n * Since the Key Vault Key won't be immediately recover the deleted key, we have {@link beginRecoverDeletedKey}.\n */\n private async recoverDeletedKey(\n name: string,\n options: RecoverDeletedKeyOptions = {},\n ): Promise<KeyVaultKey> {\n return tracingClient.withSpan(\n \"RecoverDeletedKeyPoller.recoverDeleteKey\",\n options,\n async (updatedOptions) => {\n const response = await this.client.recoverDeletedKey(name, updatedOptions);\n return getKeyFromKeyBundle(response);\n },\n );\n }\n\n /**\n * Reaches to the service and updates the delete key's poll operation.\n */\n public async update(\n options: {\n abortSignal?: AbortSignalLike;\n fireProgress?: (state: RecoverDeletedKeyPollOperationState) => void;\n } = {},\n ): Promise<RecoverDeletedKeyPollOperation> {\n const state = this.state;\n const { name } = state;\n\n const operationOptions = this.operationOptions;\n if (options.abortSignal) {\n operationOptions.abortSignal = options.abortSignal;\n }\n\n if (!state.isStarted) {\n try {\n state.result = await this.getKey(name, operationOptions);\n state.isCompleted = true;\n } catch {\n // Nothing to do here.\n }\n if (!state.isCompleted) {\n state.result = await this.recoverDeletedKey(name, operationOptions);\n state.isStarted = true;\n }\n }\n\n if (!state.isCompleted) {\n try {\n state.result = await this.getKey(name, operationOptions);\n state.isCompleted = true;\n } catch (error: any) {\n if (error.statusCode === 403) {\n // At this point, the resource exists but the user doesn't have access to it.\n state.isCompleted = true;\n } else if (error.statusCode !== 404) {\n state.error = error;\n state.isCompleted = true;\n throw error;\n }\n }\n }\n\n return this;\n }\n}\n"]}
@@ -12,7 +12,10 @@ export class RecoverDeletedKeyPoller extends KeyVaultKeyPoller {
12
12
  if (resumeFrom) {
13
13
  state = JSON.parse(resumeFrom).state;
14
14
  }
15
- const operation = new RecoverDeletedKeyPollOperation(Object.assign(Object.assign({}, state), { name }), client, operationOptions);
15
+ const operation = new RecoverDeletedKeyPollOperation({
16
+ ...state,
17
+ name,
18
+ }, client, operationOptions);
16
19
  super(operation);
17
20
  this.intervalInMs = intervalInMs;
18
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"poller.js","sourceRoot":"","sources":["../../../../src/lro/recover/poller.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAGhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,iBAG5C;IACC,YAAY,OAAiC;QAC3C,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,YAAY,GAAG,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QAEpF,IAAI,KAAsD,CAAC;QAE3D,IAAI,UAAU,EAAE,CAAC;YACf,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC;QACvC,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,8BAA8B,iCAE7C,KAAK,KACR,IAAI,KAEN,MAAM,EACN,gBAAgB,CACjB,CAAC;QAEF,KAAK,CAAC,SAAS,CAAC,CAAC;QAEjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { RecoverDeletedKeyPollOperationState } from \"./operation.js\";\nimport { RecoverDeletedKeyPollOperation } from \"./operation.js\";\nimport type { KeyVaultKey } from \"../../keysModels.js\";\nimport type { KeyVaultKeyPollerOptions } from \"../keyVaultKeyPoller.js\";\nimport { KeyVaultKeyPoller } from \"../keyVaultKeyPoller.js\";\n\n/**\n * Class that deletes a poller that waits until a key finishes being deleted\n */\nexport class RecoverDeletedKeyPoller extends KeyVaultKeyPoller<\n RecoverDeletedKeyPollOperationState,\n KeyVaultKey\n> {\n constructor(options: KeyVaultKeyPollerOptions) {\n const { client, name, operationOptions, intervalInMs = 2000, resumeFrom } = options;\n\n let state: RecoverDeletedKeyPollOperationState | undefined;\n\n if (resumeFrom) {\n state = JSON.parse(resumeFrom).state;\n }\n\n const operation = new RecoverDeletedKeyPollOperation(\n {\n ...state,\n name,\n },\n client,\n operationOptions,\n );\n\n super(operation);\n\n this.intervalInMs = intervalInMs;\n }\n}\n"]}
1
+ {"version":3,"file":"poller.js","sourceRoot":"","sources":["../../../../src/lro/recover/poller.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AAGhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,iBAG5C;IACC,YAAY,OAAiC;QAC3C,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,YAAY,GAAG,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QAEpF,IAAI,KAAsD,CAAC;QAE3D,IAAI,UAAU,EAAE,CAAC;YACf,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC;QACvC,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,8BAA8B,CAClD;YACE,GAAG,KAAK;YACR,IAAI;SACL,EACD,MAAM,EACN,gBAAgB,CACjB,CAAC;QAEF,KAAK,CAAC,SAAS,CAAC,CAAC;QAEjB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { RecoverDeletedKeyPollOperationState } from \"./operation.js\";\nimport { RecoverDeletedKeyPollOperation } from \"./operation.js\";\nimport type { KeyVaultKey } from \"../../keysModels.js\";\nimport type { KeyVaultKeyPollerOptions } from \"../keyVaultKeyPoller.js\";\nimport { KeyVaultKeyPoller } from \"../keyVaultKeyPoller.js\";\n\n/**\n * Class that deletes a poller that waits until a key finishes being deleted\n */\nexport class RecoverDeletedKeyPoller extends KeyVaultKeyPoller<\n RecoverDeletedKeyPollOperationState,\n KeyVaultKey\n> {\n constructor(options: KeyVaultKeyPollerOptions) {\n const { client, name, operationOptions, intervalInMs = 2000, resumeFrom } = options;\n\n let state: RecoverDeletedKeyPollOperationState | undefined;\n\n if (resumeFrom) {\n state = JSON.parse(resumeFrom).state;\n }\n\n const operation = new RecoverDeletedKeyPollOperation(\n {\n ...state,\n name,\n },\n client,\n operationOptions,\n );\n\n super(operation);\n\n this.intervalInMs = intervalInMs;\n }\n}\n"]}