Commit iniziale
This commit is contained in:
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/aesCryptographyProvider-browser.d.mts.map
generated
vendored
Normal file
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/aesCryptographyProvider-browser.d.mts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"aesCryptographyProvider-browser.d.mts","sourceRoot":"","sources":["../../../src/cryptography/aesCryptographyProvider-browser.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAqC,MAAM,aAAa,CAAC;AAEtF;;;;;GAKG;AACH,qBAAa,uBAAwB,YAAW,oBAAoB;IAClE,OAAO,IAAI,KAAK;IAKhB,OAAO,IAAI,KAAK;IAMhB;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB,OAAO,IAAI,KAAK;IAMhB,SAAS,IAAI,KAAK;IAMlB,IAAI,IAAI,KAAK;IAMb,QAAQ,IAAI,KAAK;IAMjB,MAAM,IAAI,KAAK;IAMf,UAAU,IAAI,KAAK;CAKpB"}
|
||||
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/aesCryptographyProvider-browser.mjs.map
generated
vendored
Normal file
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/aesCryptographyProvider-browser.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"aesCryptographyProvider-browser.mjs","sourceRoot":"","sources":["../../../src/cryptography/aesCryptographyProvider-browser.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAwB,iCAAiC,EAAE,MAAM,aAAa,CAAC;AAEtF;;;;;GAKG;AACH,MAAM,OAAO,uBAAuB;IAClC,OAAO;QACL,MAAM,IAAI,iCAAiC,CACzC,yDAAyD,CAC1D,CAAC;IACJ,CAAC;IACD,OAAO;QACL,MAAM,IAAI,iCAAiC,CACzC,yDAAyD,CAC1D,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,WAAW;QACT,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO;QACL,MAAM,IAAI,iCAAiC,CACzC,yDAAyD,CAC1D,CAAC;IACJ,CAAC;IAED,SAAS;QACP,MAAM,IAAI,iCAAiC,CACzC,yDAAyD,CAC1D,CAAC;IACJ,CAAC;IAED,IAAI;QACF,MAAM,IAAI,iCAAiC,CACzC,yDAAyD,CAC1D,CAAC;IACJ,CAAC;IAED,QAAQ;QACN,MAAM,IAAI,iCAAiC,CACzC,yDAAyD,CAC1D,CAAC;IACJ,CAAC;IAED,MAAM;QACJ,MAAM,IAAI,iCAAiC,CACzC,yDAAyD,CAC1D,CAAC;IACJ,CAAC;IAED,UAAU;QACR,MAAM,IAAI,iCAAiC,CACzC,yDAAyD,CAC1D,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CryptographyProvider, LocalCryptographyUnsupportedError } from \"./models.js\";\n\n/**\n * The browser replacement of the AesCryptographyProvider. Since we do not\n * support local cryptography in the browser this replacement always returns false\n * for `supportsAlgorithm` and `supportsOperation` so that these methods should\n * never be called.\n */\nexport class AesCryptographyProvider implements CryptographyProvider {\n encrypt(): never {\n throw new LocalCryptographyUnsupportedError(\n \"AES Local cryptography is not supported in the browser.\",\n );\n }\n decrypt(): never {\n throw new LocalCryptographyUnsupportedError(\n \"AES Local cryptography is not supported in the browser.\",\n );\n }\n\n /**\n * Browser RSA provider does not support any algorithms or operations.\n */\n isSupported(): boolean {\n return false;\n }\n\n wrapKey(): never {\n throw new LocalCryptographyUnsupportedError(\n \"AES Local cryptography is not supported in the browser.\",\n );\n }\n\n unwrapKey(): never {\n throw new LocalCryptographyUnsupportedError(\n \"AES Local cryptography is not supported in the browser.\",\n );\n }\n\n sign(): never {\n throw new LocalCryptographyUnsupportedError(\n \"AES Local cryptography is not supported in the browser.\",\n );\n }\n\n signData(): never {\n throw new LocalCryptographyUnsupportedError(\n \"AES Local cryptography is not supported in the browser.\",\n );\n }\n\n verify(): never {\n throw new LocalCryptographyUnsupportedError(\n \"AES Local cryptography is not supported in the browser.\",\n );\n }\n\n verifyData(): never {\n throw new LocalCryptographyUnsupportedError(\n \"AES Local cryptography is not supported in the browser.\",\n );\n }\n}\n"]}
|
||||
22
node_modules/@azure/keyvault-keys/dist/browser/cryptography/aesCryptographyProvider.d.ts
generated
vendored
Normal file
22
node_modules/@azure/keyvault-keys/dist/browser/cryptography/aesCryptographyProvider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { CryptographyProvider } from "./models.js";
|
||||
/**
|
||||
* The browser replacement of the AesCryptographyProvider. Since we do not
|
||||
* support local cryptography in the browser this replacement always returns false
|
||||
* for `supportsAlgorithm` and `supportsOperation` so that these methods should
|
||||
* never be called.
|
||||
*/
|
||||
export declare class AesCryptographyProvider implements CryptographyProvider {
|
||||
encrypt(): never;
|
||||
decrypt(): never;
|
||||
/**
|
||||
* Browser RSA provider does not support any algorithms or operations.
|
||||
*/
|
||||
isSupported(): boolean;
|
||||
wrapKey(): never;
|
||||
unwrapKey(): never;
|
||||
sign(): never;
|
||||
signData(): never;
|
||||
verify(): never;
|
||||
verifyData(): never;
|
||||
}
|
||||
//# sourceMappingURL=aesCryptographyProvider-browser.d.mts.map
|
||||
42
node_modules/@azure/keyvault-keys/dist/browser/cryptography/aesCryptographyProvider.js
generated
vendored
Normal file
42
node_modules/@azure/keyvault-keys/dist/browser/cryptography/aesCryptographyProvider.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { LocalCryptographyUnsupportedError } from "./models.js";
|
||||
/**
|
||||
* The browser replacement of the AesCryptographyProvider. Since we do not
|
||||
* support local cryptography in the browser this replacement always returns false
|
||||
* for `supportsAlgorithm` and `supportsOperation` so that these methods should
|
||||
* never be called.
|
||||
*/
|
||||
export class AesCryptographyProvider {
|
||||
encrypt() {
|
||||
throw new LocalCryptographyUnsupportedError("AES Local cryptography is not supported in the browser.");
|
||||
}
|
||||
decrypt() {
|
||||
throw new LocalCryptographyUnsupportedError("AES Local cryptography is not supported in the browser.");
|
||||
}
|
||||
/**
|
||||
* Browser RSA provider does not support any algorithms or operations.
|
||||
*/
|
||||
isSupported() {
|
||||
return false;
|
||||
}
|
||||
wrapKey() {
|
||||
throw new LocalCryptographyUnsupportedError("AES Local cryptography is not supported in the browser.");
|
||||
}
|
||||
unwrapKey() {
|
||||
throw new LocalCryptographyUnsupportedError("AES Local cryptography is not supported in the browser.");
|
||||
}
|
||||
sign() {
|
||||
throw new LocalCryptographyUnsupportedError("AES Local cryptography is not supported in the browser.");
|
||||
}
|
||||
signData() {
|
||||
throw new LocalCryptographyUnsupportedError("AES Local cryptography is not supported in the browser.");
|
||||
}
|
||||
verify() {
|
||||
throw new LocalCryptographyUnsupportedError("AES Local cryptography is not supported in the browser.");
|
||||
}
|
||||
verifyData() {
|
||||
throw new LocalCryptographyUnsupportedError("AES Local cryptography is not supported in the browser.");
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=aesCryptographyProvider-browser.mjs.map
|
||||
8
node_modules/@azure/keyvault-keys/dist/browser/cryptography/conversions.d.ts
generated
vendored
Normal file
8
node_modules/@azure/keyvault-keys/dist/browser/cryptography/conversions.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { JsonWebKey } from "../keysModels.js";
|
||||
/**
|
||||
* @internal
|
||||
* Encode a JWK to PEM format. To do so, it internally repackages the JWK as a DER
|
||||
* that is then encoded as a PEM.
|
||||
*/
|
||||
export declare function convertJWKtoPEM(key: JsonWebKey): string;
|
||||
//# sourceMappingURL=conversions.d.ts.map
|
||||
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/conversions.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/conversions.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"conversions.d.ts","sourceRoot":"","sources":["../../../src/cryptography/conversions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAqF9C;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CAiBvD"}
|
||||
99
node_modules/@azure/keyvault-keys/dist/browser/cryptography/conversions.js
generated
vendored
Normal file
99
node_modules/@azure/keyvault-keys/dist/browser/cryptography/conversions.js
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
/**
|
||||
* @internal
|
||||
* Encodes a length of a packet in DER format
|
||||
*/
|
||||
function encodeLength(length) {
|
||||
if (length <= 127) {
|
||||
return Uint8Array.of(length);
|
||||
}
|
||||
else if (length < 256) {
|
||||
return Uint8Array.of(0x81, length);
|
||||
}
|
||||
else if (length < 65536) {
|
||||
return Uint8Array.of(0x82, length >> 8, length & 0xff);
|
||||
}
|
||||
else {
|
||||
throw new Error("Unsupported length to encode");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
* Encodes a buffer for DER, as sets the id to the given id
|
||||
*/
|
||||
function encodeBuffer(buffer, bufferId) {
|
||||
if (buffer.length === 0) {
|
||||
return buffer;
|
||||
}
|
||||
let result = new Uint8Array(buffer);
|
||||
// If the high bit is set, prepend a 0
|
||||
if (result[0] & 0x80) {
|
||||
const array = new Uint8Array(result.length + 1);
|
||||
array[0] = 0;
|
||||
array.set(result, 1);
|
||||
result = array;
|
||||
}
|
||||
// Prepend the DER header for this buffer
|
||||
const encodedLength = encodeLength(result.length);
|
||||
const totalLength = 1 + encodedLength.length + result.length;
|
||||
const outputBuffer = new Uint8Array(totalLength);
|
||||
outputBuffer[0] = bufferId;
|
||||
outputBuffer.set(encodedLength, 1);
|
||||
outputBuffer.set(result, 1 + encodedLength.length);
|
||||
return outputBuffer;
|
||||
}
|
||||
function makeSequence(encodedParts) {
|
||||
const totalLength = encodedParts.reduce((sum, part) => sum + part.length, 0);
|
||||
const sequence = new Uint8Array(totalLength);
|
||||
for (let i = 0; i < encodedParts.length; i++) {
|
||||
const previousLength = i > 0 ? encodedParts[i - 1].length : 0;
|
||||
sequence.set(encodedParts[i], previousLength);
|
||||
}
|
||||
const full_encoded = encodeBuffer(sequence, 0x30); // SEQUENCE
|
||||
return Buffer.from(full_encoded).toString("base64");
|
||||
}
|
||||
/**
|
||||
* Fill in the PEM with 64 character lines as per RFC:
|
||||
*
|
||||
* "To represent the encapsulated text of a PEM message, the encoding
|
||||
* function's output is delimited into text lines (using local
|
||||
* conventions), with each line except the last containing exactly 64
|
||||
* printable characters and the final line containing 64 or fewer
|
||||
* printable characters."
|
||||
*/
|
||||
function formatBase64Sequence(base64Sequence) {
|
||||
const lines = base64Sequence.match(/.{1,64}/g);
|
||||
let result = "";
|
||||
if (lines) {
|
||||
for (const line of lines) {
|
||||
result += line;
|
||||
result += "\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new Error("Could not create correct PEM");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
* Encode a JWK to PEM format. To do so, it internally repackages the JWK as a DER
|
||||
* that is then encoded as a PEM.
|
||||
*/
|
||||
export function convertJWKtoPEM(key) {
|
||||
let result = "";
|
||||
if (key.n && key.e) {
|
||||
const parts = [key.n, key.e];
|
||||
const encodedParts = parts.map((part) => encodeBuffer(part, 0x2)); // INTEGER
|
||||
const base64Sequence = makeSequence(encodedParts);
|
||||
result += "-----BEGIN RSA PUBLIC KEY-----\n";
|
||||
result += formatBase64Sequence(base64Sequence);
|
||||
result += "-----END RSA PUBLIC KEY-----\n";
|
||||
}
|
||||
if (!result.length) {
|
||||
throw new Error("Unsupported key format for local operations");
|
||||
}
|
||||
return result.slice(0, -1); // Removing the last new line
|
||||
}
|
||||
//# sourceMappingURL=conversions.js.map
|
||||
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/conversions.js.map
generated
vendored
Normal file
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/conversions.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/crypto-browser.d.mts.map
generated
vendored
Normal file
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/crypto-browser.d.mts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"crypto-browser.d.mts","sourceRoot":"","sources":["../../../src/cryptography/crypto-browser.mts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAsB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAIvF;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,KAAK,CAIzE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAIvD"}
|
||||
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/crypto-browser.mjs.map
generated
vendored
Normal file
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/crypto-browser.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"crypto-browser.mjs","sourceRoot":"","sources":["../../../src/cryptography/crypto-browser.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,iCAAiC,EAAE,MAAM,aAAa,CAAC;AAEhE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,UAAkB,EAAE,KAAiB;IACpE,MAAM,IAAI,iCAAiC,CACzC,uDAAuD,CACxD,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,UAAkB,EAAE,KAAiB;IAChE,MAAM,IAAI,iCAAiC,CACzC,uDAAuD,CACxD,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,MAAM,IAAI,iCAAiC,CACzC,sDAAsD,CACvD,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { LocalCryptographyUnsupportedError } from \"./models.js\";\n\n/**\n * @internal\n * Use the platform-local hashing functionality\n */\nexport async function createHash(_algorithm: string, _data: Uint8Array): Promise<Buffer> {\n throw new LocalCryptographyUnsupportedError(\n \"Our libraries don't currently support browser hashing\",\n );\n}\n\n/**\n * @internal\n * Use the platform-local verify functionality\n */\nexport function createVerify(_algorithm: string, _data: Uint8Array): never {\n throw new LocalCryptographyUnsupportedError(\n \"Our libraries don't currently support browser hashing\",\n );\n}\n\n/**\n * @internal\n * Use the platform-local randomBytes functionality\n */\nexport function randomBytes(_length: number): Uint8Array {\n throw new LocalCryptographyUnsupportedError(\n \"Our libraries don't currently support browser crypto\",\n );\n}\n"]}
|
||||
16
node_modules/@azure/keyvault-keys/dist/browser/cryptography/crypto.d.ts
generated
vendored
Normal file
16
node_modules/@azure/keyvault-keys/dist/browser/cryptography/crypto.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* @internal
|
||||
* Use the platform-local hashing functionality
|
||||
*/
|
||||
export declare function createHash(_algorithm: string, _data: Uint8Array): Promise<Buffer>;
|
||||
/**
|
||||
* @internal
|
||||
* Use the platform-local verify functionality
|
||||
*/
|
||||
export declare function createVerify(_algorithm: string, _data: Uint8Array): never;
|
||||
/**
|
||||
* @internal
|
||||
* Use the platform-local randomBytes functionality
|
||||
*/
|
||||
export declare function randomBytes(_length: number): Uint8Array;
|
||||
//# sourceMappingURL=crypto-browser.d.mts.map
|
||||
25
node_modules/@azure/keyvault-keys/dist/browser/cryptography/crypto.js
generated
vendored
Normal file
25
node_modules/@azure/keyvault-keys/dist/browser/cryptography/crypto.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { LocalCryptographyUnsupportedError } from "./models.js";
|
||||
/**
|
||||
* @internal
|
||||
* Use the platform-local hashing functionality
|
||||
*/
|
||||
export async function createHash(_algorithm, _data) {
|
||||
throw new LocalCryptographyUnsupportedError("Our libraries don't currently support browser hashing");
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
* Use the platform-local verify functionality
|
||||
*/
|
||||
export function createVerify(_algorithm, _data) {
|
||||
throw new LocalCryptographyUnsupportedError("Our libraries don't currently support browser hashing");
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
* Use the platform-local randomBytes functionality
|
||||
*/
|
||||
export function randomBytes(_length) {
|
||||
throw new LocalCryptographyUnsupportedError("Our libraries don't currently support browser crypto");
|
||||
}
|
||||
//# sourceMappingURL=crypto-browser.mjs.map
|
||||
101
node_modules/@azure/keyvault-keys/dist/browser/cryptography/models.d.ts
generated
vendored
Normal file
101
node_modules/@azure/keyvault-keys/dist/browser/cryptography/models.d.ts
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
import { OperationOptions } from "@azure/core-client";
|
||||
import { DecryptOptions, DecryptParameters, DecryptResult, EncryptOptions, EncryptParameters, EncryptResult, KeyWrapAlgorithm, SignOptions, SignResult, SignatureAlgorithm, UnwrapKeyOptions, UnwrapResult, VerifyOptions, VerifyResult, WrapKeyOptions, WrapResult } from "../index.js";
|
||||
export declare class LocalCryptographyUnsupportedError extends Error {
|
||||
}
|
||||
/**
|
||||
* The set of operations a {@link CryptographyProvider} supports.
|
||||
*
|
||||
* This corresponds to every single method on the interface so that providers
|
||||
* can declare whether they support this method or not.
|
||||
*
|
||||
* Purposely more granular than {@link KnownKeyOperations} because some providers
|
||||
* support verifyData but not verify.
|
||||
* @internal
|
||||
*/
|
||||
export type CryptographyProviderOperation = "encrypt" | "decrypt" | "wrapKey" | "unwrapKey" | "sign" | "signData" | "verify" | "verifyData";
|
||||
/**
|
||||
*
|
||||
* Represents an object that can perform cryptography operations.
|
||||
* @internal
|
||||
*/
|
||||
export interface CryptographyProvider {
|
||||
/**
|
||||
* Encrypts the given plaintext with the specified encryption parameters.
|
||||
* @internal
|
||||
*
|
||||
* @param encryptParameters - The encryption parameters, keyed on the encryption algorithm chosen.
|
||||
* @param options - Additional options.
|
||||
*/
|
||||
encrypt(encryptParameters: EncryptParameters, options?: EncryptOptions): Promise<EncryptResult>;
|
||||
/**
|
||||
* Decrypts the given ciphertext with the specified decryption parameters.
|
||||
* @internal
|
||||
*
|
||||
* @param decryptParameters - The decryption parameters.
|
||||
* @param options - Additional options.
|
||||
*/
|
||||
decrypt(decryptParameters: DecryptParameters, options?: DecryptOptions): Promise<DecryptResult>;
|
||||
/**
|
||||
*
|
||||
* @param algorithm - The algorithm to check support for.
|
||||
* @param operation - The {@link CryptographyProviderOperation} to check support for.
|
||||
*/
|
||||
isSupported(algorithm: string, operation: CryptographyProviderOperation): boolean;
|
||||
/**
|
||||
* Wraps the given key using the specified cryptography algorithm
|
||||
* @internal
|
||||
*
|
||||
* @param algorithm - The encryption algorithm to use to wrap the given key.
|
||||
* @param keyToWrap - The key to wrap.
|
||||
* @param options - Additional options.
|
||||
*/
|
||||
wrapKey(algorithm: KeyWrapAlgorithm, keyToWrap: Uint8Array, options?: WrapKeyOptions): Promise<WrapResult>;
|
||||
/**
|
||||
* Unwraps the given wrapped key using the specified cryptography algorithm
|
||||
* @internal
|
||||
*
|
||||
* @param algorithm - The decryption algorithm to use to unwrap the key.
|
||||
* @param encryptedKey - The encrypted key to unwrap.
|
||||
* @param options - Additional options.
|
||||
*/
|
||||
unwrapKey(algorithm: KeyWrapAlgorithm, encryptedKey: Uint8Array, options?: UnwrapKeyOptions): Promise<UnwrapResult>;
|
||||
/**
|
||||
* Cryptographically sign the digest of a message
|
||||
* @internal
|
||||
*
|
||||
* @param algorithm - The signing algorithm to use.
|
||||
* @param digest - The digest of the data to sign.
|
||||
* @param options - Additional options.
|
||||
*/
|
||||
sign(algorithm: SignatureAlgorithm, digest: Uint8Array, options?: SignOptions): Promise<SignResult>;
|
||||
/**
|
||||
* Cryptographically sign a block of data
|
||||
* @internal
|
||||
*
|
||||
* @param algorithm - The signing algorithm to use.
|
||||
* @param data - The data to sign.
|
||||
* @param options - Additional options.
|
||||
*/
|
||||
signData(algorithm: SignatureAlgorithm, data: Uint8Array, options?: SignOptions): Promise<SignResult>;
|
||||
/**
|
||||
* Verify the signed message digest
|
||||
* @internal
|
||||
*
|
||||
* @param algorithm - The signing algorithm to use to verify with.
|
||||
* @param digest - The digest to verify.
|
||||
* @param signature - The signature to verify the digest against.
|
||||
* @param options - Additional options.
|
||||
*/
|
||||
verify(algorithm: SignatureAlgorithm, digest: Uint8Array, signature: Uint8Array, options?: VerifyOptions): Promise<VerifyResult>;
|
||||
/**
|
||||
* Verify the signed block of data
|
||||
* @internal
|
||||
*
|
||||
* @param algorithm - The algorithm to use to verify with.
|
||||
* @param data - The signed block of data to verify.
|
||||
* @param signature - The signature to verify the block against.
|
||||
* @param updatedOptions - Additional options.
|
||||
*/
|
||||
verifyData(algorithm: string, data: Uint8Array, signature: Uint8Array, updatedOptions: OperationOptions): Promise<VerifyResult>;
|
||||
}
|
||||
//# sourceMappingURL=models.d.ts.map
|
||||
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/models.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/models.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../src/cryptography/models.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,cAAc,EACd,UAAU,EACX,MAAM,aAAa,CAAC;AAErB,qBAAa,iCAAkC,SAAQ,KAAK;CAAG;AAE/D;;;;;;;;;GASG;AACH,MAAM,MAAM,6BAA6B,GACrC,SAAS,GACT,SAAS,GACT,SAAS,GACT,WAAW,GACX,MAAM,GACN,UAAU,GACV,QAAQ,GACR,YAAY,CAAC;AAEjB;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAEhG;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAEhG;;;;OAIG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,6BAA6B,GAAG,OAAO,CAAC;IAElF;;;;;;;OAOG;IACH,OAAO,CACL,SAAS,EAAE,gBAAgB,EAC3B,SAAS,EAAE,UAAU,EACrB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,CAAC;IAEvB;;;;;;;OAOG;IACH,SAAS,CACP,SAAS,EAAE,gBAAgB,EAC3B,YAAY,EAAE,UAAU,EACxB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,YAAY,CAAC,CAAC;IAEzB;;;;;;;OAOG;IACH,IAAI,CACF,SAAS,EAAE,kBAAkB,EAC7B,MAAM,EAAE,UAAU,EAClB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,UAAU,CAAC,CAAC;IAEvB;;;;;;;OAOG;IACH,QAAQ,CACN,SAAS,EAAE,kBAAkB,EAC7B,IAAI,EAAE,UAAU,EAChB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,UAAU,CAAC,CAAC;IAEvB;;;;;;;;OAQG;IACH,MAAM,CACJ,SAAS,EAAE,kBAAkB,EAC7B,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,UAAU,EACrB,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,YAAY,CAAC,CAAC;IAEzB;;;;;;;;OAQG;IACH,UAAU,CACR,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,UAAU,EACrB,cAAc,EAAE,gBAAgB,GAC/B,OAAO,CAAC,YAAY,CAAC,CAAC;CAC1B"}
|
||||
5
node_modules/@azure/keyvault-keys/dist/browser/cryptography/models.js
generated
vendored
Normal file
5
node_modules/@azure/keyvault-keys/dist/browser/cryptography/models.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
export class LocalCryptographyUnsupportedError extends Error {
|
||||
}
|
||||
//# sourceMappingURL=models.js.map
|
||||
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/models.js.map
generated
vendored
Normal file
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/models.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/cryptography/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAsBlC,MAAM,OAAO,iCAAkC,SAAQ,KAAK;CAAG","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { OperationOptions } from \"@azure/core-client\";\nimport {\n DecryptOptions,\n DecryptParameters,\n DecryptResult,\n EncryptOptions,\n EncryptParameters,\n EncryptResult,\n KeyWrapAlgorithm,\n SignOptions,\n SignResult,\n SignatureAlgorithm,\n UnwrapKeyOptions,\n UnwrapResult,\n VerifyOptions,\n VerifyResult,\n WrapKeyOptions,\n WrapResult,\n} from \"../index.js\";\n\nexport class LocalCryptographyUnsupportedError extends Error {}\n\n/**\n * The set of operations a {@link CryptographyProvider} supports.\n *\n * This corresponds to every single method on the interface so that providers\n * can declare whether they support this method or not.\n *\n * Purposely more granular than {@link KnownKeyOperations} because some providers\n * support verifyData but not verify.\n * @internal\n */\nexport type CryptographyProviderOperation =\n | \"encrypt\"\n | \"decrypt\"\n | \"wrapKey\"\n | \"unwrapKey\"\n | \"sign\"\n | \"signData\"\n | \"verify\"\n | \"verifyData\";\n\n/**\n *\n * Represents an object that can perform cryptography operations.\n * @internal\n */\nexport interface CryptographyProvider {\n /**\n * Encrypts the given plaintext with the specified encryption parameters.\n * @internal\n *\n * @param encryptParameters - The encryption parameters, keyed on the encryption algorithm chosen.\n * @param options - Additional options.\n */\n encrypt(encryptParameters: EncryptParameters, options?: EncryptOptions): Promise<EncryptResult>;\n\n /**\n * Decrypts the given ciphertext with the specified decryption parameters.\n * @internal\n *\n * @param decryptParameters - The decryption parameters.\n * @param options - Additional options.\n */\n decrypt(decryptParameters: DecryptParameters, options?: DecryptOptions): Promise<DecryptResult>;\n\n /**\n *\n * @param algorithm - The algorithm to check support for.\n * @param operation - The {@link CryptographyProviderOperation} to check support for.\n */\n isSupported(algorithm: string, operation: CryptographyProviderOperation): boolean;\n\n /**\n * Wraps the given key using the specified cryptography algorithm\n * @internal\n *\n * @param algorithm - The encryption algorithm to use to wrap the given key.\n * @param keyToWrap - The key to wrap.\n * @param options - Additional options.\n */\n wrapKey(\n algorithm: KeyWrapAlgorithm,\n keyToWrap: Uint8Array,\n options?: WrapKeyOptions,\n ): Promise<WrapResult>;\n\n /**\n * Unwraps the given wrapped key using the specified cryptography algorithm\n * @internal\n *\n * @param algorithm - The decryption algorithm to use to unwrap the key.\n * @param encryptedKey - The encrypted key to unwrap.\n * @param options - Additional options.\n */\n unwrapKey(\n algorithm: KeyWrapAlgorithm,\n encryptedKey: Uint8Array,\n options?: UnwrapKeyOptions,\n ): Promise<UnwrapResult>;\n\n /**\n * Cryptographically sign the digest of a message\n * @internal\n *\n * @param algorithm - The signing algorithm to use.\n * @param digest - The digest of the data to sign.\n * @param options - Additional options.\n */\n sign(\n algorithm: SignatureAlgorithm,\n digest: Uint8Array,\n options?: SignOptions,\n ): Promise<SignResult>;\n\n /**\n * Cryptographically sign a block of data\n * @internal\n *\n * @param algorithm - The signing algorithm to use.\n * @param data - The data to sign.\n * @param options - Additional options.\n */\n signData(\n algorithm: SignatureAlgorithm,\n data: Uint8Array,\n options?: SignOptions,\n ): Promise<SignResult>;\n\n /**\n * Verify the signed message digest\n * @internal\n *\n * @param algorithm - The signing algorithm to use to verify with.\n * @param digest - The digest to verify.\n * @param signature - The signature to verify the digest against.\n * @param options - Additional options.\n */\n verify(\n algorithm: SignatureAlgorithm,\n digest: Uint8Array,\n signature: Uint8Array,\n options?: VerifyOptions,\n ): Promise<VerifyResult>;\n\n /**\n * Verify the signed block of data\n * @internal\n *\n * @param algorithm - The algorithm to use to verify with.\n * @param data - The signed block of data to verify.\n * @param signature - The signature to verify the block against.\n * @param updatedOptions - Additional options.\n */\n verifyData(\n algorithm: string,\n data: Uint8Array,\n signature: Uint8Array,\n updatedOptions: OperationOptions,\n ): Promise<VerifyResult>;\n}\n"]}
|
||||
58
node_modules/@azure/keyvault-keys/dist/browser/cryptography/remoteCryptographyProvider.d.ts
generated
vendored
Normal file
58
node_modules/@azure/keyvault-keys/dist/browser/cryptography/remoteCryptographyProvider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
import { TokenCredential } from "@azure/core-auth";
|
||||
import { DecryptOptions, DecryptParameters, DecryptResult, EncryptOptions, EncryptParameters, EncryptResult, KeyWrapAlgorithm, SignOptions, SignResult, UnwrapKeyOptions, VerifyOptions, VerifyResult, WrapKeyOptions, WrapResult } from "../cryptographyClientModels.js";
|
||||
import { UnwrapResult } from "../cryptographyClientModels.js";
|
||||
import { CryptographyClientOptions, GetKeyOptions, KeyVaultKey } from "../keysModels.js";
|
||||
import { CryptographyProvider, CryptographyProviderOperation } from "./models.js";
|
||||
/**
|
||||
* The remote cryptography provider is used to run crypto operations against KeyVault.
|
||||
* @internal
|
||||
*/
|
||||
export declare class RemoteCryptographyProvider implements CryptographyProvider {
|
||||
constructor(key: string | KeyVaultKey, credential: TokenCredential, pipelineOptions?: CryptographyClientOptions);
|
||||
isSupported(_algorithm: string, _operation: CryptographyProviderOperation): boolean;
|
||||
encrypt(encryptParameters: EncryptParameters, options?: EncryptOptions): Promise<EncryptResult>;
|
||||
decrypt(decryptParameters: DecryptParameters, options?: DecryptOptions): Promise<DecryptResult>;
|
||||
wrapKey(algorithm: KeyWrapAlgorithm, keyToWrap: Uint8Array, options?: WrapKeyOptions): Promise<WrapResult>;
|
||||
unwrapKey(algorithm: KeyWrapAlgorithm, encryptedKey: Uint8Array, options?: UnwrapKeyOptions): Promise<UnwrapResult>;
|
||||
sign(algorithm: string, digest: Uint8Array, options?: SignOptions): Promise<SignResult>;
|
||||
verifyData(algorithm: string, data: Uint8Array, signature: Uint8Array, options?: VerifyOptions): Promise<VerifyResult>;
|
||||
verify(algorithm: string, digest: Uint8Array, signature: Uint8Array, options?: VerifyOptions): Promise<VerifyResult>;
|
||||
signData(algorithm: string, data: Uint8Array, options?: SignOptions): Promise<SignResult>;
|
||||
/**
|
||||
* The base URL to the vault.
|
||||
*/
|
||||
readonly vaultUrl: string;
|
||||
/**
|
||||
* The ID of the key used to perform cryptographic operations for the client.
|
||||
*/
|
||||
get keyId(): string | undefined;
|
||||
/**
|
||||
* Gets the {@link KeyVaultKey} used for cryptography operations, fetching it
|
||||
* from KeyVault if necessary.
|
||||
* @param options - Additional options.
|
||||
*/
|
||||
getKey(options?: GetKeyOptions): Promise<KeyVaultKey>;
|
||||
/**
|
||||
* A reference to the auto-generated KeyVault HTTP client.
|
||||
*/
|
||||
private client;
|
||||
/**
|
||||
* A reference to the key used for the cryptographic operations.
|
||||
* Based on what was provided to the CryptographyClient constructor,
|
||||
* it can be either a string with the URL of a Key Vault Key, or an already parsed {@link KeyVaultKey}.
|
||||
*/
|
||||
private key;
|
||||
/**
|
||||
* Name of the key the client represents
|
||||
*/
|
||||
private name;
|
||||
/**
|
||||
* Version of the key the client represents
|
||||
*/
|
||||
private version;
|
||||
/**
|
||||
* Attempts to retrieve the ID of the key.
|
||||
*/
|
||||
private getKeyID;
|
||||
}
|
||||
//# sourceMappingURL=remoteCryptographyProvider.d.ts.map
|
||||
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/remoteCryptographyProvider.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/remoteCryptographyProvider.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"remoteCryptographyProvider.d.ts","sourceRoot":"","sources":["../../../src/cryptography/remoteCryptographyProvider.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,cAAc,EACd,UAAU,EACX,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAG9D,OAAO,EACL,yBAAyB,EACzB,aAAa,EACb,WAAW,EAEZ,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,oBAAoB,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAKlF;;;GAGG;AACH,qBAAa,0BAA2B,YAAW,oBAAoB;gBAEnE,GAAG,EAAE,MAAM,GAAG,WAAW,EACzB,UAAU,EAAE,eAAe,EAC3B,eAAe,GAAE,yBAA8B;IAkCjD,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,6BAA6B,GAAG,OAAO;IAInF,OAAO,CACL,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,aAAa,CAAC;IA6BzB,OAAO,CACL,iBAAiB,EAAE,iBAAiB,EACpC,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,aAAa,CAAC;IAyBzB,OAAO,CACL,SAAS,EAAE,gBAAgB,EAC3B,SAAS,EAAE,UAAU,EACrB,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,UAAU,CAAC;IAuBtB,SAAS,CACP,SAAS,EAAE,gBAAgB,EAC3B,YAAY,EAAE,UAAU,EACxB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,YAAY,CAAC;IAuBxB,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IAmB3F,UAAU,CACR,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,UAAU,EACrB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC;IAWxB,MAAM,CACJ,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,UAAU,EACrB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC;IAsBxB,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IAmB7F;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,GAAG,SAAS,CAE9B;IAED;;;;OAIG;IACH,MAAM,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,WAAW,CAAC;IAsBzD;;OAEG;IACH,OAAO,CAAC,MAAM,CAAiB;IAE/B;;;;OAIG;IACH,OAAO,CAAC,GAAG,CAAuB;IAElC;;OAEG;IACH,OAAO,CAAC,IAAI,CAAS;IAErB;;OAEG;IACH,OAAO,CAAC,OAAO,CAAS;IAExB;;OAEG;IACH,OAAO,CAAC,QAAQ;CAUjB"}
|
||||
198
node_modules/@azure/keyvault-keys/dist/browser/cryptography/remoteCryptographyProvider.js
generated
vendored
Normal file
198
node_modules/@azure/keyvault-keys/dist/browser/cryptography/remoteCryptographyProvider.js
generated
vendored
Normal file
@@ -0,0 +1,198 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { __rest } from "tslib";
|
||||
import { SDK_VERSION } from "../constants.js";
|
||||
import { KeyVaultClient } from "../generated/index.js";
|
||||
import { parseKeyVaultKeyIdentifier } from "../identifier.js";
|
||||
import { LATEST_API_VERSION, } from "../keysModels.js";
|
||||
import { getKeyFromKeyBundle } from "../transformations.js";
|
||||
import { createHash } from "./crypto.js";
|
||||
import { logger } from "../log.js";
|
||||
import { keyVaultAuthenticationPolicy } from "@azure/keyvault-common";
|
||||
import { tracingClient } from "../tracing.js";
|
||||
/**
|
||||
* The remote cryptography provider is used to run crypto operations against KeyVault.
|
||||
* @internal
|
||||
*/
|
||||
export class RemoteCryptographyProvider {
|
||||
constructor(key, credential, pipelineOptions = {}) {
|
||||
var _a;
|
||||
this.client = getOrInitializeClient(credential, pipelineOptions);
|
||||
this.key = key;
|
||||
let keyId;
|
||||
if (typeof key === "string") {
|
||||
keyId = key;
|
||||
}
|
||||
else {
|
||||
keyId = key.id;
|
||||
}
|
||||
try {
|
||||
const parsed = parseKeyVaultKeyIdentifier(keyId);
|
||||
if (parsed.name === "") {
|
||||
throw new Error("Could not find 'name' of key in key URL");
|
||||
}
|
||||
if (!parsed.vaultUrl || parsed.vaultUrl === "") {
|
||||
throw new Error("Could not find 'vaultUrl' of key in key URL");
|
||||
}
|
||||
this.vaultUrl = parsed.vaultUrl;
|
||||
this.name = parsed.name;
|
||||
this.version = (_a = parsed.version) !== null && _a !== void 0 ? _a : "";
|
||||
}
|
||||
catch (err) {
|
||||
logger.error(err);
|
||||
throw new Error(`${keyId} is not a valid Key Vault key ID`);
|
||||
}
|
||||
}
|
||||
// The remote client supports all algorithms and all operations.
|
||||
isSupported(_algorithm, _operation) {
|
||||
return true;
|
||||
}
|
||||
encrypt(encryptParameters, options = {}) {
|
||||
const { algorithm, plaintext } = encryptParameters, params = __rest(encryptParameters, ["algorithm", "plaintext"]);
|
||||
const requestOptions = Object.assign(Object.assign({}, options), params);
|
||||
return tracingClient.withSpan("RemoteCryptographyProvider.encrypt", requestOptions, async (updatedOptions) => {
|
||||
const result = await this.client.encrypt(this.vaultUrl, this.name, this.version, algorithm, plaintext, updatedOptions);
|
||||
return {
|
||||
algorithm: encryptParameters.algorithm,
|
||||
result: result.result,
|
||||
keyID: this.getKeyID(),
|
||||
additionalAuthenticatedData: result.additionalAuthenticatedData,
|
||||
authenticationTag: result.authenticationTag,
|
||||
iv: result.iv,
|
||||
};
|
||||
});
|
||||
}
|
||||
decrypt(decryptParameters, options = {}) {
|
||||
const { algorithm, ciphertext } = decryptParameters, params = __rest(decryptParameters, ["algorithm", "ciphertext"]);
|
||||
const requestOptions = Object.assign(Object.assign({}, options), params);
|
||||
return tracingClient.withSpan("RemoteCryptographyProvider.decrypt", requestOptions, async (updatedOptions) => {
|
||||
const result = await this.client.decrypt(this.vaultUrl, this.name, this.version, algorithm, ciphertext, updatedOptions);
|
||||
return {
|
||||
result: result.result,
|
||||
keyID: this.getKeyID(),
|
||||
algorithm,
|
||||
};
|
||||
});
|
||||
}
|
||||
wrapKey(algorithm, keyToWrap, options = {}) {
|
||||
return tracingClient.withSpan("RemoteCryptographyProvider.wrapKey", options, async (updatedOptions) => {
|
||||
const result = await this.client.wrapKey(this.vaultUrl, this.name, this.version, algorithm, keyToWrap, updatedOptions);
|
||||
return {
|
||||
result: result.result,
|
||||
algorithm,
|
||||
keyID: this.getKeyID(),
|
||||
};
|
||||
});
|
||||
}
|
||||
unwrapKey(algorithm, encryptedKey, options = {}) {
|
||||
return tracingClient.withSpan("RemoteCryptographyProvider.unwrapKey", options, async (updatedOptions) => {
|
||||
const result = await this.client.unwrapKey(this.vaultUrl, this.name, this.version, algorithm, encryptedKey, updatedOptions);
|
||||
return {
|
||||
result: result.result,
|
||||
algorithm,
|
||||
keyID: this.getKeyID(),
|
||||
};
|
||||
});
|
||||
}
|
||||
sign(algorithm, digest, options = {}) {
|
||||
return tracingClient.withSpan("RemoteCryptographyProvider.sign", options, async (updatedOptions) => {
|
||||
const result = await this.client.sign(this.vaultUrl, this.name, this.version, algorithm, digest, updatedOptions);
|
||||
return { result: result.result, algorithm, keyID: this.getKeyID() };
|
||||
});
|
||||
}
|
||||
verifyData(algorithm, data, signature, options = {}) {
|
||||
return tracingClient.withSpan("RemoteCryptographyProvider.verifyData", options, async (updatedOptions) => {
|
||||
const hash = await createHash(algorithm, data);
|
||||
return this.verify(algorithm, hash, signature, updatedOptions);
|
||||
});
|
||||
}
|
||||
verify(algorithm, digest, signature, options = {}) {
|
||||
return tracingClient.withSpan("RemoteCryptographyProvider.verify", options, async (updatedOptions) => {
|
||||
const response = await this.client.verify(this.vaultUrl, this.name, this.version, algorithm, digest, signature, updatedOptions);
|
||||
return {
|
||||
result: response.value ? response.value : false,
|
||||
keyID: this.getKeyID(),
|
||||
};
|
||||
});
|
||||
}
|
||||
signData(algorithm, data, options = {}) {
|
||||
return tracingClient.withSpan("RemoteCryptographyProvider.signData", options, async (updatedOptions) => {
|
||||
const digest = await createHash(algorithm, data);
|
||||
const result = await this.client.sign(this.vaultUrl, this.name, this.version, algorithm, digest, updatedOptions);
|
||||
return { result: result.result, algorithm, keyID: this.getKeyID() };
|
||||
});
|
||||
}
|
||||
/**
|
||||
* The ID of the key used to perform cryptographic operations for the client.
|
||||
*/
|
||||
get keyId() {
|
||||
return this.getKeyID();
|
||||
}
|
||||
/**
|
||||
* Gets the {@link KeyVaultKey} used for cryptography operations, fetching it
|
||||
* from KeyVault if necessary.
|
||||
* @param options - Additional options.
|
||||
*/
|
||||
getKey(options = {}) {
|
||||
return tracingClient.withSpan("RemoteCryptographyProvider.getKey", options, async (updatedOptions) => {
|
||||
if (typeof this.key === "string") {
|
||||
if (!this.name || this.name === "") {
|
||||
throw new Error("getKey requires a key with a name");
|
||||
}
|
||||
const response = await this.client.getKey(this.vaultUrl, this.name, options && options.version ? options.version : this.version ? this.version : "", updatedOptions);
|
||||
this.key = getKeyFromKeyBundle(response);
|
||||
}
|
||||
return this.key;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Attempts to retrieve the ID of the key.
|
||||
*/
|
||||
getKeyID() {
|
||||
let kid;
|
||||
if (typeof this.key !== "string") {
|
||||
kid = this.key.id;
|
||||
}
|
||||
else {
|
||||
kid = this.key;
|
||||
}
|
||||
return kid;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* A helper method to either get the passed down generated client or initialize a new one.
|
||||
* An already constructed generated client may be passed down from {@link KeyClient} in which case we should reuse it.
|
||||
*
|
||||
* @internal
|
||||
* @param credential - The credential to use when initializing a new client.
|
||||
* @param options - The options for constructing a client or the underlying client if one already exists.
|
||||
* @returns - A generated client instance
|
||||
*/
|
||||
function getOrInitializeClient(credential, options) {
|
||||
if (options.generatedClient) {
|
||||
return options.generatedClient;
|
||||
}
|
||||
const libInfo = `azsdk-js-keyvault-keys/${SDK_VERSION}`;
|
||||
const userAgentOptions = options.userAgentOptions;
|
||||
options.userAgentOptions = {
|
||||
userAgentPrefix: userAgentOptions && userAgentOptions.userAgentPrefix
|
||||
? `${userAgentOptions.userAgentPrefix} ${libInfo}`
|
||||
: libInfo,
|
||||
};
|
||||
const internalPipelineOptions = Object.assign(Object.assign({}, options), { loggingOptions: {
|
||||
logger: logger.info,
|
||||
allowedHeaderNames: [
|
||||
"x-ms-keyvault-region",
|
||||
"x-ms-keyvault-network-info",
|
||||
"x-ms-keyvault-service-version",
|
||||
],
|
||||
} });
|
||||
const client = new KeyVaultClient(options.serviceVersion || LATEST_API_VERSION, internalPipelineOptions);
|
||||
// The authentication policy must come after the deserialization policy since the deserialization policy
|
||||
// converts 401 responses to an Error, and we don't want to deal with that.
|
||||
client.pipeline.addPolicy(keyVaultAuthenticationPolicy(credential, options), {
|
||||
afterPolicies: ["deserializationPolicy"],
|
||||
});
|
||||
return client;
|
||||
}
|
||||
//# sourceMappingURL=remoteCryptographyProvider.js.map
|
||||
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/remoteCryptographyProvider.js.map
generated
vendored
Normal file
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/remoteCryptographyProvider.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/rsaCryptographyProvider-browser.d.mts.map
generated
vendored
Normal file
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/rsaCryptographyProvider-browser.d.mts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"rsaCryptographyProvider-browser.d.mts","sourceRoot":"","sources":["../../../src/cryptography/rsaCryptographyProvider-browser.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAqC,MAAM,aAAa,CAAC;AAEtF;;;;;GAKG;AACH,qBAAa,uBAAwB,YAAW,oBAAoB;IAClE,OAAO,IAAI,KAAK;IAKhB,OAAO,IAAI,KAAK;IAMhB;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB,OAAO,IAAI,KAAK;IAMhB,SAAS,IAAI,KAAK;IAMlB,IAAI,IAAI,KAAK;IAMb,QAAQ,IAAI,KAAK;IAMjB,MAAM,IAAI,KAAK;IAMf,UAAU,IAAI,KAAK;CAKpB"}
|
||||
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/rsaCryptographyProvider-browser.mjs.map
generated
vendored
Normal file
1
node_modules/@azure/keyvault-keys/dist/browser/cryptography/rsaCryptographyProvider-browser.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"rsaCryptographyProvider-browser.mjs","sourceRoot":"","sources":["../../../src/cryptography/rsaCryptographyProvider-browser.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAwB,iCAAiC,EAAE,MAAM,aAAa,CAAC;AAEtF;;;;;GAKG;AACH,MAAM,OAAO,uBAAuB;IAClC,OAAO;QACL,MAAM,IAAI,iCAAiC,CACzC,yDAAyD,CAC1D,CAAC;IACJ,CAAC;IACD,OAAO;QACL,MAAM,IAAI,iCAAiC,CACzC,yDAAyD,CAC1D,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,WAAW;QACT,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO;QACL,MAAM,IAAI,iCAAiC,CACzC,yDAAyD,CAC1D,CAAC;IACJ,CAAC;IAED,SAAS;QACP,MAAM,IAAI,iCAAiC,CACzC,yDAAyD,CAC1D,CAAC;IACJ,CAAC;IAED,IAAI;QACF,MAAM,IAAI,iCAAiC,CACzC,yDAAyD,CAC1D,CAAC;IACJ,CAAC;IAED,QAAQ;QACN,MAAM,IAAI,iCAAiC,CACzC,yDAAyD,CAC1D,CAAC;IACJ,CAAC;IAED,MAAM;QACJ,MAAM,IAAI,iCAAiC,CACzC,yDAAyD,CAC1D,CAAC;IACJ,CAAC;IAED,UAAU;QACR,MAAM,IAAI,iCAAiC,CACzC,yDAAyD,CAC1D,CAAC;IACJ,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CryptographyProvider, LocalCryptographyUnsupportedError } from \"./models.js\";\n\n/**\n * The browser replacement of the RsaCryptographyProvider. Since we do not\n * support local cryptography in the browser this replacement always returns false\n * for `supportsAlgorithm` and `supportsOperation` so that these methods should\n * never be called.\n */\nexport class RsaCryptographyProvider implements CryptographyProvider {\n encrypt(): never {\n throw new LocalCryptographyUnsupportedError(\n \"RSA Local cryptography is not supported in the browser.\",\n );\n }\n decrypt(): never {\n throw new LocalCryptographyUnsupportedError(\n \"RSA Local cryptography is not supported in the browser.\",\n );\n }\n\n /**\n * Browser RSA Provider does not support any algorithms or operations.\n */\n isSupported(): boolean {\n return false;\n }\n\n wrapKey(): never {\n throw new LocalCryptographyUnsupportedError(\n \"RSA Local cryptography is not supported in the browser.\",\n );\n }\n\n unwrapKey(): never {\n throw new LocalCryptographyUnsupportedError(\n \"RSA Local cryptography is not supported in the browser.\",\n );\n }\n\n sign(): never {\n throw new LocalCryptographyUnsupportedError(\n \"RSA Local cryptography is not supported in the browser.\",\n );\n }\n\n signData(): never {\n throw new LocalCryptographyUnsupportedError(\n \"RSA Local cryptography is not supported in the browser.\",\n );\n }\n\n verify(): never {\n throw new LocalCryptographyUnsupportedError(\n \"RSA Local cryptography is not supported in the browser.\",\n );\n }\n\n verifyData(): never {\n throw new LocalCryptographyUnsupportedError(\n \"RSA Local cryptography is not supported in the browser.\",\n );\n }\n}\n"]}
|
||||
22
node_modules/@azure/keyvault-keys/dist/browser/cryptography/rsaCryptographyProvider.d.ts
generated
vendored
Normal file
22
node_modules/@azure/keyvault-keys/dist/browser/cryptography/rsaCryptographyProvider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
import { CryptographyProvider } from "./models.js";
|
||||
/**
|
||||
* The browser replacement of the RsaCryptographyProvider. Since we do not
|
||||
* support local cryptography in the browser this replacement always returns false
|
||||
* for `supportsAlgorithm` and `supportsOperation` so that these methods should
|
||||
* never be called.
|
||||
*/
|
||||
export declare class RsaCryptographyProvider implements CryptographyProvider {
|
||||
encrypt(): never;
|
||||
decrypt(): never;
|
||||
/**
|
||||
* Browser RSA Provider does not support any algorithms or operations.
|
||||
*/
|
||||
isSupported(): boolean;
|
||||
wrapKey(): never;
|
||||
unwrapKey(): never;
|
||||
sign(): never;
|
||||
signData(): never;
|
||||
verify(): never;
|
||||
verifyData(): never;
|
||||
}
|
||||
//# sourceMappingURL=rsaCryptographyProvider-browser.d.mts.map
|
||||
42
node_modules/@azure/keyvault-keys/dist/browser/cryptography/rsaCryptographyProvider.js
generated
vendored
Normal file
42
node_modules/@azure/keyvault-keys/dist/browser/cryptography/rsaCryptographyProvider.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
import { LocalCryptographyUnsupportedError } from "./models.js";
|
||||
/**
|
||||
* The browser replacement of the RsaCryptographyProvider. Since we do not
|
||||
* support local cryptography in the browser this replacement always returns false
|
||||
* for `supportsAlgorithm` and `supportsOperation` so that these methods should
|
||||
* never be called.
|
||||
*/
|
||||
export class RsaCryptographyProvider {
|
||||
encrypt() {
|
||||
throw new LocalCryptographyUnsupportedError("RSA Local cryptography is not supported in the browser.");
|
||||
}
|
||||
decrypt() {
|
||||
throw new LocalCryptographyUnsupportedError("RSA Local cryptography is not supported in the browser.");
|
||||
}
|
||||
/**
|
||||
* Browser RSA Provider does not support any algorithms or operations.
|
||||
*/
|
||||
isSupported() {
|
||||
return false;
|
||||
}
|
||||
wrapKey() {
|
||||
throw new LocalCryptographyUnsupportedError("RSA Local cryptography is not supported in the browser.");
|
||||
}
|
||||
unwrapKey() {
|
||||
throw new LocalCryptographyUnsupportedError("RSA Local cryptography is not supported in the browser.");
|
||||
}
|
||||
sign() {
|
||||
throw new LocalCryptographyUnsupportedError("RSA Local cryptography is not supported in the browser.");
|
||||
}
|
||||
signData() {
|
||||
throw new LocalCryptographyUnsupportedError("RSA Local cryptography is not supported in the browser.");
|
||||
}
|
||||
verify() {
|
||||
throw new LocalCryptographyUnsupportedError("RSA Local cryptography is not supported in the browser.");
|
||||
}
|
||||
verifyData() {
|
||||
throw new LocalCryptographyUnsupportedError("RSA Local cryptography is not supported in the browser.");
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=rsaCryptographyProvider-browser.mjs.map
|
||||
Reference in New Issue
Block a user