@azure/attestation 1.0.1-alpha.20241209.1 → 1.0.1-alpha.20241211.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.
@@ -1 +1 @@
1
- {"version":3,"file":"attestationAdministrationClient.d.ts","sourceRoot":"","sources":["../../src/attestationAdministrationClient.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,iCAAiC,EACjC,eAAe,EACf,oCAAoC,EACpC,YAAY,EACb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAexD;;GAEG;AACH,MAAM,WAAW,sCAAuC,SAAQ,mBAAmB;IACjF;;;OAGG;IACH,iBAAiB,CAAC,EAAE,iCAAiC,CAAC;CACvD;AAED;;GAEG;AACH,MAAM,WAAW,+CAAgD,SAAQ,gBAAgB;IACvF;;;OAGG;IACH,iBAAiB,CAAC,EAAE,iCAAiC,CAAC;CACvD;AAED;;GAEG;AACH,MAAM,WAAW,qDACf,SAAQ,+CAA+C;IACvD;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,gEACf,SAAQ,+CAA+C;CAAG;AAE5D;;;;;;;;;;;GAWG;AACH,qBAAa,+BAA+B;IAC1C;;;;;;;;;;;;;;;;OAgBG;gBAGD,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,eAAe,EAC5B,OAAO,GAAE,sCAA2C;IAmBtD;;;;;;;;;OASG;IACU,SAAS,CACpB,eAAe,EAAE,eAAe,EAChC,OAAO,GAAE,qDAA0D,GAClE,OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IA6CvC;;;;;;;;;;;;;;;;;;OAkBG;IACU,SAAS,CACpB,eAAe,EAAE,eAAe,EAChC,iBAAiB,EAAE,MAAM,EACzB,OAAO,GAAE,qDAA0D,GAClE,OAAO,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAqD7C;;;;;;;;;;;;;;;;;;OAkBG;IAEU,WAAW,CACtB,eAAe,EAAE,eAAe,EAChC,OAAO,GAAE,qDAA0D,GAClE,OAAO,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAoD7C;;;;;;;OAOG;IACU,+BAA+B,CAC1C,OAAO,GAAE,gEAAqE,GAC7E,OAAO,CAAC,mBAAmB,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAuCpD;;;;;;;;;;;;;;;;;OAiBG;IACU,8BAA8B,CACzC,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,gEAAqE,GAC7E,OAAO,CAAC,mBAAmB,CAAC,oCAAoC,CAAC,CAAC;IAwErE,OAAO,CAAC,sBAAsB;IAmB9B;;;;;;;;;;;;;;;;OAgBG;IACU,iCAAiC,CAC5C,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,gEAAqE,GAC7E,OAAO,CAAC,mBAAmB,CAAC,oCAAoC,CAAC,CAAC;YAwEvD,WAAW;IAazB,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,QAAQ,CAAC,CAAsB;IACvC,OAAO,CAAC,kBAAkB,CAAC,CAAoC;CAChE"}
1
+ {"version":3,"file":"attestationAdministrationClient.d.ts","sourceRoot":"","sources":["../../src/attestationAdministrationClient.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,iCAAiC,EACjC,eAAe,EACf,oCAAoC,EACpC,YAAY,EACb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAA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EAAqE,GAC7E,OAAO,CAAC,mBAAmB,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAuCpD;;;;;;;;;;;;;;;;;OAiBG;IACU,8BAA8B,CACzC,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,gEAAqE,GAC7E,OAAO,CAAC,mBAAmB,CAAC,oCAAoC,CAAC,CAAC;IAwErE,OAAO,CAAC,sBAAsB;IAmB9B;;;;;;;;;;;;;;;;OAgBG;IACU,iCAAiC,CAC5C,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,gEAAqE,GAC7E,OAAO,CAAC,mBAAmB,CAAC,oCAAoC,CAAC,CAAC;YAwEvD,WAAW;IAazB,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,QAAQ,CAAC,CAAsB;IACvC,OAAO,CAAC,kBAAkB,CAAC,CAAoC;CAChE"}
@@ -7,7 +7,6 @@ import { bytesToString } from "./utils/utf8.js";
7
7
  import { StoredAttestationPolicy } from "./models/storedAttestationPolicy.js";
8
8
  import { TypeDeserializer } from "./utils/typeDeserializer.js";
9
9
  import * as Mappers from "./generated/models/mappers.js";
10
- // eslint-disable-next-line @typescript-eslint/triple-slash-reference
11
10
  /// <reference path="../jsrsasign.d.ts"/>
12
11
  import * as jsrsasign from "jsrsasign";
13
12
  import { hexToBase64 } from "./utils/helpers.js";
@@ -1 +1 @@
1
- {"version":3,"file":"attestationAdministrationClient.js","sourceRoot":"","sources":["../../src/attestationAdministrationClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,uDAAuD;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AASrC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAUhD,OAAO,EA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AAO,IAAI,CAAC,QAAQ,CAAC;QACvB,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG,EAAE,CAAC;QAC1D,MAAM,OAAO,GAAwB,IAAI,KAAK,EAAE,CAAC;QACjD,MAAA,IAAI,CAAC,IAAI,0CAAE,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,OAAO,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CAKF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* eslint-disable @azure/azure-sdk/ts-naming-options */\nimport { GeneratedClient } from \"./generated/generatedClient.js\";\nimport { logger } from \"./logger.js\";\n\nimport type {\n AttestationCertificateManagementBody,\n GeneratedClientOptionalParams,\n JsonWebKey,\n PolicyCertificatesResult,\n} from \"./generated/models/index.js\";\n\nimport { bytesToString } from \"./utils/utf8.js\";\n\nimport type {\n AttestationResponse,\n AttestationSigner,\n AttestationTokenValidationOptions,\n AttestationType,\n PolicyCertificatesModificationResult,\n PolicyResult,\n} from \"./models/index.js\";\nimport { StoredAttestationPolicy } from \"./models/storedAttestationPolicy.js\";\n\nimport type { CommonClientOptions, OperationOptions } from \"@azure/core-client\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { TypeDeserializer } from \"./utils/typeDeserializer.js\";\nimport * as Mappers from \"./generated/models/mappers.js\";\n\n// eslint-disable-next-line @typescript-eslint/triple-slash-reference\n/// <reference path=\"../jsrsasign.d.ts\"/>\nimport * as jsrsasign from \"jsrsasign\";\nimport { hexToBase64 } from \"./utils/helpers.js\";\nimport { _policyResultFromGenerated } from \"./models/policyResult.js\";\nimport { _attestationSignerFromGenerated } from \"./models/attestationSigner.js\";\nimport { verifyAttestationSigningKey } from \"./utils/helpers.js\";\nimport { createAttestationResponse } from \"./models/attestationResponse.js\";\nimport { AttestationTokenImpl } from \"./models/attestationToken.js\";\nimport { tracingClient } from \"./generated/tracing.js\";\n\n/**\n * Attestation Client Construction Options.\n */\nexport interface AttestationAdministrationClientOptions extends CommonClientOptions {\n /**\n * Options to be used globally to validate attestation tokens received from\n * the attestation service.\n */\n validationOptions?: AttestationTokenValidationOptions;\n}\n\n/**\n * Operation options for the Attestation Administration Client operations.\n */\nexport interface AttestationAdministrationClientOperationOptions extends OperationOptions {\n /**\n * Options to be used globally to validate attestation tokens received from\n * the attestation service.\n */\n validationOptions?: AttestationTokenValidationOptions;\n}\n\n/**\n * Operation options for the administration Policy operations.\n */\nexport interface AttestationAdministrationClientPolicyOperationOptions\n extends AttestationAdministrationClientOperationOptions {\n /**\n * Optional Private key used to sign the token sent to the attestation service.\n *\n * Required for Isolated Mode attestation instances.\n */\n privateKey?: string;\n\n /**\n * Optional certificate which can validate the token sent to the attestation service.\n *\n * Required for Isolated Mode attestation instances.\n *\n * If the service instance is in Isolated mode, the certificate *must* be one\n * of the configured policy management certificates.\n */\n certificate?: string;\n}\n\n/**\n * Operation options for the Policy Certificates operations.\n */\nexport interface AttestationAdministrationClientPolicyCertificateOperationOptions\n extends AttestationAdministrationClientOperationOptions {}\n\n/**\n * Attestation Client class.\n *\n * The AttestationClient class enables access to the Attestation related APIs:\n *\n * - getPolicy\n * - setPolicy\n * - resetPolicy\n * - getPolicyManagementCertificates\n * - addPolicyManagementCertificate\n * - removePolicyManagementCertificate\n */\nexport class AttestationAdministrationClient {\n /**\n * Creates an instance of AttestationAdministrationClient.\n *\n * Example usage:\n * ```ts\n * import { AttestationAdministrationClient } from \"@azure/attestation\";\n *\n * const client = new AttestationAdministrationClient(\n * \"<service endpoint>\",\n * new TokenCredential(\"<>\")\n * );\n * ```\n *\n * @param endpoint - The attestation instance endpoint, for example https://mytenant.attest.azure.net.\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the Form Recognizer client.\n */\n\n constructor(\n endpoint: string,\n credentials: TokenCredential,\n options: AttestationAdministrationClientOptions = {},\n ) {\n this._validationOptions = options.validationOptions;\n\n const internalPipelineOptions: GeneratedClientOptionalParams = {\n ...options,\n ...{\n credential: credentials,\n credentialScopes: [\"https://attest.azure.net/.default\"],\n loggingOptions: {\n logger: logger.info,\n allowedHeaderNames: [\"x-ms-request-id\", \"x-ms-maa-service-version\"],\n },\n },\n };\n\n this._client = new GeneratedClient(endpoint, internalPipelineOptions);\n }\n\n /**\n * Retrieves the attestation policy document from the server, and returns it\n * to the caller.\n *\n * @param attestationType - AttestationType for which to retrieve policy.\n * @param options - Pipeline and client options for the `getPolicy` call.\n * @returns `AttestationResponse<string>` - the `value` property is the\n * attestation policy, the `token` property will be the actual token\n * returned by the attestation service.\n */\n public async getPolicy(\n attestationType: AttestationType,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<string>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-getPolicy\",\n options,\n async (updatedOptions) => {\n const getPolicyResult = await this._client.policy.get(attestationType, updatedOptions);\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(getPolicyResult.token);\n\n // Validate the token returned from the service.\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n if (!policyResult.policy) {\n throw Error(\"Server returned an invalid getPolicy response!\");\n }\n\n const policyToken = new AttestationTokenImpl(policyResult.policy);\n\n const storedPolicy = StoredAttestationPolicy.deserialize(policyToken.getBody());\n\n // Finally, retrieve the stored attestationPolicy value and return that\n // as the AttestationResponse to the caller.\n return createAttestationResponse<string>(\n token,\n bytesToString(storedPolicy.attestationPolicy),\n );\n },\n );\n }\n\n /**\n * Sets the attestation policy for the specified {@link attestationType}.\n *\n * @param attestationType - Attestation Type for which to set policy.\n * @param newPolicyDocument - Policy document to be set.\n * @param options - call options.\n * @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.\n * Clients can use the PolicyResult to validate that the policy was actually\n * set by the attestation service.\n *\n * @remarks\n *\n * Please note that if the attestation service instance is running in \"Isolated\"\n * mode, the {@link signingKey} must be one of the signing keys configured for the\n * service instance.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n public async setPolicy(\n attestationType: AttestationType,\n newPolicyDocument: string,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<PolicyResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-setPolicy\",\n options,\n async (updatedOptions) => {\n if (\n (!options.privateKey && options.certificate) ||\n (options.privateKey && !options.certificate)\n ) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (options.privateKey && options.certificate) {\n verifyAttestationSigningKey(options.privateKey, options.certificate);\n }\n\n const storedAttestationPolicy = new StoredAttestationPolicy(newPolicyDocument).serialize();\n const setPolicyToken = AttestationTokenImpl.create({\n body: storedAttestationPolicy,\n ...options,\n });\n\n const setPolicyResult = await this._client.policy.set(\n attestationType,\n setPolicyToken.serialize(),\n updatedOptions,\n );\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(setPolicyResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n return createAttestationResponse<PolicyResult>(token, policyResult);\n },\n );\n }\n\n /**\n * Resets the attestation policy for the specified {@link attestationType} to\n * the default value.\n *\n * @param attestationType - Attestation Type for which to set policy.\n * @param options - call options.\n * @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.\n * Clients can use the PolicyResult to validate that the policy was actually\n * reset by the attestation service.\n *\n * @remarks\n *\n * Please note that if the attestation service instance is running in \"Isolated\"\n * mode, the {@link signingKey} must be one of the signing keys configured for the\n * service instance.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n\n public async resetPolicy(\n attestationType: AttestationType,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<PolicyResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-setPolicy\",\n options,\n async (updatedOptions) => {\n if (\n (!options.privateKey && options.certificate) ||\n (options.privateKey && !options.certificate)\n ) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (options.privateKey && options.certificate) {\n verifyAttestationSigningKey(options.privateKey, options.certificate);\n }\n\n const resetPolicyToken = AttestationTokenImpl.create({\n privateKey: options.privateKey,\n certificate: options.certificate,\n });\n\n const resetPolicyResult = await this._client.policy.reset(\n attestationType,\n resetPolicyToken.serialize(),\n updatedOptions,\n );\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(resetPolicyResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n return createAttestationResponse<PolicyResult>(token, policyResult);\n },\n );\n }\n\n /** Returns the set of policy management certificates for this attestation instance.\n *\n * @remarks If the attestation instance is not in `Isolated` mode, this list will\n * always be empty.\n *\n * @param options - Options for the call to the attestation service.\n * @returns AttestationResponse wrapping a list of Attestation Signers.\n */\n public async getPolicyManagementCertificates(\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<AttestationSigner[]>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-getPolicyManagementCertificates\",\n options,\n async (updatedOptions) => {\n const getCertificatesResult = await this._client.policyCertificates.get(updatedOptions);\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(getCertificatesResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const jwks = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesResult: Mappers.PolicyCertificatesResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesResult\",\n ) as PolicyCertificatesResult;\n\n const policyCertificates = new Array<AttestationSigner>();\n jwks.policyCertificates.keys.forEach((jwk) => {\n policyCertificates.push(_attestationSignerFromGenerated(jwk));\n });\n\n return createAttestationResponse<AttestationSigner[]>(token, policyCertificates);\n },\n );\n }\n\n /** Add a new certificate chain to the set of policy management certificates.\n *\n * @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.\n * @param privateKey - Existing attestation private key used to sign the incoming request.\n * @param certificate - Existing attestation certificate used to verify the incoming request.\n * @param options - Options used in the call to the service.\n * @returns An attestation response including a PolicyCertificatesModificationResult\n *\n * @remarks This API is only supported on `isolated` attestation instances.\n *\n * The signing key MUST be one of the existing attestation signing certificates. The\n * new pemCertificate is signed using the signingKey and the service will validate the\n * signature before allowing the addition.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n *\n */\n public async addPolicyManagementCertificate(\n pemCertificate: string,\n privateKey: string,\n certificate: string,\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<PolicyCertificatesModificationResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-addPolicyManagementCertificate\",\n options,\n async (updatedOptions) => {\n if ((!privateKey && certificate) || (privateKey && !certificate)) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (privateKey && certificate) {\n verifyAttestationSigningKey(privateKey, certificate);\n }\n\n const cert = new jsrsasign.X509();\n cert.readCertPEM(pemCertificate);\n const kty = this.keyTypeFromCertificate(cert);\n\n const jwk: JsonWebKey = {\n x5C: [hexToBase64(cert.hex)],\n kty: kty,\n };\n\n const addBody: AttestationCertificateManagementBody = {\n policyCertificate: jwk,\n };\n\n const addCertToken = AttestationTokenImpl.create({\n body: TypeDeserializer.serialize(\n addBody,\n {\n AttestationCertificateManagementBody: Mappers.AttestationCertificateManagementBody,\n JsonWebKey: Mappers.JsonWebKey,\n },\n Mappers.AttestationCertificateManagementBody,\n ),\n privateKey: privateKey,\n certificate: certificate,\n });\n\n const addCertificateResult = await this._client.policyCertificates.add(\n addCertToken.serialize(),\n updatedOptions,\n );\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(addCertificateResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyCertificatesModificationResult object.\n const result = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesModificationResult: Mappers.PolicyCertificatesModificationResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesModificationResult\",\n ) as PolicyCertificatesModificationResult;\n\n return createAttestationResponse<PolicyCertificatesModificationResult>(token, result);\n },\n );\n }\n\n private keyTypeFromCertificate(cert: any): string {\n let kty: string;\n switch (cert.getSignatureAlgorithmName()) {\n case \"SHA256withRSA\":\n case \"SHA384withRSA\":\n case \"SHA512withRSA\":\n kty = \"RSA\";\n break;\n case \"SHA256withECDSA\":\n case \"SHA384withECDSA\":\n kty = \"EC\";\n break;\n default:\n kty = \"RSA\";\n break;\n }\n return kty;\n }\n\n /** Add a new certificate chain to the set of policy management certificates.\n *\n * @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.\n * @param privateKey - Existing attestation private key used to sign the incoming request.\n * @param certificate - Existing attestation certificate used to verify the incoming request.\n * @param options - Options used in the call to the service.\n * @returns An attestation response including a PolicyCertificatesModificationResult\n *\n * @remarks This API is only supported on `isolated` attestation instances.\n *\n * The signing key MUST be one of the existing attestation signing certificates. The\n * new pemCertificate is signed using the signingKey and the service will validate the\n * signature before allowing the addition.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n public async removePolicyManagementCertificate(\n pemCertificate: string,\n privateKey: string,\n certificate: string,\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<PolicyCertificatesModificationResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-removePolicyManagementCertificate\",\n options,\n async (updatedOptions) => {\n if ((!privateKey && certificate) || (privateKey && !certificate)) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (privateKey && certificate) {\n verifyAttestationSigningKey(privateKey, certificate);\n }\n\n const cert = new jsrsasign.X509();\n cert.readCertPEM(pemCertificate);\n const kty = this.keyTypeFromCertificate(cert);\n\n const jwk: JsonWebKey = {\n x5C: [hexToBase64(cert.hex)],\n kty: kty,\n };\n\n const addBody: AttestationCertificateManagementBody = {\n policyCertificate: jwk,\n };\n\n const removeCertToken = AttestationTokenImpl.create({\n body: TypeDeserializer.serialize(\n addBody,\n {\n AttestationCertificateManagementBody: Mappers.AttestationCertificateManagementBody,\n JsonWebKey: Mappers.JsonWebKey,\n },\n Mappers.AttestationCertificateManagementBody,\n ),\n privateKey: privateKey,\n certificate: certificate,\n });\n\n const removeCertificateResult = await this._client.policyCertificates.remove(\n removeCertToken.serialize(),\n updatedOptions,\n );\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(removeCertificateResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyCertificatesModificationResult object.\n const result = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesModificationResult: Mappers.PolicyCertificatesModificationResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesModificationResult\",\n ) as PolicyCertificatesModificationResult;\n\n return createAttestationResponse<PolicyCertificatesModificationResult>(token, result);\n },\n );\n }\n\n private async signingKeys(): Promise<AttestationSigner[]> {\n if (this._signers !== undefined) {\n return this._signers;\n }\n const jwks = await this._client.signingCertificates.get();\n const signers: AttestationSigner[] = new Array();\n jwks.keys?.forEach((element) => {\n signers.push(_attestationSignerFromGenerated(element));\n });\n this._signers = signers;\n return this._signers;\n }\n\n private _client: GeneratedClient;\n private _signers?: AttestationSigner[];\n private _validationOptions?: AttestationTokenValidationOptions;\n}\n"]}
1
+ {"version":3,"file":"attestationAdministrationClient.js","sourceRoot":"","sources":["../../src/attestationAdministrationClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,uDAAuD;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,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IAEO,KAAK,CAAC,WAAW;;QACvB,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC,QAAQ,CAAC;QACvB,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG,EAAE,CAAC;QAC1D,MAAM,OAAO,GAAwB,IAAI,KAAK,EAAE,CAAC;QACjD,MAAA,IAAI,CAAC,IAAI,0CAAE,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,OAAO,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CAKF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* eslint-disable @azure/azure-sdk/ts-naming-options */\nimport { GeneratedClient } from \"./generated/generatedClient.js\";\nimport { logger } from \"./logger.js\";\n\nimport type {\n AttestationCertificateManagementBody,\n GeneratedClientOptionalParams,\n JsonWebKey,\n PolicyCertificatesResult,\n} from \"./generated/models/index.js\";\n\nimport { bytesToString } from \"./utils/utf8.js\";\n\nimport type {\n AttestationResponse,\n AttestationSigner,\n AttestationTokenValidationOptions,\n AttestationType,\n PolicyCertificatesModificationResult,\n PolicyResult,\n} from \"./models/index.js\";\nimport { StoredAttestationPolicy } from \"./models/storedAttestationPolicy.js\";\n\nimport type { CommonClientOptions, OperationOptions } from \"@azure/core-client\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { TypeDeserializer } from \"./utils/typeDeserializer.js\";\nimport * as Mappers from \"./generated/models/mappers.js\";\n\n/// <reference path=\"../jsrsasign.d.ts\"/>\nimport * as jsrsasign from \"jsrsasign\";\nimport { hexToBase64 } from \"./utils/helpers.js\";\nimport { _policyResultFromGenerated } from \"./models/policyResult.js\";\nimport { _attestationSignerFromGenerated } from \"./models/attestationSigner.js\";\nimport { verifyAttestationSigningKey } from \"./utils/helpers.js\";\nimport { createAttestationResponse } from \"./models/attestationResponse.js\";\nimport { AttestationTokenImpl } from \"./models/attestationToken.js\";\nimport { tracingClient } from \"./generated/tracing.js\";\n\n/**\n * Attestation Client Construction Options.\n */\nexport interface AttestationAdministrationClientOptions extends CommonClientOptions {\n /**\n * Options to be used globally to validate attestation tokens received from\n * the attestation service.\n */\n validationOptions?: AttestationTokenValidationOptions;\n}\n\n/**\n * Operation options for the Attestation Administration Client operations.\n */\nexport interface AttestationAdministrationClientOperationOptions extends OperationOptions {\n /**\n * Options to be used globally to validate attestation tokens received from\n * the attestation service.\n */\n validationOptions?: AttestationTokenValidationOptions;\n}\n\n/**\n * Operation options for the administration Policy operations.\n */\nexport interface AttestationAdministrationClientPolicyOperationOptions\n extends AttestationAdministrationClientOperationOptions {\n /**\n * Optional Private key used to sign the token sent to the attestation service.\n *\n * Required for Isolated Mode attestation instances.\n */\n privateKey?: string;\n\n /**\n * Optional certificate which can validate the token sent to the attestation service.\n *\n * Required for Isolated Mode attestation instances.\n *\n * If the service instance is in Isolated mode, the certificate *must* be one\n * of the configured policy management certificates.\n */\n certificate?: string;\n}\n\n/**\n * Operation options for the Policy Certificates operations.\n */\nexport interface AttestationAdministrationClientPolicyCertificateOperationOptions\n extends AttestationAdministrationClientOperationOptions {}\n\n/**\n * Attestation Client class.\n *\n * The AttestationClient class enables access to the Attestation related APIs:\n *\n * - getPolicy\n * - setPolicy\n * - resetPolicy\n * - getPolicyManagementCertificates\n * - addPolicyManagementCertificate\n * - removePolicyManagementCertificate\n */\nexport class AttestationAdministrationClient {\n /**\n * Creates an instance of AttestationAdministrationClient.\n *\n * Example usage:\n * ```ts\n * import { AttestationAdministrationClient } from \"@azure/attestation\";\n *\n * const client = new AttestationAdministrationClient(\n * \"<service endpoint>\",\n * new TokenCredential(\"<>\")\n * );\n * ```\n *\n * @param endpoint - The attestation instance endpoint, for example https://mytenant.attest.azure.net.\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the Form Recognizer client.\n */\n\n constructor(\n endpoint: string,\n credentials: TokenCredential,\n options: AttestationAdministrationClientOptions = {},\n ) {\n this._validationOptions = options.validationOptions;\n\n const internalPipelineOptions: GeneratedClientOptionalParams = {\n ...options,\n ...{\n credential: credentials,\n credentialScopes: [\"https://attest.azure.net/.default\"],\n loggingOptions: {\n logger: logger.info,\n allowedHeaderNames: [\"x-ms-request-id\", \"x-ms-maa-service-version\"],\n },\n },\n };\n\n this._client = new GeneratedClient(endpoint, internalPipelineOptions);\n }\n\n /**\n * Retrieves the attestation policy document from the server, and returns it\n * to the caller.\n *\n * @param attestationType - AttestationType for which to retrieve policy.\n * @param options - Pipeline and client options for the `getPolicy` call.\n * @returns `AttestationResponse<string>` - the `value` property is the\n * attestation policy, the `token` property will be the actual token\n * returned by the attestation service.\n */\n public async getPolicy(\n attestationType: AttestationType,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<string>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-getPolicy\",\n options,\n async (updatedOptions) => {\n const getPolicyResult = await this._client.policy.get(attestationType, updatedOptions);\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(getPolicyResult.token);\n\n // Validate the token returned from the service.\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n if (!policyResult.policy) {\n throw Error(\"Server returned an invalid getPolicy response!\");\n }\n\n const policyToken = new AttestationTokenImpl(policyResult.policy);\n\n const storedPolicy = StoredAttestationPolicy.deserialize(policyToken.getBody());\n\n // Finally, retrieve the stored attestationPolicy value and return that\n // as the AttestationResponse to the caller.\n return createAttestationResponse<string>(\n token,\n bytesToString(storedPolicy.attestationPolicy),\n );\n },\n );\n }\n\n /**\n * Sets the attestation policy for the specified {@link attestationType}.\n *\n * @param attestationType - Attestation Type for which to set policy.\n * @param newPolicyDocument - Policy document to be set.\n * @param options - call options.\n * @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.\n * Clients can use the PolicyResult to validate that the policy was actually\n * set by the attestation service.\n *\n * @remarks\n *\n * Please note that if the attestation service instance is running in \"Isolated\"\n * mode, the {@link signingKey} must be one of the signing keys configured for the\n * service instance.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n public async setPolicy(\n attestationType: AttestationType,\n newPolicyDocument: string,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<PolicyResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-setPolicy\",\n options,\n async (updatedOptions) => {\n if (\n (!options.privateKey && options.certificate) ||\n (options.privateKey && !options.certificate)\n ) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (options.privateKey && options.certificate) {\n verifyAttestationSigningKey(options.privateKey, options.certificate);\n }\n\n const storedAttestationPolicy = new StoredAttestationPolicy(newPolicyDocument).serialize();\n const setPolicyToken = AttestationTokenImpl.create({\n body: storedAttestationPolicy,\n ...options,\n });\n\n const setPolicyResult = await this._client.policy.set(\n attestationType,\n setPolicyToken.serialize(),\n updatedOptions,\n );\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(setPolicyResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n return createAttestationResponse<PolicyResult>(token, policyResult);\n },\n );\n }\n\n /**\n * Resets the attestation policy for the specified {@link attestationType} to\n * the default value.\n *\n * @param attestationType - Attestation Type for which to set policy.\n * @param options - call options.\n * @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.\n * Clients can use the PolicyResult to validate that the policy was actually\n * reset by the attestation service.\n *\n * @remarks\n *\n * Please note that if the attestation service instance is running in \"Isolated\"\n * mode, the {@link signingKey} must be one of the signing keys configured for the\n * service instance.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n\n public async resetPolicy(\n attestationType: AttestationType,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<PolicyResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-setPolicy\",\n options,\n async (updatedOptions) => {\n if (\n (!options.privateKey && options.certificate) ||\n (options.privateKey && !options.certificate)\n ) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (options.privateKey && options.certificate) {\n verifyAttestationSigningKey(options.privateKey, options.certificate);\n }\n\n const resetPolicyToken = AttestationTokenImpl.create({\n privateKey: options.privateKey,\n certificate: options.certificate,\n });\n\n const resetPolicyResult = await this._client.policy.reset(\n attestationType,\n resetPolicyToken.serialize(),\n updatedOptions,\n );\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(resetPolicyResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n return createAttestationResponse<PolicyResult>(token, policyResult);\n },\n );\n }\n\n /** Returns the set of policy management certificates for this attestation instance.\n *\n * @remarks If the attestation instance is not in `Isolated` mode, this list will\n * always be empty.\n *\n * @param options - Options for the call to the attestation service.\n * @returns AttestationResponse wrapping a list of Attestation Signers.\n */\n public async getPolicyManagementCertificates(\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<AttestationSigner[]>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-getPolicyManagementCertificates\",\n options,\n async (updatedOptions) => {\n const getCertificatesResult = await this._client.policyCertificates.get(updatedOptions);\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(getCertificatesResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const jwks = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesResult: Mappers.PolicyCertificatesResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesResult\",\n ) as PolicyCertificatesResult;\n\n const policyCertificates = new Array<AttestationSigner>();\n jwks.policyCertificates.keys.forEach((jwk) => {\n policyCertificates.push(_attestationSignerFromGenerated(jwk));\n });\n\n return createAttestationResponse<AttestationSigner[]>(token, policyCertificates);\n },\n );\n }\n\n /** Add a new certificate chain to the set of policy management certificates.\n *\n * @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.\n * @param privateKey - Existing attestation private key used to sign the incoming request.\n * @param certificate - Existing attestation certificate used to verify the incoming request.\n * @param options - Options used in the call to the service.\n * @returns An attestation response including a PolicyCertificatesModificationResult\n *\n * @remarks This API is only supported on `isolated` attestation instances.\n *\n * The signing key MUST be one of the existing attestation signing certificates. The\n * new pemCertificate is signed using the signingKey and the service will validate the\n * signature before allowing the addition.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n *\n */\n public async addPolicyManagementCertificate(\n pemCertificate: string,\n privateKey: string,\n certificate: string,\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<PolicyCertificatesModificationResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-addPolicyManagementCertificate\",\n options,\n async (updatedOptions) => {\n if ((!privateKey && certificate) || (privateKey && !certificate)) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (privateKey && certificate) {\n verifyAttestationSigningKey(privateKey, certificate);\n }\n\n const cert = new jsrsasign.X509();\n cert.readCertPEM(pemCertificate);\n const kty = this.keyTypeFromCertificate(cert);\n\n const jwk: JsonWebKey = {\n x5C: [hexToBase64(cert.hex)],\n kty: kty,\n };\n\n const addBody: AttestationCertificateManagementBody = {\n policyCertificate: jwk,\n };\n\n const addCertToken = AttestationTokenImpl.create({\n body: TypeDeserializer.serialize(\n addBody,\n {\n AttestationCertificateManagementBody: Mappers.AttestationCertificateManagementBody,\n JsonWebKey: Mappers.JsonWebKey,\n },\n Mappers.AttestationCertificateManagementBody,\n ),\n privateKey: privateKey,\n certificate: certificate,\n });\n\n const addCertificateResult = await this._client.policyCertificates.add(\n addCertToken.serialize(),\n updatedOptions,\n );\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(addCertificateResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyCertificatesModificationResult object.\n const result = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesModificationResult: Mappers.PolicyCertificatesModificationResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesModificationResult\",\n ) as PolicyCertificatesModificationResult;\n\n return createAttestationResponse<PolicyCertificatesModificationResult>(token, result);\n },\n );\n }\n\n private keyTypeFromCertificate(cert: any): string {\n let kty: string;\n switch (cert.getSignatureAlgorithmName()) {\n case \"SHA256withRSA\":\n case \"SHA384withRSA\":\n case \"SHA512withRSA\":\n kty = \"RSA\";\n break;\n case \"SHA256withECDSA\":\n case \"SHA384withECDSA\":\n kty = \"EC\";\n break;\n default:\n kty = \"RSA\";\n break;\n }\n return kty;\n }\n\n /** Add a new certificate chain to the set of policy management certificates.\n *\n * @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.\n * @param privateKey - Existing attestation private key used to sign the incoming request.\n * @param certificate - Existing attestation certificate used to verify the incoming request.\n * @param options - Options used in the call to the service.\n * @returns An attestation response including a PolicyCertificatesModificationResult\n *\n * @remarks This API is only supported on `isolated` attestation instances.\n *\n * The signing key MUST be one of the existing attestation signing certificates. The\n * new pemCertificate is signed using the signingKey and the service will validate the\n * signature before allowing the addition.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n public async removePolicyManagementCertificate(\n pemCertificate: string,\n privateKey: string,\n certificate: string,\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<PolicyCertificatesModificationResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-removePolicyManagementCertificate\",\n options,\n async (updatedOptions) => {\n if ((!privateKey && certificate) || (privateKey && !certificate)) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (privateKey && certificate) {\n verifyAttestationSigningKey(privateKey, certificate);\n }\n\n const cert = new jsrsasign.X509();\n cert.readCertPEM(pemCertificate);\n const kty = this.keyTypeFromCertificate(cert);\n\n const jwk: JsonWebKey = {\n x5C: [hexToBase64(cert.hex)],\n kty: kty,\n };\n\n const addBody: AttestationCertificateManagementBody = {\n policyCertificate: jwk,\n };\n\n const removeCertToken = AttestationTokenImpl.create({\n body: TypeDeserializer.serialize(\n addBody,\n {\n AttestationCertificateManagementBody: Mappers.AttestationCertificateManagementBody,\n JsonWebKey: Mappers.JsonWebKey,\n },\n Mappers.AttestationCertificateManagementBody,\n ),\n privateKey: privateKey,\n certificate: certificate,\n });\n\n const removeCertificateResult = await this._client.policyCertificates.remove(\n removeCertToken.serialize(),\n updatedOptions,\n );\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(removeCertificateResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyCertificatesModificationResult object.\n const result = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesModificationResult: Mappers.PolicyCertificatesModificationResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesModificationResult\",\n ) as PolicyCertificatesModificationResult;\n\n return createAttestationResponse<PolicyCertificatesModificationResult>(token, result);\n },\n );\n }\n\n private async signingKeys(): Promise<AttestationSigner[]> {\n if (this._signers !== undefined) {\n return this._signers;\n }\n const jwks = await this._client.signingCertificates.get();\n const signers: AttestationSigner[] = new Array();\n jwks.keys?.forEach((element) => {\n signers.push(_attestationSignerFromGenerated(element));\n });\n this._signers = signers;\n return this._signers;\n }\n\n private _client: GeneratedClient;\n private _signers?: AttestationSigner[];\n private _validationOptions?: AttestationTokenValidationOptions;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"attestationAdministrationClient.d.ts","sourceRoot":"","sources":["../../src/attestationAdministrationClient.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,mBAAmB,EACnB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E,OAAO,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAoD7C;;;;;;;OAOG;IACU,+BAA+B,CAC1C,OAAO,GAAE,gEAAqE,GAC7E,OAAO,CAAC,mBAAmB,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAuCpD;;;;;;;;;;;;;;;;;OAiBG;IACU,8BAA8B,CACzC,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,gEAAqE,GAC7E,OAAO,CAAC,mBAAmB,CAAC,oCAAoC,CAAC,CAAC;IAwErE,OAAO,CAAC,sBAAsB;IAmB9B;;;;;;;;;;;;;;;;OAgBG;IACU,iCAAiC,CAC5C,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,gEAAqE,GAC7E,OAAO,CAAC,mBAAmB,CAAC,oCAAoC,CAAC,CAAC;YAwEvD,WAAW;IAazB,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,QAAQ,CAAC,CAAsB;IACvC,OAAO,CAAC,kBAAkB,CAAC,CAAoC;CAChE"}
1
+ {"version":3,"file":"attestationAdministrationClient.d.ts","sourceRoot":"","sources":["../../src/attestationAdministrationClient.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,iCAAiC,EACjC,eAAe,EACf,oCAAoC,EACpC,YAAY,EACb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAcxD;;GAEG;AACH,MAAM,WAAW,sCAAuC,SAAQ,mBAAmB;IACjF;;;OAGG;IACH,iBAAiB,CAAC,EAAE,iCAAiC,CAAC;CACvD;AAED;;GAEG;AACH,MAAM,WAAW,+CAAgD,SAAQ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ErE,OAAO,CAAC,sBAAsB;IAmB9B;;;;;;;;;;;;;;;;OAgBG;IACU,iCAAiC,CAC5C,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,gEAAqE,GAC7E,OAAO,CAAC,mBAAmB,CAAC,oCAAoC,CAAC,CAAC;YAwEvD,WAAW;IAazB,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,QAAQ,CAAC,CAAsB;IACvC,OAAO,CAAC,kBAAkB,CAAC,CAAoC;CAChE"}
@@ -11,7 +11,6 @@ const utf8_js_1 = require("./utils/utf8.js");
11
11
  const storedAttestationPolicy_js_1 = require("./models/storedAttestationPolicy.js");
12
12
  const typeDeserializer_js_1 = require("./utils/typeDeserializer.js");
13
13
  const Mappers = tslib_1.__importStar(require("./generated/models/mappers.js"));
14
- // eslint-disable-next-line @typescript-eslint/triple-slash-reference
15
14
  /// <reference path="../jsrsasign.d.ts"/>
16
15
  const jsrsasign = tslib_1.__importStar(require("jsrsasign"));
17
16
  const helpers_js_1 = require("./utils/helpers.js");
@@ -1 +1 @@
1
- {"version":3,"file":"attestationAdministrationClient.js","sourceRoot":"","sources":["../../src/attestationAdministrationClient.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAElC,uDAAuD;AACvD,uEAAiE;AACjE,2CAAqC;AASrC,6CAAgD;AAUhD,oFAA8E;AAI9E,qEAA+D;AAC/D,+EAAyD;AAEzD,qEAAqE;AACrE,yCAAyC;AACzC,6DAAuC;AACvC,mDAAiD;AACjD,8DAAsE;AACtE,wEAAgF;AAChF,mDAAiE;AACjE,4EAA4E;AAC5E,sEAAoE;AACpE,uDAAuD;AAqDvD;;;;;;;;;;;GAWG;AACH,MAAa,+BAA+B;IAC1C;;;;;;;;;;;;;;;;OAgBG;IAEH,YACE,QAAgB,EAChB,WAA4B,EAC5B,UAAkD,EAAE;QAEpD,IAAI,CAAC,kBAAkB,GA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,mCAAI,IAAI,CAAC,kBAAkB,CACrD,CAAC;YACF,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;gBACpB,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;YACtC,CAAC;YAED,+DAA+D;YAC/D,MAAM,MAAM,GAAG,sCAAgB,CAAC,WAAW,CACzC,KAAK,CAAC,OAAO,EAAE,EACf;gBACE,oCAAoC,EAAE,OAAO,CAAC,oCAAoC;gBAClF,aAAa,EAAE,OAAO,CAAC,aAAa;gBACpC,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,EACD,sCAAsC,CACC,CAAC;YAE1C,OAAO,IAAA,kDAAyB,EAAuC,KAAK,EAAE,MAAM,CAAC,CAAC;QACxF,CAAC,CACF,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,WAAW;;QACvB,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC,QAAQ,CAAC;QACvB,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG,EAAE,CAAC;QAC1D,MAAM,OAAO,GAAwB,IAAI,KAAK,EAAE,CAAC;QACjD,MAAA,IAAI,CAAC,IAAI,0CAAE,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,OAAO,CAAC,IAAI,CAAC,IAAA,sDAA+B,EAAC,OAAO,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CAKF;AA3gBD,0EA2gBC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* eslint-disable @azure/azure-sdk/ts-naming-options */\nimport { GeneratedClient } from \"./generated/generatedClient.js\";\nimport { logger } from \"./logger.js\";\n\nimport type {\n AttestationCertificateManagementBody,\n GeneratedClientOptionalParams,\n JsonWebKey,\n PolicyCertificatesResult,\n} from \"./generated/models/index.js\";\n\nimport { bytesToString } from \"./utils/utf8.js\";\n\nimport type {\n AttestationResponse,\n AttestationSigner,\n AttestationTokenValidationOptions,\n AttestationType,\n PolicyCertificatesModificationResult,\n PolicyResult,\n} from \"./models/index.js\";\nimport { StoredAttestationPolicy } from \"./models/storedAttestationPolicy.js\";\n\nimport type { CommonClientOptions, OperationOptions } from \"@azure/core-client\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { TypeDeserializer } from \"./utils/typeDeserializer.js\";\nimport * as Mappers from \"./generated/models/mappers.js\";\n\n// eslint-disable-next-line @typescript-eslint/triple-slash-reference\n/// <reference path=\"../jsrsasign.d.ts\"/>\nimport * as jsrsasign from \"jsrsasign\";\nimport { hexToBase64 } from \"./utils/helpers.js\";\nimport { _policyResultFromGenerated } from \"./models/policyResult.js\";\nimport { _attestationSignerFromGenerated } from \"./models/attestationSigner.js\";\nimport { verifyAttestationSigningKey } from \"./utils/helpers.js\";\nimport { createAttestationResponse } from \"./models/attestationResponse.js\";\nimport { AttestationTokenImpl } from \"./models/attestationToken.js\";\nimport { tracingClient } from \"./generated/tracing.js\";\n\n/**\n * Attestation Client Construction Options.\n */\nexport interface AttestationAdministrationClientOptions extends CommonClientOptions {\n /**\n * Options to be used globally to validate attestation tokens received from\n * the attestation service.\n */\n validationOptions?: AttestationTokenValidationOptions;\n}\n\n/**\n * Operation options for the Attestation Administration Client operations.\n */\nexport interface AttestationAdministrationClientOperationOptions extends OperationOptions {\n /**\n * Options to be used globally to validate attestation tokens received from\n * the attestation service.\n */\n validationOptions?: AttestationTokenValidationOptions;\n}\n\n/**\n * Operation options for the administration Policy operations.\n */\nexport interface AttestationAdministrationClientPolicyOperationOptions\n extends AttestationAdministrationClientOperationOptions {\n /**\n * Optional Private key used to sign the token sent to the attestation service.\n *\n * Required for Isolated Mode attestation instances.\n */\n privateKey?: string;\n\n /**\n * Optional certificate which can validate the token sent to the attestation service.\n *\n * Required for Isolated Mode attestation instances.\n *\n * If the service instance is in Isolated mode, the certificate *must* be one\n * of the configured policy management certificates.\n */\n certificate?: string;\n}\n\n/**\n * Operation options for the Policy Certificates operations.\n */\nexport interface AttestationAdministrationClientPolicyCertificateOperationOptions\n extends AttestationAdministrationClientOperationOptions {}\n\n/**\n * Attestation Client class.\n *\n * The AttestationClient class enables access to the Attestation related APIs:\n *\n * - getPolicy\n * - setPolicy\n * - resetPolicy\n * - getPolicyManagementCertificates\n * - addPolicyManagementCertificate\n * - removePolicyManagementCertificate\n */\nexport class AttestationAdministrationClient {\n /**\n * Creates an instance of AttestationAdministrationClient.\n *\n * Example usage:\n * ```ts\n * import { AttestationAdministrationClient } from \"@azure/attestation\";\n *\n * const client = new AttestationAdministrationClient(\n * \"<service endpoint>\",\n * new TokenCredential(\"<>\")\n * );\n * ```\n *\n * @param endpoint - The attestation instance endpoint, for example https://mytenant.attest.azure.net.\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the Form Recognizer client.\n */\n\n constructor(\n endpoint: string,\n credentials: TokenCredential,\n options: AttestationAdministrationClientOptions = {},\n ) {\n this._validationOptions = options.validationOptions;\n\n const internalPipelineOptions: GeneratedClientOptionalParams = {\n ...options,\n ...{\n credential: credentials,\n credentialScopes: [\"https://attest.azure.net/.default\"],\n loggingOptions: {\n logger: logger.info,\n allowedHeaderNames: [\"x-ms-request-id\", \"x-ms-maa-service-version\"],\n },\n },\n };\n\n this._client = new GeneratedClient(endpoint, internalPipelineOptions);\n }\n\n /**\n * Retrieves the attestation policy document from the server, and returns it\n * to the caller.\n *\n * @param attestationType - AttestationType for which to retrieve policy.\n * @param options - Pipeline and client options for the `getPolicy` call.\n * @returns `AttestationResponse<string>` - the `value` property is the\n * attestation policy, the `token` property will be the actual token\n * returned by the attestation service.\n */\n public async getPolicy(\n attestationType: AttestationType,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<string>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-getPolicy\",\n options,\n async (updatedOptions) => {\n const getPolicyResult = await this._client.policy.get(attestationType, updatedOptions);\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(getPolicyResult.token);\n\n // Validate the token returned from the service.\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n if (!policyResult.policy) {\n throw Error(\"Server returned an invalid getPolicy response!\");\n }\n\n const policyToken = new AttestationTokenImpl(policyResult.policy);\n\n const storedPolicy = StoredAttestationPolicy.deserialize(policyToken.getBody());\n\n // Finally, retrieve the stored attestationPolicy value and return that\n // as the AttestationResponse to the caller.\n return createAttestationResponse<string>(\n token,\n bytesToString(storedPolicy.attestationPolicy),\n );\n },\n );\n }\n\n /**\n * Sets the attestation policy for the specified {@link attestationType}.\n *\n * @param attestationType - Attestation Type for which to set policy.\n * @param newPolicyDocument - Policy document to be set.\n * @param options - call options.\n * @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.\n * Clients can use the PolicyResult to validate that the policy was actually\n * set by the attestation service.\n *\n * @remarks\n *\n * Please note that if the attestation service instance is running in \"Isolated\"\n * mode, the {@link signingKey} must be one of the signing keys configured for the\n * service instance.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n public async setPolicy(\n attestationType: AttestationType,\n newPolicyDocument: string,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<PolicyResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-setPolicy\",\n options,\n async (updatedOptions) => {\n if (\n (!options.privateKey && options.certificate) ||\n (options.privateKey && !options.certificate)\n ) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (options.privateKey && options.certificate) {\n verifyAttestationSigningKey(options.privateKey, options.certificate);\n }\n\n const storedAttestationPolicy = new StoredAttestationPolicy(newPolicyDocument).serialize();\n const setPolicyToken = AttestationTokenImpl.create({\n body: storedAttestationPolicy,\n ...options,\n });\n\n const setPolicyResult = await this._client.policy.set(\n attestationType,\n setPolicyToken.serialize(),\n updatedOptions,\n );\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(setPolicyResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n return createAttestationResponse<PolicyResult>(token, policyResult);\n },\n );\n }\n\n /**\n * Resets the attestation policy for the specified {@link attestationType} to\n * the default value.\n *\n * @param attestationType - Attestation Type for which to set policy.\n * @param options - call options.\n * @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.\n * Clients can use the PolicyResult to validate that the policy was actually\n * reset by the attestation service.\n *\n * @remarks\n *\n * Please note that if the attestation service instance is running in \"Isolated\"\n * mode, the {@link signingKey} must be one of the signing keys configured for the\n * service instance.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n\n public async resetPolicy(\n attestationType: AttestationType,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<PolicyResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-setPolicy\",\n options,\n async (updatedOptions) => {\n if (\n (!options.privateKey && options.certificate) ||\n (options.privateKey && !options.certificate)\n ) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (options.privateKey && options.certificate) {\n verifyAttestationSigningKey(options.privateKey, options.certificate);\n }\n\n const resetPolicyToken = AttestationTokenImpl.create({\n privateKey: options.privateKey,\n certificate: options.certificate,\n });\n\n const resetPolicyResult = await this._client.policy.reset(\n attestationType,\n resetPolicyToken.serialize(),\n updatedOptions,\n );\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(resetPolicyResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n return createAttestationResponse<PolicyResult>(token, policyResult);\n },\n );\n }\n\n /** Returns the set of policy management certificates for this attestation instance.\n *\n * @remarks If the attestation instance is not in `Isolated` mode, this list will\n * always be empty.\n *\n * @param options - Options for the call to the attestation service.\n * @returns AttestationResponse wrapping a list of Attestation Signers.\n */\n public async getPolicyManagementCertificates(\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<AttestationSigner[]>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-getPolicyManagementCertificates\",\n options,\n async (updatedOptions) => {\n const getCertificatesResult = await this._client.policyCertificates.get(updatedOptions);\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(getCertificatesResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const jwks = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesResult: Mappers.PolicyCertificatesResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesResult\",\n ) as PolicyCertificatesResult;\n\n const policyCertificates = new Array<AttestationSigner>();\n jwks.policyCertificates.keys.forEach((jwk) => {\n policyCertificates.push(_attestationSignerFromGenerated(jwk));\n });\n\n return createAttestationResponse<AttestationSigner[]>(token, policyCertificates);\n },\n );\n }\n\n /** Add a new certificate chain to the set of policy management certificates.\n *\n * @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.\n * @param privateKey - Existing attestation private key used to sign the incoming request.\n * @param certificate - Existing attestation certificate used to verify the incoming request.\n * @param options - Options used in the call to the service.\n * @returns An attestation response including a PolicyCertificatesModificationResult\n *\n * @remarks This API is only supported on `isolated` attestation instances.\n *\n * The signing key MUST be one of the existing attestation signing certificates. The\n * new pemCertificate is signed using the signingKey and the service will validate the\n * signature before allowing the addition.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n *\n */\n public async addPolicyManagementCertificate(\n pemCertificate: string,\n privateKey: string,\n certificate: string,\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<PolicyCertificatesModificationResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-addPolicyManagementCertificate\",\n options,\n async (updatedOptions) => {\n if ((!privateKey && certificate) || (privateKey && !certificate)) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (privateKey && certificate) {\n verifyAttestationSigningKey(privateKey, certificate);\n }\n\n const cert = new jsrsasign.X509();\n cert.readCertPEM(pemCertificate);\n const kty = this.keyTypeFromCertificate(cert);\n\n const jwk: JsonWebKey = {\n x5C: [hexToBase64(cert.hex)],\n kty: kty,\n };\n\n const addBody: AttestationCertificateManagementBody = {\n policyCertificate: jwk,\n };\n\n const addCertToken = AttestationTokenImpl.create({\n body: TypeDeserializer.serialize(\n addBody,\n {\n AttestationCertificateManagementBody: Mappers.AttestationCertificateManagementBody,\n JsonWebKey: Mappers.JsonWebKey,\n },\n Mappers.AttestationCertificateManagementBody,\n ),\n privateKey: privateKey,\n certificate: certificate,\n });\n\n const addCertificateResult = await this._client.policyCertificates.add(\n addCertToken.serialize(),\n updatedOptions,\n );\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(addCertificateResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyCertificatesModificationResult object.\n const result = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesModificationResult: Mappers.PolicyCertificatesModificationResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesModificationResult\",\n ) as PolicyCertificatesModificationResult;\n\n return createAttestationResponse<PolicyCertificatesModificationResult>(token, result);\n },\n );\n }\n\n private keyTypeFromCertificate(cert: any): string {\n let kty: string;\n switch (cert.getSignatureAlgorithmName()) {\n case \"SHA256withRSA\":\n case \"SHA384withRSA\":\n case \"SHA512withRSA\":\n kty = \"RSA\";\n break;\n case \"SHA256withECDSA\":\n case \"SHA384withECDSA\":\n kty = \"EC\";\n break;\n default:\n kty = \"RSA\";\n break;\n }\n return kty;\n }\n\n /** Add a new certificate chain to the set of policy management certificates.\n *\n * @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.\n * @param privateKey - Existing attestation private key used to sign the incoming request.\n * @param certificate - Existing attestation certificate used to verify the incoming request.\n * @param options - Options used in the call to the service.\n * @returns An attestation response including a PolicyCertificatesModificationResult\n *\n * @remarks This API is only supported on `isolated` attestation instances.\n *\n * The signing key MUST be one of the existing attestation signing certificates. The\n * new pemCertificate is signed using the signingKey and the service will validate the\n * signature before allowing the addition.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n public async removePolicyManagementCertificate(\n pemCertificate: string,\n privateKey: string,\n certificate: string,\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<PolicyCertificatesModificationResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-removePolicyManagementCertificate\",\n options,\n async (updatedOptions) => {\n if ((!privateKey && certificate) || (privateKey && !certificate)) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (privateKey && certificate) {\n verifyAttestationSigningKey(privateKey, certificate);\n }\n\n const cert = new jsrsasign.X509();\n cert.readCertPEM(pemCertificate);\n const kty = this.keyTypeFromCertificate(cert);\n\n const jwk: JsonWebKey = {\n x5C: [hexToBase64(cert.hex)],\n kty: kty,\n };\n\n const addBody: AttestationCertificateManagementBody = {\n policyCertificate: jwk,\n };\n\n const removeCertToken = AttestationTokenImpl.create({\n body: TypeDeserializer.serialize(\n addBody,\n {\n AttestationCertificateManagementBody: Mappers.AttestationCertificateManagementBody,\n JsonWebKey: Mappers.JsonWebKey,\n },\n Mappers.AttestationCertificateManagementBody,\n ),\n privateKey: privateKey,\n certificate: certificate,\n });\n\n const removeCertificateResult = await this._client.policyCertificates.remove(\n removeCertToken.serialize(),\n updatedOptions,\n );\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(removeCertificateResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyCertificatesModificationResult object.\n const result = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesModificationResult: Mappers.PolicyCertificatesModificationResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesModificationResult\",\n ) as PolicyCertificatesModificationResult;\n\n return createAttestationResponse<PolicyCertificatesModificationResult>(token, result);\n },\n );\n }\n\n private async signingKeys(): Promise<AttestationSigner[]> {\n if (this._signers !== undefined) {\n return this._signers;\n }\n const jwks = await this._client.signingCertificates.get();\n const signers: AttestationSigner[] = new Array();\n jwks.keys?.forEach((element) => {\n signers.push(_attestationSignerFromGenerated(element));\n });\n this._signers = signers;\n return this._signers;\n }\n\n private _client: GeneratedClient;\n private _signers?: AttestationSigner[];\n private _validationOptions?: AttestationTokenValidationOptions;\n}\n"]}
1
+ {"version":3,"file":"attestationAdministrationClient.js","sourceRoot":"","sources":["../../src/attestationAdministrationClient.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAElC,uDAAuD;AACvD,uEAAiE;AACjE,2CAAqC;AASrC,6CAAgD;AAUhD,oFAA8E;AAI9E,qEAA+D;AAC/D,+EAAyD;AAEzD,yCAAyC;AACzC,6DAAuC;AACvC,mDAAiD;AACjD,8DAAsE;AACtE,wEAAgF;AAChF,mDAAiE;AACjE,4EAA4E;AAC5E,sEAAoE;AACpE,uDAAuD;AAqDvD;;;;;;;;;;;GAWG;AACH,MAAa,+BAA+B;IAC1C;;;;;;;;;;;;;;;;OAgBG;IAEH,YACE,QAAgB,EAChB,WAA4B,EAC5B,UAAkD,EAAE;QAEpD,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC;QAEpD,MAAM,uBAAuB,mCACxB,OAAO,GACP;YACD,UAAU,EAAE,WAAW;YACvB,gBAAgB,EAAE,CAAC,mCAAmC,CAAC;YACvD,cAAc,EAAE;gBACd,MAAM,EAAE,kBAAM,CAAC,IAAI;gBACnB,kBAAkB,EAAE,CAAC,iBAAiB,EAAE,0BAA0B,CAAC;aACpE;SACF,CACF,CAAC;QAEF,IAAI,C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oC,EAAE,OAAO,CAAC,oCAAoC;gBAClF,aAAa,EAAE,OAAO,CAAC,aAAa;gBACpC,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,EACD,sCAAsC,CACC,CAAC;YAE1C,OAAO,IAAA,kDAAyB,EAAuC,KAAK,EAAE,MAAM,CAAC,CAAC;QACxF,CAAC,CACF,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,WAAW;;QACvB,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC,QAAQ,CAAC;QACvB,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG,EAAE,CAAC;QAC1D,MAAM,OAAO,GAAwB,IAAI,KAAK,EAAE,CAAC;QACjD,MAAA,IAAI,CAAC,IAAI,0CAAE,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,OAAO,CAAC,IAAI,CAAC,IAAA,sDAA+B,EAAC,OAAO,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CAKF;AA3gBD,0EA2gBC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* eslint-disable @azure/azure-sdk/ts-naming-options */\nimport { GeneratedClient } from \"./generated/generatedClient.js\";\nimport { logger } from \"./logger.js\";\n\nimport type {\n AttestationCertificateManagementBody,\n GeneratedClientOptionalParams,\n JsonWebKey,\n PolicyCertificatesResult,\n} from \"./generated/models/index.js\";\n\nimport { bytesToString } from \"./utils/utf8.js\";\n\nimport type {\n AttestationResponse,\n AttestationSigner,\n AttestationTokenValidationOptions,\n AttestationType,\n PolicyCertificatesModificationResult,\n PolicyResult,\n} from \"./models/index.js\";\nimport { StoredAttestationPolicy } from \"./models/storedAttestationPolicy.js\";\n\nimport type { CommonClientOptions, OperationOptions } from \"@azure/core-client\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { TypeDeserializer } from \"./utils/typeDeserializer.js\";\nimport * as Mappers from \"./generated/models/mappers.js\";\n\n/// <reference path=\"../jsrsasign.d.ts\"/>\nimport * as jsrsasign from \"jsrsasign\";\nimport { hexToBase64 } from \"./utils/helpers.js\";\nimport { _policyResultFromGenerated } from \"./models/policyResult.js\";\nimport { _attestationSignerFromGenerated } from \"./models/attestationSigner.js\";\nimport { verifyAttestationSigningKey } from \"./utils/helpers.js\";\nimport { createAttestationResponse } from \"./models/attestationResponse.js\";\nimport { AttestationTokenImpl } from \"./models/attestationToken.js\";\nimport { tracingClient } from \"./generated/tracing.js\";\n\n/**\n * Attestation Client Construction Options.\n */\nexport interface AttestationAdministrationClientOptions extends CommonClientOptions {\n /**\n * Options to be used globally to validate attestation tokens received from\n * the attestation service.\n */\n validationOptions?: AttestationTokenValidationOptions;\n}\n\n/**\n * Operation options for the Attestation Administration Client operations.\n */\nexport interface AttestationAdministrationClientOperationOptions extends OperationOptions {\n /**\n * Options to be used globally to validate attestation tokens received from\n * the attestation service.\n */\n validationOptions?: AttestationTokenValidationOptions;\n}\n\n/**\n * Operation options for the administration Policy operations.\n */\nexport interface AttestationAdministrationClientPolicyOperationOptions\n extends AttestationAdministrationClientOperationOptions {\n /**\n * Optional Private key used to sign the token sent to the attestation service.\n *\n * Required for Isolated Mode attestation instances.\n */\n privateKey?: string;\n\n /**\n * Optional certificate which can validate the token sent to the attestation service.\n *\n * Required for Isolated Mode attestation instances.\n *\n * If the service instance is in Isolated mode, the certificate *must* be one\n * of the configured policy management certificates.\n */\n certificate?: string;\n}\n\n/**\n * Operation options for the Policy Certificates operations.\n */\nexport interface AttestationAdministrationClientPolicyCertificateOperationOptions\n extends AttestationAdministrationClientOperationOptions {}\n\n/**\n * Attestation Client class.\n *\n * The AttestationClient class enables access to the Attestation related APIs:\n *\n * - getPolicy\n * - setPolicy\n * - resetPolicy\n * - getPolicyManagementCertificates\n * - addPolicyManagementCertificate\n * - removePolicyManagementCertificate\n */\nexport class AttestationAdministrationClient {\n /**\n * Creates an instance of AttestationAdministrationClient.\n *\n * Example usage:\n * ```ts\n * import { AttestationAdministrationClient } from \"@azure/attestation\";\n *\n * const client = new AttestationAdministrationClient(\n * \"<service endpoint>\",\n * new TokenCredential(\"<>\")\n * );\n * ```\n *\n * @param endpoint - The attestation instance endpoint, for example https://mytenant.attest.azure.net.\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the Form Recognizer client.\n */\n\n constructor(\n endpoint: string,\n credentials: TokenCredential,\n options: AttestationAdministrationClientOptions = {},\n ) {\n this._validationOptions = options.validationOptions;\n\n const internalPipelineOptions: GeneratedClientOptionalParams = {\n ...options,\n ...{\n credential: credentials,\n credentialScopes: [\"https://attest.azure.net/.default\"],\n loggingOptions: {\n logger: logger.info,\n allowedHeaderNames: [\"x-ms-request-id\", \"x-ms-maa-service-version\"],\n },\n },\n };\n\n this._client = new GeneratedClient(endpoint, internalPipelineOptions);\n }\n\n /**\n * Retrieves the attestation policy document from the server, and returns it\n * to the caller.\n *\n * @param attestationType - AttestationType for which to retrieve policy.\n * @param options - Pipeline and client options for the `getPolicy` call.\n * @returns `AttestationResponse<string>` - the `value` property is the\n * attestation policy, the `token` property will be the actual token\n * returned by the attestation service.\n */\n public async getPolicy(\n attestationType: AttestationType,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<string>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-getPolicy\",\n options,\n async (updatedOptions) => {\n const getPolicyResult = await this._client.policy.get(attestationType, updatedOptions);\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(getPolicyResult.token);\n\n // Validate the token returned from the service.\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n if (!policyResult.policy) {\n throw Error(\"Server returned an invalid getPolicy response!\");\n }\n\n const policyToken = new AttestationTokenImpl(policyResult.policy);\n\n const storedPolicy = StoredAttestationPolicy.deserialize(policyToken.getBody());\n\n // Finally, retrieve the stored attestationPolicy value and return that\n // as the AttestationResponse to the caller.\n return createAttestationResponse<string>(\n token,\n bytesToString(storedPolicy.attestationPolicy),\n );\n },\n );\n }\n\n /**\n * Sets the attestation policy for the specified {@link attestationType}.\n *\n * @param attestationType - Attestation Type for which to set policy.\n * @param newPolicyDocument - Policy document to be set.\n * @param options - call options.\n * @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.\n * Clients can use the PolicyResult to validate that the policy was actually\n * set by the attestation service.\n *\n * @remarks\n *\n * Please note that if the attestation service instance is running in \"Isolated\"\n * mode, the {@link signingKey} must be one of the signing keys configured for the\n * service instance.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n public async setPolicy(\n attestationType: AttestationType,\n newPolicyDocument: string,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<PolicyResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-setPolicy\",\n options,\n async (updatedOptions) => {\n if (\n (!options.privateKey && options.certificate) ||\n (options.privateKey && !options.certificate)\n ) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (options.privateKey && options.certificate) {\n verifyAttestationSigningKey(options.privateKey, options.certificate);\n }\n\n const storedAttestationPolicy = new StoredAttestationPolicy(newPolicyDocument).serialize();\n const setPolicyToken = AttestationTokenImpl.create({\n body: storedAttestationPolicy,\n ...options,\n });\n\n const setPolicyResult = await this._client.policy.set(\n attestationType,\n setPolicyToken.serialize(),\n updatedOptions,\n );\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(setPolicyResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n return createAttestationResponse<PolicyResult>(token, policyResult);\n },\n );\n }\n\n /**\n * Resets the attestation policy for the specified {@link attestationType} to\n * the default value.\n *\n * @param attestationType - Attestation Type for which to set policy.\n * @param options - call options.\n * @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.\n * Clients can use the PolicyResult to validate that the policy was actually\n * reset by the attestation service.\n *\n * @remarks\n *\n * Please note that if the attestation service instance is running in \"Isolated\"\n * mode, the {@link signingKey} must be one of the signing keys configured for the\n * service instance.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n\n public async resetPolicy(\n attestationType: AttestationType,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<PolicyResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-setPolicy\",\n options,\n async (updatedOptions) => {\n if (\n (!options.privateKey && options.certificate) ||\n (options.privateKey && !options.certificate)\n ) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (options.privateKey && options.certificate) {\n verifyAttestationSigningKey(options.privateKey, options.certificate);\n }\n\n const resetPolicyToken = AttestationTokenImpl.create({\n privateKey: options.privateKey,\n certificate: options.certificate,\n });\n\n const resetPolicyResult = await this._client.policy.reset(\n attestationType,\n resetPolicyToken.serialize(),\n updatedOptions,\n );\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(resetPolicyResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n return createAttestationResponse<PolicyResult>(token, policyResult);\n },\n );\n }\n\n /** Returns the set of policy management certificates for this attestation instance.\n *\n * @remarks If the attestation instance is not in `Isolated` mode, this list will\n * always be empty.\n *\n * @param options - Options for the call to the attestation service.\n * @returns AttestationResponse wrapping a list of Attestation Signers.\n */\n public async getPolicyManagementCertificates(\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<AttestationSigner[]>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-getPolicyManagementCertificates\",\n options,\n async (updatedOptions) => {\n const getCertificatesResult = await this._client.policyCertificates.get(updatedOptions);\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(getCertificatesResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const jwks = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesResult: Mappers.PolicyCertificatesResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesResult\",\n ) as PolicyCertificatesResult;\n\n const policyCertificates = new Array<AttestationSigner>();\n jwks.policyCertificates.keys.forEach((jwk) => {\n policyCertificates.push(_attestationSignerFromGenerated(jwk));\n });\n\n return createAttestationResponse<AttestationSigner[]>(token, policyCertificates);\n },\n );\n }\n\n /** Add a new certificate chain to the set of policy management certificates.\n *\n * @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.\n * @param privateKey - Existing attestation private key used to sign the incoming request.\n * @param certificate - Existing attestation certificate used to verify the incoming request.\n * @param options - Options used in the call to the service.\n * @returns An attestation response including a PolicyCertificatesModificationResult\n *\n * @remarks This API is only supported on `isolated` attestation instances.\n *\n * The signing key MUST be one of the existing attestation signing certificates. The\n * new pemCertificate is signed using the signingKey and the service will validate the\n * signature before allowing the addition.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n *\n */\n public async addPolicyManagementCertificate(\n pemCertificate: string,\n privateKey: string,\n certificate: string,\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<PolicyCertificatesModificationResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-addPolicyManagementCertificate\",\n options,\n async (updatedOptions) => {\n if ((!privateKey && certificate) || (privateKey && !certificate)) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (privateKey && certificate) {\n verifyAttestationSigningKey(privateKey, certificate);\n }\n\n const cert = new jsrsasign.X509();\n cert.readCertPEM(pemCertificate);\n const kty = this.keyTypeFromCertificate(cert);\n\n const jwk: JsonWebKey = {\n x5C: [hexToBase64(cert.hex)],\n kty: kty,\n };\n\n const addBody: AttestationCertificateManagementBody = {\n policyCertificate: jwk,\n };\n\n const addCertToken = AttestationTokenImpl.create({\n body: TypeDeserializer.serialize(\n addBody,\n {\n AttestationCertificateManagementBody: Mappers.AttestationCertificateManagementBody,\n JsonWebKey: Mappers.JsonWebKey,\n },\n Mappers.AttestationCertificateManagementBody,\n ),\n privateKey: privateKey,\n certificate: certificate,\n });\n\n const addCertificateResult = await this._client.policyCertificates.add(\n addCertToken.serialize(),\n updatedOptions,\n );\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(addCertificateResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyCertificatesModificationResult object.\n const result = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesModificationResult: Mappers.PolicyCertificatesModificationResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesModificationResult\",\n ) as PolicyCertificatesModificationResult;\n\n return createAttestationResponse<PolicyCertificatesModificationResult>(token, result);\n },\n );\n }\n\n private keyTypeFromCertificate(cert: any): string {\n let kty: string;\n switch (cert.getSignatureAlgorithmName()) {\n case \"SHA256withRSA\":\n case \"SHA384withRSA\":\n case \"SHA512withRSA\":\n kty = \"RSA\";\n break;\n case \"SHA256withECDSA\":\n case \"SHA384withECDSA\":\n kty = \"EC\";\n break;\n default:\n kty = \"RSA\";\n break;\n }\n return kty;\n }\n\n /** Add a new certificate chain to the set of policy management certificates.\n *\n * @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.\n * @param privateKey - Existing attestation private key used to sign the incoming request.\n * @param certificate - Existing attestation certificate used to verify the incoming request.\n * @param options - Options used in the call to the service.\n * @returns An attestation response including a PolicyCertificatesModificationResult\n *\n * @remarks This API is only supported on `isolated` attestation instances.\n *\n * The signing key MUST be one of the existing attestation signing certificates. The\n * new pemCertificate is signed using the signingKey and the service will validate the\n * signature before allowing the addition.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n public async removePolicyManagementCertificate(\n pemCertificate: string,\n privateKey: string,\n certificate: string,\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<PolicyCertificatesModificationResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-removePolicyManagementCertificate\",\n options,\n async (updatedOptions) => {\n if ((!privateKey && certificate) || (privateKey && !certificate)) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (privateKey && certificate) {\n verifyAttestationSigningKey(privateKey, certificate);\n }\n\n const cert = new jsrsasign.X509();\n cert.readCertPEM(pemCertificate);\n const kty = this.keyTypeFromCertificate(cert);\n\n const jwk: JsonWebKey = {\n x5C: [hexToBase64(cert.hex)],\n kty: kty,\n };\n\n const addBody: AttestationCertificateManagementBody = {\n policyCertificate: jwk,\n };\n\n const removeCertToken = AttestationTokenImpl.create({\n body: TypeDeserializer.serialize(\n addBody,\n {\n AttestationCertificateManagementBody: Mappers.AttestationCertificateManagementBody,\n JsonWebKey: Mappers.JsonWebKey,\n },\n Mappers.AttestationCertificateManagementBody,\n ),\n privateKey: privateKey,\n certificate: certificate,\n });\n\n const removeCertificateResult = await this._client.policyCertificates.remove(\n removeCertToken.serialize(),\n updatedOptions,\n );\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(removeCertificateResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyCertificatesModificationResult object.\n const result = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesModificationResult: Mappers.PolicyCertificatesModificationResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesModificationResult\",\n ) as PolicyCertificatesModificationResult;\n\n return createAttestationResponse<PolicyCertificatesModificationResult>(token, result);\n },\n );\n }\n\n private async signingKeys(): Promise<AttestationSigner[]> {\n if (this._signers !== undefined) {\n return this._signers;\n }\n const jwks = await this._client.signingCertificates.get();\n const signers: AttestationSigner[] = new Array();\n jwks.keys?.forEach((element) => {\n signers.push(_attestationSignerFromGenerated(element));\n });\n this._signers = signers;\n return this._signers;\n }\n\n private _client: GeneratedClient;\n private _signers?: AttestationSigner[];\n private _validationOptions?: AttestationTokenValidationOptions;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"attestationAdministrationClient.d.ts","sourceRoot":"","sources":["../../src/attestationAdministrationClient.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,iCAAiC,EACjC,eAAe,EACf,oCAAoC,EACpC,YAAY,EACb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAexD;;GAEG;AACH,MAAM,WAAW,sCAAuC,SAAQ,mBAAmB;IACjF;;;OAGG;IACH,iBAAiB,CAAC,EAAE,iCAAiC,CAAC;CACvD;AAED;;GAEG;AACH,MAAM,WAAW,+CAAgD,SAAQ,gBAAgB;IACvF;;;OAGG;IACH,iBAAiB,CAAC,EAAE,iCAAiC,CAAC;CACvD;AAED;;GAEG;AACH,MAAM,WAAW,qDACf,SAAQ,+CAA+C;IACvD;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,gEACf,SAAQ,+CAA+C;CAAG;AAE5D;;;;;;;;;;;GAWG;AACH,qBAAa,+BAA+B;IAC1C;;;;;;;;;;;;;;;;OAgBG;gBAGD,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,eAAe,EAC5B,OAAO,GAAE,sCAA2C;IAmBtD;;;;;;;;;OASG;IACU,SAAS,CACpB,eAAe,EAAE,eAAe,EAChC,OAAO,GAAE,qDAA0D,GAClE,OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IA6CvC;;;;;;;;;;;;;;;;;;OAkBG;IACU,SAAS,CACpB,eAAe,EAAE,eAAe,EAChC,iBAAiB,EAAE,MAAM,EACzB,OAAO,GAAE,qDAA0D,GAClE,OAAO,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAqD7C;;;;;;;;;;;;;;;;;;OAkBG;IAEU,WAAW,CACtB,eAAe,EAAE,eAAe,EAChC,OAAO,GAAE,qDAA0D,GAClE,OAAO,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAoD7C;;;;;;;OAOG;IACU,+BAA+B,CAC1C,OAAO,GAAE,gEAAqE,GAC7E,OAAO,CAAC,mBAAmB,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAuCpD;;;;;;;;;;;;;;;;;OAiBG;IACU,8BAA8B,CACzC,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,gEAAqE,GAC7E,OAAO,CAAC,mBAAmB,CAAC,oCAAoC,CAAC,CAAC;IAwErE,OAAO,CAAC,sBAAsB;IAmB9B;;;;;;;;;;;;;;;;OAgBG;IACU,iCAAiC,CAC5C,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,gEAAqE,GAC7E,OAAO,CAAC,mBAAmB,CAAC,oCAAoC,CAAC,CAAC;YAwEvD,WAAW;IAazB,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,QAAQ,CAAC,CAAsB;IACvC,OAAO,CAAC,kBAAkB,CAAC,CAAoC;CAChE"}
1
+ {"version":3,"file":"attestationAdministrationClient.d.ts","sourceRoot":"","sources":["../../src/attestationAdministrationClient.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,iCAAiC,EACjC,eAAe,EACf,oCAAoC,EACpC,YAAY,EACb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,mBA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E,OAAO,CAAC,mBAAmB,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAuCpD;;;;;;;;;;;;;;;;;OAiBG;IACU,8BAA8B,CACzC,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,gEAAqE,GAC7E,OAAO,CAAC,mBAAmB,CAAC,oCAAoC,CAAC,CAAC;IAwErE,OAAO,CAAC,sBAAsB;IAmB9B;;;;;;;;;;;;;;;;OAgBG;IACU,iCAAiC,CAC5C,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,gEAAqE,GAC7E,OAAO,CAAC,mBAAmB,CAAC,oCAAoC,CAAC,CAAC;YAwEvD,WAAW;IAazB,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,QAAQ,CAAC,CAAsB;IACvC,OAAO,CAAC,kBAAkB,CAAC,CAAoC;CAChE"}
@@ -7,7 +7,6 @@ import { bytesToString } from "./utils/utf8.js";
7
7
  import { StoredAttestationPolicy } from "./models/storedAttestationPolicy.js";
8
8
  import { TypeDeserializer } from "./utils/typeDeserializer.js";
9
9
  import * as Mappers from "./generated/models/mappers.js";
10
- // eslint-disable-next-line @typescript-eslint/triple-slash-reference
11
10
  /// <reference path="../jsrsasign.d.ts"/>
12
11
  import * as jsrsasign from "jsrsasign";
13
12
  import { hexToBase64 } from "./utils/helpers.js";
@@ -1 +1 @@
1
- {"version":3,"file":"attestationAdministrationClient.js","sourceRoot":"","sources":["../../src/attestationAdministrationClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,uDAAuD;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AASrC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAUhD,OAAO,EAAE,uBAAuB,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AAC,QAAQ,CAAC;QACvB,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG,EAAE,CAAC;QAC1D,MAAM,OAAO,GAAwB,IAAI,KAAK,EAAE,CAAC;QACjD,MAAA,IAAI,CAAC,IAAI,0CAAE,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,OAAO,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CAKF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* eslint-disable @azure/azure-sdk/ts-naming-options */\nimport { GeneratedClient } from \"./generated/generatedClient.js\";\nimport { logger } from \"./logger.js\";\n\nimport type {\n AttestationCertificateManagementBody,\n GeneratedClientOptionalParams,\n JsonWebKey,\n PolicyCertificatesResult,\n} from \"./generated/models/index.js\";\n\nimport { bytesToString } from \"./utils/utf8.js\";\n\nimport type {\n AttestationResponse,\n AttestationSigner,\n AttestationTokenValidationOptions,\n AttestationType,\n PolicyCertificatesModificationResult,\n PolicyResult,\n} from \"./models/index.js\";\nimport { StoredAttestationPolicy } from \"./models/storedAttestationPolicy.js\";\n\nimport type { CommonClientOptions, OperationOptions } from \"@azure/core-client\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { TypeDeserializer } from \"./utils/typeDeserializer.js\";\nimport * as Mappers from \"./generated/models/mappers.js\";\n\n// eslint-disable-next-line @typescript-eslint/triple-slash-reference\n/// <reference path=\"../jsrsasign.d.ts\"/>\nimport * as jsrsasign from \"jsrsasign\";\nimport { hexToBase64 } from \"./utils/helpers.js\";\nimport { _policyResultFromGenerated } from \"./models/policyResult.js\";\nimport { _attestationSignerFromGenerated } from \"./models/attestationSigner.js\";\nimport { verifyAttestationSigningKey } from \"./utils/helpers.js\";\nimport { createAttestationResponse } from \"./models/attestationResponse.js\";\nimport { AttestationTokenImpl } from \"./models/attestationToken.js\";\nimport { tracingClient } from \"./generated/tracing.js\";\n\n/**\n * Attestation Client Construction Options.\n */\nexport interface AttestationAdministrationClientOptions extends CommonClientOptions {\n /**\n * Options to be used globally to validate attestation tokens received from\n * the attestation service.\n */\n validationOptions?: AttestationTokenValidationOptions;\n}\n\n/**\n * Operation options for the Attestation Administration Client operations.\n */\nexport interface AttestationAdministrationClientOperationOptions extends OperationOptions {\n /**\n * Options to be used globally to validate attestation tokens received from\n * the attestation service.\n */\n validationOptions?: AttestationTokenValidationOptions;\n}\n\n/**\n * Operation options for the administration Policy operations.\n */\nexport interface AttestationAdministrationClientPolicyOperationOptions\n extends AttestationAdministrationClientOperationOptions {\n /**\n * Optional Private key used to sign the token sent to the attestation service.\n *\n * Required for Isolated Mode attestation instances.\n */\n privateKey?: string;\n\n /**\n * Optional certificate which can validate the token sent to the attestation service.\n *\n * Required for Isolated Mode attestation instances.\n *\n * If the service instance is in Isolated mode, the certificate *must* be one\n * of the configured policy management certificates.\n */\n certificate?: string;\n}\n\n/**\n * Operation options for the Policy Certificates operations.\n */\nexport interface AttestationAdministrationClientPolicyCertificateOperationOptions\n extends AttestationAdministrationClientOperationOptions {}\n\n/**\n * Attestation Client class.\n *\n * The AttestationClient class enables access to the Attestation related APIs:\n *\n * - getPolicy\n * - setPolicy\n * - resetPolicy\n * - getPolicyManagementCertificates\n * - addPolicyManagementCertificate\n * - removePolicyManagementCertificate\n */\nexport class AttestationAdministrationClient {\n /**\n * Creates an instance of AttestationAdministrationClient.\n *\n * Example usage:\n * ```ts\n * import { AttestationAdministrationClient } from \"@azure/attestation\";\n *\n * const client = new AttestationAdministrationClient(\n * \"<service endpoint>\",\n * new TokenCredential(\"<>\")\n * );\n * ```\n *\n * @param endpoint - The attestation instance endpoint, for example https://mytenant.attest.azure.net.\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the Form Recognizer client.\n */\n\n constructor(\n endpoint: string,\n credentials: TokenCredential,\n options: AttestationAdministrationClientOptions = {},\n ) {\n this._validationOptions = options.validationOptions;\n\n const internalPipelineOptions: GeneratedClientOptionalParams = {\n ...options,\n ...{\n credential: credentials,\n credentialScopes: [\"https://attest.azure.net/.default\"],\n loggingOptions: {\n logger: logger.info,\n allowedHeaderNames: [\"x-ms-request-id\", \"x-ms-maa-service-version\"],\n },\n },\n };\n\n this._client = new GeneratedClient(endpoint, internalPipelineOptions);\n }\n\n /**\n * Retrieves the attestation policy document from the server, and returns it\n * to the caller.\n *\n * @param attestationType - AttestationType for which to retrieve policy.\n * @param options - Pipeline and client options for the `getPolicy` call.\n * @returns `AttestationResponse<string>` - the `value` property is the\n * attestation policy, the `token` property will be the actual token\n * returned by the attestation service.\n */\n public async getPolicy(\n attestationType: AttestationType,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<string>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-getPolicy\",\n options,\n async (updatedOptions) => {\n const getPolicyResult = await this._client.policy.get(attestationType, updatedOptions);\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(getPolicyResult.token);\n\n // Validate the token returned from the service.\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n if (!policyResult.policy) {\n throw Error(\"Server returned an invalid getPolicy response!\");\n }\n\n const policyToken = new AttestationTokenImpl(policyResult.policy);\n\n const storedPolicy = StoredAttestationPolicy.deserialize(policyToken.getBody());\n\n // Finally, retrieve the stored attestationPolicy value and return that\n // as the AttestationResponse to the caller.\n return createAttestationResponse<string>(\n token,\n bytesToString(storedPolicy.attestationPolicy),\n );\n },\n );\n }\n\n /**\n * Sets the attestation policy for the specified {@link attestationType}.\n *\n * @param attestationType - Attestation Type for which to set policy.\n * @param newPolicyDocument - Policy document to be set.\n * @param options - call options.\n * @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.\n * Clients can use the PolicyResult to validate that the policy was actually\n * set by the attestation service.\n *\n * @remarks\n *\n * Please note that if the attestation service instance is running in \"Isolated\"\n * mode, the {@link signingKey} must be one of the signing keys configured for the\n * service instance.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n public async setPolicy(\n attestationType: AttestationType,\n newPolicyDocument: string,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<PolicyResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-setPolicy\",\n options,\n async (updatedOptions) => {\n if (\n (!options.privateKey && options.certificate) ||\n (options.privateKey && !options.certificate)\n ) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (options.privateKey && options.certificate) {\n verifyAttestationSigningKey(options.privateKey, options.certificate);\n }\n\n const storedAttestationPolicy = new StoredAttestationPolicy(newPolicyDocument).serialize();\n const setPolicyToken = AttestationTokenImpl.create({\n body: storedAttestationPolicy,\n ...options,\n });\n\n const setPolicyResult = await this._client.policy.set(\n attestationType,\n setPolicyToken.serialize(),\n updatedOptions,\n );\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(setPolicyResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n return createAttestationResponse<PolicyResult>(token, policyResult);\n },\n );\n }\n\n /**\n * Resets the attestation policy for the specified {@link attestationType} to\n * the default value.\n *\n * @param attestationType - Attestation Type for which to set policy.\n * @param options - call options.\n * @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.\n * Clients can use the PolicyResult to validate that the policy was actually\n * reset by the attestation service.\n *\n * @remarks\n *\n * Please note that if the attestation service instance is running in \"Isolated\"\n * mode, the {@link signingKey} must be one of the signing keys configured for the\n * service instance.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n\n public async resetPolicy(\n attestationType: AttestationType,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<PolicyResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-setPolicy\",\n options,\n async (updatedOptions) => {\n if (\n (!options.privateKey && options.certificate) ||\n (options.privateKey && !options.certificate)\n ) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (options.privateKey && options.certificate) {\n verifyAttestationSigningKey(options.privateKey, options.certificate);\n }\n\n const resetPolicyToken = AttestationTokenImpl.create({\n privateKey: options.privateKey,\n certificate: options.certificate,\n });\n\n const resetPolicyResult = await this._client.policy.reset(\n attestationType,\n resetPolicyToken.serialize(),\n updatedOptions,\n );\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(resetPolicyResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n return createAttestationResponse<PolicyResult>(token, policyResult);\n },\n );\n }\n\n /** Returns the set of policy management certificates for this attestation instance.\n *\n * @remarks If the attestation instance is not in `Isolated` mode, this list will\n * always be empty.\n *\n * @param options - Options for the call to the attestation service.\n * @returns AttestationResponse wrapping a list of Attestation Signers.\n */\n public async getPolicyManagementCertificates(\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<AttestationSigner[]>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-getPolicyManagementCertificates\",\n options,\n async (updatedOptions) => {\n const getCertificatesResult = await this._client.policyCertificates.get(updatedOptions);\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(getCertificatesResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const jwks = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesResult: Mappers.PolicyCertificatesResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesResult\",\n ) as PolicyCertificatesResult;\n\n const policyCertificates = new Array<AttestationSigner>();\n jwks.policyCertificates.keys.forEach((jwk) => {\n policyCertificates.push(_attestationSignerFromGenerated(jwk));\n });\n\n return createAttestationResponse<AttestationSigner[]>(token, policyCertificates);\n },\n );\n }\n\n /** Add a new certificate chain to the set of policy management certificates.\n *\n * @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.\n * @param privateKey - Existing attestation private key used to sign the incoming request.\n * @param certificate - Existing attestation certificate used to verify the incoming request.\n * @param options - Options used in the call to the service.\n * @returns An attestation response including a PolicyCertificatesModificationResult\n *\n * @remarks This API is only supported on `isolated` attestation instances.\n *\n * The signing key MUST be one of the existing attestation signing certificates. The\n * new pemCertificate is signed using the signingKey and the service will validate the\n * signature before allowing the addition.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n *\n */\n public async addPolicyManagementCertificate(\n pemCertificate: string,\n privateKey: string,\n certificate: string,\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<PolicyCertificatesModificationResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-addPolicyManagementCertificate\",\n options,\n async (updatedOptions) => {\n if ((!privateKey && certificate) || (privateKey && !certificate)) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (privateKey && certificate) {\n verifyAttestationSigningKey(privateKey, certificate);\n }\n\n const cert = new jsrsasign.X509();\n cert.readCertPEM(pemCertificate);\n const kty = this.keyTypeFromCertificate(cert);\n\n const jwk: JsonWebKey = {\n x5C: [hexToBase64(cert.hex)],\n kty: kty,\n };\n\n const addBody: AttestationCertificateManagementBody = {\n policyCertificate: jwk,\n };\n\n const addCertToken = AttestationTokenImpl.create({\n body: TypeDeserializer.serialize(\n addBody,\n {\n AttestationCertificateManagementBody: Mappers.AttestationCertificateManagementBody,\n JsonWebKey: Mappers.JsonWebKey,\n },\n Mappers.AttestationCertificateManagementBody,\n ),\n privateKey: privateKey,\n certificate: certificate,\n });\n\n const addCertificateResult = await this._client.policyCertificates.add(\n addCertToken.serialize(),\n updatedOptions,\n );\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(addCertificateResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyCertificatesModificationResult object.\n const result = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesModificationResult: Mappers.PolicyCertificatesModificationResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesModificationResult\",\n ) as PolicyCertificatesModificationResult;\n\n return createAttestationResponse<PolicyCertificatesModificationResult>(token, result);\n },\n );\n }\n\n private keyTypeFromCertificate(cert: any): string {\n let kty: string;\n switch (cert.getSignatureAlgorithmName()) {\n case \"SHA256withRSA\":\n case \"SHA384withRSA\":\n case \"SHA512withRSA\":\n kty = \"RSA\";\n break;\n case \"SHA256withECDSA\":\n case \"SHA384withECDSA\":\n kty = \"EC\";\n break;\n default:\n kty = \"RSA\";\n break;\n }\n return kty;\n }\n\n /** Add a new certificate chain to the set of policy management certificates.\n *\n * @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.\n * @param privateKey - Existing attestation private key used to sign the incoming request.\n * @param certificate - Existing attestation certificate used to verify the incoming request.\n * @param options - Options used in the call to the service.\n * @returns An attestation response including a PolicyCertificatesModificationResult\n *\n * @remarks This API is only supported on `isolated` attestation instances.\n *\n * The signing key MUST be one of the existing attestation signing certificates. The\n * new pemCertificate is signed using the signingKey and the service will validate the\n * signature before allowing the addition.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n public async removePolicyManagementCertificate(\n pemCertificate: string,\n privateKey: string,\n certificate: string,\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<PolicyCertificatesModificationResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-removePolicyManagementCertificate\",\n options,\n async (updatedOptions) => {\n if ((!privateKey && certificate) || (privateKey && !certificate)) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (privateKey && certificate) {\n verifyAttestationSigningKey(privateKey, certificate);\n }\n\n const cert = new jsrsasign.X509();\n cert.readCertPEM(pemCertificate);\n const kty = this.keyTypeFromCertificate(cert);\n\n const jwk: JsonWebKey = {\n x5C: [hexToBase64(cert.hex)],\n kty: kty,\n };\n\n const addBody: AttestationCertificateManagementBody = {\n policyCertificate: jwk,\n };\n\n const removeCertToken = AttestationTokenImpl.create({\n body: TypeDeserializer.serialize(\n addBody,\n {\n AttestationCertificateManagementBody: Mappers.AttestationCertificateManagementBody,\n JsonWebKey: Mappers.JsonWebKey,\n },\n Mappers.AttestationCertificateManagementBody,\n ),\n privateKey: privateKey,\n certificate: certificate,\n });\n\n const removeCertificateResult = await this._client.policyCertificates.remove(\n removeCertToken.serialize(),\n updatedOptions,\n );\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(removeCertificateResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyCertificatesModificationResult object.\n const result = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesModificationResult: Mappers.PolicyCertificatesModificationResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesModificationResult\",\n ) as PolicyCertificatesModificationResult;\n\n return createAttestationResponse<PolicyCertificatesModificationResult>(token, result);\n },\n );\n }\n\n private async signingKeys(): Promise<AttestationSigner[]> {\n if (this._signers !== undefined) {\n return this._signers;\n }\n const jwks = await this._client.signingCertificates.get();\n const signers: AttestationSigner[] = new Array();\n jwks.keys?.forEach((element) => {\n signers.push(_attestationSignerFromGenerated(element));\n });\n this._signers = signers;\n return this._signers;\n }\n\n private _client: GeneratedClient;\n private _signers?: AttestationSigner[];\n private _validationOptions?: AttestationTokenValidationOptions;\n}\n"]}
1
+ {"version":3,"file":"attestationAdministrationClient.js","sourceRoot":"","sources":["../../src/attestationAdministrationClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,uDAAuD;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,MAAM,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CAAC,WAAW;;QACvB,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC,QAAQ,CAAC;QACvB,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG,EAAE,CAAC;QAC1D,MAAM,OAAO,GAAwB,IAAI,KAAK,EAAE,CAAC;QACjD,MAAA,IAAI,CAAC,IAAI,0CAAE,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,OAAO,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CAKF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* eslint-disable @azure/azure-sdk/ts-naming-options */\nimport { GeneratedClient } from \"./generated/generatedClient.js\";\nimport { logger } from \"./logger.js\";\n\nimport type {\n AttestationCertificateManagementBody,\n GeneratedClientOptionalParams,\n JsonWebKey,\n PolicyCertificatesResult,\n} from \"./generated/models/index.js\";\n\nimport { bytesToString } from \"./utils/utf8.js\";\n\nimport type {\n AttestationResponse,\n AttestationSigner,\n AttestationTokenValidationOptions,\n AttestationType,\n PolicyCertificatesModificationResult,\n PolicyResult,\n} from \"./models/index.js\";\nimport { StoredAttestationPolicy } from \"./models/storedAttestationPolicy.js\";\n\nimport type { CommonClientOptions, OperationOptions } from \"@azure/core-client\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { TypeDeserializer } from \"./utils/typeDeserializer.js\";\nimport * as Mappers from \"./generated/models/mappers.js\";\n\n/// <reference path=\"../jsrsasign.d.ts\"/>\nimport * as jsrsasign from \"jsrsasign\";\nimport { hexToBase64 } from \"./utils/helpers.js\";\nimport { _policyResultFromGenerated } from \"./models/policyResult.js\";\nimport { _attestationSignerFromGenerated } from \"./models/attestationSigner.js\";\nimport { verifyAttestationSigningKey } from \"./utils/helpers.js\";\nimport { createAttestationResponse } from \"./models/attestationResponse.js\";\nimport { AttestationTokenImpl } from \"./models/attestationToken.js\";\nimport { tracingClient } from \"./generated/tracing.js\";\n\n/**\n * Attestation Client Construction Options.\n */\nexport interface AttestationAdministrationClientOptions extends CommonClientOptions {\n /**\n * Options to be used globally to validate attestation tokens received from\n * the attestation service.\n */\n validationOptions?: AttestationTokenValidationOptions;\n}\n\n/**\n * Operation options for the Attestation Administration Client operations.\n */\nexport interface AttestationAdministrationClientOperationOptions extends OperationOptions {\n /**\n * Options to be used globally to validate attestation tokens received from\n * the attestation service.\n */\n validationOptions?: AttestationTokenValidationOptions;\n}\n\n/**\n * Operation options for the administration Policy operations.\n */\nexport interface AttestationAdministrationClientPolicyOperationOptions\n extends AttestationAdministrationClientOperationOptions {\n /**\n * Optional Private key used to sign the token sent to the attestation service.\n *\n * Required for Isolated Mode attestation instances.\n */\n privateKey?: string;\n\n /**\n * Optional certificate which can validate the token sent to the attestation service.\n *\n * Required for Isolated Mode attestation instances.\n *\n * If the service instance is in Isolated mode, the certificate *must* be one\n * of the configured policy management certificates.\n */\n certificate?: string;\n}\n\n/**\n * Operation options for the Policy Certificates operations.\n */\nexport interface AttestationAdministrationClientPolicyCertificateOperationOptions\n extends AttestationAdministrationClientOperationOptions {}\n\n/**\n * Attestation Client class.\n *\n * The AttestationClient class enables access to the Attestation related APIs:\n *\n * - getPolicy\n * - setPolicy\n * - resetPolicy\n * - getPolicyManagementCertificates\n * - addPolicyManagementCertificate\n * - removePolicyManagementCertificate\n */\nexport class AttestationAdministrationClient {\n /**\n * Creates an instance of AttestationAdministrationClient.\n *\n * Example usage:\n * ```ts\n * import { AttestationAdministrationClient } from \"@azure/attestation\";\n *\n * const client = new AttestationAdministrationClient(\n * \"<service endpoint>\",\n * new TokenCredential(\"<>\")\n * );\n * ```\n *\n * @param endpoint - The attestation instance endpoint, for example https://mytenant.attest.azure.net.\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the Form Recognizer client.\n */\n\n constructor(\n endpoint: string,\n credentials: TokenCredential,\n options: AttestationAdministrationClientOptions = {},\n ) {\n this._validationOptions = options.validationOptions;\n\n const internalPipelineOptions: GeneratedClientOptionalParams = {\n ...options,\n ...{\n credential: credentials,\n credentialScopes: [\"https://attest.azure.net/.default\"],\n loggingOptions: {\n logger: logger.info,\n allowedHeaderNames: [\"x-ms-request-id\", \"x-ms-maa-service-version\"],\n },\n },\n };\n\n this._client = new GeneratedClient(endpoint, internalPipelineOptions);\n }\n\n /**\n * Retrieves the attestation policy document from the server, and returns it\n * to the caller.\n *\n * @param attestationType - AttestationType for which to retrieve policy.\n * @param options - Pipeline and client options for the `getPolicy` call.\n * @returns `AttestationResponse<string>` - the `value` property is the\n * attestation policy, the `token` property will be the actual token\n * returned by the attestation service.\n */\n public async getPolicy(\n attestationType: AttestationType,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<string>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-getPolicy\",\n options,\n async (updatedOptions) => {\n const getPolicyResult = await this._client.policy.get(attestationType, updatedOptions);\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(getPolicyResult.token);\n\n // Validate the token returned from the service.\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n if (!policyResult.policy) {\n throw Error(\"Server returned an invalid getPolicy response!\");\n }\n\n const policyToken = new AttestationTokenImpl(policyResult.policy);\n\n const storedPolicy = StoredAttestationPolicy.deserialize(policyToken.getBody());\n\n // Finally, retrieve the stored attestationPolicy value and return that\n // as the AttestationResponse to the caller.\n return createAttestationResponse<string>(\n token,\n bytesToString(storedPolicy.attestationPolicy),\n );\n },\n );\n }\n\n /**\n * Sets the attestation policy for the specified {@link attestationType}.\n *\n * @param attestationType - Attestation Type for which to set policy.\n * @param newPolicyDocument - Policy document to be set.\n * @param options - call options.\n * @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.\n * Clients can use the PolicyResult to validate that the policy was actually\n * set by the attestation service.\n *\n * @remarks\n *\n * Please note that if the attestation service instance is running in \"Isolated\"\n * mode, the {@link signingKey} must be one of the signing keys configured for the\n * service instance.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n public async setPolicy(\n attestationType: AttestationType,\n newPolicyDocument: string,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<PolicyResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-setPolicy\",\n options,\n async (updatedOptions) => {\n if (\n (!options.privateKey && options.certificate) ||\n (options.privateKey && !options.certificate)\n ) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (options.privateKey && options.certificate) {\n verifyAttestationSigningKey(options.privateKey, options.certificate);\n }\n\n const storedAttestationPolicy = new StoredAttestationPolicy(newPolicyDocument).serialize();\n const setPolicyToken = AttestationTokenImpl.create({\n body: storedAttestationPolicy,\n ...options,\n });\n\n const setPolicyResult = await this._client.policy.set(\n attestationType,\n setPolicyToken.serialize(),\n updatedOptions,\n );\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(setPolicyResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n return createAttestationResponse<PolicyResult>(token, policyResult);\n },\n );\n }\n\n /**\n * Resets the attestation policy for the specified {@link attestationType} to\n * the default value.\n *\n * @param attestationType - Attestation Type for which to set policy.\n * @param options - call options.\n * @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.\n * Clients can use the PolicyResult to validate that the policy was actually\n * reset by the attestation service.\n *\n * @remarks\n *\n * Please note that if the attestation service instance is running in \"Isolated\"\n * mode, the {@link signingKey} must be one of the signing keys configured for the\n * service instance.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n\n public async resetPolicy(\n attestationType: AttestationType,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<PolicyResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-setPolicy\",\n options,\n async (updatedOptions) => {\n if (\n (!options.privateKey && options.certificate) ||\n (options.privateKey && !options.certificate)\n ) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (options.privateKey && options.certificate) {\n verifyAttestationSigningKey(options.privateKey, options.certificate);\n }\n\n const resetPolicyToken = AttestationTokenImpl.create({\n privateKey: options.privateKey,\n certificate: options.certificate,\n });\n\n const resetPolicyResult = await this._client.policy.reset(\n attestationType,\n resetPolicyToken.serialize(),\n updatedOptions,\n );\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(resetPolicyResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n return createAttestationResponse<PolicyResult>(token, policyResult);\n },\n );\n }\n\n /** Returns the set of policy management certificates for this attestation instance.\n *\n * @remarks If the attestation instance is not in `Isolated` mode, this list will\n * always be empty.\n *\n * @param options - Options for the call to the attestation service.\n * @returns AttestationResponse wrapping a list of Attestation Signers.\n */\n public async getPolicyManagementCertificates(\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<AttestationSigner[]>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-getPolicyManagementCertificates\",\n options,\n async (updatedOptions) => {\n const getCertificatesResult = await this._client.policyCertificates.get(updatedOptions);\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(getCertificatesResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const jwks = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesResult: Mappers.PolicyCertificatesResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesResult\",\n ) as PolicyCertificatesResult;\n\n const policyCertificates = new Array<AttestationSigner>();\n jwks.policyCertificates.keys.forEach((jwk) => {\n policyCertificates.push(_attestationSignerFromGenerated(jwk));\n });\n\n return createAttestationResponse<AttestationSigner[]>(token, policyCertificates);\n },\n );\n }\n\n /** Add a new certificate chain to the set of policy management certificates.\n *\n * @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.\n * @param privateKey - Existing attestation private key used to sign the incoming request.\n * @param certificate - Existing attestation certificate used to verify the incoming request.\n * @param options - Options used in the call to the service.\n * @returns An attestation response including a PolicyCertificatesModificationResult\n *\n * @remarks This API is only supported on `isolated` attestation instances.\n *\n * The signing key MUST be one of the existing attestation signing certificates. The\n * new pemCertificate is signed using the signingKey and the service will validate the\n * signature before allowing the addition.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n *\n */\n public async addPolicyManagementCertificate(\n pemCertificate: string,\n privateKey: string,\n certificate: string,\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<PolicyCertificatesModificationResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-addPolicyManagementCertificate\",\n options,\n async (updatedOptions) => {\n if ((!privateKey && certificate) || (privateKey && !certificate)) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (privateKey && certificate) {\n verifyAttestationSigningKey(privateKey, certificate);\n }\n\n const cert = new jsrsasign.X509();\n cert.readCertPEM(pemCertificate);\n const kty = this.keyTypeFromCertificate(cert);\n\n const jwk: JsonWebKey = {\n x5C: [hexToBase64(cert.hex)],\n kty: kty,\n };\n\n const addBody: AttestationCertificateManagementBody = {\n policyCertificate: jwk,\n };\n\n const addCertToken = AttestationTokenImpl.create({\n body: TypeDeserializer.serialize(\n addBody,\n {\n AttestationCertificateManagementBody: Mappers.AttestationCertificateManagementBody,\n JsonWebKey: Mappers.JsonWebKey,\n },\n Mappers.AttestationCertificateManagementBody,\n ),\n privateKey: privateKey,\n certificate: certificate,\n });\n\n const addCertificateResult = await this._client.policyCertificates.add(\n addCertToken.serialize(),\n updatedOptions,\n );\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(addCertificateResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyCertificatesModificationResult object.\n const result = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesModificationResult: Mappers.PolicyCertificatesModificationResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesModificationResult\",\n ) as PolicyCertificatesModificationResult;\n\n return createAttestationResponse<PolicyCertificatesModificationResult>(token, result);\n },\n );\n }\n\n private keyTypeFromCertificate(cert: any): string {\n let kty: string;\n switch (cert.getSignatureAlgorithmName()) {\n case \"SHA256withRSA\":\n case \"SHA384withRSA\":\n case \"SHA512withRSA\":\n kty = \"RSA\";\n break;\n case \"SHA256withECDSA\":\n case \"SHA384withECDSA\":\n kty = \"EC\";\n break;\n default:\n kty = \"RSA\";\n break;\n }\n return kty;\n }\n\n /** Add a new certificate chain to the set of policy management certificates.\n *\n * @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.\n * @param privateKey - Existing attestation private key used to sign the incoming request.\n * @param certificate - Existing attestation certificate used to verify the incoming request.\n * @param options - Options used in the call to the service.\n * @returns An attestation response including a PolicyCertificatesModificationResult\n *\n * @remarks This API is only supported on `isolated` attestation instances.\n *\n * The signing key MUST be one of the existing attestation signing certificates. The\n * new pemCertificate is signed using the signingKey and the service will validate the\n * signature before allowing the addition.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n public async removePolicyManagementCertificate(\n pemCertificate: string,\n privateKey: string,\n certificate: string,\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<PolicyCertificatesModificationResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-removePolicyManagementCertificate\",\n options,\n async (updatedOptions) => {\n if ((!privateKey && certificate) || (privateKey && !certificate)) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (privateKey && certificate) {\n verifyAttestationSigningKey(privateKey, certificate);\n }\n\n const cert = new jsrsasign.X509();\n cert.readCertPEM(pemCertificate);\n const kty = this.keyTypeFromCertificate(cert);\n\n const jwk: JsonWebKey = {\n x5C: [hexToBase64(cert.hex)],\n kty: kty,\n };\n\n const addBody: AttestationCertificateManagementBody = {\n policyCertificate: jwk,\n };\n\n const removeCertToken = AttestationTokenImpl.create({\n body: TypeDeserializer.serialize(\n addBody,\n {\n AttestationCertificateManagementBody: Mappers.AttestationCertificateManagementBody,\n JsonWebKey: Mappers.JsonWebKey,\n },\n Mappers.AttestationCertificateManagementBody,\n ),\n privateKey: privateKey,\n certificate: certificate,\n });\n\n const removeCertificateResult = await this._client.policyCertificates.remove(\n removeCertToken.serialize(),\n updatedOptions,\n );\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(removeCertificateResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyCertificatesModificationResult object.\n const result = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesModificationResult: Mappers.PolicyCertificatesModificationResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesModificationResult\",\n ) as PolicyCertificatesModificationResult;\n\n return createAttestationResponse<PolicyCertificatesModificationResult>(token, result);\n },\n );\n }\n\n private async signingKeys(): Promise<AttestationSigner[]> {\n if (this._signers !== undefined) {\n return this._signers;\n }\n const jwks = await this._client.signingCertificates.get();\n const signers: AttestationSigner[] = new Array();\n jwks.keys?.forEach((element) => {\n signers.push(_attestationSignerFromGenerated(element));\n });\n this._signers = signers;\n return this._signers;\n }\n\n private _client: GeneratedClient;\n private _signers?: AttestationSigner[];\n private _validationOptions?: AttestationTokenValidationOptions;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"attestationAdministrationClient.d.ts","sourceRoot":"","sources":["../../src/attestationAdministrationClient.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EAC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C,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAoD7C;;;;;;;OAOG;IACU,+BAA+B,CAC1C,OAAO,GAAE,gEAAqE,GAC7E,OAAO,CAAC,mBAAmB,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAuCpD;;;;;;;;;;;;;;;;;OAiBG;IACU,8BAA8B,CACzC,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,gEAAqE,GAC7E,OAAO,CAAC,mBAAmB,CAAC,oCAAoC,CAAC,CAAC;IAwErE,OAAO,CAAC,sBAAsB;IAmB9B;;;;;;;;;;;;;;;;OAgBG;IACU,iCAAiC,CAC5C,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,gEAAqE,GAC7E,OAAO,CAAC,mBAAmB,CAAC,oCAAoC,CAAC,CAAC;YAwEvD,WAAW;IAazB,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,QAAQ,CAAC,CAAsB;IACvC,OAAO,CAAC,kBAAkB,CAAC,CAAoC;CAChE"}
1
+ {"version":3,"file":"attestationAdministrationClient.d.ts","sourceRoot":"","sources":["../../src/attestationAdministrationClient.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,iCAAiC,EACjC,eAAe,EACf,oCAAoC,EACpC,YAAY,EACb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAcxD;;GAEG;AACH,MAAM,WAAW,sCAAuC,SAAQ,mBAAmB;IACjF;;;OAGG;IACH,iBAAiB,CAAC,EAAE,iCAAiC,CAAC;CACvD;AAED;;GAEG;AACH,MAAM,WAAW,+CAAgD,SAAQ,gBAAgB;I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AC,sBAAsB;IAmB9B;;;;;;;;;;;;;;;;OAgBG;IACU,iCAAiC,CAC5C,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,gEAAqE,GAC7E,OAAO,CAAC,mBAAmB,CAAC,oCAAoC,CAAC,CAAC;YAwEvD,WAAW;IAazB,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,QAAQ,CAAC,CAAsB;IACvC,OAAO,CAAC,kBAAkB,CAAC,CAAoC;CAChE"}
@@ -7,7 +7,6 @@ import { bytesToString } from "./utils/utf8.js";
7
7
  import { StoredAttestationPolicy } from "./models/storedAttestationPolicy.js";
8
8
  import { TypeDeserializer } from "./utils/typeDeserializer.js";
9
9
  import * as Mappers from "./generated/models/mappers.js";
10
- // eslint-disable-next-line @typescript-eslint/triple-slash-reference
11
10
  /// <reference path="../jsrsasign.d.ts"/>
12
11
  import * as jsrsasign from "jsrsasign";
13
12
  import { hexToBase64 } from "./utils/helpers.js";
@@ -1 +1 @@
1
- {"version":3,"file":"attestationAdministrationClient.js","sourceRoot":"","sources":["../../src/attestationAdministrationClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,uDAAuD;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AASrC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAUhD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAI9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,OAAO,MAAM,+BAA+B,CAAC;AAEzD,qEAAqE;AACrE,yCAAyC;AACzC,OAAO,KAAK,SAAS,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,0BAA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BAA+B,CAAC,OAAO,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CAKF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* eslint-disable @azure/azure-sdk/ts-naming-options */\nimport { GeneratedClient } from \"./generated/generatedClient.js\";\nimport { logger } from \"./logger.js\";\n\nimport type {\n AttestationCertificateManagementBody,\n GeneratedClientOptionalParams,\n JsonWebKey,\n PolicyCertificatesResult,\n} from \"./generated/models/index.js\";\n\nimport { bytesToString } from \"./utils/utf8.js\";\n\nimport type {\n AttestationResponse,\n AttestationSigner,\n AttestationTokenValidationOptions,\n AttestationType,\n PolicyCertificatesModificationResult,\n PolicyResult,\n} from \"./models/index.js\";\nimport { StoredAttestationPolicy } from \"./models/storedAttestationPolicy.js\";\n\nimport type { CommonClientOptions, OperationOptions } from \"@azure/core-client\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { TypeDeserializer } from \"./utils/typeDeserializer.js\";\nimport * as Mappers from \"./generated/models/mappers.js\";\n\n// eslint-disable-next-line @typescript-eslint/triple-slash-reference\n/// <reference path=\"../jsrsasign.d.ts\"/>\nimport * as jsrsasign from \"jsrsasign\";\nimport { hexToBase64 } from \"./utils/helpers.js\";\nimport { _policyResultFromGenerated } from \"./models/policyResult.js\";\nimport { _attestationSignerFromGenerated } from \"./models/attestationSigner.js\";\nimport { verifyAttestationSigningKey } from \"./utils/helpers.js\";\nimport { createAttestationResponse } from \"./models/attestationResponse.js\";\nimport { AttestationTokenImpl } from \"./models/attestationToken.js\";\nimport { tracingClient } from \"./generated/tracing.js\";\n\n/**\n * Attestation Client Construction Options.\n */\nexport interface AttestationAdministrationClientOptions extends CommonClientOptions {\n /**\n * Options to be used globally to validate attestation tokens received from\n * the attestation service.\n */\n validationOptions?: AttestationTokenValidationOptions;\n}\n\n/**\n * Operation options for the Attestation Administration Client operations.\n */\nexport interface AttestationAdministrationClientOperationOptions extends OperationOptions {\n /**\n * Options to be used globally to validate attestation tokens received from\n * the attestation service.\n */\n validationOptions?: AttestationTokenValidationOptions;\n}\n\n/**\n * Operation options for the administration Policy operations.\n */\nexport interface AttestationAdministrationClientPolicyOperationOptions\n extends AttestationAdministrationClientOperationOptions {\n /**\n * Optional Private key used to sign the token sent to the attestation service.\n *\n * Required for Isolated Mode attestation instances.\n */\n privateKey?: string;\n\n /**\n * Optional certificate which can validate the token sent to the attestation service.\n *\n * Required for Isolated Mode attestation instances.\n *\n * If the service instance is in Isolated mode, the certificate *must* be one\n * of the configured policy management certificates.\n */\n certificate?: string;\n}\n\n/**\n * Operation options for the Policy Certificates operations.\n */\nexport interface AttestationAdministrationClientPolicyCertificateOperationOptions\n extends AttestationAdministrationClientOperationOptions {}\n\n/**\n * Attestation Client class.\n *\n * The AttestationClient class enables access to the Attestation related APIs:\n *\n * - getPolicy\n * - setPolicy\n * - resetPolicy\n * - getPolicyManagementCertificates\n * - addPolicyManagementCertificate\n * - removePolicyManagementCertificate\n */\nexport class AttestationAdministrationClient {\n /**\n * Creates an instance of AttestationAdministrationClient.\n *\n * Example usage:\n * ```ts\n * import { AttestationAdministrationClient } from \"@azure/attestation\";\n *\n * const client = new AttestationAdministrationClient(\n * \"<service endpoint>\",\n * new TokenCredential(\"<>\")\n * );\n * ```\n *\n * @param endpoint - The attestation instance endpoint, for example https://mytenant.attest.azure.net.\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the Form Recognizer client.\n */\n\n constructor(\n endpoint: string,\n credentials: TokenCredential,\n options: AttestationAdministrationClientOptions = {},\n ) {\n this._validationOptions = options.validationOptions;\n\n const internalPipelineOptions: GeneratedClientOptionalParams = {\n ...options,\n ...{\n credential: credentials,\n credentialScopes: [\"https://attest.azure.net/.default\"],\n loggingOptions: {\n logger: logger.info,\n allowedHeaderNames: [\"x-ms-request-id\", \"x-ms-maa-service-version\"],\n },\n },\n };\n\n this._client = new GeneratedClient(endpoint, internalPipelineOptions);\n }\n\n /**\n * Retrieves the attestation policy document from the server, and returns it\n * to the caller.\n *\n * @param attestationType - AttestationType for which to retrieve policy.\n * @param options - Pipeline and client options for the `getPolicy` call.\n * @returns `AttestationResponse<string>` - the `value` property is the\n * attestation policy, the `token` property will be the actual token\n * returned by the attestation service.\n */\n public async getPolicy(\n attestationType: AttestationType,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<string>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-getPolicy\",\n options,\n async (updatedOptions) => {\n const getPolicyResult = await this._client.policy.get(attestationType, updatedOptions);\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(getPolicyResult.token);\n\n // Validate the token returned from the service.\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n if (!policyResult.policy) {\n throw Error(\"Server returned an invalid getPolicy response!\");\n }\n\n const policyToken = new AttestationTokenImpl(policyResult.policy);\n\n const storedPolicy = StoredAttestationPolicy.deserialize(policyToken.getBody());\n\n // Finally, retrieve the stored attestationPolicy value and return that\n // as the AttestationResponse to the caller.\n return createAttestationResponse<string>(\n token,\n bytesToString(storedPolicy.attestationPolicy),\n );\n },\n );\n }\n\n /**\n * Sets the attestation policy for the specified {@link attestationType}.\n *\n * @param attestationType - Attestation Type for which to set policy.\n * @param newPolicyDocument - Policy document to be set.\n * @param options - call options.\n * @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.\n * Clients can use the PolicyResult to validate that the policy was actually\n * set by the attestation service.\n *\n * @remarks\n *\n * Please note that if the attestation service instance is running in \"Isolated\"\n * mode, the {@link signingKey} must be one of the signing keys configured for the\n * service instance.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n public async setPolicy(\n attestationType: AttestationType,\n newPolicyDocument: string,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<PolicyResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-setPolicy\",\n options,\n async (updatedOptions) => {\n if (\n (!options.privateKey && options.certificate) ||\n (options.privateKey && !options.certificate)\n ) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (options.privateKey && options.certificate) {\n verifyAttestationSigningKey(options.privateKey, options.certificate);\n }\n\n const storedAttestationPolicy = new StoredAttestationPolicy(newPolicyDocument).serialize();\n const setPolicyToken = AttestationTokenImpl.create({\n body: storedAttestationPolicy,\n ...options,\n });\n\n const setPolicyResult = await this._client.policy.set(\n attestationType,\n setPolicyToken.serialize(),\n updatedOptions,\n );\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(setPolicyResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n return createAttestationResponse<PolicyResult>(token, policyResult);\n },\n );\n }\n\n /**\n * Resets the attestation policy for the specified {@link attestationType} to\n * the default value.\n *\n * @param attestationType - Attestation Type for which to set policy.\n * @param options - call options.\n * @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.\n * Clients can use the PolicyResult to validate that the policy was actually\n * reset by the attestation service.\n *\n * @remarks\n *\n * Please note that if the attestation service instance is running in \"Isolated\"\n * mode, the {@link signingKey} must be one of the signing keys configured for the\n * service instance.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n\n public async resetPolicy(\n attestationType: AttestationType,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<PolicyResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-setPolicy\",\n options,\n async (updatedOptions) => {\n if (\n (!options.privateKey && options.certificate) ||\n (options.privateKey && !options.certificate)\n ) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (options.privateKey && options.certificate) {\n verifyAttestationSigningKey(options.privateKey, options.certificate);\n }\n\n const resetPolicyToken = AttestationTokenImpl.create({\n privateKey: options.privateKey,\n certificate: options.certificate,\n });\n\n const resetPolicyResult = await this._client.policy.reset(\n attestationType,\n resetPolicyToken.serialize(),\n updatedOptions,\n );\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(resetPolicyResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n return createAttestationResponse<PolicyResult>(token, policyResult);\n },\n );\n }\n\n /** Returns the set of policy management certificates for this attestation instance.\n *\n * @remarks If the attestation instance is not in `Isolated` mode, this list will\n * always be empty.\n *\n * @param options - Options for the call to the attestation service.\n * @returns AttestationResponse wrapping a list of Attestation Signers.\n */\n public async getPolicyManagementCertificates(\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<AttestationSigner[]>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-getPolicyManagementCertificates\",\n options,\n async (updatedOptions) => {\n const getCertificatesResult = await this._client.policyCertificates.get(updatedOptions);\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(getCertificatesResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const jwks = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesResult: Mappers.PolicyCertificatesResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesResult\",\n ) as PolicyCertificatesResult;\n\n const policyCertificates = new Array<AttestationSigner>();\n jwks.policyCertificates.keys.forEach((jwk) => {\n policyCertificates.push(_attestationSignerFromGenerated(jwk));\n });\n\n return createAttestationResponse<AttestationSigner[]>(token, policyCertificates);\n },\n );\n }\n\n /** Add a new certificate chain to the set of policy management certificates.\n *\n * @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.\n * @param privateKey - Existing attestation private key used to sign the incoming request.\n * @param certificate - Existing attestation certificate used to verify the incoming request.\n * @param options - Options used in the call to the service.\n * @returns An attestation response including a PolicyCertificatesModificationResult\n *\n * @remarks This API is only supported on `isolated` attestation instances.\n *\n * The signing key MUST be one of the existing attestation signing certificates. The\n * new pemCertificate is signed using the signingKey and the service will validate the\n * signature before allowing the addition.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n *\n */\n public async addPolicyManagementCertificate(\n pemCertificate: string,\n privateKey: string,\n certificate: string,\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<PolicyCertificatesModificationResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-addPolicyManagementCertificate\",\n options,\n async (updatedOptions) => {\n if ((!privateKey && certificate) || (privateKey && !certificate)) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (privateKey && certificate) {\n verifyAttestationSigningKey(privateKey, certificate);\n }\n\n const cert = new jsrsasign.X509();\n cert.readCertPEM(pemCertificate);\n const kty = this.keyTypeFromCertificate(cert);\n\n const jwk: JsonWebKey = {\n x5C: [hexToBase64(cert.hex)],\n kty: kty,\n };\n\n const addBody: AttestationCertificateManagementBody = {\n policyCertificate: jwk,\n };\n\n const addCertToken = AttestationTokenImpl.create({\n body: TypeDeserializer.serialize(\n addBody,\n {\n AttestationCertificateManagementBody: Mappers.AttestationCertificateManagementBody,\n JsonWebKey: Mappers.JsonWebKey,\n },\n Mappers.AttestationCertificateManagementBody,\n ),\n privateKey: privateKey,\n certificate: certificate,\n });\n\n const addCertificateResult = await this._client.policyCertificates.add(\n addCertToken.serialize(),\n updatedOptions,\n );\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(addCertificateResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyCertificatesModificationResult object.\n const result = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesModificationResult: Mappers.PolicyCertificatesModificationResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesModificationResult\",\n ) as PolicyCertificatesModificationResult;\n\n return createAttestationResponse<PolicyCertificatesModificationResult>(token, result);\n },\n );\n }\n\n private keyTypeFromCertificate(cert: any): string {\n let kty: string;\n switch (cert.getSignatureAlgorithmName()) {\n case \"SHA256withRSA\":\n case \"SHA384withRSA\":\n case \"SHA512withRSA\":\n kty = \"RSA\";\n break;\n case \"SHA256withECDSA\":\n case \"SHA384withECDSA\":\n kty = \"EC\";\n break;\n default:\n kty = \"RSA\";\n break;\n }\n return kty;\n }\n\n /** Add a new certificate chain to the set of policy management certificates.\n *\n * @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.\n * @param privateKey - Existing attestation private key used to sign the incoming request.\n * @param certificate - Existing attestation certificate used to verify the incoming request.\n * @param options - Options used in the call to the service.\n * @returns An attestation response including a PolicyCertificatesModificationResult\n *\n * @remarks This API is only supported on `isolated` attestation instances.\n *\n * The signing key MUST be one of the existing attestation signing certificates. The\n * new pemCertificate is signed using the signingKey and the service will validate the\n * signature before allowing the addition.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n public async removePolicyManagementCertificate(\n pemCertificate: string,\n privateKey: string,\n certificate: string,\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<PolicyCertificatesModificationResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-removePolicyManagementCertificate\",\n options,\n async (updatedOptions) => {\n if ((!privateKey && certificate) || (privateKey && !certificate)) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (privateKey && certificate) {\n verifyAttestationSigningKey(privateKey, certificate);\n }\n\n const cert = new jsrsasign.X509();\n cert.readCertPEM(pemCertificate);\n const kty = this.keyTypeFromCertificate(cert);\n\n const jwk: JsonWebKey = {\n x5C: [hexToBase64(cert.hex)],\n kty: kty,\n };\n\n const addBody: AttestationCertificateManagementBody = {\n policyCertificate: jwk,\n };\n\n const removeCertToken = AttestationTokenImpl.create({\n body: TypeDeserializer.serialize(\n addBody,\n {\n AttestationCertificateManagementBody: Mappers.AttestationCertificateManagementBody,\n JsonWebKey: Mappers.JsonWebKey,\n },\n Mappers.AttestationCertificateManagementBody,\n ),\n privateKey: privateKey,\n certificate: certificate,\n });\n\n const removeCertificateResult = await this._client.policyCertificates.remove(\n removeCertToken.serialize(),\n updatedOptions,\n );\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(removeCertificateResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyCertificatesModificationResult object.\n const result = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesModificationResult: Mappers.PolicyCertificatesModificationResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesModificationResult\",\n ) as PolicyCertificatesModificationResult;\n\n return createAttestationResponse<PolicyCertificatesModificationResult>(token, result);\n },\n );\n }\n\n private async signingKeys(): Promise<AttestationSigner[]> {\n if (this._signers !== undefined) {\n return this._signers;\n }\n const jwks = await this._client.signingCertificates.get();\n const signers: AttestationSigner[] = new Array();\n jwks.keys?.forEach((element) => {\n signers.push(_attestationSignerFromGenerated(element));\n });\n this._signers = signers;\n return this._signers;\n }\n\n private _client: GeneratedClient;\n private _signers?: AttestationSigner[];\n private _validationOptions?: AttestationTokenValidationOptions;\n}\n"]}
1
+ {"version":3,"file":"attestationAdministrationClient.js","sourceRoot":"","sources":["../../src/attestationAdministrationClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,uDAAuD;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AASrC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAUhD,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAI9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,OAAO,MAAM,+BAA+B,CAAC;AAEzD,yCAAyC;AACzC,OAAO,KAAK,SAAS,MAA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CAAC,IAAI,0CAAE,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,OAAO,CAAC,IAAI,CAAC,+BAA+B,CAAC,OAAO,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CAKF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* eslint-disable @azure/azure-sdk/ts-naming-options */\nimport { GeneratedClient } from \"./generated/generatedClient.js\";\nimport { logger } from \"./logger.js\";\n\nimport type {\n AttestationCertificateManagementBody,\n GeneratedClientOptionalParams,\n JsonWebKey,\n PolicyCertificatesResult,\n} from \"./generated/models/index.js\";\n\nimport { bytesToString } from \"./utils/utf8.js\";\n\nimport type {\n AttestationResponse,\n AttestationSigner,\n AttestationTokenValidationOptions,\n AttestationType,\n PolicyCertificatesModificationResult,\n PolicyResult,\n} from \"./models/index.js\";\nimport { StoredAttestationPolicy } from \"./models/storedAttestationPolicy.js\";\n\nimport type { CommonClientOptions, OperationOptions } from \"@azure/core-client\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { TypeDeserializer } from \"./utils/typeDeserializer.js\";\nimport * as Mappers from \"./generated/models/mappers.js\";\n\n/// <reference path=\"../jsrsasign.d.ts\"/>\nimport * as jsrsasign from \"jsrsasign\";\nimport { hexToBase64 } from \"./utils/helpers.js\";\nimport { _policyResultFromGenerated } from \"./models/policyResult.js\";\nimport { _attestationSignerFromGenerated } from \"./models/attestationSigner.js\";\nimport { verifyAttestationSigningKey } from \"./utils/helpers.js\";\nimport { createAttestationResponse } from \"./models/attestationResponse.js\";\nimport { AttestationTokenImpl } from \"./models/attestationToken.js\";\nimport { tracingClient } from \"./generated/tracing.js\";\n\n/**\n * Attestation Client Construction Options.\n */\nexport interface AttestationAdministrationClientOptions extends CommonClientOptions {\n /**\n * Options to be used globally to validate attestation tokens received from\n * the attestation service.\n */\n validationOptions?: AttestationTokenValidationOptions;\n}\n\n/**\n * Operation options for the Attestation Administration Client operations.\n */\nexport interface AttestationAdministrationClientOperationOptions extends OperationOptions {\n /**\n * Options to be used globally to validate attestation tokens received from\n * the attestation service.\n */\n validationOptions?: AttestationTokenValidationOptions;\n}\n\n/**\n * Operation options for the administration Policy operations.\n */\nexport interface AttestationAdministrationClientPolicyOperationOptions\n extends AttestationAdministrationClientOperationOptions {\n /**\n * Optional Private key used to sign the token sent to the attestation service.\n *\n * Required for Isolated Mode attestation instances.\n */\n privateKey?: string;\n\n /**\n * Optional certificate which can validate the token sent to the attestation service.\n *\n * Required for Isolated Mode attestation instances.\n *\n * If the service instance is in Isolated mode, the certificate *must* be one\n * of the configured policy management certificates.\n */\n certificate?: string;\n}\n\n/**\n * Operation options for the Policy Certificates operations.\n */\nexport interface AttestationAdministrationClientPolicyCertificateOperationOptions\n extends AttestationAdministrationClientOperationOptions {}\n\n/**\n * Attestation Client class.\n *\n * The AttestationClient class enables access to the Attestation related APIs:\n *\n * - getPolicy\n * - setPolicy\n * - resetPolicy\n * - getPolicyManagementCertificates\n * - addPolicyManagementCertificate\n * - removePolicyManagementCertificate\n */\nexport class AttestationAdministrationClient {\n /**\n * Creates an instance of AttestationAdministrationClient.\n *\n * Example usage:\n * ```ts\n * import { AttestationAdministrationClient } from \"@azure/attestation\";\n *\n * const client = new AttestationAdministrationClient(\n * \"<service endpoint>\",\n * new TokenCredential(\"<>\")\n * );\n * ```\n *\n * @param endpoint - The attestation instance endpoint, for example https://mytenant.attest.azure.net.\n * @param credential - Used to authenticate requests to the service.\n * @param options - Used to configure the Form Recognizer client.\n */\n\n constructor(\n endpoint: string,\n credentials: TokenCredential,\n options: AttestationAdministrationClientOptions = {},\n ) {\n this._validationOptions = options.validationOptions;\n\n const internalPipelineOptions: GeneratedClientOptionalParams = {\n ...options,\n ...{\n credential: credentials,\n credentialScopes: [\"https://attest.azure.net/.default\"],\n loggingOptions: {\n logger: logger.info,\n allowedHeaderNames: [\"x-ms-request-id\", \"x-ms-maa-service-version\"],\n },\n },\n };\n\n this._client = new GeneratedClient(endpoint, internalPipelineOptions);\n }\n\n /**\n * Retrieves the attestation policy document from the server, and returns it\n * to the caller.\n *\n * @param attestationType - AttestationType for which to retrieve policy.\n * @param options - Pipeline and client options for the `getPolicy` call.\n * @returns `AttestationResponse<string>` - the `value` property is the\n * attestation policy, the `token` property will be the actual token\n * returned by the attestation service.\n */\n public async getPolicy(\n attestationType: AttestationType,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<string>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-getPolicy\",\n options,\n async (updatedOptions) => {\n const getPolicyResult = await this._client.policy.get(attestationType, updatedOptions);\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(getPolicyResult.token);\n\n // Validate the token returned from the service.\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n if (!policyResult.policy) {\n throw Error(\"Server returned an invalid getPolicy response!\");\n }\n\n const policyToken = new AttestationTokenImpl(policyResult.policy);\n\n const storedPolicy = StoredAttestationPolicy.deserialize(policyToken.getBody());\n\n // Finally, retrieve the stored attestationPolicy value and return that\n // as the AttestationResponse to the caller.\n return createAttestationResponse<string>(\n token,\n bytesToString(storedPolicy.attestationPolicy),\n );\n },\n );\n }\n\n /**\n * Sets the attestation policy for the specified {@link attestationType}.\n *\n * @param attestationType - Attestation Type for which to set policy.\n * @param newPolicyDocument - Policy document to be set.\n * @param options - call options.\n * @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.\n * Clients can use the PolicyResult to validate that the policy was actually\n * set by the attestation service.\n *\n * @remarks\n *\n * Please note that if the attestation service instance is running in \"Isolated\"\n * mode, the {@link signingKey} must be one of the signing keys configured for the\n * service instance.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n public async setPolicy(\n attestationType: AttestationType,\n newPolicyDocument: string,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<PolicyResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-setPolicy\",\n options,\n async (updatedOptions) => {\n if (\n (!options.privateKey && options.certificate) ||\n (options.privateKey && !options.certificate)\n ) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (options.privateKey && options.certificate) {\n verifyAttestationSigningKey(options.privateKey, options.certificate);\n }\n\n const storedAttestationPolicy = new StoredAttestationPolicy(newPolicyDocument).serialize();\n const setPolicyToken = AttestationTokenImpl.create({\n body: storedAttestationPolicy,\n ...options,\n });\n\n const setPolicyResult = await this._client.policy.set(\n attestationType,\n setPolicyToken.serialize(),\n updatedOptions,\n );\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(setPolicyResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n return createAttestationResponse<PolicyResult>(token, policyResult);\n },\n );\n }\n\n /**\n * Resets the attestation policy for the specified {@link attestationType} to\n * the default value.\n *\n * @param attestationType - Attestation Type for which to set policy.\n * @param options - call options.\n * @returns An {@link AttestationResponse} wrapping a {@link PolicyResult}.\n * Clients can use the PolicyResult to validate that the policy was actually\n * reset by the attestation service.\n *\n * @remarks\n *\n * Please note that if the attestation service instance is running in \"Isolated\"\n * mode, the {@link signingKey} must be one of the signing keys configured for the\n * service instance.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n\n public async resetPolicy(\n attestationType: AttestationType,\n options: AttestationAdministrationClientPolicyOperationOptions = {},\n ): Promise<AttestationResponse<PolicyResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-setPolicy\",\n options,\n async (updatedOptions) => {\n if (\n (!options.privateKey && options.certificate) ||\n (options.privateKey && !options.certificate)\n ) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (options.privateKey && options.certificate) {\n verifyAttestationSigningKey(options.privateKey, options.certificate);\n }\n\n const resetPolicyToken = AttestationTokenImpl.create({\n privateKey: options.privateKey,\n certificate: options.certificate,\n });\n\n const resetPolicyResult = await this._client.policy.reset(\n attestationType,\n resetPolicyToken.serialize(),\n updatedOptions,\n );\n\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(resetPolicyResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const policyResult = _policyResultFromGenerated(token.getBody());\n\n // The policyResult.policy value will be a JSON Web Signature representing\n // the actual policy object being retrieved. Serialize the token to an\n // AttestationToken object so we can access the body properties on the token.\n return createAttestationResponse<PolicyResult>(token, policyResult);\n },\n );\n }\n\n /** Returns the set of policy management certificates for this attestation instance.\n *\n * @remarks If the attestation instance is not in `Isolated` mode, this list will\n * always be empty.\n *\n * @param options - Options for the call to the attestation service.\n * @returns AttestationResponse wrapping a list of Attestation Signers.\n */\n public async getPolicyManagementCertificates(\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<AttestationSigner[]>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-getPolicyManagementCertificates\",\n options,\n async (updatedOptions) => {\n const getCertificatesResult = await this._client.policyCertificates.get(updatedOptions);\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(getCertificatesResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyResult object to retrieve the underlying policy\n // token\n const jwks = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesResult: Mappers.PolicyCertificatesResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesResult\",\n ) as PolicyCertificatesResult;\n\n const policyCertificates = new Array<AttestationSigner>();\n jwks.policyCertificates.keys.forEach((jwk) => {\n policyCertificates.push(_attestationSignerFromGenerated(jwk));\n });\n\n return createAttestationResponse<AttestationSigner[]>(token, policyCertificates);\n },\n );\n }\n\n /** Add a new certificate chain to the set of policy management certificates.\n *\n * @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.\n * @param privateKey - Existing attestation private key used to sign the incoming request.\n * @param certificate - Existing attestation certificate used to verify the incoming request.\n * @param options - Options used in the call to the service.\n * @returns An attestation response including a PolicyCertificatesModificationResult\n *\n * @remarks This API is only supported on `isolated` attestation instances.\n *\n * The signing key MUST be one of the existing attestation signing certificates. The\n * new pemCertificate is signed using the signingKey and the service will validate the\n * signature before allowing the addition.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n *\n */\n public async addPolicyManagementCertificate(\n pemCertificate: string,\n privateKey: string,\n certificate: string,\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<PolicyCertificatesModificationResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-addPolicyManagementCertificate\",\n options,\n async (updatedOptions) => {\n if ((!privateKey && certificate) || (privateKey && !certificate)) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (privateKey && certificate) {\n verifyAttestationSigningKey(privateKey, certificate);\n }\n\n const cert = new jsrsasign.X509();\n cert.readCertPEM(pemCertificate);\n const kty = this.keyTypeFromCertificate(cert);\n\n const jwk: JsonWebKey = {\n x5C: [hexToBase64(cert.hex)],\n kty: kty,\n };\n\n const addBody: AttestationCertificateManagementBody = {\n policyCertificate: jwk,\n };\n\n const addCertToken = AttestationTokenImpl.create({\n body: TypeDeserializer.serialize(\n addBody,\n {\n AttestationCertificateManagementBody: Mappers.AttestationCertificateManagementBody,\n JsonWebKey: Mappers.JsonWebKey,\n },\n Mappers.AttestationCertificateManagementBody,\n ),\n privateKey: privateKey,\n certificate: certificate,\n });\n\n const addCertificateResult = await this._client.policyCertificates.add(\n addCertToken.serialize(),\n updatedOptions,\n );\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(addCertificateResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyCertificatesModificationResult object.\n const result = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesModificationResult: Mappers.PolicyCertificatesModificationResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesModificationResult\",\n ) as PolicyCertificatesModificationResult;\n\n return createAttestationResponse<PolicyCertificatesModificationResult>(token, result);\n },\n );\n }\n\n private keyTypeFromCertificate(cert: any): string {\n let kty: string;\n switch (cert.getSignatureAlgorithmName()) {\n case \"SHA256withRSA\":\n case \"SHA384withRSA\":\n case \"SHA512withRSA\":\n kty = \"RSA\";\n break;\n case \"SHA256withECDSA\":\n case \"SHA384withECDSA\":\n kty = \"EC\";\n break;\n default:\n kty = \"RSA\";\n break;\n }\n return kty;\n }\n\n /** Add a new certificate chain to the set of policy management certificates.\n *\n * @param pemCertificate - PEM encoded certificate to add to the set of policy management certificates.\n * @param privateKey - Existing attestation private key used to sign the incoming request.\n * @param certificate - Existing attestation certificate used to verify the incoming request.\n * @param options - Options used in the call to the service.\n * @returns An attestation response including a PolicyCertificatesModificationResult\n *\n * @remarks This API is only supported on `isolated` attestation instances.\n *\n * The signing key MUST be one of the existing attestation signing certificates. The\n * new pemCertificate is signed using the signingKey and the service will validate the\n * signature before allowing the addition.\n *\n * @throws {@link Error} when a private key is specified without a certificate and vice versa.\n * @throws {@link Error} when the key in the certificate provided does not match the private key.\n */\n public async removePolicyManagementCertificate(\n pemCertificate: string,\n privateKey: string,\n certificate: string,\n options: AttestationAdministrationClientPolicyCertificateOperationOptions = {},\n ): Promise<AttestationResponse<PolicyCertificatesModificationResult>> {\n return tracingClient.withSpan(\n \"AttestationAdministrationClient-removePolicyManagementCertificate\",\n options,\n async (updatedOptions) => {\n if ((!privateKey && certificate) || (privateKey && !certificate)) {\n throw new Error(\n \"If privateKey is specified, certificate must also be provided. If certificate is provided, privateKey must also be provided.\",\n );\n }\n\n if (privateKey && certificate) {\n verifyAttestationSigningKey(privateKey, certificate);\n }\n\n const cert = new jsrsasign.X509();\n cert.readCertPEM(pemCertificate);\n const kty = this.keyTypeFromCertificate(cert);\n\n const jwk: JsonWebKey = {\n x5C: [hexToBase64(cert.hex)],\n kty: kty,\n };\n\n const addBody: AttestationCertificateManagementBody = {\n policyCertificate: jwk,\n };\n\n const removeCertToken = AttestationTokenImpl.create({\n body: TypeDeserializer.serialize(\n addBody,\n {\n AttestationCertificateManagementBody: Mappers.AttestationCertificateManagementBody,\n JsonWebKey: Mappers.JsonWebKey,\n },\n Mappers.AttestationCertificateManagementBody,\n ),\n privateKey: privateKey,\n certificate: certificate,\n });\n\n const removeCertificateResult = await this._client.policyCertificates.remove(\n removeCertToken.serialize(),\n updatedOptions,\n );\n // The attestation token returned from the service has a PolicyResult\n // object as the body.\n const token = new AttestationTokenImpl(removeCertificateResult.token);\n const problems = token.getTokenProblems(\n await this.signingKeys(),\n options.validationOptions ?? this._validationOptions,\n );\n if (problems.length) {\n throw new Error(problems.join(\";\"));\n }\n\n // Deserialize the PolicyCertificatesModificationResult object.\n const result = TypeDeserializer.deserialize(\n token.getBody(),\n {\n PolicyCertificatesModificationResult: Mappers.PolicyCertificatesModificationResult,\n JsonWebKeySet: Mappers.JsonWebKeySet,\n JsonWebKey: Mappers.JsonWebKey,\n },\n \"PolicyCertificatesModificationResult\",\n ) as PolicyCertificatesModificationResult;\n\n return createAttestationResponse<PolicyCertificatesModificationResult>(token, result);\n },\n );\n }\n\n private async signingKeys(): Promise<AttestationSigner[]> {\n if (this._signers !== undefined) {\n return this._signers;\n }\n const jwks = await this._client.signingCertificates.get();\n const signers: AttestationSigner[] = new Array();\n jwks.keys?.forEach((element) => {\n signers.push(_attestationSignerFromGenerated(element));\n });\n this._signers = signers;\n return this._signers;\n }\n\n private _client: GeneratedClient;\n private _signers?: AttestationSigner[];\n private _validationOptions?: AttestationTokenValidationOptions;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/attestation",
3
- "version": "1.0.1-alpha.20241209.1",
3
+ "version": "1.0.1-alpha.20241211.1",
4
4
  "description": "Javascript/Typescript client implementation for the Microsoft Azure Attestation service.",
5
5
  "sdk-type": "client",
6
6
  "main": "./dist/commonjs/index.js",
@@ -34,7 +34,7 @@
34
34
  "generate:client": "autorest --typescript ./swagger/README.md",
35
35
  "integration-test": "npm run integration-test:node && npm run integration-test:browser",
36
36
  "integration-test:browser": "dev-tool run test:vitest --browser",
37
- "integration-test:node": "dev-tool run test:vitest -- --test-timeout 5000000",
37
+ "integration-test:node": "dev-tool run test:vitest --esm -- --test-timeout 5000000",
38
38
  "lint": "eslint package.json api-extractor.json src test",
39
39
  "lint:fix": "eslint package.json api-extractor.json src test --fix --fix-type [problem,suggestion]",
40
40
  "pack": "npm pack 2>&1",
@@ -122,7 +122,8 @@
122
122
  "browser",
123
123
  "react-native"
124
124
  ],
125
- "selfLink": false
125
+ "selfLink": false,
126
+ "project": "./tsconfig.src.json"
126
127
  },
127
128
  "exports": {
128
129
  "./package.json": "./package.json",