@azure/attestation 1.0.1-alpha.20241022.1 → 1.0.1-alpha.20241023.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/attestationAdministrationClient.d.ts +183 -0
- package/dist/browser/attestationAdministrationClient.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/attestationAdministrationClient.js +13 -13
- package/dist/browser/attestationAdministrationClient.js.map +1 -0
- package/dist/browser/attestationClient.d.ts +209 -0
- package/dist/browser/attestationClient.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/attestationClient.js +12 -12
- package/dist/browser/attestationClient.js.map +1 -0
- package/dist/browser/generated/generatedClient.d.ts +21 -0
- package/dist/browser/generated/generatedClient.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/generated/generatedClient.js +1 -1
- package/dist/browser/generated/generatedClient.js.map +1 -0
- package/dist/browser/generated/index.d.ts +4 -0
- package/dist/browser/generated/index.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/generated/index.js +3 -3
- package/dist/browser/generated/index.js.map +1 -0
- package/dist/browser/generated/models/index.d.ts +393 -0
- package/dist/browser/generated/models/index.d.ts.map +1 -0
- package/dist/browser/generated/models/mappers.d.ts +22 -0
- package/dist/browser/generated/models/mappers.d.ts.map +1 -0
- package/dist/browser/generated/models/parameters.d.ts +17 -0
- package/dist/browser/generated/models/parameters.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/generated/models/parameters.js +1 -1
- package/dist/browser/generated/models/parameters.js.map +1 -0
- package/dist/browser/generated/operations/attestation.d.ts +34 -0
- package/dist/browser/generated/operations/attestation.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/generated/operations/attestation.js +3 -3
- package/dist/browser/generated/operations/attestation.js.map +1 -0
- package/dist/browser/generated/operations/index.d.ts +6 -0
- package/dist/browser/generated/operations/index.d.ts.map +1 -0
- package/{dist-esm/src/generated/operationsInterfaces → dist/browser/generated/operations}/index.js +5 -5
- package/dist/browser/generated/operations/index.js.map +1 -0
- package/dist/browser/generated/operations/metadataConfiguration.d.ts +18 -0
- package/dist/browser/generated/operations/metadataConfiguration.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/generated/operations/metadataConfiguration.js +3 -3
- package/dist/browser/generated/operations/metadataConfiguration.js.map +1 -0
- package/dist/browser/generated/operations/policy.d.ts +37 -0
- package/dist/browser/generated/operations/policy.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/generated/operations/policy.js +3 -3
- package/dist/browser/generated/operations/policy.js.map +1 -0
- package/dist/browser/generated/operations/policyCertificates.d.ts +34 -0
- package/dist/browser/generated/operations/policyCertificates.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/generated/operations/policyCertificates.js +3 -3
- package/dist/browser/generated/operations/policyCertificates.js.map +1 -0
- package/dist/browser/generated/operations/signingCertificates.d.ts +18 -0
- package/dist/browser/generated/operations/signingCertificates.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/generated/operations/signingCertificates.js +3 -3
- package/dist/browser/generated/operations/signingCertificates.js.map +1 -0
- package/dist/browser/generated/operationsInterfaces/attestation.d.ts +26 -0
- package/dist/browser/generated/operationsInterfaces/attestation.d.ts.map +1 -0
- package/dist/browser/generated/operationsInterfaces/attestation.js.map +1 -0
- package/dist/browser/generated/operationsInterfaces/index.d.ts +6 -0
- package/dist/browser/generated/operationsInterfaces/index.d.ts.map +1 -0
- package/{dist-esm/src/generated/operations → dist/browser/generated/operationsInterfaces}/index.js +5 -5
- package/dist/browser/generated/operationsInterfaces/index.js.map +1 -0
- package/dist/browser/generated/operationsInterfaces/metadataConfiguration.d.ts +10 -0
- package/dist/browser/generated/operationsInterfaces/metadataConfiguration.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/generated/operationsInterfaces/metadataConfiguration.js.map +1 -1
- package/dist/browser/generated/operationsInterfaces/policy.d.ts +29 -0
- package/dist/browser/generated/operationsInterfaces/policy.d.ts.map +1 -0
- package/dist/browser/generated/operationsInterfaces/policy.js.map +1 -0
- package/dist/browser/generated/operationsInterfaces/policyCertificates.d.ts +26 -0
- package/dist/browser/generated/operationsInterfaces/policyCertificates.d.ts.map +1 -0
- package/dist/browser/generated/operationsInterfaces/policyCertificates.js.map +1 -0
- package/dist/browser/generated/operationsInterfaces/signingCertificates.d.ts +10 -0
- package/dist/browser/generated/operationsInterfaces/signingCertificates.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/generated/operationsInterfaces/signingCertificates.js.map +1 -1
- package/dist/browser/generated/tracing.d.ts +2 -0
- package/dist/browser/generated/tracing.d.ts.map +1 -0
- package/dist/browser/index.d.ts +4 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +6 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/logger.d.ts +7 -0
- package/dist/browser/logger.d.ts.map +1 -0
- package/dist/browser/models/attestationPolicyToken.d.ts +28 -0
- package/dist/browser/models/attestationPolicyToken.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/models/attestationPolicyToken.js +2 -2
- package/dist/browser/models/attestationPolicyToken.js.map +1 -0
- package/dist/browser/models/attestationResponse.d.ts +30 -0
- package/dist/browser/models/attestationResponse.d.ts.map +1 -0
- package/dist/browser/models/attestationResponse.js.map +1 -0
- package/dist/browser/models/attestationResult.d.ts +294 -0
- package/dist/browser/models/attestationResult.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/models/attestationResult.js +1 -1
- package/dist/browser/models/attestationResult.js.map +1 -0
- package/dist/browser/models/attestationSigner.d.ts +27 -0
- package/dist/browser/models/attestationSigner.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/models/attestationSigner.js +1 -1
- package/dist/browser/models/attestationSigner.js.map +1 -0
- package/dist/browser/models/attestationToken.d.ts +339 -0
- package/dist/browser/models/attestationToken.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/models/attestationToken.js +6 -6
- package/dist/browser/models/attestationToken.js.map +1 -0
- package/dist/browser/models/index.d.ts +8 -0
- package/dist/browser/models/index.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/models/index.js +2 -2
- package/dist/browser/models/index.js.map +1 -0
- package/dist/browser/models/policyResult.d.ts +31 -0
- package/dist/browser/models/policyResult.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/models/policyResult.js +3 -3
- package/dist/browser/models/policyResult.js.map +1 -0
- package/dist/browser/models/storedAttestationPolicy.d.ts +24 -0
- package/dist/browser/models/storedAttestationPolicy.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/models/storedAttestationPolicy.js +3 -3
- package/dist/browser/models/storedAttestationPolicy.js.map +1 -0
- package/dist/browser/package.json +3 -0
- package/dist/browser/utils/base64-browser.d.mts.map +1 -0
- package/dist/browser/utils/base64-browser.mjs.map +1 -0
- package/dist/browser/utils/base64.d.ts +28 -0
- package/{dist-esm/src/utils/base64.browser.js → dist/browser/utils/base64.js} +1 -1
- package/dist/browser/utils/buffer-browser.d.mts.map +1 -0
- package/dist/browser/utils/buffer-browser.mjs.map +1 -0
- package/dist/browser/utils/buffer.d.ts +8 -0
- package/{dist-esm/src/utils/buffer.browser.js → dist/browser/utils/buffer.js} +1 -1
- package/dist/browser/utils/helpers.d.ts +22 -0
- package/dist/browser/utils/helpers.d.ts.map +1 -0
- package/{dist-esm/src → dist/browser}/utils/helpers.js +1 -1
- package/dist/browser/utils/helpers.js.map +1 -0
- package/dist/browser/utils/textEncoding-browser.d.mts +10 -0
- package/dist/browser/utils/textEncoding-browser.d.mts.map +1 -0
- package/{dist-esm/src/utils/textEncoding.browser.js → dist/browser/utils/textEncoding-browser.mjs} +1 -1
- package/dist/browser/utils/textEncoding-browser.mjs.map +1 -0
- package/dist/browser/utils/typeDeserializer.d.ts +34 -0
- package/dist/browser/utils/typeDeserializer.d.ts.map +1 -0
- package/dist/browser/utils/utf8.d.ts +13 -0
- package/dist/browser/utils/utf8.d.ts.map +1 -0
- package/dist/commonjs/attestationAdministrationClient.d.ts +183 -0
- package/dist/commonjs/attestationAdministrationClient.d.ts.map +1 -0
- package/dist/commonjs/attestationAdministrationClient.js +391 -0
- package/dist/commonjs/attestationAdministrationClient.js.map +1 -0
- package/dist/commonjs/attestationClient.d.ts +209 -0
- package/dist/commonjs/attestationClient.d.ts.map +1 -0
- package/dist/commonjs/attestationClient.js +243 -0
- package/dist/commonjs/attestationClient.js.map +1 -0
- package/dist/commonjs/generated/generatedClient.d.ts +21 -0
- package/dist/commonjs/generated/generatedClient.d.ts.map +1 -0
- package/dist/commonjs/generated/generatedClient.js +78 -0
- package/dist/commonjs/generated/generatedClient.js.map +1 -0
- package/dist/commonjs/generated/index.d.ts +4 -0
- package/dist/commonjs/generated/index.d.ts.map +1 -0
- package/dist/commonjs/generated/index.js +16 -0
- package/dist/commonjs/generated/index.js.map +1 -0
- package/dist/commonjs/generated/models/index.d.ts +393 -0
- package/dist/commonjs/generated/models/index.d.ts.map +1 -0
- package/dist/commonjs/generated/models/index.js +45 -0
- package/dist/commonjs/generated/models/index.js.map +1 -0
- package/dist/commonjs/generated/models/mappers.d.ts +22 -0
- package/dist/commonjs/generated/models/mappers.d.ts.map +1 -0
- package/dist/commonjs/generated/models/mappers.js +725 -0
- package/dist/commonjs/generated/models/mappers.js.map +1 -0
- package/dist/commonjs/generated/models/parameters.d.ts +17 -0
- package/dist/commonjs/generated/models/parameters.d.ts.map +1 -0
- package/dist/commonjs/generated/models/parameters.js +157 -0
- package/dist/commonjs/generated/models/parameters.js.map +1 -0
- package/dist/commonjs/generated/operations/attestation.d.ts +34 -0
- package/dist/commonjs/generated/operations/attestation.d.ts.map +1 -0
- package/dist/commonjs/generated/operations/attestation.js +116 -0
- package/dist/commonjs/generated/operations/attestation.js.map +1 -0
- package/dist/commonjs/generated/operations/index.d.ts +6 -0
- package/dist/commonjs/generated/operations/index.d.ts.map +1 -0
- package/dist/commonjs/generated/operations/index.js +16 -0
- package/dist/commonjs/generated/operations/index.js.map +1 -0
- package/dist/commonjs/generated/operations/metadataConfiguration.d.ts +18 -0
- package/dist/commonjs/generated/operations/metadataConfiguration.d.ts.map +1 -0
- package/dist/commonjs/generated/operations/metadataConfiguration.js +55 -0
- package/dist/commonjs/generated/operations/metadataConfiguration.js.map +1 -0
- package/dist/commonjs/generated/operations/policy.d.ts +37 -0
- package/dist/commonjs/generated/operations/policy.d.ts.map +1 -0
- package/dist/commonjs/generated/operations/policy.js +117 -0
- package/dist/commonjs/generated/operations/policy.js.map +1 -0
- package/dist/commonjs/generated/operations/policyCertificates.d.ts +34 -0
- package/dist/commonjs/generated/operations/policyCertificates.d.ts.map +1 -0
- package/dist/commonjs/generated/operations/policyCertificates.js +114 -0
- package/dist/commonjs/generated/operations/policyCertificates.js.map +1 -0
- package/dist/commonjs/generated/operations/signingCertificates.d.ts +18 -0
- package/dist/commonjs/generated/operations/signingCertificates.d.ts.map +1 -0
- package/dist/commonjs/generated/operations/signingCertificates.js +53 -0
- package/dist/commonjs/generated/operations/signingCertificates.js.map +1 -0
- package/dist/commonjs/generated/operationsInterfaces/attestation.d.ts +26 -0
- package/dist/commonjs/generated/operationsInterfaces/attestation.d.ts.map +1 -0
- package/dist/commonjs/generated/operationsInterfaces/attestation.js +10 -0
- package/dist/commonjs/generated/operationsInterfaces/attestation.js.map +1 -0
- package/dist/commonjs/generated/operationsInterfaces/index.d.ts +6 -0
- package/dist/commonjs/generated/operationsInterfaces/index.d.ts.map +1 -0
- package/dist/commonjs/generated/operationsInterfaces/index.js +16 -0
- package/dist/commonjs/generated/operationsInterfaces/index.js.map +1 -0
- package/dist/commonjs/generated/operationsInterfaces/metadataConfiguration.d.ts +10 -0
- package/dist/commonjs/generated/operationsInterfaces/metadataConfiguration.d.ts.map +1 -0
- package/dist/commonjs/generated/operationsInterfaces/metadataConfiguration.js +10 -0
- package/dist/commonjs/generated/operationsInterfaces/metadataConfiguration.js.map +1 -0
- package/dist/commonjs/generated/operationsInterfaces/policy.d.ts +29 -0
- package/dist/commonjs/generated/operationsInterfaces/policy.d.ts.map +1 -0
- package/dist/commonjs/generated/operationsInterfaces/policy.js +10 -0
- package/dist/commonjs/generated/operationsInterfaces/policy.js.map +1 -0
- package/dist/commonjs/generated/operationsInterfaces/policyCertificates.d.ts +26 -0
- package/dist/commonjs/generated/operationsInterfaces/policyCertificates.d.ts.map +1 -0
- package/dist/commonjs/generated/operationsInterfaces/policyCertificates.js +10 -0
- package/dist/commonjs/generated/operationsInterfaces/policyCertificates.js.map +1 -0
- package/dist/commonjs/generated/operationsInterfaces/signingCertificates.d.ts +10 -0
- package/dist/commonjs/generated/operationsInterfaces/signingCertificates.d.ts.map +1 -0
- package/dist/commonjs/generated/operationsInterfaces/signingCertificates.js +10 -0
- package/dist/commonjs/generated/operationsInterfaces/signingCertificates.js.map +1 -0
- package/dist/commonjs/generated/tracing.d.ts +2 -0
- package/dist/commonjs/generated/tracing.d.ts.map +1 -0
- package/dist/commonjs/generated/tracing.js +17 -0
- package/dist/commonjs/generated/tracing.js.map +1 -0
- package/dist/commonjs/index.d.ts +4 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +12 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/logger.d.ts +7 -0
- package/dist/commonjs/logger.d.ts.map +1 -0
- package/dist/commonjs/logger.js +13 -0
- package/dist/commonjs/logger.js.map +1 -0
- package/dist/commonjs/models/attestationPolicyToken.d.ts +28 -0
- package/dist/commonjs/models/attestationPolicyToken.d.ts.map +1 -0
- package/dist/commonjs/models/attestationPolicyToken.js +29 -0
- package/dist/commonjs/models/attestationPolicyToken.js.map +1 -0
- package/dist/commonjs/models/attestationResponse.d.ts +30 -0
- package/dist/commonjs/models/attestationResponse.d.ts.map +1 -0
- package/dist/commonjs/models/attestationResponse.js +16 -0
- package/dist/commonjs/models/attestationResponse.js.map +1 -0
- package/dist/commonjs/models/attestationResult.d.ts +294 -0
- package/dist/commonjs/models/attestationResult.d.ts.map +1 -0
- package/dist/commonjs/models/attestationResult.js +173 -0
- package/dist/commonjs/models/attestationResult.js.map +1 -0
- package/dist/commonjs/models/attestationSigner.d.ts +27 -0
- package/dist/commonjs/models/attestationSigner.d.ts.map +1 -0
- package/dist/commonjs/models/attestationSigner.js +21 -0
- package/dist/commonjs/models/attestationSigner.js.map +1 -0
- package/dist/commonjs/models/attestationToken.d.ts +339 -0
- package/dist/commonjs/models/attestationToken.d.ts.map +1 -0
- package/dist/commonjs/models/attestationToken.js +358 -0
- package/dist/commonjs/models/attestationToken.js.map +1 -0
- package/dist/commonjs/models/index.d.ts +8 -0
- package/dist/commonjs/models/index.d.ts.map +1 -0
- package/dist/commonjs/models/index.js +12 -0
- package/dist/commonjs/models/index.js.map +1 -0
- package/dist/commonjs/models/policyResult.d.ts +31 -0
- package/dist/commonjs/models/policyResult.d.ts.map +1 -0
- package/dist/commonjs/models/policyResult.js +27 -0
- package/dist/commonjs/models/policyResult.js.map +1 -0
- package/dist/commonjs/models/storedAttestationPolicy.d.ts +24 -0
- package/dist/commonjs/models/storedAttestationPolicy.d.ts.map +1 -0
- package/dist/commonjs/models/storedAttestationPolicy.js +41 -0
- package/dist/commonjs/models/storedAttestationPolicy.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/commonjs/utils/base64.d.ts +28 -0
- package/dist/commonjs/utils/base64.d.ts.map +1 -0
- package/dist/commonjs/utils/base64.js +79 -0
- package/dist/commonjs/utils/base64.js.map +1 -0
- package/dist/commonjs/utils/buffer.d.ts +8 -0
- package/dist/commonjs/utils/buffer.d.ts.map +1 -0
- package/dist/commonjs/utils/buffer.js +22 -0
- package/dist/commonjs/utils/buffer.js.map +1 -0
- package/dist/commonjs/utils/helpers.d.ts +22 -0
- package/dist/commonjs/utils/helpers.d.ts.map +1 -0
- package/dist/commonjs/utils/helpers.js +62 -0
- package/dist/commonjs/utils/helpers.js.map +1 -0
- package/dist/commonjs/utils/typeDeserializer.d.ts +34 -0
- package/dist/commonjs/utils/typeDeserializer.d.ts.map +1 -0
- package/dist/commonjs/utils/typeDeserializer.js +42 -0
- package/dist/commonjs/utils/typeDeserializer.js.map +1 -0
- package/dist/commonjs/utils/utf8.d.ts +13 -0
- package/dist/commonjs/utils/utf8.d.ts.map +1 -0
- package/dist/commonjs/utils/utf8.js +31 -0
- package/dist/commonjs/utils/utf8.js.map +1 -0
- package/dist/esm/attestationAdministrationClient.d.ts +183 -0
- package/dist/esm/attestationAdministrationClient.d.ts.map +1 -0
- package/dist/esm/attestationAdministrationClient.js +386 -0
- package/dist/esm/attestationAdministrationClient.js.map +1 -0
- package/dist/esm/attestationClient.d.ts +209 -0
- package/dist/esm/attestationClient.d.ts.map +1 -0
- package/dist/esm/attestationClient.js +238 -0
- package/dist/esm/attestationClient.js.map +1 -0
- package/dist/esm/generated/generatedClient.d.ts +21 -0
- package/dist/esm/generated/generatedClient.d.ts.map +1 -0
- package/dist/esm/generated/generatedClient.js +73 -0
- package/dist/esm/generated/generatedClient.js.map +1 -0
- package/dist/esm/generated/index.d.ts +4 -0
- package/dist/esm/generated/index.d.ts.map +1 -0
- package/dist/esm/generated/index.js +11 -0
- package/dist/esm/generated/index.js.map +1 -0
- package/dist/esm/generated/models/index.d.ts +393 -0
- package/dist/esm/generated/models/index.d.ts.map +1 -0
- package/dist/esm/generated/models/index.js +42 -0
- package/dist/esm/generated/models/index.js.map +1 -0
- package/dist/esm/generated/models/mappers.d.ts +22 -0
- package/dist/esm/generated/models/mappers.d.ts.map +1 -0
- package/dist/esm/generated/models/mappers.js +722 -0
- package/dist/esm/generated/models/mappers.js.map +1 -0
- package/dist/esm/generated/models/parameters.d.ts +17 -0
- package/dist/esm/generated/models/parameters.d.ts.map +1 -0
- package/dist/esm/generated/models/parameters.js +154 -0
- package/dist/esm/generated/models/parameters.js.map +1 -0
- package/dist/esm/generated/operations/attestation.d.ts +34 -0
- package/dist/esm/generated/operations/attestation.d.ts.map +1 -0
- package/dist/esm/generated/operations/attestation.js +111 -0
- package/dist/esm/generated/operations/attestation.js.map +1 -0
- package/dist/esm/generated/operations/index.d.ts +6 -0
- package/dist/esm/generated/operations/index.d.ts.map +1 -0
- package/dist/esm/generated/operations/index.js +13 -0
- package/dist/esm/generated/operations/index.js.map +1 -0
- package/dist/esm/generated/operations/metadataConfiguration.d.ts +18 -0
- package/dist/esm/generated/operations/metadataConfiguration.d.ts.map +1 -0
- package/dist/esm/generated/operations/metadataConfiguration.js +50 -0
- package/dist/esm/generated/operations/metadataConfiguration.js.map +1 -0
- package/dist/esm/generated/operations/policy.d.ts +37 -0
- package/dist/esm/generated/operations/policy.d.ts.map +1 -0
- package/dist/esm/generated/operations/policy.js +112 -0
- package/dist/esm/generated/operations/policy.js.map +1 -0
- package/dist/esm/generated/operations/policyCertificates.d.ts +34 -0
- package/dist/esm/generated/operations/policyCertificates.d.ts.map +1 -0
- package/dist/esm/generated/operations/policyCertificates.js +109 -0
- package/dist/esm/generated/operations/policyCertificates.js.map +1 -0
- package/dist/esm/generated/operations/signingCertificates.d.ts +18 -0
- package/dist/esm/generated/operations/signingCertificates.d.ts.map +1 -0
- package/dist/esm/generated/operations/signingCertificates.js +48 -0
- package/dist/esm/generated/operations/signingCertificates.js.map +1 -0
- package/dist/esm/generated/operationsInterfaces/attestation.d.ts +26 -0
- package/dist/esm/generated/operationsInterfaces/attestation.d.ts.map +1 -0
- package/dist/esm/generated/operationsInterfaces/attestation.js +9 -0
- package/dist/esm/generated/operationsInterfaces/attestation.js.map +1 -0
- package/dist/esm/generated/operationsInterfaces/index.d.ts +6 -0
- package/dist/esm/generated/operationsInterfaces/index.d.ts.map +1 -0
- package/dist/esm/generated/operationsInterfaces/index.js +13 -0
- package/dist/esm/generated/operationsInterfaces/index.js.map +1 -0
- package/dist/esm/generated/operationsInterfaces/metadataConfiguration.d.ts +10 -0
- package/dist/esm/generated/operationsInterfaces/metadataConfiguration.d.ts.map +1 -0
- package/dist/esm/generated/operationsInterfaces/metadataConfiguration.js +9 -0
- package/dist/esm/generated/operationsInterfaces/metadataConfiguration.js.map +1 -0
- package/dist/esm/generated/operationsInterfaces/policy.d.ts +29 -0
- package/dist/esm/generated/operationsInterfaces/policy.d.ts.map +1 -0
- package/dist/esm/generated/operationsInterfaces/policy.js +9 -0
- package/dist/esm/generated/operationsInterfaces/policy.js.map +1 -0
- package/dist/esm/generated/operationsInterfaces/policyCertificates.d.ts +26 -0
- package/dist/esm/generated/operationsInterfaces/policyCertificates.d.ts.map +1 -0
- package/dist/esm/generated/operationsInterfaces/policyCertificates.js +9 -0
- package/dist/esm/generated/operationsInterfaces/policyCertificates.js.map +1 -0
- package/dist/esm/generated/operationsInterfaces/signingCertificates.d.ts +10 -0
- package/dist/esm/generated/operationsInterfaces/signingCertificates.d.ts.map +1 -0
- package/dist/esm/generated/operationsInterfaces/signingCertificates.js +9 -0
- package/dist/esm/generated/operationsInterfaces/signingCertificates.js.map +1 -0
- package/dist/esm/generated/tracing.d.ts +2 -0
- package/dist/esm/generated/tracing.d.ts.map +1 -0
- package/dist/esm/generated/tracing.js +14 -0
- package/dist/esm/generated/tracing.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/logger.d.ts +7 -0
- package/dist/esm/logger.d.ts.map +1 -0
- package/dist/esm/logger.js +10 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/esm/models/attestationPolicyToken.d.ts +28 -0
- package/dist/esm/models/attestationPolicyToken.d.ts.map +1 -0
- package/dist/esm/models/attestationPolicyToken.js +26 -0
- package/dist/esm/models/attestationPolicyToken.js.map +1 -0
- package/dist/esm/models/attestationResponse.d.ts +30 -0
- package/dist/esm/models/attestationResponse.d.ts.map +1 -0
- package/dist/esm/models/attestationResponse.js +13 -0
- package/dist/esm/models/attestationResponse.js.map +1 -0
- package/dist/esm/models/attestationResult.d.ts +294 -0
- package/dist/esm/models/attestationResult.d.ts.map +1 -0
- package/dist/esm/models/attestationResult.js +168 -0
- package/dist/esm/models/attestationResult.js.map +1 -0
- package/dist/esm/models/attestationSigner.d.ts +27 -0
- package/dist/esm/models/attestationSigner.d.ts.map +1 -0
- package/dist/esm/models/attestationSigner.js +18 -0
- package/dist/esm/models/attestationSigner.js.map +1 -0
- package/dist/esm/models/attestationToken.d.ts +339 -0
- package/dist/esm/models/attestationToken.d.ts.map +1 -0
- package/dist/esm/models/attestationToken.js +353 -0
- package/dist/esm/models/attestationToken.js.map +1 -0
- package/dist/esm/models/index.d.ts +8 -0
- package/dist/esm/models/index.d.ts.map +1 -0
- package/dist/esm/models/index.js +5 -0
- package/dist/esm/models/index.js.map +1 -0
- package/dist/esm/models/policyResult.d.ts +31 -0
- package/dist/esm/models/policyResult.d.ts.map +1 -0
- package/dist/esm/models/policyResult.js +23 -0
- package/dist/esm/models/policyResult.js.map +1 -0
- package/dist/esm/models/storedAttestationPolicy.d.ts +24 -0
- package/dist/esm/models/storedAttestationPolicy.d.ts.map +1 -0
- package/dist/esm/models/storedAttestationPolicy.js +36 -0
- package/dist/esm/models/storedAttestationPolicy.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/utils/base64.d.ts +28 -0
- package/dist/esm/utils/base64.d.ts.map +1 -0
- package/dist/esm/utils/buffer.d.ts +8 -0
- package/dist/esm/utils/buffer.d.ts.map +1 -0
- package/dist/esm/utils/helpers.d.ts +22 -0
- package/dist/esm/utils/helpers.d.ts.map +1 -0
- package/dist/esm/utils/helpers.js +56 -0
- package/dist/esm/utils/helpers.js.map +1 -0
- package/dist/esm/utils/textEncoding-browser.d.mts +4 -0
- package/dist/esm/utils/textEncoding-browser.d.mts.map +1 -0
- package/dist/esm/utils/textEncoding-browser.mjs +6 -0
- package/dist/esm/utils/textEncoding-browser.mjs.map +1 -0
- package/dist/esm/utils/typeDeserializer.d.ts +34 -0
- package/dist/esm/utils/typeDeserializer.d.ts.map +1 -0
- package/dist/esm/utils/typeDeserializer.js +38 -0
- package/dist/esm/utils/typeDeserializer.js.map +1 -0
- package/dist/esm/utils/utf8.d.ts +13 -0
- package/dist/esm/utils/utf8.d.ts.map +1 -0
- package/dist/esm/utils/utf8.js +27 -0
- package/dist/esm/utils/utf8.js.map +1 -0
- package/dist/react-native/attestationAdministrationClient.d.ts +183 -0
- package/dist/react-native/attestationAdministrationClient.d.ts.map +1 -0
- package/dist/react-native/attestationAdministrationClient.js +386 -0
- package/dist/react-native/attestationAdministrationClient.js.map +1 -0
- package/dist/react-native/attestationClient.d.ts +209 -0
- package/dist/react-native/attestationClient.d.ts.map +1 -0
- package/dist/react-native/attestationClient.js +238 -0
- package/dist/react-native/attestationClient.js.map +1 -0
- package/dist/react-native/generated/generatedClient.d.ts +21 -0
- package/dist/react-native/generated/generatedClient.d.ts.map +1 -0
- package/dist/react-native/generated/generatedClient.js +73 -0
- package/dist/react-native/generated/generatedClient.js.map +1 -0
- package/dist/react-native/generated/index.d.ts +4 -0
- package/dist/react-native/generated/index.d.ts.map +1 -0
- package/dist/react-native/generated/index.js +11 -0
- package/dist/react-native/generated/index.js.map +1 -0
- package/dist/react-native/generated/models/index.d.ts +393 -0
- package/dist/react-native/generated/models/index.d.ts.map +1 -0
- package/dist/react-native/generated/models/index.js +42 -0
- package/dist/react-native/generated/models/index.js.map +1 -0
- package/dist/react-native/generated/models/mappers.d.ts +22 -0
- package/dist/react-native/generated/models/mappers.d.ts.map +1 -0
- package/dist/react-native/generated/models/mappers.js +722 -0
- package/dist/react-native/generated/models/mappers.js.map +1 -0
- package/dist/react-native/generated/models/parameters.d.ts +17 -0
- package/dist/react-native/generated/models/parameters.d.ts.map +1 -0
- package/dist/react-native/generated/models/parameters.js +154 -0
- package/dist/react-native/generated/models/parameters.js.map +1 -0
- package/dist/react-native/generated/operations/attestation.d.ts +34 -0
- package/dist/react-native/generated/operations/attestation.d.ts.map +1 -0
- package/dist/react-native/generated/operations/attestation.js +111 -0
- package/dist/react-native/generated/operations/attestation.js.map +1 -0
- package/dist/react-native/generated/operations/index.d.ts +6 -0
- package/dist/react-native/generated/operations/index.d.ts.map +1 -0
- package/dist/react-native/generated/operations/index.js +13 -0
- package/dist/react-native/generated/operations/index.js.map +1 -0
- package/dist/react-native/generated/operations/metadataConfiguration.d.ts +18 -0
- package/dist/react-native/generated/operations/metadataConfiguration.d.ts.map +1 -0
- package/dist/react-native/generated/operations/metadataConfiguration.js +50 -0
- package/dist/react-native/generated/operations/metadataConfiguration.js.map +1 -0
- package/dist/react-native/generated/operations/policy.d.ts +37 -0
- package/dist/react-native/generated/operations/policy.d.ts.map +1 -0
- package/dist/react-native/generated/operations/policy.js +112 -0
- package/dist/react-native/generated/operations/policy.js.map +1 -0
- package/dist/react-native/generated/operations/policyCertificates.d.ts +34 -0
- package/dist/react-native/generated/operations/policyCertificates.d.ts.map +1 -0
- package/dist/react-native/generated/operations/policyCertificates.js +109 -0
- package/dist/react-native/generated/operations/policyCertificates.js.map +1 -0
- package/dist/react-native/generated/operations/signingCertificates.d.ts +18 -0
- package/dist/react-native/generated/operations/signingCertificates.d.ts.map +1 -0
- package/dist/react-native/generated/operations/signingCertificates.js +48 -0
- package/dist/react-native/generated/operations/signingCertificates.js.map +1 -0
- package/dist/react-native/generated/operationsInterfaces/attestation.d.ts +26 -0
- package/dist/react-native/generated/operationsInterfaces/attestation.d.ts.map +1 -0
- package/dist/react-native/generated/operationsInterfaces/attestation.js +9 -0
- package/dist/react-native/generated/operationsInterfaces/attestation.js.map +1 -0
- package/dist/react-native/generated/operationsInterfaces/index.d.ts +6 -0
- package/dist/react-native/generated/operationsInterfaces/index.d.ts.map +1 -0
- package/dist/react-native/generated/operationsInterfaces/index.js +13 -0
- package/dist/react-native/generated/operationsInterfaces/index.js.map +1 -0
- package/dist/react-native/generated/operationsInterfaces/metadataConfiguration.d.ts +10 -0
- package/dist/react-native/generated/operationsInterfaces/metadataConfiguration.d.ts.map +1 -0
- package/dist/react-native/generated/operationsInterfaces/metadataConfiguration.js +9 -0
- package/dist/react-native/generated/operationsInterfaces/metadataConfiguration.js.map +1 -0
- package/dist/react-native/generated/operationsInterfaces/policy.d.ts +29 -0
- package/dist/react-native/generated/operationsInterfaces/policy.d.ts.map +1 -0
- package/dist/react-native/generated/operationsInterfaces/policy.js +9 -0
- package/dist/react-native/generated/operationsInterfaces/policy.js.map +1 -0
- package/dist/react-native/generated/operationsInterfaces/policyCertificates.d.ts +26 -0
- package/dist/react-native/generated/operationsInterfaces/policyCertificates.d.ts.map +1 -0
- package/dist/react-native/generated/operationsInterfaces/policyCertificates.js +9 -0
- package/dist/react-native/generated/operationsInterfaces/policyCertificates.js.map +1 -0
- package/dist/react-native/generated/operationsInterfaces/signingCertificates.d.ts +10 -0
- package/dist/react-native/generated/operationsInterfaces/signingCertificates.d.ts.map +1 -0
- package/dist/react-native/generated/operationsInterfaces/signingCertificates.js +9 -0
- package/dist/react-native/generated/operationsInterfaces/signingCertificates.js.map +1 -0
- package/dist/react-native/generated/tracing.d.ts +2 -0
- package/dist/react-native/generated/tracing.d.ts.map +1 -0
- package/dist/react-native/generated/tracing.js +14 -0
- package/dist/react-native/generated/tracing.js.map +1 -0
- package/dist/react-native/index.d.ts +4 -0
- package/dist/react-native/index.d.ts.map +1 -0
- package/dist/react-native/index.js +6 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/logger.d.ts +7 -0
- package/dist/react-native/logger.d.ts.map +1 -0
- package/dist/react-native/logger.js +10 -0
- package/dist/react-native/logger.js.map +1 -0
- package/dist/react-native/models/attestationPolicyToken.d.ts +28 -0
- package/dist/react-native/models/attestationPolicyToken.d.ts.map +1 -0
- package/dist/react-native/models/attestationPolicyToken.js +26 -0
- package/dist/react-native/models/attestationPolicyToken.js.map +1 -0
- package/dist/react-native/models/attestationResponse.d.ts +30 -0
- package/dist/react-native/models/attestationResponse.d.ts.map +1 -0
- package/dist/react-native/models/attestationResponse.js +13 -0
- package/dist/react-native/models/attestationResponse.js.map +1 -0
- package/dist/react-native/models/attestationResult.d.ts +294 -0
- package/dist/react-native/models/attestationResult.d.ts.map +1 -0
- package/dist/react-native/models/attestationResult.js +168 -0
- package/dist/react-native/models/attestationResult.js.map +1 -0
- package/dist/react-native/models/attestationSigner.d.ts +27 -0
- package/dist/react-native/models/attestationSigner.d.ts.map +1 -0
- package/dist/react-native/models/attestationSigner.js +18 -0
- package/dist/react-native/models/attestationSigner.js.map +1 -0
- package/dist/react-native/models/attestationToken.d.ts +339 -0
- package/dist/react-native/models/attestationToken.d.ts.map +1 -0
- package/dist/react-native/models/attestationToken.js +353 -0
- package/dist/react-native/models/attestationToken.js.map +1 -0
- package/dist/react-native/models/index.d.ts +8 -0
- package/dist/react-native/models/index.d.ts.map +1 -0
- package/dist/react-native/models/index.js +5 -0
- package/dist/react-native/models/index.js.map +1 -0
- package/dist/react-native/models/policyResult.d.ts +31 -0
- package/dist/react-native/models/policyResult.d.ts.map +1 -0
- package/dist/react-native/models/policyResult.js +23 -0
- package/dist/react-native/models/policyResult.js.map +1 -0
- package/dist/react-native/models/storedAttestationPolicy.d.ts +24 -0
- package/dist/react-native/models/storedAttestationPolicy.d.ts.map +1 -0
- package/dist/react-native/models/storedAttestationPolicy.js +36 -0
- package/dist/react-native/models/storedAttestationPolicy.js.map +1 -0
- package/dist/react-native/package.json +3 -0
- package/dist/react-native/utils/base64.d.ts +28 -0
- package/dist/react-native/utils/base64.d.ts.map +1 -0
- package/dist/react-native/utils/base64.js +70 -0
- package/dist/react-native/utils/base64.js.map +1 -0
- package/dist/react-native/utils/buffer.d.ts +8 -0
- package/dist/react-native/utils/buffer.d.ts.map +1 -0
- package/dist/react-native/utils/buffer.js +19 -0
- package/dist/react-native/utils/buffer.js.map +1 -0
- package/dist/react-native/utils/helpers.d.ts +22 -0
- package/dist/react-native/utils/helpers.d.ts.map +1 -0
- package/dist/react-native/utils/helpers.js +56 -0
- package/dist/react-native/utils/helpers.js.map +1 -0
- package/dist/react-native/utils/textEncoding-browser.d.mts +4 -0
- package/dist/react-native/utils/textEncoding-browser.d.mts.map +1 -0
- package/dist/react-native/utils/textEncoding-browser.mjs +6 -0
- package/dist/react-native/utils/textEncoding-browser.mjs.map +1 -0
- package/dist/react-native/utils/typeDeserializer.d.ts +34 -0
- package/dist/react-native/utils/typeDeserializer.d.ts.map +1 -0
- package/dist/react-native/utils/typeDeserializer.js +38 -0
- package/dist/react-native/utils/typeDeserializer.js.map +1 -0
- package/dist/react-native/utils/utf8.d.ts +13 -0
- package/dist/react-native/utils/utf8.d.ts.map +1 -0
- package/dist/react-native/utils/utf8.js +27 -0
- package/dist/react-native/utils/utf8.js.map +1 -0
- package/package.json +60 -49
- package/dist/index.js +0 -2881
- package/dist/index.js.map +0 -1
- package/dist-esm/src/attestationAdministrationClient.js.map +0 -1
- package/dist-esm/src/attestationClient.js.map +0 -1
- package/dist-esm/src/generated/generatedClient.js.map +0 -1
- package/dist-esm/src/generated/index.js.map +0 -1
- package/dist-esm/src/generated/models/parameters.js.map +0 -1
- package/dist-esm/src/generated/operations/attestation.js.map +0 -1
- package/dist-esm/src/generated/operations/index.js.map +0 -1
- package/dist-esm/src/generated/operations/metadataConfiguration.js.map +0 -1
- package/dist-esm/src/generated/operations/policy.js.map +0 -1
- package/dist-esm/src/generated/operations/policyCertificates.js.map +0 -1
- package/dist-esm/src/generated/operations/signingCertificates.js.map +0 -1
- package/dist-esm/src/generated/operationsInterfaces/attestation.js.map +0 -1
- package/dist-esm/src/generated/operationsInterfaces/index.js.map +0 -1
- package/dist-esm/src/generated/operationsInterfaces/policy.js.map +0 -1
- package/dist-esm/src/generated/operationsInterfaces/policyCertificates.js.map +0 -1
- package/dist-esm/src/index.js +0 -6
- package/dist-esm/src/index.js.map +0 -1
- package/dist-esm/src/models/attestationPolicyToken.js.map +0 -1
- package/dist-esm/src/models/attestationResponse.js.map +0 -1
- package/dist-esm/src/models/attestationResult.js.map +0 -1
- package/dist-esm/src/models/attestationSigner.js.map +0 -1
- package/dist-esm/src/models/attestationToken.js.map +0 -1
- package/dist-esm/src/models/index.js.map +0 -1
- package/dist-esm/src/models/policyResult.js.map +0 -1
- package/dist-esm/src/models/storedAttestationPolicy.js.map +0 -1
- package/dist-esm/src/utils/base64.browser.js.map +0 -1
- package/dist-esm/src/utils/buffer.browser.js.map +0 -1
- package/dist-esm/src/utils/helpers.js.map +0 -1
- package/dist-esm/src/utils/textEncoding.browser.js.map +0 -1
- /package/{types/latest → dist}/attestation.d.ts +0 -0
- /package/{dist-esm/src → dist/browser}/generated/models/index.js +0 -0
- /package/{dist-esm/src → dist/browser}/generated/models/index.js.map +0 -0
- /package/{dist-esm/src → dist/browser}/generated/models/mappers.js +0 -0
- /package/{dist-esm/src → dist/browser}/generated/models/mappers.js.map +0 -0
- /package/{dist-esm/src → dist/browser}/generated/operationsInterfaces/attestation.js +0 -0
- /package/{dist-esm/src → dist/browser}/generated/operationsInterfaces/metadataConfiguration.js +0 -0
- /package/{dist-esm/src → dist/browser}/generated/operationsInterfaces/policy.js +0 -0
- /package/{dist-esm/src → dist/browser}/generated/operationsInterfaces/policyCertificates.js +0 -0
- /package/{dist-esm/src → dist/browser}/generated/operationsInterfaces/signingCertificates.js +0 -0
- /package/{dist-esm/src → dist/browser}/generated/tracing.js +0 -0
- /package/{dist-esm/src → dist/browser}/generated/tracing.js.map +0 -0
- /package/{dist-esm/src → dist/browser}/logger.js +0 -0
- /package/{dist-esm/src → dist/browser}/logger.js.map +0 -0
- /package/{dist-esm/src → dist/browser}/models/attestationResponse.js +0 -0
- /package/{dist-esm/src → dist/browser}/utils/typeDeserializer.js +0 -0
- /package/{dist-esm/src → dist/browser}/utils/typeDeserializer.js.map +0 -0
- /package/{dist-esm/src → dist/browser}/utils/utf8.js +0 -0
- /package/{dist-esm/src → dist/browser}/utils/utf8.js.map +0 -0
- /package/{types/latest → dist/commonjs}/tsdoc-metadata.json +0 -0
- /package/{dist-esm/src → dist/esm}/utils/base64.js +0 -0
- /package/{dist-esm/src → dist/esm}/utils/base64.js.map +0 -0
- /package/{dist-esm/src → dist/esm}/utils/buffer.js +0 -0
- /package/{dist-esm/src → dist/esm}/utils/buffer.js.map +0 -0
package/dist/index.js
DELETED
|
@@ -1,2881 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var coreClient = require('@azure/core-client');
|
|
6
|
-
var coreTracing = require('@azure/core-tracing');
|
|
7
|
-
var logger$1 = require('@azure/logger');
|
|
8
|
-
var coreAuth = require('@azure/core-auth');
|
|
9
|
-
var jsrsasign = require('jsrsasign');
|
|
10
|
-
|
|
11
|
-
function _interopNamespaceDefault(e) {
|
|
12
|
-
var n = Object.create(null);
|
|
13
|
-
if (e) {
|
|
14
|
-
Object.keys(e).forEach(function (k) {
|
|
15
|
-
if (k !== 'default') {
|
|
16
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function () { return e[k]; }
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
n.default = e;
|
|
25
|
-
return Object.freeze(n);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
var coreClient__namespace = /*#__PURE__*/_interopNamespaceDefault(coreClient);
|
|
29
|
-
var jsrsasign__namespace = /*#__PURE__*/_interopNamespaceDefault(jsrsasign);
|
|
30
|
-
|
|
31
|
-
/*
|
|
32
|
-
* Copyright (c) Microsoft Corporation.
|
|
33
|
-
* Licensed under the MIT License.
|
|
34
|
-
*
|
|
35
|
-
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
36
|
-
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
37
|
-
*/
|
|
38
|
-
/** Known values of {@link AttestationType} that the service accepts. */
|
|
39
|
-
exports.KnownAttestationType = void 0;
|
|
40
|
-
(function (KnownAttestationType) {
|
|
41
|
-
/** Intel Software Guard eXtensions */
|
|
42
|
-
KnownAttestationType["SgxEnclave"] = "SgxEnclave";
|
|
43
|
-
/** OpenEnclave extensions to SGX */
|
|
44
|
-
KnownAttestationType["OpenEnclave"] = "OpenEnclave";
|
|
45
|
-
/** Edge TPM Virtualization Based Security */
|
|
46
|
-
KnownAttestationType["Tpm"] = "Tpm";
|
|
47
|
-
})(exports.KnownAttestationType || (exports.KnownAttestationType = {}));
|
|
48
|
-
/** Known values of {@link DataType} that the service accepts. */
|
|
49
|
-
var KnownDataType;
|
|
50
|
-
(function (KnownDataType) {
|
|
51
|
-
/** The contents of the field should be treated as binary and not interpreted by MAA. */
|
|
52
|
-
KnownDataType["Binary"] = "Binary";
|
|
53
|
-
/** The contents of the field should be treated as a JSON object and may be further interpreted by MAA. */
|
|
54
|
-
KnownDataType["Json"] = "JSON";
|
|
55
|
-
})(KnownDataType || (KnownDataType = {}));
|
|
56
|
-
/** Known values of {@link CertificateModification} that the service accepts. */
|
|
57
|
-
exports.KnownCertificateModification = void 0;
|
|
58
|
-
(function (KnownCertificateModification) {
|
|
59
|
-
/** After the operation was performed, the certificate is in the set of certificates. */
|
|
60
|
-
KnownCertificateModification["IsPresent"] = "IsPresent";
|
|
61
|
-
/** After the operation was performed, the certificate is no longer present in the set of certificates. */
|
|
62
|
-
KnownCertificateModification["IsAbsent"] = "IsAbsent";
|
|
63
|
-
})(exports.KnownCertificateModification || (exports.KnownCertificateModification = {}));
|
|
64
|
-
/** Known values of {@link PolicyModification} that the service accepts. */
|
|
65
|
-
exports.KnownPolicyModification = void 0;
|
|
66
|
-
(function (KnownPolicyModification) {
|
|
67
|
-
/** The specified policy object was updated. */
|
|
68
|
-
KnownPolicyModification["Updated"] = "Updated";
|
|
69
|
-
/** The specified policy object was removed. */
|
|
70
|
-
KnownPolicyModification["Removed"] = "Removed";
|
|
71
|
-
})(exports.KnownPolicyModification || (exports.KnownPolicyModification = {}));
|
|
72
|
-
|
|
73
|
-
// Copyright (c) Microsoft Corporation.
|
|
74
|
-
// Licensed under the MIT License.
|
|
75
|
-
const decoder = typeof Buffer === "undefined" ? new TextDecoder("ascii") : undefined;
|
|
76
|
-
const encoder = typeof Buffer === "undefined" ? new TextEncoder() : undefined;
|
|
77
|
-
const decode = decoder
|
|
78
|
-
? (buffer) => decoder.decode(buffer)
|
|
79
|
-
: (buffer) => buffer.toString("ascii");
|
|
80
|
-
const encode = encoder
|
|
81
|
-
? (str) => encoder.encode(str)
|
|
82
|
-
: (str) => Buffer.from(str, "utf8");
|
|
83
|
-
/**
|
|
84
|
-
* Converts a string into a utf8 encoded byte array.
|
|
85
|
-
* @param content - The utf8 string to convert.
|
|
86
|
-
* @internal
|
|
87
|
-
*/
|
|
88
|
-
function stringToBytes(content) {
|
|
89
|
-
return encode(content);
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Converts a utf8 string into a byte array.
|
|
93
|
-
* @param content - The utf8 string to convert.
|
|
94
|
-
* @internal
|
|
95
|
-
*/
|
|
96
|
-
function bytesToString(content) {
|
|
97
|
-
return decode(content);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// Copyright (c) Microsoft Corporation.
|
|
101
|
-
// Licensed under the MIT License.
|
|
102
|
-
/**
|
|
103
|
-
* The TypeDeserializer class enables easy access to the Attestation Model serialization
|
|
104
|
-
* and deserialization APIs.
|
|
105
|
-
*/
|
|
106
|
-
class TypeDeserializer {
|
|
107
|
-
/**
|
|
108
|
-
* Deserializes a JSON object into a model type.
|
|
109
|
-
* @param rawJson - The JSON encoded object to convert into model type.
|
|
110
|
-
* @param bodyMapper - A mapping between type names and {@link Mapper} objects
|
|
111
|
-
* which defines the model properties for the type. the {@link bodyTypeName}
|
|
112
|
-
* must be one of the properties in the {@link bodyMapper} parameter.
|
|
113
|
-
* @param bodyTypeName - The name of the type of the body.
|
|
114
|
-
* @returns The deserialized type. It is the responsibility of the caller to cast to the
|
|
115
|
-
* expected return type.
|
|
116
|
-
*
|
|
117
|
-
* @internal
|
|
118
|
-
*/
|
|
119
|
-
static deserialize(rawJson, typeMappers, bodyTypeName) {
|
|
120
|
-
const serializer = coreClient.createSerializer(typeMappers);
|
|
121
|
-
return serializer.deserialize(typeMappers[bodyTypeName], rawJson, bodyTypeName);
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Serializes a JSON object into a model type.
|
|
125
|
-
* @param objectToSerialize - The JSON encoded object to convert into model type.
|
|
126
|
-
* @param bodyMapper - A {@link Mapper} object which defines the model properties for the type.
|
|
127
|
-
* @returns The serialized type as a JSON encoded string.
|
|
128
|
-
*
|
|
129
|
-
* @internal
|
|
130
|
-
*/
|
|
131
|
-
static serialize(objectToSerialize, typeMappers, bodyMapper) {
|
|
132
|
-
const serializer = coreClient.createSerializer(typeMappers);
|
|
133
|
-
return JSON.stringify(serializer.serialize(bodyMapper, objectToSerialize));
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/*
|
|
138
|
-
* Copyright (c) Microsoft Corporation.
|
|
139
|
-
* Licensed under the MIT License.
|
|
140
|
-
*
|
|
141
|
-
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
142
|
-
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
143
|
-
*/
|
|
144
|
-
const PolicyResponse = {
|
|
145
|
-
type: {
|
|
146
|
-
name: "Composite",
|
|
147
|
-
className: "PolicyResponse",
|
|
148
|
-
modelProperties: {
|
|
149
|
-
token: {
|
|
150
|
-
constraints: {
|
|
151
|
-
Pattern: new RegExp("[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]*\\.[A-Za-z0-9_-]*")
|
|
152
|
-
},
|
|
153
|
-
serializedName: "token",
|
|
154
|
-
required: true,
|
|
155
|
-
type: {
|
|
156
|
-
name: "String"
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
const CloudError = {
|
|
163
|
-
type: {
|
|
164
|
-
name: "Composite",
|
|
165
|
-
className: "CloudError",
|
|
166
|
-
modelProperties: {
|
|
167
|
-
error: {
|
|
168
|
-
serializedName: "error",
|
|
169
|
-
type: {
|
|
170
|
-
name: "Composite",
|
|
171
|
-
className: "CloudErrorBody"
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
const CloudErrorBody = {
|
|
178
|
-
type: {
|
|
179
|
-
name: "Composite",
|
|
180
|
-
className: "CloudErrorBody",
|
|
181
|
-
modelProperties: {
|
|
182
|
-
code: {
|
|
183
|
-
serializedName: "code",
|
|
184
|
-
type: {
|
|
185
|
-
name: "String"
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
message: {
|
|
189
|
-
serializedName: "message",
|
|
190
|
-
type: {
|
|
191
|
-
name: "String"
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
const PolicyCertificatesResponse = {
|
|
198
|
-
type: {
|
|
199
|
-
name: "Composite",
|
|
200
|
-
className: "PolicyCertificatesResponse",
|
|
201
|
-
modelProperties: {
|
|
202
|
-
token: {
|
|
203
|
-
constraints: {
|
|
204
|
-
Pattern: new RegExp("[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]*\\.[A-Za-z0-9_-]*")
|
|
205
|
-
},
|
|
206
|
-
serializedName: "token",
|
|
207
|
-
required: true,
|
|
208
|
-
type: {
|
|
209
|
-
name: "String"
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
const PolicyCertificatesModifyResponse = {
|
|
216
|
-
type: {
|
|
217
|
-
name: "Composite",
|
|
218
|
-
className: "PolicyCertificatesModifyResponse",
|
|
219
|
-
modelProperties: {
|
|
220
|
-
token: {
|
|
221
|
-
constraints: {
|
|
222
|
-
Pattern: new RegExp("[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]*\\.[A-Za-z0-9_-]*")
|
|
223
|
-
},
|
|
224
|
-
serializedName: "token",
|
|
225
|
-
required: true,
|
|
226
|
-
type: {
|
|
227
|
-
name: "String"
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
};
|
|
233
|
-
const AttestOpenEnclaveRequest = {
|
|
234
|
-
type: {
|
|
235
|
-
name: "Composite",
|
|
236
|
-
className: "AttestOpenEnclaveRequest",
|
|
237
|
-
modelProperties: {
|
|
238
|
-
report: {
|
|
239
|
-
serializedName: "report",
|
|
240
|
-
type: {
|
|
241
|
-
name: "Base64Url"
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
runtimeData: {
|
|
245
|
-
serializedName: "runtimeData",
|
|
246
|
-
type: {
|
|
247
|
-
name: "Composite",
|
|
248
|
-
className: "RuntimeData"
|
|
249
|
-
}
|
|
250
|
-
},
|
|
251
|
-
initTimeData: {
|
|
252
|
-
serializedName: "initTimeData",
|
|
253
|
-
type: {
|
|
254
|
-
name: "Composite",
|
|
255
|
-
className: "InitTimeData"
|
|
256
|
-
}
|
|
257
|
-
},
|
|
258
|
-
draftPolicyForAttestation: {
|
|
259
|
-
serializedName: "draftPolicyForAttestation",
|
|
260
|
-
type: {
|
|
261
|
-
name: "String"
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
const RuntimeData = {
|
|
268
|
-
type: {
|
|
269
|
-
name: "Composite",
|
|
270
|
-
className: "RuntimeData",
|
|
271
|
-
modelProperties: {
|
|
272
|
-
data: {
|
|
273
|
-
serializedName: "data",
|
|
274
|
-
type: {
|
|
275
|
-
name: "Base64Url"
|
|
276
|
-
}
|
|
277
|
-
},
|
|
278
|
-
dataType: {
|
|
279
|
-
serializedName: "dataType",
|
|
280
|
-
type: {
|
|
281
|
-
name: "String"
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
const InitTimeData = {
|
|
288
|
-
type: {
|
|
289
|
-
name: "Composite",
|
|
290
|
-
className: "InitTimeData",
|
|
291
|
-
modelProperties: {
|
|
292
|
-
data: {
|
|
293
|
-
serializedName: "data",
|
|
294
|
-
type: {
|
|
295
|
-
name: "Base64Url"
|
|
296
|
-
}
|
|
297
|
-
},
|
|
298
|
-
dataType: {
|
|
299
|
-
serializedName: "dataType",
|
|
300
|
-
type: {
|
|
301
|
-
name: "String"
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
const AttestationResponse = {
|
|
308
|
-
type: {
|
|
309
|
-
name: "Composite",
|
|
310
|
-
className: "AttestationResponse",
|
|
311
|
-
modelProperties: {
|
|
312
|
-
token: {
|
|
313
|
-
constraints: {
|
|
314
|
-
Pattern: new RegExp("[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]*\\.[A-Za-z0-9_-]*")
|
|
315
|
-
},
|
|
316
|
-
serializedName: "token",
|
|
317
|
-
required: true,
|
|
318
|
-
type: {
|
|
319
|
-
name: "String"
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
};
|
|
325
|
-
const AttestSgxEnclaveRequest = {
|
|
326
|
-
type: {
|
|
327
|
-
name: "Composite",
|
|
328
|
-
className: "AttestSgxEnclaveRequest",
|
|
329
|
-
modelProperties: {
|
|
330
|
-
quote: {
|
|
331
|
-
serializedName: "quote",
|
|
332
|
-
type: {
|
|
333
|
-
name: "Base64Url"
|
|
334
|
-
}
|
|
335
|
-
},
|
|
336
|
-
runtimeData: {
|
|
337
|
-
serializedName: "runtimeData",
|
|
338
|
-
type: {
|
|
339
|
-
name: "Composite",
|
|
340
|
-
className: "RuntimeData"
|
|
341
|
-
}
|
|
342
|
-
},
|
|
343
|
-
initTimeData: {
|
|
344
|
-
serializedName: "initTimeData",
|
|
345
|
-
type: {
|
|
346
|
-
name: "Composite",
|
|
347
|
-
className: "InitTimeData"
|
|
348
|
-
}
|
|
349
|
-
},
|
|
350
|
-
draftPolicyForAttestation: {
|
|
351
|
-
serializedName: "draftPolicyForAttestation",
|
|
352
|
-
type: {
|
|
353
|
-
name: "String"
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
const TpmAttestationRequest = {
|
|
360
|
-
type: {
|
|
361
|
-
name: "Composite",
|
|
362
|
-
className: "TpmAttestationRequest",
|
|
363
|
-
modelProperties: {
|
|
364
|
-
data: {
|
|
365
|
-
serializedName: "data",
|
|
366
|
-
type: {
|
|
367
|
-
name: "Base64Url"
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
};
|
|
373
|
-
const TpmAttestationResponse = {
|
|
374
|
-
type: {
|
|
375
|
-
name: "Composite",
|
|
376
|
-
className: "TpmAttestationResponse",
|
|
377
|
-
modelProperties: {
|
|
378
|
-
data: {
|
|
379
|
-
serializedName: "data",
|
|
380
|
-
type: {
|
|
381
|
-
name: "Base64Url"
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
};
|
|
387
|
-
const JsonWebKeySet = {
|
|
388
|
-
type: {
|
|
389
|
-
name: "Composite",
|
|
390
|
-
className: "JsonWebKeySet",
|
|
391
|
-
modelProperties: {
|
|
392
|
-
keys: {
|
|
393
|
-
serializedName: "keys",
|
|
394
|
-
required: true,
|
|
395
|
-
type: {
|
|
396
|
-
name: "Sequence",
|
|
397
|
-
element: {
|
|
398
|
-
type: {
|
|
399
|
-
name: "Composite",
|
|
400
|
-
className: "JsonWebKey"
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
};
|
|
408
|
-
const JsonWebKey = {
|
|
409
|
-
type: {
|
|
410
|
-
name: "Composite",
|
|
411
|
-
className: "JsonWebKey",
|
|
412
|
-
modelProperties: {
|
|
413
|
-
alg: {
|
|
414
|
-
serializedName: "alg",
|
|
415
|
-
type: {
|
|
416
|
-
name: "String"
|
|
417
|
-
}
|
|
418
|
-
},
|
|
419
|
-
crv: {
|
|
420
|
-
serializedName: "crv",
|
|
421
|
-
type: {
|
|
422
|
-
name: "String"
|
|
423
|
-
}
|
|
424
|
-
},
|
|
425
|
-
d: {
|
|
426
|
-
serializedName: "d",
|
|
427
|
-
type: {
|
|
428
|
-
name: "String"
|
|
429
|
-
}
|
|
430
|
-
},
|
|
431
|
-
dp: {
|
|
432
|
-
serializedName: "dp",
|
|
433
|
-
type: {
|
|
434
|
-
name: "String"
|
|
435
|
-
}
|
|
436
|
-
},
|
|
437
|
-
dq: {
|
|
438
|
-
serializedName: "dq",
|
|
439
|
-
type: {
|
|
440
|
-
name: "String"
|
|
441
|
-
}
|
|
442
|
-
},
|
|
443
|
-
e: {
|
|
444
|
-
serializedName: "e",
|
|
445
|
-
type: {
|
|
446
|
-
name: "String"
|
|
447
|
-
}
|
|
448
|
-
},
|
|
449
|
-
k: {
|
|
450
|
-
serializedName: "k",
|
|
451
|
-
type: {
|
|
452
|
-
name: "String"
|
|
453
|
-
}
|
|
454
|
-
},
|
|
455
|
-
kid: {
|
|
456
|
-
serializedName: "kid",
|
|
457
|
-
type: {
|
|
458
|
-
name: "String"
|
|
459
|
-
}
|
|
460
|
-
},
|
|
461
|
-
kty: {
|
|
462
|
-
serializedName: "kty",
|
|
463
|
-
required: true,
|
|
464
|
-
type: {
|
|
465
|
-
name: "String"
|
|
466
|
-
}
|
|
467
|
-
},
|
|
468
|
-
n: {
|
|
469
|
-
serializedName: "n",
|
|
470
|
-
type: {
|
|
471
|
-
name: "String"
|
|
472
|
-
}
|
|
473
|
-
},
|
|
474
|
-
p: {
|
|
475
|
-
serializedName: "p",
|
|
476
|
-
type: {
|
|
477
|
-
name: "String"
|
|
478
|
-
}
|
|
479
|
-
},
|
|
480
|
-
q: {
|
|
481
|
-
serializedName: "q",
|
|
482
|
-
type: {
|
|
483
|
-
name: "String"
|
|
484
|
-
}
|
|
485
|
-
},
|
|
486
|
-
qi: {
|
|
487
|
-
serializedName: "qi",
|
|
488
|
-
type: {
|
|
489
|
-
name: "String"
|
|
490
|
-
}
|
|
491
|
-
},
|
|
492
|
-
use: {
|
|
493
|
-
serializedName: "use",
|
|
494
|
-
type: {
|
|
495
|
-
name: "String"
|
|
496
|
-
}
|
|
497
|
-
},
|
|
498
|
-
x: {
|
|
499
|
-
serializedName: "x",
|
|
500
|
-
type: {
|
|
501
|
-
name: "String"
|
|
502
|
-
}
|
|
503
|
-
},
|
|
504
|
-
x5C: {
|
|
505
|
-
serializedName: "x5c",
|
|
506
|
-
type: {
|
|
507
|
-
name: "Sequence",
|
|
508
|
-
element: {
|
|
509
|
-
type: {
|
|
510
|
-
name: "String"
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
},
|
|
515
|
-
y: {
|
|
516
|
-
serializedName: "y",
|
|
517
|
-
type: {
|
|
518
|
-
name: "String"
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
};
|
|
524
|
-
const AttestationCertificateManagementBody = {
|
|
525
|
-
type: {
|
|
526
|
-
name: "Composite",
|
|
527
|
-
className: "AttestationCertificateManagementBody",
|
|
528
|
-
modelProperties: {
|
|
529
|
-
policyCertificate: {
|
|
530
|
-
serializedName: "policyCertificate",
|
|
531
|
-
type: {
|
|
532
|
-
name: "Composite",
|
|
533
|
-
className: "JsonWebKey"
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
};
|
|
539
|
-
const PolicyCertificatesResult = {
|
|
540
|
-
type: {
|
|
541
|
-
name: "Composite",
|
|
542
|
-
className: "PolicyCertificatesResult",
|
|
543
|
-
modelProperties: {
|
|
544
|
-
policyCertificates: {
|
|
545
|
-
serializedName: "x-ms-policy-certificates",
|
|
546
|
-
type: {
|
|
547
|
-
name: "Composite",
|
|
548
|
-
className: "JsonWebKeySet"
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
};
|
|
554
|
-
const PolicyCertificatesModificationResult = {
|
|
555
|
-
type: {
|
|
556
|
-
name: "Composite",
|
|
557
|
-
className: "PolicyCertificatesModificationResult",
|
|
558
|
-
modelProperties: {
|
|
559
|
-
certificateThumbprint: {
|
|
560
|
-
serializedName: "x-ms-certificate-thumbprint",
|
|
561
|
-
required: true,
|
|
562
|
-
type: {
|
|
563
|
-
name: "String"
|
|
564
|
-
}
|
|
565
|
-
},
|
|
566
|
-
certificateResolution: {
|
|
567
|
-
serializedName: "x-ms-policycertificates-result",
|
|
568
|
-
required: true,
|
|
569
|
-
type: {
|
|
570
|
-
name: "String"
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
};
|
|
576
|
-
const StoredAttestationPolicy$1 = {
|
|
577
|
-
type: {
|
|
578
|
-
name: "Composite",
|
|
579
|
-
className: "StoredAttestationPolicy",
|
|
580
|
-
modelProperties: {
|
|
581
|
-
attestationPolicy: {
|
|
582
|
-
serializedName: "AttestationPolicy",
|
|
583
|
-
type: {
|
|
584
|
-
name: "Base64Url"
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
};
|
|
590
|
-
const PolicyResult = {
|
|
591
|
-
type: {
|
|
592
|
-
name: "Composite",
|
|
593
|
-
className: "PolicyResult",
|
|
594
|
-
modelProperties: {
|
|
595
|
-
policyResolution: {
|
|
596
|
-
serializedName: "x-ms-policy-result",
|
|
597
|
-
required: true,
|
|
598
|
-
type: {
|
|
599
|
-
name: "String"
|
|
600
|
-
}
|
|
601
|
-
},
|
|
602
|
-
policyTokenHash: {
|
|
603
|
-
serializedName: "x-ms-policy-token-hash",
|
|
604
|
-
required: true,
|
|
605
|
-
type: {
|
|
606
|
-
name: "Base64Url"
|
|
607
|
-
}
|
|
608
|
-
},
|
|
609
|
-
policySigner: {
|
|
610
|
-
serializedName: "x-ms-policy-signer",
|
|
611
|
-
type: {
|
|
612
|
-
name: "Composite",
|
|
613
|
-
className: "JsonWebKey"
|
|
614
|
-
}
|
|
615
|
-
},
|
|
616
|
-
policy: {
|
|
617
|
-
constraints: {
|
|
618
|
-
Pattern: new RegExp("[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]*\\.[A-Za-z0-9_-]*")
|
|
619
|
-
},
|
|
620
|
-
serializedName: "x-ms-policy",
|
|
621
|
-
type: {
|
|
622
|
-
name: "String"
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
};
|
|
628
|
-
const GeneratedAttestationResult = {
|
|
629
|
-
type: {
|
|
630
|
-
name: "Composite",
|
|
631
|
-
className: "GeneratedAttestationResult",
|
|
632
|
-
modelProperties: {
|
|
633
|
-
jti: {
|
|
634
|
-
serializedName: "jti",
|
|
635
|
-
required: true,
|
|
636
|
-
type: {
|
|
637
|
-
name: "String"
|
|
638
|
-
}
|
|
639
|
-
},
|
|
640
|
-
iss: {
|
|
641
|
-
serializedName: "iss",
|
|
642
|
-
required: true,
|
|
643
|
-
type: {
|
|
644
|
-
name: "String"
|
|
645
|
-
}
|
|
646
|
-
},
|
|
647
|
-
iat: {
|
|
648
|
-
serializedName: "iat",
|
|
649
|
-
type: {
|
|
650
|
-
name: "Number"
|
|
651
|
-
}
|
|
652
|
-
},
|
|
653
|
-
exp: {
|
|
654
|
-
serializedName: "exp",
|
|
655
|
-
type: {
|
|
656
|
-
name: "Number"
|
|
657
|
-
}
|
|
658
|
-
},
|
|
659
|
-
nbf: {
|
|
660
|
-
serializedName: "nbf",
|
|
661
|
-
type: {
|
|
662
|
-
name: "Number"
|
|
663
|
-
}
|
|
664
|
-
},
|
|
665
|
-
cnf: {
|
|
666
|
-
serializedName: "cnf",
|
|
667
|
-
type: {
|
|
668
|
-
name: "Dictionary",
|
|
669
|
-
value: { type: { name: "any" } }
|
|
670
|
-
}
|
|
671
|
-
},
|
|
672
|
-
nonce: {
|
|
673
|
-
serializedName: "nonce",
|
|
674
|
-
type: {
|
|
675
|
-
name: "String"
|
|
676
|
-
}
|
|
677
|
-
},
|
|
678
|
-
version: {
|
|
679
|
-
serializedName: "x-ms-ver",
|
|
680
|
-
required: true,
|
|
681
|
-
type: {
|
|
682
|
-
name: "String"
|
|
683
|
-
}
|
|
684
|
-
},
|
|
685
|
-
runtimeClaims: {
|
|
686
|
-
serializedName: "x-ms-runtime",
|
|
687
|
-
type: {
|
|
688
|
-
name: "Dictionary",
|
|
689
|
-
value: { type: { name: "any" } }
|
|
690
|
-
}
|
|
691
|
-
},
|
|
692
|
-
inittimeClaims: {
|
|
693
|
-
serializedName: "x-ms-inittime",
|
|
694
|
-
type: {
|
|
695
|
-
name: "Dictionary",
|
|
696
|
-
value: { type: { name: "any" } }
|
|
697
|
-
}
|
|
698
|
-
},
|
|
699
|
-
policyClaims: {
|
|
700
|
-
serializedName: "x-ms-policy",
|
|
701
|
-
type: {
|
|
702
|
-
name: "Dictionary",
|
|
703
|
-
value: { type: { name: "any" } }
|
|
704
|
-
}
|
|
705
|
-
},
|
|
706
|
-
verifierType: {
|
|
707
|
-
serializedName: "x-ms-attestation-type",
|
|
708
|
-
required: true,
|
|
709
|
-
type: {
|
|
710
|
-
name: "String"
|
|
711
|
-
}
|
|
712
|
-
},
|
|
713
|
-
policySigner: {
|
|
714
|
-
serializedName: "x-ms-policy-signer",
|
|
715
|
-
type: {
|
|
716
|
-
name: "Composite",
|
|
717
|
-
className: "JsonWebKey"
|
|
718
|
-
}
|
|
719
|
-
},
|
|
720
|
-
policyHash: {
|
|
721
|
-
serializedName: "x-ms-policy-hash",
|
|
722
|
-
required: true,
|
|
723
|
-
type: {
|
|
724
|
-
name: "Base64Url"
|
|
725
|
-
}
|
|
726
|
-
},
|
|
727
|
-
isDebuggable: {
|
|
728
|
-
serializedName: "x-ms-sgx-is-debuggable",
|
|
729
|
-
required: true,
|
|
730
|
-
type: {
|
|
731
|
-
name: "Boolean"
|
|
732
|
-
}
|
|
733
|
-
},
|
|
734
|
-
productId: {
|
|
735
|
-
serializedName: "x-ms-sgx-product-id",
|
|
736
|
-
required: true,
|
|
737
|
-
type: {
|
|
738
|
-
name: "Number"
|
|
739
|
-
}
|
|
740
|
-
},
|
|
741
|
-
mrEnclave: {
|
|
742
|
-
serializedName: "x-ms-sgx-mrenclave",
|
|
743
|
-
required: true,
|
|
744
|
-
type: {
|
|
745
|
-
name: "String"
|
|
746
|
-
}
|
|
747
|
-
},
|
|
748
|
-
mrSigner: {
|
|
749
|
-
serializedName: "x-ms-sgx-mrsigner",
|
|
750
|
-
required: true,
|
|
751
|
-
type: {
|
|
752
|
-
name: "String"
|
|
753
|
-
}
|
|
754
|
-
},
|
|
755
|
-
svn: {
|
|
756
|
-
serializedName: "x-ms-sgx-svn",
|
|
757
|
-
required: true,
|
|
758
|
-
type: {
|
|
759
|
-
name: "Number"
|
|
760
|
-
}
|
|
761
|
-
},
|
|
762
|
-
enclaveHeldData: {
|
|
763
|
-
serializedName: "x-ms-sgx-ehd",
|
|
764
|
-
type: {
|
|
765
|
-
name: "Base64Url"
|
|
766
|
-
}
|
|
767
|
-
},
|
|
768
|
-
sgxCollateral: {
|
|
769
|
-
serializedName: "x-ms-sgx-collateral",
|
|
770
|
-
type: {
|
|
771
|
-
name: "Dictionary",
|
|
772
|
-
value: { type: { name: "any" } }
|
|
773
|
-
}
|
|
774
|
-
},
|
|
775
|
-
deprecatedVersion: {
|
|
776
|
-
serializedName: "ver",
|
|
777
|
-
type: {
|
|
778
|
-
name: "String"
|
|
779
|
-
}
|
|
780
|
-
},
|
|
781
|
-
deprecatedIsDebuggable: {
|
|
782
|
-
serializedName: "is-debuggable",
|
|
783
|
-
type: {
|
|
784
|
-
name: "Boolean"
|
|
785
|
-
}
|
|
786
|
-
},
|
|
787
|
-
deprecatedSgxCollateral: {
|
|
788
|
-
serializedName: "maa-attestationcollateral",
|
|
789
|
-
type: {
|
|
790
|
-
name: "Dictionary",
|
|
791
|
-
value: { type: { name: "any" } }
|
|
792
|
-
}
|
|
793
|
-
},
|
|
794
|
-
deprecatedEnclaveHeldData: {
|
|
795
|
-
serializedName: "aas-ehd",
|
|
796
|
-
type: {
|
|
797
|
-
name: "Base64Url"
|
|
798
|
-
}
|
|
799
|
-
},
|
|
800
|
-
deprecatedEnclaveHeldData2: {
|
|
801
|
-
serializedName: "maa-ehd",
|
|
802
|
-
type: {
|
|
803
|
-
name: "Base64Url"
|
|
804
|
-
}
|
|
805
|
-
},
|
|
806
|
-
deprecatedProductId: {
|
|
807
|
-
serializedName: "product-id",
|
|
808
|
-
type: {
|
|
809
|
-
name: "Number"
|
|
810
|
-
}
|
|
811
|
-
},
|
|
812
|
-
deprecatedMrEnclave: {
|
|
813
|
-
serializedName: "sgx-mrenclave",
|
|
814
|
-
type: {
|
|
815
|
-
name: "String"
|
|
816
|
-
}
|
|
817
|
-
},
|
|
818
|
-
deprecatedMrSigner: {
|
|
819
|
-
serializedName: "sgx-mrsigner",
|
|
820
|
-
type: {
|
|
821
|
-
name: "String"
|
|
822
|
-
}
|
|
823
|
-
},
|
|
824
|
-
deprecatedSvn: {
|
|
825
|
-
serializedName: "svn",
|
|
826
|
-
type: {
|
|
827
|
-
name: "Number"
|
|
828
|
-
}
|
|
829
|
-
},
|
|
830
|
-
deprecatedTee: {
|
|
831
|
-
serializedName: "tee",
|
|
832
|
-
type: {
|
|
833
|
-
name: "String"
|
|
834
|
-
}
|
|
835
|
-
},
|
|
836
|
-
deprecatedPolicySigner: {
|
|
837
|
-
serializedName: "policy_signer",
|
|
838
|
-
type: {
|
|
839
|
-
name: "Composite",
|
|
840
|
-
className: "JsonWebKey"
|
|
841
|
-
}
|
|
842
|
-
},
|
|
843
|
-
deprecatedPolicyHash: {
|
|
844
|
-
serializedName: "policy_hash",
|
|
845
|
-
type: {
|
|
846
|
-
name: "Base64Url"
|
|
847
|
-
}
|
|
848
|
-
},
|
|
849
|
-
deprecatedRpData: {
|
|
850
|
-
serializedName: "rp_data",
|
|
851
|
-
type: {
|
|
852
|
-
name: "String"
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
};
|
|
858
|
-
|
|
859
|
-
var Mappers = /*#__PURE__*/Object.freeze({
|
|
860
|
-
__proto__: null,
|
|
861
|
-
AttestOpenEnclaveRequest: AttestOpenEnclaveRequest,
|
|
862
|
-
AttestSgxEnclaveRequest: AttestSgxEnclaveRequest,
|
|
863
|
-
AttestationCertificateManagementBody: AttestationCertificateManagementBody,
|
|
864
|
-
AttestationResponse: AttestationResponse,
|
|
865
|
-
CloudError: CloudError,
|
|
866
|
-
CloudErrorBody: CloudErrorBody,
|
|
867
|
-
GeneratedAttestationResult: GeneratedAttestationResult,
|
|
868
|
-
InitTimeData: InitTimeData,
|
|
869
|
-
JsonWebKey: JsonWebKey,
|
|
870
|
-
JsonWebKeySet: JsonWebKeySet,
|
|
871
|
-
PolicyCertificatesModificationResult: PolicyCertificatesModificationResult,
|
|
872
|
-
PolicyCertificatesModifyResponse: PolicyCertificatesModifyResponse,
|
|
873
|
-
PolicyCertificatesResponse: PolicyCertificatesResponse,
|
|
874
|
-
PolicyCertificatesResult: PolicyCertificatesResult,
|
|
875
|
-
PolicyResponse: PolicyResponse,
|
|
876
|
-
PolicyResult: PolicyResult,
|
|
877
|
-
RuntimeData: RuntimeData,
|
|
878
|
-
StoredAttestationPolicy: StoredAttestationPolicy$1,
|
|
879
|
-
TpmAttestationRequest: TpmAttestationRequest,
|
|
880
|
-
TpmAttestationResponse: TpmAttestationResponse
|
|
881
|
-
});
|
|
882
|
-
|
|
883
|
-
// Copyright (c) Microsoft Corporation.
|
|
884
|
-
// Licensed under the MIT License.
|
|
885
|
-
/*
|
|
886
|
-
* Copyright (c) Microsoft Corporation.
|
|
887
|
-
* Licensed under the MIT License.
|
|
888
|
-
*
|
|
889
|
-
*/
|
|
890
|
-
/**
|
|
891
|
-
* Represents a stored attestation policy sent to the attestation service.
|
|
892
|
-
*/
|
|
893
|
-
class StoredAttestationPolicy {
|
|
894
|
-
constructor(value) {
|
|
895
|
-
this.attestationPolicy = stringToBytes(value);
|
|
896
|
-
}
|
|
897
|
-
/**
|
|
898
|
-
* Serializes a StoredAttestationPolicy object to a JSON encoded string.
|
|
899
|
-
*
|
|
900
|
-
* @returns The serialized JSON policy.
|
|
901
|
-
*/
|
|
902
|
-
serialize() {
|
|
903
|
-
return TypeDeserializer.serialize(this, { StoredAttestationPolicy: StoredAttestationPolicy$1 }, StoredAttestationPolicy$1);
|
|
904
|
-
}
|
|
905
|
-
/**
|
|
906
|
-
* Deserializes a stored attestation policy object returned from the attestation service.
|
|
907
|
-
*
|
|
908
|
-
* @param value - Raw JSON object from service to serialize as an attestation policy.
|
|
909
|
-
* @returns Stored attestation policy.
|
|
910
|
-
*/
|
|
911
|
-
static deserialize(value) {
|
|
912
|
-
return TypeDeserializer.deserialize(value, { StoredAttestationPolicy: StoredAttestationPolicy$1 }, "StoredAttestationPolicy");
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
// Copyright (c) Microsoft Corporation.
|
|
917
|
-
// Licensed under the MIT License.
|
|
918
|
-
/**
|
|
919
|
-
* Encodes a string in base64 format.
|
|
920
|
-
* @param value - the string to encode
|
|
921
|
-
*/
|
|
922
|
-
/**
|
|
923
|
-
* Encodes a byte array in base64 format.
|
|
924
|
-
* @param value - the Uint8Array to encode
|
|
925
|
-
*/
|
|
926
|
-
function base64EncodeByteArray(value) {
|
|
927
|
-
// Buffer.from accepts <ArrayBuffer> | <SharedArrayBuffer>-- the TypeScript definition is off here
|
|
928
|
-
// https://nodejs.org/api/buffer.html#buffer_class_method_buffer_from_arraybuffer_byteoffset_length
|
|
929
|
-
const bufferValue = value instanceof Buffer ? value : Buffer.from(value.buffer);
|
|
930
|
-
return bufferValue.toString("base64");
|
|
931
|
-
}
|
|
932
|
-
/**
|
|
933
|
-
* Decodes a base64 string into a byte array.
|
|
934
|
-
* @param value - the base64 string to decode
|
|
935
|
-
*/
|
|
936
|
-
function base64DecodeString(value) {
|
|
937
|
-
return Buffer.from(value, "base64");
|
|
938
|
-
}
|
|
939
|
-
/**
|
|
940
|
-
* Adds missing padding to a Base64 encoded string
|
|
941
|
-
* @param unpadded - The unpadded input string
|
|
942
|
-
* @returns The padded string
|
|
943
|
-
*/
|
|
944
|
-
function fixPadding(unpadded) {
|
|
945
|
-
const count = 3 - ((unpadded.length + 3) % 4);
|
|
946
|
-
return unpadded + "=".repeat(count);
|
|
947
|
-
}
|
|
948
|
-
/**
|
|
949
|
-
* Decodes a base64url string into a byte array.
|
|
950
|
-
* @param value - the base64url string to decode
|
|
951
|
-
*/
|
|
952
|
-
function base64UrlDecodeString(value) {
|
|
953
|
-
const encoded = value.replace(/-/g, "+").replace(/_/g, "/");
|
|
954
|
-
const paddedEncoded = fixPadding(encoded);
|
|
955
|
-
return base64DecodeString(paddedEncoded);
|
|
956
|
-
}
|
|
957
|
-
function hexToByteArray(value) {
|
|
958
|
-
if (value.length % 2 !== 0) {
|
|
959
|
-
throw new Error("base64FromHex: Input must be a multiple of 2 characters");
|
|
960
|
-
}
|
|
961
|
-
const byteArray = new Array();
|
|
962
|
-
for (let i = 0; i < value.length; i += 2) {
|
|
963
|
-
byteArray.push(parseInt(value.substr(i, 2), 16));
|
|
964
|
-
}
|
|
965
|
-
return Uint8Array.from(byteArray);
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
// Copyright (c) Microsoft Corporation.
|
|
969
|
-
// Licensed under the MIT License.
|
|
970
|
-
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
|
|
971
|
-
/// <reference path="../jsrsasign.d.ts"/>
|
|
972
|
-
/** Create an AttestationSigningKey from the provided private key and certificate.
|
|
973
|
-
*
|
|
974
|
-
* @param privateKey - PEM encoded DER Encoded RSA or ECDS key.
|
|
975
|
-
* @param certificate - PEM encoded DER encoded X.509 certificate.
|
|
976
|
-
*/
|
|
977
|
-
function verifyAttestationSigningKey(privateKey, certificate) {
|
|
978
|
-
//
|
|
979
|
-
// Ensure that the key and certificate are associated with each other.
|
|
980
|
-
//
|
|
981
|
-
// Sign a buffer with the key, then verify the signature with the
|
|
982
|
-
// certificate.
|
|
983
|
-
const x509 = new jsrsasign__namespace.X509();
|
|
984
|
-
x509.readCertPEM(certificate);
|
|
985
|
-
const alg = x509.getSignatureAlgorithmName();
|
|
986
|
-
const signer = new jsrsasign__namespace.KJUR.crypto.Signature({ alg: alg });
|
|
987
|
-
// Confirm that the certificate and private key are related to each other.
|
|
988
|
-
const bufferToSign = "1234";
|
|
989
|
-
signer.init(privateKey);
|
|
990
|
-
signer.updateString(bufferToSign);
|
|
991
|
-
const sigVal = signer.sign();
|
|
992
|
-
const verifier = new jsrsasign__namespace.KJUR.crypto.Signature({ alg: alg });
|
|
993
|
-
verifier.init(x509.getPublicKey());
|
|
994
|
-
verifier.updateString(bufferToSign);
|
|
995
|
-
if (!verifier.verify(sigVal)) {
|
|
996
|
-
throw new Error("verifyAttestationSigningKey: Key does not match Certificate.");
|
|
997
|
-
}
|
|
998
|
-
return { certificate: certificate, privateKey: privateKey };
|
|
999
|
-
}
|
|
1000
|
-
/**
|
|
1001
|
-
*
|
|
1002
|
-
* @param base64 - Base64 encoded DER object to encode as PEM.
|
|
1003
|
-
* @param pemType - PEM object type - typically "CERTIFICATE" |
|
|
1004
|
-
*/
|
|
1005
|
-
function pemFromBase64(base64, pemType) {
|
|
1006
|
-
let pem = "-----BEGIN " + pemType + "-----\n";
|
|
1007
|
-
while (base64 !== "") {
|
|
1008
|
-
pem += base64.substr(0, 64) + "\n";
|
|
1009
|
-
base64 = base64.substr(64);
|
|
1010
|
-
}
|
|
1011
|
-
pem += "-----END " + pemType + "-----\n";
|
|
1012
|
-
return pem;
|
|
1013
|
-
}
|
|
1014
|
-
/**
|
|
1015
|
-
* Converts a hex encoded string to its base64 equivalent.
|
|
1016
|
-
* @param value - Hex encoded value
|
|
1017
|
-
*/
|
|
1018
|
-
function hexToBase64(value) {
|
|
1019
|
-
return base64EncodeByteArray(hexToByteArray(value));
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
// Copyright (c) Microsoft Corporation.
|
|
1023
|
-
// Licensed under the MIT License.
|
|
1024
|
-
/**
|
|
1025
|
-
*
|
|
1026
|
-
* @param key - JsonWebKey for signing key.
|
|
1027
|
-
* @returns AttestationSigner created from the JsonWebKey.
|
|
1028
|
-
*
|
|
1029
|
-
* @internal
|
|
1030
|
-
*/
|
|
1031
|
-
function _attestationSignerFromGenerated(key) {
|
|
1032
|
-
var _a, _b;
|
|
1033
|
-
return {
|
|
1034
|
-
keyId: key === null || key === void 0 ? void 0 : key.kid,
|
|
1035
|
-
certificates: (_b = (_a = key === null || key === void 0 ? void 0 : key.x5C) === null || _a === void 0 ? void 0 : _a.map((cert) => pemFromBase64(cert, "CERTIFICATE"))) !== null && _b !== void 0 ? _b : [],
|
|
1036
|
-
};
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1039
|
-
// Copyright (c) Microsoft Corporation.
|
|
1040
|
-
// Licensed under the MIT License.
|
|
1041
|
-
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
|
|
1042
|
-
/// <reference path="../jsrsasign.d.ts"/>
|
|
1043
|
-
/**
|
|
1044
|
-
*
|
|
1045
|
-
* An AttestationToken represents an RFC 7515 JSON Web Signature object.
|
|
1046
|
-
*
|
|
1047
|
-
* It can represent either the token returned by the attestation service,
|
|
1048
|
-
* or it can be used to create a token locally which can be used to verify
|
|
1049
|
-
* attestation policy changes.
|
|
1050
|
-
*/
|
|
1051
|
-
class AttestationTokenImpl {
|
|
1052
|
-
/**
|
|
1053
|
-
* @internal
|
|
1054
|
-
*
|
|
1055
|
-
* @param token - Attetation token returned by the attestation service.
|
|
1056
|
-
*/
|
|
1057
|
-
constructor(token) {
|
|
1058
|
-
this._token = token;
|
|
1059
|
-
const pieces = token.split(".");
|
|
1060
|
-
if (pieces.length !== 3) {
|
|
1061
|
-
throw Error("Incorrectly formatted token:");
|
|
1062
|
-
}
|
|
1063
|
-
this._headerBytes = base64UrlDecodeString(pieces[0]);
|
|
1064
|
-
this._header = safeJsonParse(bytesToString(this._headerBytes));
|
|
1065
|
-
this._bodyBytes = base64UrlDecodeString(pieces[1]);
|
|
1066
|
-
this._body = safeJsonParse(bytesToString(this._bodyBytes));
|
|
1067
|
-
// this._signature = base64UrlDecodeString(pieces[2]);
|
|
1068
|
-
this._jwsVerifier = jsrsasign__namespace.KJUR.jws.JWS.parse(token);
|
|
1069
|
-
}
|
|
1070
|
-
/**
|
|
1071
|
-
* Returns the deserialized body of the AttestationToken object.
|
|
1072
|
-
*
|
|
1073
|
-
* @returns The body of the attestation token as an object.
|
|
1074
|
-
*/
|
|
1075
|
-
getBody() {
|
|
1076
|
-
return this._jwsVerifier.payloadObj;
|
|
1077
|
-
}
|
|
1078
|
-
/**
|
|
1079
|
-
* the token to a string.
|
|
1080
|
-
*
|
|
1081
|
-
* @remarks
|
|
1082
|
-
* Serializes the token to a string.
|
|
1083
|
-
*
|
|
1084
|
-
* @returns The token serialized to a RFC 7515 JSON Web Signature.
|
|
1085
|
-
*/
|
|
1086
|
-
serialize() {
|
|
1087
|
-
return this._token;
|
|
1088
|
-
}
|
|
1089
|
-
/**
|
|
1090
|
-
* Returns the set of problems discovered in the attestation token.
|
|
1091
|
-
*
|
|
1092
|
-
* @param possibleSigners - the set of possible signers for this attestation token.
|
|
1093
|
-
* @param options - validation options
|
|
1094
|
-
* @returns an array of string values. If there are no problems, returns an empty array.
|
|
1095
|
-
*/
|
|
1096
|
-
getTokenProblems(possibleSigners, options = {
|
|
1097
|
-
validateExpirationTime: true,
|
|
1098
|
-
validateToken: true,
|
|
1099
|
-
validateNotBeforeTime: true,
|
|
1100
|
-
}) {
|
|
1101
|
-
let problems = new Array();
|
|
1102
|
-
if (!options.validateToken) {
|
|
1103
|
-
return problems;
|
|
1104
|
-
}
|
|
1105
|
-
let foundSigner = undefined;
|
|
1106
|
-
if (this.algorithm !== "none") {
|
|
1107
|
-
const signers = this.getCandidateSigners(possibleSigners);
|
|
1108
|
-
signers.some((signer) => {
|
|
1109
|
-
const cert = this.certFromSigner(signer);
|
|
1110
|
-
// const pubKeyObj = cert.getPublicKey();
|
|
1111
|
-
const isValid = jsrsasign__namespace.KJUR.jws.JWS.verify(this._token, cert);
|
|
1112
|
-
if (isValid) {
|
|
1113
|
-
foundSigner = signer;
|
|
1114
|
-
}
|
|
1115
|
-
});
|
|
1116
|
-
if (foundSigner === undefined) {
|
|
1117
|
-
problems.push("Attestation Token is not properly signed.");
|
|
1118
|
-
}
|
|
1119
|
-
}
|
|
1120
|
-
// If the token has a body, check the expiration time and issuer.
|
|
1121
|
-
if (this._body !== undefined) {
|
|
1122
|
-
problems = problems.concat(this.validateTimeProperties(options));
|
|
1123
|
-
problems = problems.concat(this.validateIssuer(options));
|
|
1124
|
-
}
|
|
1125
|
-
if (options.validateAttestationToken !== undefined) {
|
|
1126
|
-
// If there is a validation error, the getProblemsCallback will return the list of
|
|
1127
|
-
// problems found.
|
|
1128
|
-
const validationErrors = options.validateAttestationToken(this, foundSigner);
|
|
1129
|
-
if (validationErrors) {
|
|
1130
|
-
problems = problems.concat(validationErrors);
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
return problems;
|
|
1134
|
-
}
|
|
1135
|
-
validateIssuer(options) {
|
|
1136
|
-
const problems = new Array();
|
|
1137
|
-
if (this.issuer && options.validateIssuer) {
|
|
1138
|
-
if (this.issuer !== options.expectedIssuer) {
|
|
1139
|
-
problems.push("Found issuer: " + this.issuer + "; expected issuer: " + options.expectedIssuer);
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
return problems;
|
|
1143
|
-
}
|
|
1144
|
-
/**
|
|
1145
|
-
* Validate the expiration and notbefore time claims in the JSON web token.
|
|
1146
|
-
*
|
|
1147
|
-
* @param options - Options to be used validating the time properties.
|
|
1148
|
-
*/
|
|
1149
|
-
validateTimeProperties(options) {
|
|
1150
|
-
var _a, _b;
|
|
1151
|
-
// Calculate the current time as a number of seconds since the start of the
|
|
1152
|
-
// Unix epoch.
|
|
1153
|
-
const problems = new Array();
|
|
1154
|
-
const timeNow = Math.floor(new Date().getTime() / 1000);
|
|
1155
|
-
// Validate expiration time.
|
|
1156
|
-
if (this.expiresOn !== undefined && options.validateExpirationTime) {
|
|
1157
|
-
const expTime = this.expiresOn.getTime() / 1000;
|
|
1158
|
-
if (timeNow > expTime) {
|
|
1159
|
-
const delta = timeNow - expTime;
|
|
1160
|
-
if (delta > ((_a = options.timeValidationSlack) !== null && _a !== void 0 ? _a : 0)) {
|
|
1161
|
-
problems.push("AttestationToken has expired.");
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
// Validate not before time.
|
|
1166
|
-
if (this.notBefore !== undefined && options.validateNotBeforeTime) {
|
|
1167
|
-
const nbfTime = this.notBefore.getTime() / 1000;
|
|
1168
|
-
if (nbfTime > timeNow) {
|
|
1169
|
-
const delta = nbfTime - timeNow;
|
|
1170
|
-
if (delta > ((_b = options.timeValidationSlack) !== null && _b !== void 0 ? _b : 0)) {
|
|
1171
|
-
problems.push("AttestationToken is not yet valid.");
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
return problems;
|
|
1176
|
-
}
|
|
1177
|
-
certFromSigner(signer) {
|
|
1178
|
-
// return the PEM encoded certificate.
|
|
1179
|
-
return signer.certificates[0];
|
|
1180
|
-
}
|
|
1181
|
-
getCandidateSigners(possibleSigningCertificates) {
|
|
1182
|
-
const candidateSigners = new Array();
|
|
1183
|
-
const desiredKeyId = this.keyId;
|
|
1184
|
-
if (desiredKeyId !== undefined && possibleSigningCertificates !== undefined) {
|
|
1185
|
-
possibleSigningCertificates.forEach((possibleSigner) => {
|
|
1186
|
-
if (possibleSigner.keyId === desiredKeyId) {
|
|
1187
|
-
candidateSigners.push(possibleSigner);
|
|
1188
|
-
}
|
|
1189
|
-
});
|
|
1190
|
-
// If we didn't find any candidate signers looking through the provided
|
|
1191
|
-
// signing certificates, then maybe there's a certificate chain in the
|
|
1192
|
-
// token itself that might be used to sign the token.
|
|
1193
|
-
if (candidateSigners.length === 0) {
|
|
1194
|
-
if (this.certificateChain !== undefined && this.certificateChain !== null) {
|
|
1195
|
-
candidateSigners.push(this.certificateChain);
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
else {
|
|
1200
|
-
possibleSigningCertificates === null || possibleSigningCertificates === void 0 ? void 0 : possibleSigningCertificates.map((value) => candidateSigners.push(value));
|
|
1201
|
-
if (this.certificateChain !== undefined) {
|
|
1202
|
-
candidateSigners.push(this.certificateChain);
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
return candidateSigners;
|
|
1206
|
-
}
|
|
1207
|
-
/** ********* JSON WEB SIGNATURE (RFC 7515) PROPERTIES */
|
|
1208
|
-
/**
|
|
1209
|
-
* Returns the algorithm from the header of the JSON Web Signature.
|
|
1210
|
-
*
|
|
1211
|
-
* See {@link https://www.rfc-editor.org/rfc/rfc7515.html#section-4.1.1 | RFC 7515 Section 4.1.1})
|
|
1212
|
-
* for details.
|
|
1213
|
-
*
|
|
1214
|
-
* If the value of algorithm is "none" it indicates that the token is unsecured.
|
|
1215
|
-
*/
|
|
1216
|
-
get algorithm() {
|
|
1217
|
-
var _a;
|
|
1218
|
-
return (_a = this._header) === null || _a === void 0 ? void 0 : _a.alg;
|
|
1219
|
-
}
|
|
1220
|
-
/**
|
|
1221
|
-
* Json Web Signature Header "kid".
|
|
1222
|
-
* See {@link https://www.rfc-editor.org/rfc/rfc7515.html#section-4.1.4 | RFC 7515 Section 4.1.4})
|
|
1223
|
-
* for details.
|
|
1224
|
-
*/
|
|
1225
|
-
get keyId() {
|
|
1226
|
-
return this._header.kid;
|
|
1227
|
-
}
|
|
1228
|
-
/**
|
|
1229
|
-
* Json Web Signature Header "crit".
|
|
1230
|
-
*
|
|
1231
|
-
* See {@link https://www.rfc-editor.org/rfc/rfc7515.html#section-4.1.11 | RFC 7515 Section 4.1.11})
|
|
1232
|
-
* for details.
|
|
1233
|
-
*
|
|
1234
|
-
*/
|
|
1235
|
-
get critical() {
|
|
1236
|
-
return this._header.crit;
|
|
1237
|
-
}
|
|
1238
|
-
/**
|
|
1239
|
-
* Json Web Token Header "content type".
|
|
1240
|
-
* See {@link https://www.rfc-editor.org/rfc/rfc7515.html#section-4.1.10 | RFC 7515 Section 4.1.10})
|
|
1241
|
-
*
|
|
1242
|
-
*/
|
|
1243
|
-
get contentType() {
|
|
1244
|
-
return this._header.cty;
|
|
1245
|
-
}
|
|
1246
|
-
/**
|
|
1247
|
-
* Json Web Token Header "key URL".
|
|
1248
|
-
*
|
|
1249
|
-
* @see {@link https://www.rfc-editor.org/rfc/rfc7515.html#section-4.1.2 | RFC 7515 Section 4.1.2})
|
|
1250
|
-
*
|
|
1251
|
-
*/
|
|
1252
|
-
get keyUrl() {
|
|
1253
|
-
return this._header.jku;
|
|
1254
|
-
}
|
|
1255
|
-
/**
|
|
1256
|
-
* Json Web Token Header "X509 Url".
|
|
1257
|
-
* @see {@link https://www.rfc-editor.org/rfc/rfc7515.html#section-4.1.5 | RFC 7515 Section 4.1.5})
|
|
1258
|
-
*
|
|
1259
|
-
*/
|
|
1260
|
-
get x509Url() {
|
|
1261
|
-
return this._header.x5u;
|
|
1262
|
-
}
|
|
1263
|
-
/** Json Web Token Header "Typ".
|
|
1264
|
-
*
|
|
1265
|
-
* @see {@link https://www.rfc-editor.org/rfc/rfc7515.html#section-4.1.9 | RFC 7515 Section 4.1.9})
|
|
1266
|
-
*
|
|
1267
|
-
*/
|
|
1268
|
-
get type() {
|
|
1269
|
-
return this._header.typ;
|
|
1270
|
-
}
|
|
1271
|
-
/**
|
|
1272
|
-
* Json Web Token Header "x509 thumprint".
|
|
1273
|
-
* See {@link https://www.rfc-editor.org/rfc/rfc7515.html#section-4.1.7 | RFC 7515 Section 4.1.7})
|
|
1274
|
-
*/
|
|
1275
|
-
get certificateThumbprint() {
|
|
1276
|
-
return this._header.x5t;
|
|
1277
|
-
}
|
|
1278
|
-
/** Json Web Token Header "x509 SHA256 thumprint".
|
|
1279
|
-
*
|
|
1280
|
-
* See {@link https://www.rfc-editor.org/rfc/rfc7515.html#section-4.1.8 | RFC 7515 Section 4.1.8})
|
|
1281
|
-
*
|
|
1282
|
-
*/
|
|
1283
|
-
get certificateSha256Thumbprint() {
|
|
1284
|
-
return this._header["x5t#256"];
|
|
1285
|
-
}
|
|
1286
|
-
/** Json Web Token Header "x509 certificate chain".
|
|
1287
|
-
*
|
|
1288
|
-
* See {@link https://www.rfc-editor.org/rfc/rfc7515.html#section-4.1.6 | RFC 7515 Section 4.1.6})
|
|
1289
|
-
*
|
|
1290
|
-
*/
|
|
1291
|
-
get certificateChain() {
|
|
1292
|
-
let jwk;
|
|
1293
|
-
if (this._header.jwk !== undefined) {
|
|
1294
|
-
jwk = TypeDeserializer.deserialize(this._header.jwk, [JsonWebKey], "JsonWebKey");
|
|
1295
|
-
}
|
|
1296
|
-
else {
|
|
1297
|
-
jwk = TypeDeserializer.deserialize(this._header, { JsonWebKey: JsonWebKey }, "JsonWebKey");
|
|
1298
|
-
}
|
|
1299
|
-
return _attestationSignerFromGenerated(jwk);
|
|
1300
|
-
}
|
|
1301
|
-
/** ********* JSON WEB TOKEN (RFC 7519) PROPERTIES */
|
|
1302
|
-
/** Issuer of the attestation token.
|
|
1303
|
-
* See {@link https://www.rfc-editor.org/rfc/rfc7519.html#section-4.1.6 | RFC 7519 Section 4.1.6})
|
|
1304
|
-
* for details.
|
|
1305
|
-
*/
|
|
1306
|
-
get issuer() {
|
|
1307
|
-
return this._body.iss;
|
|
1308
|
-
}
|
|
1309
|
-
/** Expiration time for the token, from JWT body.
|
|
1310
|
-
*
|
|
1311
|
-
* See {@link https://www.rfc-editor.org/rfc/rfc7519.html#section-4.1.4 | RFC 7519 Section 4.1.4})
|
|
1312
|
-
* for details.
|
|
1313
|
-
*/
|
|
1314
|
-
get expiresOn() {
|
|
1315
|
-
return this._body.exp ? new Date(this._body.exp * 1000) : undefined;
|
|
1316
|
-
}
|
|
1317
|
-
/** Issuance time for the token, from JWT body.
|
|
1318
|
-
*
|
|
1319
|
-
* See {@link https://www.rfc-editor.org/rfc/rfc7519.html#section-4.1.6 | RFC 7519 Section 4.1.6})
|
|
1320
|
-
* for details.
|
|
1321
|
-
*/
|
|
1322
|
-
get issuedAt() {
|
|
1323
|
-
return this._body.iat ? new Date(this._body.iat * 1000) : undefined;
|
|
1324
|
-
}
|
|
1325
|
-
/**
|
|
1326
|
-
* Not Before time for the token, from JWT body.
|
|
1327
|
-
*
|
|
1328
|
-
* See {@link https://www.rfc-editor.org/rfc/rfc7519.html#section-4.1.5 | RFC 7519 Section 4.1.5})
|
|
1329
|
-
* for details.
|
|
1330
|
-
*/
|
|
1331
|
-
get notBefore() {
|
|
1332
|
-
return this._body.nbf ? new Date(this._body.nbf * 1000) : undefined;
|
|
1333
|
-
}
|
|
1334
|
-
/**
|
|
1335
|
-
* Creates a new attestation token from a body and signing key.
|
|
1336
|
-
* @param body - stringified body of the body of the token to be created.
|
|
1337
|
-
* @param signer - Optional signing key used to sign the newly created token.
|
|
1338
|
-
* @returns an {@link AttestationToken | attestation token}
|
|
1339
|
-
*/
|
|
1340
|
-
static create(params) {
|
|
1341
|
-
var _a;
|
|
1342
|
-
const header = { alg: "none" };
|
|
1343
|
-
if ((!params.privateKey && params.certificate) || (params.privateKey && !params.certificate)) {
|
|
1344
|
-
throw new Error("If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.");
|
|
1345
|
-
}
|
|
1346
|
-
if (params.privateKey && params.certificate) {
|
|
1347
|
-
verifyAttestationSigningKey(params.privateKey, params.certificate);
|
|
1348
|
-
}
|
|
1349
|
-
if (params.privateKey || params.certificate) {
|
|
1350
|
-
const x5c = new jsrsasign__namespace.X509();
|
|
1351
|
-
x5c.readCertPEM(params.certificate);
|
|
1352
|
-
const pubKey = x5c.getPublicKey();
|
|
1353
|
-
if (pubKey instanceof jsrsasign__namespace.RSAKey) {
|
|
1354
|
-
header.alg = "RS256";
|
|
1355
|
-
}
|
|
1356
|
-
else if (pubKey instanceof jsrsasign__namespace.KJUR.crypto.ECDSA) {
|
|
1357
|
-
header.alg = "ES256";
|
|
1358
|
-
}
|
|
1359
|
-
else {
|
|
1360
|
-
throw new Error("Unknown public key type: " + typeof pubKey);
|
|
1361
|
-
}
|
|
1362
|
-
header.x5c = [hexToBase64(x5c.hex)];
|
|
1363
|
-
}
|
|
1364
|
-
else {
|
|
1365
|
-
header.alg = "none";
|
|
1366
|
-
}
|
|
1367
|
-
const encodedToken = jsrsasign__namespace.KJUR.jws.JWS.sign(header.alg, header, (_a = params.body) !== null && _a !== void 0 ? _a : "", params.privateKey);
|
|
1368
|
-
return new AttestationTokenImpl(encodedToken);
|
|
1369
|
-
}
|
|
1370
|
-
}
|
|
1371
|
-
function isObject(thing) {
|
|
1372
|
-
return Object.prototype.toString.call(thing) === "[object Object]";
|
|
1373
|
-
}
|
|
1374
|
-
function safeJsonParse(thing) {
|
|
1375
|
-
if (isObject(thing))
|
|
1376
|
-
return thing;
|
|
1377
|
-
try {
|
|
1378
|
-
return JSON.parse(thing);
|
|
1379
|
-
}
|
|
1380
|
-
catch (e) {
|
|
1381
|
-
return undefined;
|
|
1382
|
-
}
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
|
-
// Copyright (c) Microsoft Corporation.
|
|
1386
|
-
// Licensed under the MIT License.
|
|
1387
|
-
/** Constructs an AttestationToken containing an Attestation Policy document.
|
|
1388
|
-
*
|
|
1389
|
-
* @param policy - Attestation policy to embed in the attestation token.
|
|
1390
|
-
* @param privateKey - optional private key used to sign the attestation token.
|
|
1391
|
-
* @param certificate - optional certificate used to verify the attestation token.
|
|
1392
|
-
*
|
|
1393
|
-
* @remarks Note that if the attestation instance is running in `Isolated` mode,
|
|
1394
|
-
* the privateKey and certificate are required. If the attestation instance
|
|
1395
|
-
* is running in `AAD` mode, they are optional.
|
|
1396
|
-
*
|
|
1397
|
-
* @throws {@link Error} when the key in the certificate provided does not match the private key.
|
|
1398
|
-
*/
|
|
1399
|
-
function createAttestationPolicyToken(policy, privateKey, certificate) {
|
|
1400
|
-
const token = AttestationTokenImpl.create({
|
|
1401
|
-
body: new StoredAttestationPolicy(policy).serialize(),
|
|
1402
|
-
privateKey: privateKey,
|
|
1403
|
-
certificate: certificate,
|
|
1404
|
-
});
|
|
1405
|
-
return token;
|
|
1406
|
-
}
|
|
1407
|
-
|
|
1408
|
-
/*
|
|
1409
|
-
* Copyright (c) Microsoft Corporation.
|
|
1410
|
-
* Licensed under the MIT License.
|
|
1411
|
-
*
|
|
1412
|
-
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
1413
|
-
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
1414
|
-
*/
|
|
1415
|
-
const tracingClient = coreTracing.createTracingClient({
|
|
1416
|
-
namespace: "Azure.Security.Attestation",
|
|
1417
|
-
packageName: "@azure/attestation",
|
|
1418
|
-
packageVersion: "1.0.1"
|
|
1419
|
-
});
|
|
1420
|
-
|
|
1421
|
-
/*
|
|
1422
|
-
* Copyright (c) Microsoft Corporation.
|
|
1423
|
-
* Licensed under the MIT License.
|
|
1424
|
-
*
|
|
1425
|
-
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
1426
|
-
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
1427
|
-
*/
|
|
1428
|
-
const accept = {
|
|
1429
|
-
parameterPath: "accept",
|
|
1430
|
-
mapper: {
|
|
1431
|
-
defaultValue: "application/json",
|
|
1432
|
-
isConstant: true,
|
|
1433
|
-
serializedName: "Accept",
|
|
1434
|
-
type: {
|
|
1435
|
-
name: "String"
|
|
1436
|
-
}
|
|
1437
|
-
}
|
|
1438
|
-
};
|
|
1439
|
-
const instanceUrl = {
|
|
1440
|
-
parameterPath: "instanceUrl",
|
|
1441
|
-
mapper: {
|
|
1442
|
-
serializedName: "instanceUrl",
|
|
1443
|
-
required: true,
|
|
1444
|
-
type: {
|
|
1445
|
-
name: "String"
|
|
1446
|
-
}
|
|
1447
|
-
},
|
|
1448
|
-
skipEncoding: true
|
|
1449
|
-
};
|
|
1450
|
-
const apiVersion = {
|
|
1451
|
-
parameterPath: "apiVersion",
|
|
1452
|
-
mapper: {
|
|
1453
|
-
defaultValue: "2020-10-01",
|
|
1454
|
-
isConstant: true,
|
|
1455
|
-
serializedName: "api-version",
|
|
1456
|
-
type: {
|
|
1457
|
-
name: "String"
|
|
1458
|
-
}
|
|
1459
|
-
}
|
|
1460
|
-
};
|
|
1461
|
-
const attestationType = {
|
|
1462
|
-
parameterPath: "attestationType",
|
|
1463
|
-
mapper: {
|
|
1464
|
-
serializedName: "attestationType",
|
|
1465
|
-
required: true,
|
|
1466
|
-
type: {
|
|
1467
|
-
name: "String"
|
|
1468
|
-
}
|
|
1469
|
-
}
|
|
1470
|
-
};
|
|
1471
|
-
const contentType = {
|
|
1472
|
-
parameterPath: ["options", "contentType"],
|
|
1473
|
-
mapper: {
|
|
1474
|
-
defaultValue: "text/plain",
|
|
1475
|
-
isConstant: true,
|
|
1476
|
-
serializedName: "Content-Type",
|
|
1477
|
-
type: {
|
|
1478
|
-
name: "String"
|
|
1479
|
-
}
|
|
1480
|
-
}
|
|
1481
|
-
};
|
|
1482
|
-
const newAttestationPolicy = {
|
|
1483
|
-
parameterPath: "newAttestationPolicy",
|
|
1484
|
-
mapper: {
|
|
1485
|
-
serializedName: "newAttestationPolicy",
|
|
1486
|
-
required: true,
|
|
1487
|
-
type: {
|
|
1488
|
-
name: "String"
|
|
1489
|
-
}
|
|
1490
|
-
}
|
|
1491
|
-
};
|
|
1492
|
-
const accept1 = {
|
|
1493
|
-
parameterPath: "accept",
|
|
1494
|
-
mapper: {
|
|
1495
|
-
defaultValue: "application/json",
|
|
1496
|
-
isConstant: true,
|
|
1497
|
-
serializedName: "Accept",
|
|
1498
|
-
type: {
|
|
1499
|
-
name: "String"
|
|
1500
|
-
}
|
|
1501
|
-
}
|
|
1502
|
-
};
|
|
1503
|
-
const policyJws = {
|
|
1504
|
-
parameterPath: "policyJws",
|
|
1505
|
-
mapper: {
|
|
1506
|
-
serializedName: "policyJws",
|
|
1507
|
-
required: true,
|
|
1508
|
-
type: {
|
|
1509
|
-
name: "String"
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
|
-
};
|
|
1513
|
-
const contentType1 = {
|
|
1514
|
-
parameterPath: ["options", "contentType"],
|
|
1515
|
-
mapper: {
|
|
1516
|
-
defaultValue: "application/json",
|
|
1517
|
-
isConstant: true,
|
|
1518
|
-
serializedName: "Content-Type",
|
|
1519
|
-
type: {
|
|
1520
|
-
name: "String"
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
};
|
|
1524
|
-
const policyCertificateToAdd = {
|
|
1525
|
-
parameterPath: "policyCertificateToAdd",
|
|
1526
|
-
mapper: {
|
|
1527
|
-
constraints: {
|
|
1528
|
-
Pattern: new RegExp("[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]*\\.[A-Za-z0-9_-]*")
|
|
1529
|
-
},
|
|
1530
|
-
serializedName: "policyCertificateToAdd",
|
|
1531
|
-
required: true,
|
|
1532
|
-
type: {
|
|
1533
|
-
name: "String"
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
};
|
|
1537
|
-
const policyCertificateToRemove = {
|
|
1538
|
-
parameterPath: "policyCertificateToRemove",
|
|
1539
|
-
mapper: {
|
|
1540
|
-
constraints: {
|
|
1541
|
-
Pattern: new RegExp("[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]*\\.[A-Za-z0-9_-]*")
|
|
1542
|
-
},
|
|
1543
|
-
serializedName: "policyCertificateToRemove",
|
|
1544
|
-
required: true,
|
|
1545
|
-
type: {
|
|
1546
|
-
name: "String"
|
|
1547
|
-
}
|
|
1548
|
-
}
|
|
1549
|
-
};
|
|
1550
|
-
const request = {
|
|
1551
|
-
parameterPath: "request",
|
|
1552
|
-
mapper: AttestOpenEnclaveRequest
|
|
1553
|
-
};
|
|
1554
|
-
const request1 = {
|
|
1555
|
-
parameterPath: "request",
|
|
1556
|
-
mapper: AttestSgxEnclaveRequest
|
|
1557
|
-
};
|
|
1558
|
-
const request2 = {
|
|
1559
|
-
parameterPath: "request",
|
|
1560
|
-
mapper: TpmAttestationRequest
|
|
1561
|
-
};
|
|
1562
|
-
const accept2 = {
|
|
1563
|
-
parameterPath: "accept",
|
|
1564
|
-
mapper: {
|
|
1565
|
-
defaultValue: "application/jwk+json, application/json",
|
|
1566
|
-
isConstant: true,
|
|
1567
|
-
serializedName: "Accept",
|
|
1568
|
-
type: {
|
|
1569
|
-
name: "String"
|
|
1570
|
-
}
|
|
1571
|
-
}
|
|
1572
|
-
};
|
|
1573
|
-
|
|
1574
|
-
/*
|
|
1575
|
-
* Copyright (c) Microsoft Corporation.
|
|
1576
|
-
* Licensed under the MIT License.
|
|
1577
|
-
*
|
|
1578
|
-
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
1579
|
-
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
1580
|
-
*/
|
|
1581
|
-
/** Class containing Policy operations. */
|
|
1582
|
-
class PolicyImpl {
|
|
1583
|
-
/**
|
|
1584
|
-
* Initialize a new instance of the class Policy class.
|
|
1585
|
-
* @param client Reference to the service client
|
|
1586
|
-
*/
|
|
1587
|
-
constructor(client) {
|
|
1588
|
-
this.client = client;
|
|
1589
|
-
}
|
|
1590
|
-
/**
|
|
1591
|
-
* Retrieves the current policy for an attestation type.
|
|
1592
|
-
* @param attestationType Specifies the trusted execution environment to be used to validate the
|
|
1593
|
-
* evidence
|
|
1594
|
-
* @param options The options parameters.
|
|
1595
|
-
*/
|
|
1596
|
-
async get(attestationType, options) {
|
|
1597
|
-
return tracingClient.withSpan("GeneratedClient.get", options !== null && options !== void 0 ? options : {}, async (options) => {
|
|
1598
|
-
return this.client.sendOperationRequest({ attestationType, options }, getOperationSpec$3);
|
|
1599
|
-
});
|
|
1600
|
-
}
|
|
1601
|
-
/**
|
|
1602
|
-
* Sets the policy for a given attestation type.
|
|
1603
|
-
* @param attestationType Specifies the trusted execution environment to be used to validate the
|
|
1604
|
-
* evidence
|
|
1605
|
-
* @param newAttestationPolicy JWT Expressing the new policy whose body is a StoredAttestationPolicy
|
|
1606
|
-
* object.
|
|
1607
|
-
* @param options The options parameters.
|
|
1608
|
-
*/
|
|
1609
|
-
async set(attestationType, newAttestationPolicy, options) {
|
|
1610
|
-
return tracingClient.withSpan("GeneratedClient.set", options !== null && options !== void 0 ? options : {}, async (options) => {
|
|
1611
|
-
return this.client.sendOperationRequest({ attestationType, newAttestationPolicy, options }, setOperationSpec);
|
|
1612
|
-
});
|
|
1613
|
-
}
|
|
1614
|
-
/**
|
|
1615
|
-
* Resets the attestation policy for the specified tenant and reverts to the default policy.
|
|
1616
|
-
* @param attestationType Specifies the trusted execution environment to be used to validate the
|
|
1617
|
-
* evidence
|
|
1618
|
-
* @param policyJws JSON Web Signature with an empty policy document
|
|
1619
|
-
* @param options The options parameters.
|
|
1620
|
-
*/
|
|
1621
|
-
async reset(attestationType, policyJws, options) {
|
|
1622
|
-
return tracingClient.withSpan("GeneratedClient.reset", options !== null && options !== void 0 ? options : {}, async (options) => {
|
|
1623
|
-
return this.client.sendOperationRequest({ attestationType, policyJws, options }, resetOperationSpec);
|
|
1624
|
-
});
|
|
1625
|
-
}
|
|
1626
|
-
}
|
|
1627
|
-
// Operation Specifications
|
|
1628
|
-
const serializer$4 = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
|
|
1629
|
-
const getOperationSpec$3 = {
|
|
1630
|
-
path: "/policies/{attestationType}",
|
|
1631
|
-
httpMethod: "GET",
|
|
1632
|
-
responses: {
|
|
1633
|
-
200: {
|
|
1634
|
-
bodyMapper: PolicyResponse
|
|
1635
|
-
},
|
|
1636
|
-
default: {
|
|
1637
|
-
bodyMapper: CloudError
|
|
1638
|
-
}
|
|
1639
|
-
},
|
|
1640
|
-
queryParameters: [apiVersion],
|
|
1641
|
-
urlParameters: [instanceUrl, attestationType],
|
|
1642
|
-
headerParameters: [accept],
|
|
1643
|
-
serializer: serializer$4
|
|
1644
|
-
};
|
|
1645
|
-
const setOperationSpec = {
|
|
1646
|
-
path: "/policies/{attestationType}",
|
|
1647
|
-
httpMethod: "PUT",
|
|
1648
|
-
responses: {
|
|
1649
|
-
200: {
|
|
1650
|
-
bodyMapper: PolicyResponse
|
|
1651
|
-
},
|
|
1652
|
-
default: {
|
|
1653
|
-
bodyMapper: CloudError
|
|
1654
|
-
}
|
|
1655
|
-
},
|
|
1656
|
-
requestBody: newAttestationPolicy,
|
|
1657
|
-
queryParameters: [apiVersion],
|
|
1658
|
-
urlParameters: [instanceUrl, attestationType],
|
|
1659
|
-
headerParameters: [contentType, accept1],
|
|
1660
|
-
mediaType: "text",
|
|
1661
|
-
serializer: serializer$4
|
|
1662
|
-
};
|
|
1663
|
-
const resetOperationSpec = {
|
|
1664
|
-
path: "/policies/{attestationType}:reset",
|
|
1665
|
-
httpMethod: "POST",
|
|
1666
|
-
responses: {
|
|
1667
|
-
200: {
|
|
1668
|
-
bodyMapper: PolicyResponse
|
|
1669
|
-
},
|
|
1670
|
-
default: {
|
|
1671
|
-
bodyMapper: CloudError
|
|
1672
|
-
}
|
|
1673
|
-
},
|
|
1674
|
-
requestBody: policyJws,
|
|
1675
|
-
queryParameters: [apiVersion],
|
|
1676
|
-
urlParameters: [instanceUrl, attestationType],
|
|
1677
|
-
headerParameters: [contentType, accept1],
|
|
1678
|
-
mediaType: "text",
|
|
1679
|
-
serializer: serializer$4
|
|
1680
|
-
};
|
|
1681
|
-
|
|
1682
|
-
/*
|
|
1683
|
-
* Copyright (c) Microsoft Corporation.
|
|
1684
|
-
* Licensed under the MIT License.
|
|
1685
|
-
*
|
|
1686
|
-
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
1687
|
-
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
1688
|
-
*/
|
|
1689
|
-
/** Class containing PolicyCertificates operations. */
|
|
1690
|
-
class PolicyCertificatesImpl {
|
|
1691
|
-
/**
|
|
1692
|
-
* Initialize a new instance of the class PolicyCertificates class.
|
|
1693
|
-
* @param client Reference to the service client
|
|
1694
|
-
*/
|
|
1695
|
-
constructor(client) {
|
|
1696
|
-
this.client = client;
|
|
1697
|
-
}
|
|
1698
|
-
/**
|
|
1699
|
-
* Retrieves the set of certificates used to express policy for the current tenant.
|
|
1700
|
-
* @param options The options parameters.
|
|
1701
|
-
*/
|
|
1702
|
-
async get(options) {
|
|
1703
|
-
return tracingClient.withSpan("GeneratedClient.get", options !== null && options !== void 0 ? options : {}, async (options) => {
|
|
1704
|
-
return this.client.sendOperationRequest({ options }, getOperationSpec$2);
|
|
1705
|
-
});
|
|
1706
|
-
}
|
|
1707
|
-
/**
|
|
1708
|
-
* Adds a new attestation policy certificate to the set of policy management certificates.
|
|
1709
|
-
* @param policyCertificateToAdd An RFC7519 JSON Web Token whose body is an RFC7517 JSON Web Key
|
|
1710
|
-
* object. The RFC7519 JWT must be signed with one of the existing signing certificates
|
|
1711
|
-
* @param options The options parameters.
|
|
1712
|
-
*/
|
|
1713
|
-
async add(policyCertificateToAdd, options) {
|
|
1714
|
-
return tracingClient.withSpan("GeneratedClient.add", options !== null && options !== void 0 ? options : {}, async (options) => {
|
|
1715
|
-
return this.client.sendOperationRequest({ policyCertificateToAdd, options }, addOperationSpec);
|
|
1716
|
-
});
|
|
1717
|
-
}
|
|
1718
|
-
/**
|
|
1719
|
-
* Removes the specified policy management certificate. Note that the final policy management
|
|
1720
|
-
* certificate cannot be removed.
|
|
1721
|
-
* @param policyCertificateToRemove An RFC7519 JSON Web Token whose body is an
|
|
1722
|
-
* AttestationCertificateManagementBody object. The RFC7519 JWT must be signed with one of the existing
|
|
1723
|
-
* signing certificates
|
|
1724
|
-
* @param options The options parameters.
|
|
1725
|
-
*/
|
|
1726
|
-
async remove(policyCertificateToRemove, options) {
|
|
1727
|
-
return tracingClient.withSpan("GeneratedClient.remove", options !== null && options !== void 0 ? options : {}, async (options) => {
|
|
1728
|
-
return this.client.sendOperationRequest({ policyCertificateToRemove, options }, removeOperationSpec);
|
|
1729
|
-
});
|
|
1730
|
-
}
|
|
1731
|
-
}
|
|
1732
|
-
// Operation Specifications
|
|
1733
|
-
const serializer$3 = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
|
|
1734
|
-
const getOperationSpec$2 = {
|
|
1735
|
-
path: "/certificates",
|
|
1736
|
-
httpMethod: "GET",
|
|
1737
|
-
responses: {
|
|
1738
|
-
200: {
|
|
1739
|
-
bodyMapper: PolicyCertificatesResponse
|
|
1740
|
-
},
|
|
1741
|
-
default: {
|
|
1742
|
-
bodyMapper: CloudError
|
|
1743
|
-
}
|
|
1744
|
-
},
|
|
1745
|
-
queryParameters: [apiVersion],
|
|
1746
|
-
urlParameters: [instanceUrl],
|
|
1747
|
-
headerParameters: [accept],
|
|
1748
|
-
serializer: serializer$3
|
|
1749
|
-
};
|
|
1750
|
-
const addOperationSpec = {
|
|
1751
|
-
path: "/certificates:add",
|
|
1752
|
-
httpMethod: "POST",
|
|
1753
|
-
responses: {
|
|
1754
|
-
200: {
|
|
1755
|
-
bodyMapper: PolicyCertificatesModifyResponse
|
|
1756
|
-
},
|
|
1757
|
-
default: {
|
|
1758
|
-
bodyMapper: CloudError
|
|
1759
|
-
}
|
|
1760
|
-
},
|
|
1761
|
-
requestBody: policyCertificateToAdd,
|
|
1762
|
-
queryParameters: [apiVersion],
|
|
1763
|
-
urlParameters: [instanceUrl],
|
|
1764
|
-
headerParameters: [accept, contentType1],
|
|
1765
|
-
mediaType: "json",
|
|
1766
|
-
serializer: serializer$3
|
|
1767
|
-
};
|
|
1768
|
-
const removeOperationSpec = {
|
|
1769
|
-
path: "/certificates:remove",
|
|
1770
|
-
httpMethod: "POST",
|
|
1771
|
-
responses: {
|
|
1772
|
-
200: {
|
|
1773
|
-
bodyMapper: PolicyCertificatesModifyResponse
|
|
1774
|
-
},
|
|
1775
|
-
default: {
|
|
1776
|
-
bodyMapper: CloudError
|
|
1777
|
-
}
|
|
1778
|
-
},
|
|
1779
|
-
requestBody: policyCertificateToRemove,
|
|
1780
|
-
queryParameters: [apiVersion],
|
|
1781
|
-
urlParameters: [instanceUrl],
|
|
1782
|
-
headerParameters: [accept, contentType1],
|
|
1783
|
-
mediaType: "json",
|
|
1784
|
-
serializer: serializer$3
|
|
1785
|
-
};
|
|
1786
|
-
|
|
1787
|
-
/*
|
|
1788
|
-
* Copyright (c) Microsoft Corporation.
|
|
1789
|
-
* Licensed under the MIT License.
|
|
1790
|
-
*
|
|
1791
|
-
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
1792
|
-
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
1793
|
-
*/
|
|
1794
|
-
/** Class containing Attestation operations. */
|
|
1795
|
-
class AttestationImpl {
|
|
1796
|
-
/**
|
|
1797
|
-
* Initialize a new instance of the class Attestation class.
|
|
1798
|
-
* @param client Reference to the service client
|
|
1799
|
-
*/
|
|
1800
|
-
constructor(client) {
|
|
1801
|
-
this.client = client;
|
|
1802
|
-
}
|
|
1803
|
-
/**
|
|
1804
|
-
* Processes an OpenEnclave report , producing an artifact. The type of artifact produced is dependent
|
|
1805
|
-
* upon attestation policy.
|
|
1806
|
-
* @param request Request object containing the quote
|
|
1807
|
-
* @param options The options parameters.
|
|
1808
|
-
*/
|
|
1809
|
-
async attestOpenEnclave(request, options) {
|
|
1810
|
-
return tracingClient.withSpan("GeneratedClient.attestOpenEnclave", options !== null && options !== void 0 ? options : {}, async (options) => {
|
|
1811
|
-
return this.client.sendOperationRequest({ request, options }, attestOpenEnclaveOperationSpec);
|
|
1812
|
-
});
|
|
1813
|
-
}
|
|
1814
|
-
/**
|
|
1815
|
-
* Processes an SGX enclave quote, producing an artifact. The type of artifact produced is dependent
|
|
1816
|
-
* upon attestation policy.
|
|
1817
|
-
* @param request Request object containing the quote
|
|
1818
|
-
* @param options The options parameters.
|
|
1819
|
-
*/
|
|
1820
|
-
async attestSgxEnclave(request, options) {
|
|
1821
|
-
return tracingClient.withSpan("GeneratedClient.attestSgxEnclave", options !== null && options !== void 0 ? options : {}, async (options) => {
|
|
1822
|
-
return this.client.sendOperationRequest({ request, options }, attestSgxEnclaveOperationSpec);
|
|
1823
|
-
});
|
|
1824
|
-
}
|
|
1825
|
-
/**
|
|
1826
|
-
* Processes attestation evidence from a VBS enclave, producing an attestation result. The attestation
|
|
1827
|
-
* result produced is dependent upon the attestation policy.
|
|
1828
|
-
* @param request Request object
|
|
1829
|
-
* @param options The options parameters.
|
|
1830
|
-
*/
|
|
1831
|
-
async attestTpm(request, options) {
|
|
1832
|
-
return tracingClient.withSpan("GeneratedClient.attestTpm", options !== null && options !== void 0 ? options : {}, async (options) => {
|
|
1833
|
-
return this.client.sendOperationRequest({ request, options }, attestTpmOperationSpec);
|
|
1834
|
-
});
|
|
1835
|
-
}
|
|
1836
|
-
}
|
|
1837
|
-
// Operation Specifications
|
|
1838
|
-
const serializer$2 = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
|
|
1839
|
-
const attestOpenEnclaveOperationSpec = {
|
|
1840
|
-
path: "/attest/OpenEnclave",
|
|
1841
|
-
httpMethod: "POST",
|
|
1842
|
-
responses: {
|
|
1843
|
-
200: {
|
|
1844
|
-
bodyMapper: AttestationResponse
|
|
1845
|
-
},
|
|
1846
|
-
default: {
|
|
1847
|
-
bodyMapper: CloudError
|
|
1848
|
-
}
|
|
1849
|
-
},
|
|
1850
|
-
requestBody: request,
|
|
1851
|
-
queryParameters: [apiVersion],
|
|
1852
|
-
urlParameters: [instanceUrl],
|
|
1853
|
-
headerParameters: [accept, contentType1],
|
|
1854
|
-
mediaType: "json",
|
|
1855
|
-
serializer: serializer$2
|
|
1856
|
-
};
|
|
1857
|
-
const attestSgxEnclaveOperationSpec = {
|
|
1858
|
-
path: "/attest/SgxEnclave",
|
|
1859
|
-
httpMethod: "POST",
|
|
1860
|
-
responses: {
|
|
1861
|
-
200: {
|
|
1862
|
-
bodyMapper: AttestationResponse
|
|
1863
|
-
},
|
|
1864
|
-
default: {
|
|
1865
|
-
bodyMapper: CloudError
|
|
1866
|
-
}
|
|
1867
|
-
},
|
|
1868
|
-
requestBody: request1,
|
|
1869
|
-
queryParameters: [apiVersion],
|
|
1870
|
-
urlParameters: [instanceUrl],
|
|
1871
|
-
headerParameters: [accept, contentType1],
|
|
1872
|
-
mediaType: "json",
|
|
1873
|
-
serializer: serializer$2
|
|
1874
|
-
};
|
|
1875
|
-
const attestTpmOperationSpec = {
|
|
1876
|
-
path: "/attest/Tpm",
|
|
1877
|
-
httpMethod: "POST",
|
|
1878
|
-
responses: {
|
|
1879
|
-
200: {
|
|
1880
|
-
bodyMapper: TpmAttestationResponse
|
|
1881
|
-
},
|
|
1882
|
-
default: {
|
|
1883
|
-
bodyMapper: CloudError
|
|
1884
|
-
}
|
|
1885
|
-
},
|
|
1886
|
-
requestBody: request2,
|
|
1887
|
-
queryParameters: [apiVersion],
|
|
1888
|
-
urlParameters: [instanceUrl],
|
|
1889
|
-
headerParameters: [accept, contentType1],
|
|
1890
|
-
mediaType: "json",
|
|
1891
|
-
serializer: serializer$2
|
|
1892
|
-
};
|
|
1893
|
-
|
|
1894
|
-
/*
|
|
1895
|
-
* Copyright (c) Microsoft Corporation.
|
|
1896
|
-
* Licensed under the MIT License.
|
|
1897
|
-
*
|
|
1898
|
-
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
1899
|
-
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
1900
|
-
*/
|
|
1901
|
-
/** Class containing SigningCertificates operations. */
|
|
1902
|
-
class SigningCertificatesImpl {
|
|
1903
|
-
/**
|
|
1904
|
-
* Initialize a new instance of the class SigningCertificates class.
|
|
1905
|
-
* @param client Reference to the service client
|
|
1906
|
-
*/
|
|
1907
|
-
constructor(client) {
|
|
1908
|
-
this.client = client;
|
|
1909
|
-
}
|
|
1910
|
-
/**
|
|
1911
|
-
* Retrieves metadata signing certificates in use by the attestation service
|
|
1912
|
-
* @param options The options parameters.
|
|
1913
|
-
*/
|
|
1914
|
-
async get(options) {
|
|
1915
|
-
return tracingClient.withSpan("GeneratedClient.get", options !== null && options !== void 0 ? options : {}, async (options) => {
|
|
1916
|
-
return this.client.sendOperationRequest({ options }, getOperationSpec$1);
|
|
1917
|
-
});
|
|
1918
|
-
}
|
|
1919
|
-
}
|
|
1920
|
-
// Operation Specifications
|
|
1921
|
-
const serializer$1 = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
|
|
1922
|
-
const getOperationSpec$1 = {
|
|
1923
|
-
path: "/certs",
|
|
1924
|
-
httpMethod: "GET",
|
|
1925
|
-
responses: {
|
|
1926
|
-
200: {
|
|
1927
|
-
bodyMapper: JsonWebKeySet
|
|
1928
|
-
},
|
|
1929
|
-
default: {
|
|
1930
|
-
bodyMapper: CloudError
|
|
1931
|
-
}
|
|
1932
|
-
},
|
|
1933
|
-
urlParameters: [instanceUrl],
|
|
1934
|
-
headerParameters: [accept2],
|
|
1935
|
-
serializer: serializer$1
|
|
1936
|
-
};
|
|
1937
|
-
|
|
1938
|
-
/*
|
|
1939
|
-
* Copyright (c) Microsoft Corporation.
|
|
1940
|
-
* Licensed under the MIT License.
|
|
1941
|
-
*
|
|
1942
|
-
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
1943
|
-
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
1944
|
-
*/
|
|
1945
|
-
/** Class containing MetadataConfiguration operations. */
|
|
1946
|
-
class MetadataConfigurationImpl {
|
|
1947
|
-
/**
|
|
1948
|
-
* Initialize a new instance of the class MetadataConfiguration class.
|
|
1949
|
-
* @param client Reference to the service client
|
|
1950
|
-
*/
|
|
1951
|
-
constructor(client) {
|
|
1952
|
-
this.client = client;
|
|
1953
|
-
}
|
|
1954
|
-
/**
|
|
1955
|
-
* Retrieves metadata about the attestation signing keys in use by the attestation service
|
|
1956
|
-
* @param options The options parameters.
|
|
1957
|
-
*/
|
|
1958
|
-
async get(options) {
|
|
1959
|
-
return tracingClient.withSpan("GeneratedClient.get", options !== null && options !== void 0 ? options : {}, async (options) => {
|
|
1960
|
-
return this.client.sendOperationRequest({ options }, getOperationSpec);
|
|
1961
|
-
});
|
|
1962
|
-
}
|
|
1963
|
-
}
|
|
1964
|
-
// Operation Specifications
|
|
1965
|
-
const serializer = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
|
|
1966
|
-
const getOperationSpec = {
|
|
1967
|
-
path: "/.well-known/openid-configuration",
|
|
1968
|
-
httpMethod: "GET",
|
|
1969
|
-
responses: {
|
|
1970
|
-
200: {
|
|
1971
|
-
bodyMapper: {
|
|
1972
|
-
type: { name: "Dictionary", value: { type: { name: "any" } } }
|
|
1973
|
-
}
|
|
1974
|
-
},
|
|
1975
|
-
default: {
|
|
1976
|
-
bodyMapper: CloudError
|
|
1977
|
-
}
|
|
1978
|
-
},
|
|
1979
|
-
urlParameters: [instanceUrl],
|
|
1980
|
-
headerParameters: [accept],
|
|
1981
|
-
serializer
|
|
1982
|
-
};
|
|
1983
|
-
|
|
1984
|
-
/*
|
|
1985
|
-
* Copyright (c) Microsoft Corporation.
|
|
1986
|
-
* Licensed under the MIT License.
|
|
1987
|
-
*
|
|
1988
|
-
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
1989
|
-
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
1990
|
-
*/
|
|
1991
|
-
class GeneratedClient extends coreClient__namespace.ServiceClient {
|
|
1992
|
-
/**
|
|
1993
|
-
* Initializes a new instance of the GeneratedClient class.
|
|
1994
|
-
* @param instanceUrl The attestation instance base URI, for example https://mytenant.attest.azure.net.
|
|
1995
|
-
* @param options The parameter options
|
|
1996
|
-
*/
|
|
1997
|
-
constructor(instanceUrl, options) {
|
|
1998
|
-
var _a, _b;
|
|
1999
|
-
if (instanceUrl === undefined) {
|
|
2000
|
-
throw new Error("'instanceUrl' cannot be null");
|
|
2001
|
-
}
|
|
2002
|
-
// Initializing default values for options
|
|
2003
|
-
if (!options) {
|
|
2004
|
-
options = {};
|
|
2005
|
-
}
|
|
2006
|
-
const defaults = {
|
|
2007
|
-
requestContentType: "application/json; charset=utf-8"
|
|
2008
|
-
};
|
|
2009
|
-
const packageDetails = `azsdk-js-attestation/1.0.1`;
|
|
2010
|
-
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
2011
|
-
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
2012
|
-
: `${packageDetails}`;
|
|
2013
|
-
const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
|
|
2014
|
-
userAgentPrefix
|
|
2015
|
-
}, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{instanceUrl}" });
|
|
2016
|
-
super(optionsWithDefaults);
|
|
2017
|
-
// Parameter assignments
|
|
2018
|
-
this.instanceUrl = instanceUrl;
|
|
2019
|
-
// Assigning values to Constant parameters
|
|
2020
|
-
this.apiVersion = options.apiVersion || "2020-10-01";
|
|
2021
|
-
this.policy = new PolicyImpl(this);
|
|
2022
|
-
this.policyCertificates = new PolicyCertificatesImpl(this);
|
|
2023
|
-
this.attestation = new AttestationImpl(this);
|
|
2024
|
-
this.signingCertificates = new SigningCertificatesImpl(this);
|
|
2025
|
-
this.metadataConfiguration = new MetadataConfigurationImpl(this);
|
|
2026
|
-
this.addCustomApiVersionPolicy(options.apiVersion);
|
|
2027
|
-
}
|
|
2028
|
-
/** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */
|
|
2029
|
-
addCustomApiVersionPolicy(apiVersion) {
|
|
2030
|
-
if (!apiVersion) {
|
|
2031
|
-
return;
|
|
2032
|
-
}
|
|
2033
|
-
const apiVersionPolicy = {
|
|
2034
|
-
name: "CustomApiVersionPolicy",
|
|
2035
|
-
async sendRequest(request, next) {
|
|
2036
|
-
const param = request.url.split("?");
|
|
2037
|
-
if (param.length > 1) {
|
|
2038
|
-
const newParams = param[1].split("&").map((item) => {
|
|
2039
|
-
if (item.indexOf("api-version") > -1) {
|
|
2040
|
-
return "api-version=" + apiVersion;
|
|
2041
|
-
}
|
|
2042
|
-
else {
|
|
2043
|
-
return item;
|
|
2044
|
-
}
|
|
2045
|
-
});
|
|
2046
|
-
request.url = param[0] + "?" + newParams.join("&");
|
|
2047
|
-
}
|
|
2048
|
-
return next(request);
|
|
2049
|
-
}
|
|
2050
|
-
};
|
|
2051
|
-
this.pipeline.addPolicy(apiVersionPolicy);
|
|
2052
|
-
}
|
|
2053
|
-
}
|
|
2054
|
-
|
|
2055
|
-
// Copyright (c) Microsoft Corporation.
|
|
2056
|
-
// Licensed under the MIT License.
|
|
2057
|
-
/**
|
|
2058
|
-
* The \@azure/logger configuration for this package.
|
|
2059
|
-
*
|
|
2060
|
-
* @internal
|
|
2061
|
-
*/
|
|
2062
|
-
const logger = logger$1.createClientLogger("attestation");
|
|
2063
|
-
|
|
2064
|
-
// Copyright (c) Microsoft Corporation.
|
|
2065
|
-
// Licensed under the MIT License.
|
|
2066
|
-
/** Create an AttestationResponse object.
|
|
2067
|
-
*
|
|
2068
|
-
* @param token - Token which was returned from the attestation service.
|
|
2069
|
-
* @param value - Value for the response. Usually derived from the body of the token
|
|
2070
|
-
* returned by the service.
|
|
2071
|
-
* @returns - A newly created AttestationResponse object.
|
|
2072
|
-
*/
|
|
2073
|
-
function createAttestationResponse(token, value) {
|
|
2074
|
-
return { token: token, body: value };
|
|
2075
|
-
}
|
|
2076
|
-
|
|
2077
|
-
// Copyright (c) Microsoft Corporation.
|
|
2078
|
-
// Licensed under the MIT License.
|
|
2079
|
-
/**
|
|
2080
|
-
* A Microsoft Azure Attestation response token body - the body of a response token issued by MAA
|
|
2081
|
-
*/
|
|
2082
|
-
class AttestationResultImpl {
|
|
2083
|
-
/**
|
|
2084
|
-
*
|
|
2085
|
-
* @param params - The parameters for the constructor.
|
|
2086
|
-
*
|
|
2087
|
-
* @hidden
|
|
2088
|
-
*/
|
|
2089
|
-
constructor(params) {
|
|
2090
|
-
this._issuer = params.issuer;
|
|
2091
|
-
this._nonce = params.nonce;
|
|
2092
|
-
this._version = params.version;
|
|
2093
|
-
this._uniqueId = params.uniqueId;
|
|
2094
|
-
this._runTimeClaims = params.runTimeClaims;
|
|
2095
|
-
this._initTimeClaims = params.initTimeClaims;
|
|
2096
|
-
this._policyClaims = params.policyClaims;
|
|
2097
|
-
this._verifierType = params.verifierType;
|
|
2098
|
-
this._policySigner = params.policySigner;
|
|
2099
|
-
this._policyHash = params.policyHash;
|
|
2100
|
-
this._isDebuggable = params.isDebuggable;
|
|
2101
|
-
this._productId = params.productId;
|
|
2102
|
-
this._mrEnclave = params.mrEnclave;
|
|
2103
|
-
this._mrSigner = params.mrSigner;
|
|
2104
|
-
this._svn = params.svn;
|
|
2105
|
-
this._enclaveHeldData = params.enclaveHeldData;
|
|
2106
|
-
this._sgxCollateral = params.sgxCollateral;
|
|
2107
|
-
}
|
|
2108
|
-
/**
|
|
2109
|
-
* Unique Identifier for the token
|
|
2110
|
-
*
|
|
2111
|
-
*/
|
|
2112
|
-
get uniqueId() {
|
|
2113
|
-
return this._uniqueId;
|
|
2114
|
-
}
|
|
2115
|
-
/**
|
|
2116
|
-
* Returns the issuer of the attestation token. MUST be the same as the
|
|
2117
|
-
* endpoint used when constructing the attestation client instance.
|
|
2118
|
-
*/
|
|
2119
|
-
get issuer() {
|
|
2120
|
-
return this._issuer;
|
|
2121
|
-
}
|
|
2122
|
-
/**
|
|
2123
|
-
* Returns the "nonce" value specified in the Attest request.
|
|
2124
|
-
*/
|
|
2125
|
-
get nonce() {
|
|
2126
|
-
return this._nonce;
|
|
2127
|
-
}
|
|
2128
|
-
/**
|
|
2129
|
-
* The Schema version of this structure. Current Value: 1.0
|
|
2130
|
-
*/
|
|
2131
|
-
get version() {
|
|
2132
|
-
return this._version;
|
|
2133
|
-
}
|
|
2134
|
-
/**
|
|
2135
|
-
* Runtime Claims
|
|
2136
|
-
*/
|
|
2137
|
-
get runTimeClaims() {
|
|
2138
|
-
return this._runTimeClaims;
|
|
2139
|
-
}
|
|
2140
|
-
/**
|
|
2141
|
-
* Inittime Claims
|
|
2142
|
-
*/
|
|
2143
|
-
get initTimeClaims() {
|
|
2144
|
-
return this._initTimeClaims;
|
|
2145
|
-
}
|
|
2146
|
-
/**
|
|
2147
|
-
* Policy Generated Claims
|
|
2148
|
-
*/
|
|
2149
|
-
get policyClaims() {
|
|
2150
|
-
return this._policyClaims;
|
|
2151
|
-
}
|
|
2152
|
-
/**
|
|
2153
|
-
* The Attestation type being attested.
|
|
2154
|
-
*/
|
|
2155
|
-
get verifierType() {
|
|
2156
|
-
return this._verifierType;
|
|
2157
|
-
}
|
|
2158
|
-
/**
|
|
2159
|
-
* The certificate used to sign the policy object, if specified.
|
|
2160
|
-
*/
|
|
2161
|
-
get policySigner() {
|
|
2162
|
-
return this._policySigner;
|
|
2163
|
-
}
|
|
2164
|
-
/**
|
|
2165
|
-
* The SHA256 hash of the BASE64URL encoded policy text used for attestation
|
|
2166
|
-
*/
|
|
2167
|
-
get policyHash() {
|
|
2168
|
-
return this._policyHash;
|
|
2169
|
-
}
|
|
2170
|
-
/**
|
|
2171
|
-
* True if the enclave is debuggable, false otherwise
|
|
2172
|
-
*/
|
|
2173
|
-
get isDebuggable() {
|
|
2174
|
-
return this._isDebuggable;
|
|
2175
|
-
}
|
|
2176
|
-
/**
|
|
2177
|
-
* The SGX Product ID for the enclave.
|
|
2178
|
-
*/
|
|
2179
|
-
get productId() {
|
|
2180
|
-
return this._productId;
|
|
2181
|
-
}
|
|
2182
|
-
/**
|
|
2183
|
-
* The HEX encoded SGX MRENCLAVE value for the enclave.
|
|
2184
|
-
*/
|
|
2185
|
-
get mrEnclave() {
|
|
2186
|
-
return this._mrEnclave;
|
|
2187
|
-
}
|
|
2188
|
-
/**
|
|
2189
|
-
* The HEX encoded SGX MRSIGNER value for the enclave.
|
|
2190
|
-
*/
|
|
2191
|
-
get mrSigner() {
|
|
2192
|
-
return this._mrSigner;
|
|
2193
|
-
}
|
|
2194
|
-
/**
|
|
2195
|
-
* The SGX SVN value for the enclave.
|
|
2196
|
-
*/
|
|
2197
|
-
get svn() {
|
|
2198
|
-
return this._svn;
|
|
2199
|
-
}
|
|
2200
|
-
/**
|
|
2201
|
-
* A copy of the RuntimeData specified as an input to the attest call.
|
|
2202
|
-
*/
|
|
2203
|
-
get enclaveHeldData() {
|
|
2204
|
-
return this._enclaveHeldData;
|
|
2205
|
-
}
|
|
2206
|
-
/**
|
|
2207
|
-
* The SGX SVN value for the enclave.
|
|
2208
|
-
*/
|
|
2209
|
-
get sgxCollateral() {
|
|
2210
|
-
return this._sgxCollateral;
|
|
2211
|
-
}
|
|
2212
|
-
}
|
|
2213
|
-
/**
|
|
2214
|
-
*
|
|
2215
|
-
* @param generated - Generated attestation result object.
|
|
2216
|
-
* @returns newly created AttestationResult from the generated result.
|
|
2217
|
-
*
|
|
2218
|
-
* @internal
|
|
2219
|
-
*/
|
|
2220
|
-
function _attestationResultFromGenerated(generated) {
|
|
2221
|
-
return new AttestationResultImpl({
|
|
2222
|
-
issuer: generated.iss,
|
|
2223
|
-
version: generated.version,
|
|
2224
|
-
nonce: generated.nonce,
|
|
2225
|
-
uniqueId: generated.jti,
|
|
2226
|
-
policySigner: generated.policySigner
|
|
2227
|
-
? _attestationSignerFromGenerated(generated.policySigner)
|
|
2228
|
-
: undefined,
|
|
2229
|
-
runTimeClaims: generated.runtimeClaims,
|
|
2230
|
-
initTimeClaims: generated.inittimeClaims,
|
|
2231
|
-
policyClaims: generated.policyClaims,
|
|
2232
|
-
verifierType: generated.verifierType,
|
|
2233
|
-
policyHash: generated.policyHash,
|
|
2234
|
-
isDebuggable: generated.isDebuggable,
|
|
2235
|
-
productId: generated.productId,
|
|
2236
|
-
mrEnclave: generated.mrEnclave,
|
|
2237
|
-
mrSigner: generated.mrSigner,
|
|
2238
|
-
svn: generated.svn,
|
|
2239
|
-
enclaveHeldData: generated.enclaveHeldData,
|
|
2240
|
-
sgxCollateral: generated.sgxCollateral,
|
|
2241
|
-
});
|
|
2242
|
-
}
|
|
2243
|
-
|
|
2244
|
-
// Copyright (c) Microsoft Corporation.
|
|
2245
|
-
// Licensed under the MIT License.
|
|
2246
|
-
/**
|
|
2247
|
-
* Converts an attestation input from Uint8Array/Buffer/Blob to Uint8Array.
|
|
2248
|
-
*
|
|
2249
|
-
* @param input - Input to attestation API.
|
|
2250
|
-
* @returns Promise which completes with the input data as a Uint8Array.
|
|
2251
|
-
*/
|
|
2252
|
-
async function Uint8ArrayFromInput(input) {
|
|
2253
|
-
if (input === undefined) {
|
|
2254
|
-
return input;
|
|
2255
|
-
}
|
|
2256
|
-
if (input.byteLength === undefined) {
|
|
2257
|
-
throw TypeError("Blob is unsupported in node.");
|
|
2258
|
-
}
|
|
2259
|
-
// We've eliminated the 'Blob' case above, so we know this must be either a Buffer or Uint8Array.
|
|
2260
|
-
return input;
|
|
2261
|
-
}
|
|
2262
|
-
|
|
2263
|
-
// Copyright (c) Microsoft Corporation.
|
|
2264
|
-
// Licensed under the MIT License.
|
|
2265
|
-
/**
|
|
2266
|
-
* Attestation Client class.
|
|
2267
|
-
*
|
|
2268
|
-
* The AttestationClient class enables access to the Attestation related APIs:
|
|
2269
|
-
*
|
|
2270
|
-
* - getOpenIdMetadata
|
|
2271
|
-
* - getAttestationSigners
|
|
2272
|
-
* - attestSgxEnclave
|
|
2273
|
-
* - attestOpenEnclave
|
|
2274
|
-
* - attestTpm
|
|
2275
|
-
*/
|
|
2276
|
-
class AttestationClient {
|
|
2277
|
-
constructor(endpoint, credentialsOrOptions, clientOptions = {}) {
|
|
2278
|
-
let credentialScopes = undefined;
|
|
2279
|
-
let credential = undefined;
|
|
2280
|
-
let options;
|
|
2281
|
-
if (credentialsOrOptions && coreAuth.isTokenCredential(credentialsOrOptions)) {
|
|
2282
|
-
credential = credentialsOrOptions;
|
|
2283
|
-
credentialScopes = ["https://attest.azure.net/.default"];
|
|
2284
|
-
options = clientOptions;
|
|
2285
|
-
}
|
|
2286
|
-
else {
|
|
2287
|
-
options = credentialsOrOptions || {};
|
|
2288
|
-
}
|
|
2289
|
-
const internalPipelineOptions = Object.assign(Object.assign({}, options), {
|
|
2290
|
-
credentialScopes: credentialScopes,
|
|
2291
|
-
credential: credential,
|
|
2292
|
-
loggingOptions: {
|
|
2293
|
-
logger: logger.info,
|
|
2294
|
-
allowedHeaderNames: ["x-ms-request-id", "x-ms-maa-service-version"],
|
|
2295
|
-
},
|
|
2296
|
-
});
|
|
2297
|
-
this._client = new GeneratedClient(endpoint, internalPipelineOptions);
|
|
2298
|
-
this._validationOptions = options.validationOptions;
|
|
2299
|
-
}
|
|
2300
|
-
/** Attests an OpenEnclave report generated from an SGX Enclave using the OpenEnclave SDK.
|
|
2301
|
-
*
|
|
2302
|
-
* @param report - An OpenEnclave report generated by an SGX enclave.
|
|
2303
|
-
* @param options - Operation options for the attestOpenEnclave API call.
|
|
2304
|
-
* @returns Returns an AttestationResponse whose body is an AttestationResult describing
|
|
2305
|
-
* the claims returned by the attestation service.
|
|
2306
|
-
*
|
|
2307
|
-
* @throws {@link Error} if the `initTimeData` option and `initTimeJson` option is provided.
|
|
2308
|
-
* @throws {@link Error} if the `runTimeData` option and `runTimeJson` option is provided.
|
|
2309
|
-
* @throws {@link Error} if the `initTimeJson` option is provided and the value of `initTimeJson` is not JSON.
|
|
2310
|
-
* @throws {@link Error} if the `runTimeJson` option is provided and the value of `runTimeJson` is not JSON.
|
|
2311
|
-
*/
|
|
2312
|
-
async attestOpenEnclave(report, options = {}) {
|
|
2313
|
-
return tracingClient.withSpan("AttestationClient-attestOpenEnclave", options, async (updatedOptions) => {
|
|
2314
|
-
var _a, _b, _c, _d;
|
|
2315
|
-
if (options.initTimeData !== undefined && options.initTimeJson !== undefined) {
|
|
2316
|
-
throw new Error("Cannot provide both initTimeData and initTimeJson.");
|
|
2317
|
-
}
|
|
2318
|
-
if (options.runTimeData !== undefined && options.runTimeJson !== undefined) {
|
|
2319
|
-
throw new Error("Cannot provide both runTimeData and runTimeJson.");
|
|
2320
|
-
}
|
|
2321
|
-
const initData = await Uint8ArrayFromInput((_a = options.initTimeData) !== null && _a !== void 0 ? _a : options.initTimeJson);
|
|
2322
|
-
const initTimeData = initData
|
|
2323
|
-
? {
|
|
2324
|
-
data: initData,
|
|
2325
|
-
dataType: options.initTimeJson !== undefined ? KnownDataType.Json : KnownDataType.Binary,
|
|
2326
|
-
}
|
|
2327
|
-
: undefined;
|
|
2328
|
-
const runData = await Uint8ArrayFromInput((_b = options.runTimeData) !== null && _b !== void 0 ? _b : options.runTimeJson);
|
|
2329
|
-
const runTimeData = runData
|
|
2330
|
-
? {
|
|
2331
|
-
data: runData,
|
|
2332
|
-
dataType: options.runTimeJson !== undefined ? KnownDataType.Json : KnownDataType.Binary,
|
|
2333
|
-
}
|
|
2334
|
-
: undefined;
|
|
2335
|
-
const attestationResponse = await this._client.attestation.attestOpenEnclave({
|
|
2336
|
-
report: await Uint8ArrayFromInput(report),
|
|
2337
|
-
initTimeData: initTimeData,
|
|
2338
|
-
runtimeData: runTimeData,
|
|
2339
|
-
draftPolicyForAttestation: (_c = options.draftPolicyForAttestation) !== null && _c !== void 0 ? _c : undefined,
|
|
2340
|
-
}, updatedOptions);
|
|
2341
|
-
const token = new AttestationTokenImpl(attestationResponse.token);
|
|
2342
|
-
const problems = token.getTokenProblems(await this._signingKeys(), (_d = options.validationOptions) !== null && _d !== void 0 ? _d : this._validationOptions);
|
|
2343
|
-
if (problems.length) {
|
|
2344
|
-
throw new Error(problems.join(";"));
|
|
2345
|
-
}
|
|
2346
|
-
const attestationResult = TypeDeserializer.deserialize(token.getBody(), {
|
|
2347
|
-
GeneratedAttestationResult: GeneratedAttestationResult,
|
|
2348
|
-
JsonWebKey: JsonWebKey,
|
|
2349
|
-
}, "GeneratedAttestationResult");
|
|
2350
|
-
return createAttestationResponse(token, _attestationResultFromGenerated(attestationResult));
|
|
2351
|
-
});
|
|
2352
|
-
}
|
|
2353
|
-
/** Attests a quote generated from SGX Enclave using the Intel SDK.
|
|
2354
|
-
*
|
|
2355
|
-
* @param quote - An SGX quote generated by an SGX enclave.
|
|
2356
|
-
* @param options - Operation options for the attestOpenEnclave API call.
|
|
2357
|
-
* @returns Returns an AttestationResponse whose body is an AttestationResult describing
|
|
2358
|
-
* the claims returned by the attestation service.
|
|
2359
|
-
* @throws {@link Error} if the `initTimeData` option and `initTimeJson` option is provided.
|
|
2360
|
-
* @throws {@link Error} if the `runTimeData` option and `runTimeJson` option is provided.
|
|
2361
|
-
*/
|
|
2362
|
-
async attestSgxEnclave(quote, options = {}) {
|
|
2363
|
-
return tracingClient.withSpan("AttestationClient-attestSgxEnclave", options, async (updatedOptions) => {
|
|
2364
|
-
var _a, _b, _c, _d;
|
|
2365
|
-
if (options.initTimeData !== undefined && options.initTimeJson !== undefined) {
|
|
2366
|
-
throw new Error("Cannot provide both initTimeData and initTimeJson.");
|
|
2367
|
-
}
|
|
2368
|
-
if (options.runTimeData !== undefined && options.runTimeJson !== undefined) {
|
|
2369
|
-
throw new Error("Cannot provide both runTimeData and runTimeJson.");
|
|
2370
|
-
}
|
|
2371
|
-
const initData = await Uint8ArrayFromInput((_a = options.initTimeData) !== null && _a !== void 0 ? _a : options.initTimeJson);
|
|
2372
|
-
const initTimeData = initData
|
|
2373
|
-
? {
|
|
2374
|
-
data: initData,
|
|
2375
|
-
dataType: options.initTimeJson !== undefined ? KnownDataType.Json : KnownDataType.Binary,
|
|
2376
|
-
}
|
|
2377
|
-
: undefined;
|
|
2378
|
-
const runData = await Uint8ArrayFromInput((_b = options.runTimeData) !== null && _b !== void 0 ? _b : options.runTimeJson);
|
|
2379
|
-
const runTimeData = runData
|
|
2380
|
-
? {
|
|
2381
|
-
data: runData,
|
|
2382
|
-
dataType: options.runTimeJson !== undefined ? KnownDataType.Json : KnownDataType.Binary,
|
|
2383
|
-
}
|
|
2384
|
-
: undefined;
|
|
2385
|
-
const attestationResponse = await this._client.attestation.attestSgxEnclave({
|
|
2386
|
-
quote: await Uint8ArrayFromInput(quote),
|
|
2387
|
-
initTimeData: initTimeData,
|
|
2388
|
-
runtimeData: runTimeData,
|
|
2389
|
-
draftPolicyForAttestation: (_c = options.draftPolicyForAttestation) !== null && _c !== void 0 ? _c : undefined,
|
|
2390
|
-
}, updatedOptions);
|
|
2391
|
-
const token = new AttestationTokenImpl(attestationResponse.token);
|
|
2392
|
-
const problems = token.getTokenProblems(await this._signingKeys(), (_d = options.validationOptions) !== null && _d !== void 0 ? _d : this._validationOptions);
|
|
2393
|
-
if (problems.length) {
|
|
2394
|
-
throw new Error(problems.join(";"));
|
|
2395
|
-
}
|
|
2396
|
-
const attestationResult = TypeDeserializer.deserialize(token.getBody(), {
|
|
2397
|
-
GeneratedAttestationResult: GeneratedAttestationResult,
|
|
2398
|
-
JsonWebKey: JsonWebKey,
|
|
2399
|
-
}, "GeneratedAttestationResult");
|
|
2400
|
-
return createAttestationResponse(token, _attestationResultFromGenerated(attestationResult));
|
|
2401
|
-
});
|
|
2402
|
-
}
|
|
2403
|
-
/** Attest a TPM based enclave.
|
|
2404
|
-
|
|
2405
|
-
* See the {@link https://docs.microsoft.com/en-us/azure/attestation/virtualization-based-security-protocol | TPM Attestation Protocol Reference} for more information.
|
|
2406
|
-
*
|
|
2407
|
-
* @param request - Incoming request to send to the TPM attestation service, Utf8 encoded.
|
|
2408
|
-
* @param options - Pipeline options for TPM attestation request.
|
|
2409
|
-
* @returns A structure containing the response from the TPM attestation, Utf8 encoded.
|
|
2410
|
-
*
|
|
2411
|
-
* @remarks
|
|
2412
|
-
*
|
|
2413
|
-
* The incoming requests to the TPM attestation API are stringified JSON objects.
|
|
2414
|
-
*
|
|
2415
|
-
* @example
|
|
2416
|
-
* For example, the initial call for a TPM attestation operation is:
|
|
2417
|
-
*
|
|
2418
|
-
* ```js
|
|
2419
|
-
* const encodedPayload = JSON.stringify({ payload: { type: "aikcert" } });
|
|
2420
|
-
* const result = await client.attestTpm(encodedPayload);
|
|
2421
|
-
* ```
|
|
2422
|
-
*
|
|
2423
|
-
* where stringToBytes converts the string to UTF8.
|
|
2424
|
-
*
|
|
2425
|
-
* Note that the attestTpm requires an attestation client which is configured with
|
|
2426
|
-
* authentication credentials.
|
|
2427
|
-
*
|
|
2428
|
-
*/
|
|
2429
|
-
async attestTpm(request, options = {}) {
|
|
2430
|
-
return tracingClient.withSpan("AttestationClient-attestSgxEnclave", options, async (updatedOptions) => {
|
|
2431
|
-
const response = await this._client.attestation.attestTpm({ data: stringToBytes(request) }, updatedOptions);
|
|
2432
|
-
if (response.data) {
|
|
2433
|
-
return bytesToString(response.data);
|
|
2434
|
-
}
|
|
2435
|
-
else {
|
|
2436
|
-
throw Error("Internal error - response data cannot be undefined.");
|
|
2437
|
-
}
|
|
2438
|
-
});
|
|
2439
|
-
}
|
|
2440
|
-
/**
|
|
2441
|
-
* Returns the list of attestation signers which can be used to sign attestation
|
|
2442
|
-
* service tokens.
|
|
2443
|
-
*
|
|
2444
|
-
* @param options - Client operation options.
|
|
2445
|
-
* @returns the set of AttestationSigners which may be used to sign attestation tokens.
|
|
2446
|
-
*/
|
|
2447
|
-
async getAttestationSigners(
|
|
2448
|
-
// eslint-disable-next-line @azure/azure-sdk/ts-naming-options
|
|
2449
|
-
options = {}) {
|
|
2450
|
-
return tracingClient.withSpan("AttestationClient-getAttestationSigners", options, async (updatedOptions) => {
|
|
2451
|
-
var _a;
|
|
2452
|
-
const signingCertificates = await this._client.signingCertificates.get(updatedOptions);
|
|
2453
|
-
const signers = new Array();
|
|
2454
|
-
(_a = signingCertificates.keys) === null || _a === void 0 ? void 0 : _a.forEach((element) => {
|
|
2455
|
-
signers.push(_attestationSignerFromGenerated(element));
|
|
2456
|
-
});
|
|
2457
|
-
return signers;
|
|
2458
|
-
});
|
|
2459
|
-
}
|
|
2460
|
-
/**
|
|
2461
|
-
* Returns the OpenID Metadata discovery document for the attestation service instance.
|
|
2462
|
-
* @param options - Client operation options.
|
|
2463
|
-
* @returns The OpenID metadata discovery document for the attestation service.
|
|
2464
|
-
*/
|
|
2465
|
-
async getOpenIdMetadata(
|
|
2466
|
-
// eslint-disable-next-line @azure/azure-sdk/ts-naming-options
|
|
2467
|
-
options = {}) {
|
|
2468
|
-
return tracingClient.withSpan("AttestationClient-getOpenIdMetadata", options, async (updatedOptions) => {
|
|
2469
|
-
const configs = await this._client.metadataConfiguration.get(updatedOptions);
|
|
2470
|
-
return configs;
|
|
2471
|
-
});
|
|
2472
|
-
}
|
|
2473
|
-
async _signingKeys() {
|
|
2474
|
-
var _a;
|
|
2475
|
-
if (this._signers !== undefined) {
|
|
2476
|
-
return this._signers;
|
|
2477
|
-
}
|
|
2478
|
-
const jwks = await this._client.signingCertificates.get();
|
|
2479
|
-
const signers = new Array();
|
|
2480
|
-
(_a = jwks.keys) === null || _a === void 0 ? void 0 : _a.forEach((element) => {
|
|
2481
|
-
signers.push(_attestationSignerFromGenerated(element));
|
|
2482
|
-
});
|
|
2483
|
-
this._signers = signers;
|
|
2484
|
-
return this._signers;
|
|
2485
|
-
}
|
|
2486
|
-
}
|
|
2487
|
-
|
|
2488
|
-
// Copyright (c) Microsoft Corporation.
|
|
2489
|
-
// Licensed under the MIT License.
|
|
2490
|
-
/**
|
|
2491
|
-
* Create a new instance of a {@link PolicyResult} from a raw JSON object.
|
|
2492
|
-
* @param rawJson - JSON Policy Result object returned from the Attestation service.
|
|
2493
|
-
* @returns a newly created {@link PolicyResult} object whose contents reflect the JSON received from
|
|
2494
|
-
* the attestation service.
|
|
2495
|
-
*/
|
|
2496
|
-
function _policyResultFromGenerated(rawJson) {
|
|
2497
|
-
const policyResult = TypeDeserializer.deserialize(rawJson, { PolicyResult: PolicyResult, JsonWebKey: JsonWebKey }, "PolicyResult");
|
|
2498
|
-
return {
|
|
2499
|
-
policyResolution: policyResult.policyResolution,
|
|
2500
|
-
policyTokenHash: policyResult.policyTokenHash,
|
|
2501
|
-
policy: policyResult.policy,
|
|
2502
|
-
policySigner: policyResult.policySigner
|
|
2503
|
-
? _attestationSignerFromGenerated(policyResult.policySigner)
|
|
2504
|
-
: undefined,
|
|
2505
|
-
};
|
|
2506
|
-
}
|
|
2507
|
-
|
|
2508
|
-
// Copyright (c) Microsoft Corporation.
|
|
2509
|
-
// Licensed under the MIT License.
|
|
2510
|
-
/* eslint-disable @azure/azure-sdk/ts-naming-options */
|
|
2511
|
-
/**
|
|
2512
|
-
* Attestation Client class.
|
|
2513
|
-
*
|
|
2514
|
-
* The AttestationClient class enables access to the Attestation related APIs:
|
|
2515
|
-
*
|
|
2516
|
-
* - getPolicy
|
|
2517
|
-
* - setPolicy
|
|
2518
|
-
* - resetPolicy
|
|
2519
|
-
* - getPolicyManagementCertificates
|
|
2520
|
-
* - addPolicyManagementCertificate
|
|
2521
|
-
* - removePolicyManagementCertificate
|
|
2522
|
-
*/
|
|
2523
|
-
class AttestationAdministrationClient {
|
|
2524
|
-
/**
|
|
2525
|
-
* Creates an instance of AttestationAdministrationClient.
|
|
2526
|
-
*
|
|
2527
|
-
* Example usage:
|
|
2528
|
-
* ```ts
|
|
2529
|
-
* import { AttestationAdministrationClient } from "@azure/attestation";
|
|
2530
|
-
*
|
|
2531
|
-
* const client = new AttestationAdministrationClient(
|
|
2532
|
-
* "<service endpoint>",
|
|
2533
|
-
* new TokenCredential("<>")
|
|
2534
|
-
* );
|
|
2535
|
-
* ```
|
|
2536
|
-
*
|
|
2537
|
-
* @param endpoint - The attestation instance endpoint, for example https://mytenant.attest.azure.net.
|
|
2538
|
-
* @param credential - Used to authenticate requests to the service.
|
|
2539
|
-
* @param options - Used to configure the Form Recognizer client.
|
|
2540
|
-
*/
|
|
2541
|
-
constructor(endpoint, credentials, options = {}) {
|
|
2542
|
-
this._validationOptions = options.validationOptions;
|
|
2543
|
-
const internalPipelineOptions = Object.assign(Object.assign({}, options), {
|
|
2544
|
-
credential: credentials,
|
|
2545
|
-
credentialScopes: ["https://attest.azure.net/.default"],
|
|
2546
|
-
loggingOptions: {
|
|
2547
|
-
logger: logger.info,
|
|
2548
|
-
allowedHeaderNames: ["x-ms-request-id", "x-ms-maa-service-version"],
|
|
2549
|
-
},
|
|
2550
|
-
});
|
|
2551
|
-
this._client = new GeneratedClient(endpoint, internalPipelineOptions);
|
|
2552
|
-
}
|
|
2553
|
-
/**
|
|
2554
|
-
* Retrieves the attestation policy document from the server, and returns it
|
|
2555
|
-
* to the caller.
|
|
2556
|
-
*
|
|
2557
|
-
* @param attestationType - AttestationType for which to retrieve policy.
|
|
2558
|
-
* @param options - Pipeline and client options for the `getPolicy` call.
|
|
2559
|
-
* @returns `AttestationResponse<string>` - the `value` property is the
|
|
2560
|
-
* attestation policy, the `token` property will be the actual token
|
|
2561
|
-
* returned by the attestation service.
|
|
2562
|
-
*/
|
|
2563
|
-
async getPolicy(attestationType, options = {}) {
|
|
2564
|
-
return tracingClient.withSpan("AttestationAdministrationClient-getPolicy", options, async (updatedOptions) => {
|
|
2565
|
-
var _a;
|
|
2566
|
-
const getPolicyResult = await this._client.policy.get(attestationType, updatedOptions);
|
|
2567
|
-
// The attestation token returned from the service has a PolicyResult
|
|
2568
|
-
// object as the body.
|
|
2569
|
-
const token = new AttestationTokenImpl(getPolicyResult.token);
|
|
2570
|
-
// Validate the token returned from the service.
|
|
2571
|
-
const problems = token.getTokenProblems(await this.signingKeys(), (_a = options.validationOptions) !== null && _a !== void 0 ? _a : this._validationOptions);
|
|
2572
|
-
if (problems.length) {
|
|
2573
|
-
throw new Error(problems.join(";"));
|
|
2574
|
-
}
|
|
2575
|
-
// Deserialize the PolicyResult object to retrieve the underlying policy
|
|
2576
|
-
// token
|
|
2577
|
-
const policyResult = _policyResultFromGenerated(token.getBody());
|
|
2578
|
-
// The policyResult.policy value will be a JSON Web Signature representing
|
|
2579
|
-
// the actual policy object being retrieved. Serialize the token to an
|
|
2580
|
-
// AttestationToken object so we can access the body properties on the token.
|
|
2581
|
-
if (!policyResult.policy) {
|
|
2582
|
-
throw Error("Server returned an invalid getPolicy response!");
|
|
2583
|
-
}
|
|
2584
|
-
const policyToken = new AttestationTokenImpl(policyResult.policy);
|
|
2585
|
-
const storedPolicy = StoredAttestationPolicy.deserialize(policyToken.getBody());
|
|
2586
|
-
// Finally, retrieve the stored attestationPolicy value and return that
|
|
2587
|
-
// as the AttestationResponse to the caller.
|
|
2588
|
-
return createAttestationResponse(token, bytesToString(storedPolicy.attestationPolicy));
|
|
2589
|
-
});
|
|
2590
|
-
}
|
|
2591
|
-
/**
|
|
2592
|
-
* Sets the attestation policy for the specified {@link attestationType}.
|
|
2593
|
-
*
|
|
2594
|
-
* @param attestationType - Attestation Type for which to set policy.
|
|
2595
|
-
* @param newPolicyDocument - Policy document to be set.
|
|
2596
|
-
* @param options - call options.
|
|
2597
|
-
* @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.
|
|
2598
|
-
* Clients can use the PolicyResult to validate that the policy was actually
|
|
2599
|
-
* set by the attestation service.
|
|
2600
|
-
*
|
|
2601
|
-
* @remarks
|
|
2602
|
-
*
|
|
2603
|
-
* Please note that if the attestation service instance is running in "Isolated"
|
|
2604
|
-
* mode, the {@link signingKey} must be one of the signing keys configured for the
|
|
2605
|
-
* service instance.
|
|
2606
|
-
*
|
|
2607
|
-
* @throws {@link Error} when a private key is specified without a certificate and vice versa.
|
|
2608
|
-
* @throws {@link Error} when the key in the certificate provided does not match the private key.
|
|
2609
|
-
*/
|
|
2610
|
-
async setPolicy(attestationType, newPolicyDocument, options = {}) {
|
|
2611
|
-
return tracingClient.withSpan("AttestationAdministrationClient-setPolicy", options, async (updatedOptions) => {
|
|
2612
|
-
var _a;
|
|
2613
|
-
if ((!options.privateKey && options.certificate) ||
|
|
2614
|
-
(options.privateKey && !options.certificate)) {
|
|
2615
|
-
throw new Error("If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.");
|
|
2616
|
-
}
|
|
2617
|
-
if (options.privateKey && options.certificate) {
|
|
2618
|
-
verifyAttestationSigningKey(options.privateKey, options.certificate);
|
|
2619
|
-
}
|
|
2620
|
-
const storedAttestationPolicy = new StoredAttestationPolicy(newPolicyDocument).serialize();
|
|
2621
|
-
const setPolicyToken = AttestationTokenImpl.create(Object.assign({ body: storedAttestationPolicy }, options));
|
|
2622
|
-
const setPolicyResult = await this._client.policy.set(attestationType, setPolicyToken.serialize(), updatedOptions);
|
|
2623
|
-
// The attestation token returned from the service has a PolicyResult
|
|
2624
|
-
// object as the body.
|
|
2625
|
-
const token = new AttestationTokenImpl(setPolicyResult.token);
|
|
2626
|
-
const problems = token.getTokenProblems(await this.signingKeys(), (_a = options.validationOptions) !== null && _a !== void 0 ? _a : this._validationOptions);
|
|
2627
|
-
if (problems.length) {
|
|
2628
|
-
throw new Error(problems.join(";"));
|
|
2629
|
-
}
|
|
2630
|
-
// Deserialize the PolicyResult object to retrieve the underlying policy
|
|
2631
|
-
// token
|
|
2632
|
-
const policyResult = _policyResultFromGenerated(token.getBody());
|
|
2633
|
-
// The policyResult.policy value will be a JSON Web Signature representing
|
|
2634
|
-
// the actual policy object being retrieved. Serialize the token to an
|
|
2635
|
-
// AttestationToken object so we can access the body properties on the token.
|
|
2636
|
-
return createAttestationResponse(token, policyResult);
|
|
2637
|
-
});
|
|
2638
|
-
}
|
|
2639
|
-
/**
|
|
2640
|
-
* Resets the attestation policy for the specified {@link attestationType} to
|
|
2641
|
-
* the default value.
|
|
2642
|
-
*
|
|
2643
|
-
* @param attestationType - Attestation Type for which to set policy.
|
|
2644
|
-
* @param options - call options.
|
|
2645
|
-
* @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.
|
|
2646
|
-
* Clients can use the PolicyResult to validate that the policy was actually
|
|
2647
|
-
* reset by the attestation service.
|
|
2648
|
-
*
|
|
2649
|
-
* @remarks
|
|
2650
|
-
*
|
|
2651
|
-
* Please note that if the attestation service instance is running in "Isolated"
|
|
2652
|
-
* mode, the {@link signingKey} must be one of the signing keys configured for the
|
|
2653
|
-
* service instance.
|
|
2654
|
-
*
|
|
2655
|
-
* @throws {@link Error} when a private key is specified without a certificate and vice versa.
|
|
2656
|
-
* @throws {@link Error} when the key in the certificate provided does not match the private key.
|
|
2657
|
-
*/
|
|
2658
|
-
async resetPolicy(attestationType, options = {}) {
|
|
2659
|
-
return tracingClient.withSpan("AttestationAdministrationClient-setPolicy", options, async (updatedOptions) => {
|
|
2660
|
-
var _a;
|
|
2661
|
-
if ((!options.privateKey && options.certificate) ||
|
|
2662
|
-
(options.privateKey && !options.certificate)) {
|
|
2663
|
-
throw new Error("If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.");
|
|
2664
|
-
}
|
|
2665
|
-
if (options.privateKey && options.certificate) {
|
|
2666
|
-
verifyAttestationSigningKey(options.privateKey, options.certificate);
|
|
2667
|
-
}
|
|
2668
|
-
const resetPolicyToken = AttestationTokenImpl.create({
|
|
2669
|
-
privateKey: options.privateKey,
|
|
2670
|
-
certificate: options.certificate,
|
|
2671
|
-
});
|
|
2672
|
-
const resetPolicyResult = await this._client.policy.reset(attestationType, resetPolicyToken.serialize(), updatedOptions);
|
|
2673
|
-
// The attestation token returned from the service has a PolicyResult
|
|
2674
|
-
// object as the body.
|
|
2675
|
-
const token = new AttestationTokenImpl(resetPolicyResult.token);
|
|
2676
|
-
const problems = token.getTokenProblems(await this.signingKeys(), (_a = options.validationOptions) !== null && _a !== void 0 ? _a : this._validationOptions);
|
|
2677
|
-
if (problems.length) {
|
|
2678
|
-
throw new Error(problems.join(";"));
|
|
2679
|
-
}
|
|
2680
|
-
// Deserialize the PolicyResult object to retrieve the underlying policy
|
|
2681
|
-
// token
|
|
2682
|
-
const policyResult = _policyResultFromGenerated(token.getBody());
|
|
2683
|
-
// The policyResult.policy value will be a JSON Web Signature representing
|
|
2684
|
-
// the actual policy object being retrieved. Serialize the token to an
|
|
2685
|
-
// AttestationToken object so we can access the body properties on the token.
|
|
2686
|
-
return createAttestationResponse(token, policyResult);
|
|
2687
|
-
});
|
|
2688
|
-
}
|
|
2689
|
-
/** Returns the set of policy management certificates for this attestation instance.
|
|
2690
|
-
*
|
|
2691
|
-
* @remarks If the attestation instance is not in `Isolated` mode, this list will
|
|
2692
|
-
* always be empty.
|
|
2693
|
-
*
|
|
2694
|
-
* @param options - Options for the call to the attestation service.
|
|
2695
|
-
* @returns AttestationResponse wrapping a list of Attestation Signers.
|
|
2696
|
-
*/
|
|
2697
|
-
async getPolicyManagementCertificates(options = {}) {
|
|
2698
|
-
return tracingClient.withSpan("AttestationAdministrationClient-getPolicyManagementCertificates", options, async (updatedOptions) => {
|
|
2699
|
-
var _a;
|
|
2700
|
-
const getCertificatesResult = await this._client.policyCertificates.get(updatedOptions);
|
|
2701
|
-
// The attestation token returned from the service has a PolicyResult
|
|
2702
|
-
// object as the body.
|
|
2703
|
-
const token = new AttestationTokenImpl(getCertificatesResult.token);
|
|
2704
|
-
const problems = token.getTokenProblems(await this.signingKeys(), (_a = options.validationOptions) !== null && _a !== void 0 ? _a : this._validationOptions);
|
|
2705
|
-
if (problems.length) {
|
|
2706
|
-
throw new Error(problems.join(";"));
|
|
2707
|
-
}
|
|
2708
|
-
// Deserialize the PolicyResult object to retrieve the underlying policy
|
|
2709
|
-
// token
|
|
2710
|
-
const jwks = TypeDeserializer.deserialize(token.getBody(), {
|
|
2711
|
-
PolicyCertificatesResult: PolicyCertificatesResult,
|
|
2712
|
-
JsonWebKeySet: JsonWebKeySet,
|
|
2713
|
-
JsonWebKey: JsonWebKey,
|
|
2714
|
-
}, "PolicyCertificatesResult");
|
|
2715
|
-
const policyCertificates = new Array();
|
|
2716
|
-
jwks.policyCertificates.keys.forEach((jwk) => {
|
|
2717
|
-
policyCertificates.push(_attestationSignerFromGenerated(jwk));
|
|
2718
|
-
});
|
|
2719
|
-
return createAttestationResponse(token, policyCertificates);
|
|
2720
|
-
});
|
|
2721
|
-
}
|
|
2722
|
-
/** Add a new certificate chain to the set of policy management certificates.
|
|
2723
|
-
*
|
|
2724
|
-
* @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.
|
|
2725
|
-
* @param privateKey - Existing attestation private key used to sign the incoming request.
|
|
2726
|
-
* @param certificate - Existing attestation certificate used to verify the incoming request.
|
|
2727
|
-
* @param options - Options used in the call to the service.
|
|
2728
|
-
* @returns An attestation response including a PolicyCertificatesModificationResult
|
|
2729
|
-
*
|
|
2730
|
-
* @remarks This API is only supported on `isolated` attestation instances.
|
|
2731
|
-
*
|
|
2732
|
-
* The signing key MUST be one of the existing attestation signing certificates. The
|
|
2733
|
-
* new pemCertificate is signed using the signingKey and the service will validate the
|
|
2734
|
-
* signature before allowing the addition.
|
|
2735
|
-
*
|
|
2736
|
-
* @throws {@link Error} when a private key is specified without a certificate and vice versa.
|
|
2737
|
-
* @throws {@link Error} when the key in the certificate provided does not match the private key.
|
|
2738
|
-
*
|
|
2739
|
-
*/
|
|
2740
|
-
async addPolicyManagementCertificate(pemCertificate, privateKey, certificate, options = {}) {
|
|
2741
|
-
return tracingClient.withSpan("AttestationAdministrationClient-addPolicyManagementCertificate", options, async (updatedOptions) => {
|
|
2742
|
-
var _a;
|
|
2743
|
-
if ((!privateKey && certificate) || (privateKey && !certificate)) {
|
|
2744
|
-
throw new Error("If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.");
|
|
2745
|
-
}
|
|
2746
|
-
if (privateKey && certificate) {
|
|
2747
|
-
verifyAttestationSigningKey(privateKey, certificate);
|
|
2748
|
-
}
|
|
2749
|
-
const cert = new jsrsasign__namespace.X509();
|
|
2750
|
-
cert.readCertPEM(pemCertificate);
|
|
2751
|
-
const kty = this.keyTypeFromCertificate(cert);
|
|
2752
|
-
const jwk = {
|
|
2753
|
-
x5C: [hexToBase64(cert.hex)],
|
|
2754
|
-
kty: kty,
|
|
2755
|
-
};
|
|
2756
|
-
const addBody = {
|
|
2757
|
-
policyCertificate: jwk,
|
|
2758
|
-
};
|
|
2759
|
-
const addCertToken = AttestationTokenImpl.create({
|
|
2760
|
-
body: TypeDeserializer.serialize(addBody, {
|
|
2761
|
-
AttestationCertificateManagementBody: AttestationCertificateManagementBody,
|
|
2762
|
-
JsonWebKey: JsonWebKey,
|
|
2763
|
-
}, AttestationCertificateManagementBody),
|
|
2764
|
-
privateKey: privateKey,
|
|
2765
|
-
certificate: certificate,
|
|
2766
|
-
});
|
|
2767
|
-
const addCertificateResult = await this._client.policyCertificates.add(addCertToken.serialize(), updatedOptions);
|
|
2768
|
-
// The attestation token returned from the service has a PolicyResult
|
|
2769
|
-
// object as the body.
|
|
2770
|
-
const token = new AttestationTokenImpl(addCertificateResult.token);
|
|
2771
|
-
const problems = token.getTokenProblems(await this.signingKeys(), (_a = options.validationOptions) !== null && _a !== void 0 ? _a : this._validationOptions);
|
|
2772
|
-
if (problems.length) {
|
|
2773
|
-
throw new Error(problems.join(";"));
|
|
2774
|
-
}
|
|
2775
|
-
// Deserialize the PolicyCertificatesModificationResult object.
|
|
2776
|
-
const result = TypeDeserializer.deserialize(token.getBody(), {
|
|
2777
|
-
PolicyCertificatesModificationResult: PolicyCertificatesModificationResult,
|
|
2778
|
-
JsonWebKeySet: JsonWebKeySet,
|
|
2779
|
-
JsonWebKey: JsonWebKey,
|
|
2780
|
-
}, "PolicyCertificatesModificationResult");
|
|
2781
|
-
return createAttestationResponse(token, result);
|
|
2782
|
-
});
|
|
2783
|
-
}
|
|
2784
|
-
keyTypeFromCertificate(cert) {
|
|
2785
|
-
let kty;
|
|
2786
|
-
switch (cert.getSignatureAlgorithmName()) {
|
|
2787
|
-
case "SHA256withRSA":
|
|
2788
|
-
case "SHA384withRSA":
|
|
2789
|
-
case "SHA512withRSA":
|
|
2790
|
-
kty = "RSA";
|
|
2791
|
-
break;
|
|
2792
|
-
case "SHA256withECDSA":
|
|
2793
|
-
case "SHA384withECDSA":
|
|
2794
|
-
kty = "EC";
|
|
2795
|
-
break;
|
|
2796
|
-
default:
|
|
2797
|
-
kty = "RSA";
|
|
2798
|
-
break;
|
|
2799
|
-
}
|
|
2800
|
-
return kty;
|
|
2801
|
-
}
|
|
2802
|
-
/** Add a new certificate chain to the set of policy management certificates.
|
|
2803
|
-
*
|
|
2804
|
-
* @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.
|
|
2805
|
-
* @param privateKey - Existing attestation private key used to sign the incoming request.
|
|
2806
|
-
* @param certificate - Existing attestation certificate used to verify the incoming request.
|
|
2807
|
-
* @param options - Options used in the call to the service.
|
|
2808
|
-
* @returns An attestation response including a PolicyCertificatesModificationResult
|
|
2809
|
-
*
|
|
2810
|
-
* @remarks This API is only supported on `isolated` attestation instances.
|
|
2811
|
-
*
|
|
2812
|
-
* The signing key MUST be one of the existing attestation signing certificates. The
|
|
2813
|
-
* new pemCertificate is signed using the signingKey and the service will validate the
|
|
2814
|
-
* signature before allowing the addition.
|
|
2815
|
-
*
|
|
2816
|
-
* @throws {@link Error} when a private key is specified without a certificate and vice versa.
|
|
2817
|
-
* @throws {@link Error} when the key in the certificate provided does not match the private key.
|
|
2818
|
-
*/
|
|
2819
|
-
async removePolicyManagementCertificate(pemCertificate, privateKey, certificate, options = {}) {
|
|
2820
|
-
return tracingClient.withSpan("AttestationAdministrationClient-removePolicyManagementCertificate", options, async (updatedOptions) => {
|
|
2821
|
-
var _a;
|
|
2822
|
-
if ((!privateKey && certificate) || (privateKey && !certificate)) {
|
|
2823
|
-
throw new Error("If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.");
|
|
2824
|
-
}
|
|
2825
|
-
if (privateKey && certificate) {
|
|
2826
|
-
verifyAttestationSigningKey(privateKey, certificate);
|
|
2827
|
-
}
|
|
2828
|
-
const cert = new jsrsasign__namespace.X509();
|
|
2829
|
-
cert.readCertPEM(pemCertificate);
|
|
2830
|
-
const kty = this.keyTypeFromCertificate(cert);
|
|
2831
|
-
const jwk = {
|
|
2832
|
-
x5C: [hexToBase64(cert.hex)],
|
|
2833
|
-
kty: kty,
|
|
2834
|
-
};
|
|
2835
|
-
const addBody = {
|
|
2836
|
-
policyCertificate: jwk,
|
|
2837
|
-
};
|
|
2838
|
-
const removeCertToken = AttestationTokenImpl.create({
|
|
2839
|
-
body: TypeDeserializer.serialize(addBody, {
|
|
2840
|
-
AttestationCertificateManagementBody: AttestationCertificateManagementBody,
|
|
2841
|
-
JsonWebKey: JsonWebKey,
|
|
2842
|
-
}, AttestationCertificateManagementBody),
|
|
2843
|
-
privateKey: privateKey,
|
|
2844
|
-
certificate: certificate,
|
|
2845
|
-
});
|
|
2846
|
-
const removeCertificateResult = await this._client.policyCertificates.remove(removeCertToken.serialize(), updatedOptions);
|
|
2847
|
-
// The attestation token returned from the service has a PolicyResult
|
|
2848
|
-
// object as the body.
|
|
2849
|
-
const token = new AttestationTokenImpl(removeCertificateResult.token);
|
|
2850
|
-
const problems = token.getTokenProblems(await this.signingKeys(), (_a = options.validationOptions) !== null && _a !== void 0 ? _a : this._validationOptions);
|
|
2851
|
-
if (problems.length) {
|
|
2852
|
-
throw new Error(problems.join(";"));
|
|
2853
|
-
}
|
|
2854
|
-
// Deserialize the PolicyCertificatesModificationResult object.
|
|
2855
|
-
const result = TypeDeserializer.deserialize(token.getBody(), {
|
|
2856
|
-
PolicyCertificatesModificationResult: PolicyCertificatesModificationResult,
|
|
2857
|
-
JsonWebKeySet: JsonWebKeySet,
|
|
2858
|
-
JsonWebKey: JsonWebKey,
|
|
2859
|
-
}, "PolicyCertificatesModificationResult");
|
|
2860
|
-
return createAttestationResponse(token, result);
|
|
2861
|
-
});
|
|
2862
|
-
}
|
|
2863
|
-
async signingKeys() {
|
|
2864
|
-
var _a;
|
|
2865
|
-
if (this._signers !== undefined) {
|
|
2866
|
-
return this._signers;
|
|
2867
|
-
}
|
|
2868
|
-
const jwks = await this._client.signingCertificates.get();
|
|
2869
|
-
const signers = new Array();
|
|
2870
|
-
(_a = jwks.keys) === null || _a === void 0 ? void 0 : _a.forEach((element) => {
|
|
2871
|
-
signers.push(_attestationSignerFromGenerated(element));
|
|
2872
|
-
});
|
|
2873
|
-
this._signers = signers;
|
|
2874
|
-
return this._signers;
|
|
2875
|
-
}
|
|
2876
|
-
}
|
|
2877
|
-
|
|
2878
|
-
exports.AttestationAdministrationClient = AttestationAdministrationClient;
|
|
2879
|
-
exports.AttestationClient = AttestationClient;
|
|
2880
|
-
exports.createAttestationPolicyToken = createAttestationPolicyToken;
|
|
2881
|
-
//# sourceMappingURL=index.js.map
|