Initial project import

This commit is contained in:
drjones
2026-06-13 17:36:44 -07:00
commit ad2a18cc8d
18471 changed files with 4497570 additions and 0 deletions

44
node_modules/stripe/cjs/crypto/CryptoProvider.d.ts generated vendored Normal file
View File

@@ -0,0 +1,44 @@
/**
* Interface encapsulating the various crypto computations used by the library,
* allowing pluggable underlying crypto implementations.
*
* Implementations can choose which methods they want to implement (eg. a
* CryptoProvider can be used which only implements the asynchronous
* versions of each crypto computation).
*/
export declare class CryptoProvider {
/**
* Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8).
* The output HMAC should be encoded in hexadecimal.
*
* Sample values for implementations:
* - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd'
* - computeHMACSignature('\ud83d\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43
*/
computeHMACSignature(payload: string, secret: string): string;
/**
* Asynchronous version of `computeHMACSignature`. Some implementations may
* only allow support async signature computation.
*
* Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8).
* The output HMAC should be encoded in hexadecimal.
*
* Sample values for implementations:
* - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd'
* - computeHMACSignature('\ud83d\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43
*/
computeHMACSignatureAsync(payload: string, secret: string): Promise<string>;
/**
* Computes a SHA-256 hash of the data.
*/
computeSHA256Async(data: Uint8Array): Promise<Uint8Array>;
}
/**
* If the crypto provider only supports asynchronous operations,
* throw CryptoProviderOnlySupportsAsyncError instead of
* a generic error so that the caller can choose to provide
* a more helpful error message to direct the user to use
* an asynchronous pathway.
*/
export declare class CryptoProviderOnlySupportsAsyncError extends Error {
}

56
node_modules/stripe/cjs/crypto/CryptoProvider.js generated vendored Normal file
View File

@@ -0,0 +1,56 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CryptoProviderOnlySupportsAsyncError = exports.CryptoProvider = void 0;
/**
* Interface encapsulating the various crypto computations used by the library,
* allowing pluggable underlying crypto implementations.
*
* Implementations can choose which methods they want to implement (eg. a
* CryptoProvider can be used which only implements the asynchronous
* versions of each crypto computation).
*/
class CryptoProvider {
/**
* Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8).
* The output HMAC should be encoded in hexadecimal.
*
* Sample values for implementations:
* - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd'
* - computeHMACSignature('\ud83d\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43
*/
computeHMACSignature(payload, secret) {
throw new Error('computeHMACSignature not implemented.');
}
/**
* Asynchronous version of `computeHMACSignature`. Some implementations may
* only allow support async signature computation.
*
* Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8).
* The output HMAC should be encoded in hexadecimal.
*
* Sample values for implementations:
* - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd'
* - computeHMACSignature('\ud83d\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43
*/
computeHMACSignatureAsync(payload, secret) {
throw new Error('computeHMACSignatureAsync not implemented.');
}
/**
* Computes a SHA-256 hash of the data.
*/
computeSHA256Async(data) {
throw new Error('computeSHA256 not implemented.');
}
}
exports.CryptoProvider = CryptoProvider;
/**
* If the crypto provider only supports asynchronous operations,
* throw CryptoProviderOnlySupportsAsyncError instead of
* a generic error so that the caller can choose to provide
* a more helpful error message to direct the user to use
* an asynchronous pathway.
*/
class CryptoProviderOnlySupportsAsyncError extends Error {
}
exports.CryptoProviderOnlySupportsAsyncError = CryptoProviderOnlySupportsAsyncError;
//# sourceMappingURL=CryptoProvider.js.map

1
node_modules/stripe/cjs/crypto/CryptoProvider.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"CryptoProvider.js","sourceRoot":"","sources":["../../src/crypto/CryptoProvider.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,MAAa,cAAc;IACzB;;;;;;;OAOG;IACH,oBAAoB,CAAC,OAAe,EAAE,MAAc;QAClD,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;;;;;OAUG;IACH,yBAAyB,CAAC,OAAe,EAAE,MAAc;QACvD,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACH,kBAAkB,CAAC,IAAgB;QACjC,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;CACF;AAlCD,wCAkCC;AAED;;;;;;GAMG;AACH,MAAa,oCAAqC,SAAQ,KAAK;CAAG;AAAlE,oFAAkE"}

12
node_modules/stripe/cjs/crypto/NodeCryptoProvider.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
import { CryptoProvider } from './CryptoProvider.js';
/**
* `CryptoProvider which uses the Node `crypto` package for its computations.
*/
export declare class NodeCryptoProvider extends CryptoProvider {
/** @override */
computeHMACSignature(payload: string, secret: string): string;
/** @override */
computeHMACSignatureAsync(payload: string, secret: string): Promise<string>;
/** @override */
computeSHA256Async(data: Uint8Array): Promise<Uint8Array>;
}

31
node_modules/stripe/cjs/crypto/NodeCryptoProvider.js generated vendored Normal file
View File

@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NodeCryptoProvider = void 0;
const crypto = require("crypto");
const CryptoProvider_js_1 = require("./CryptoProvider.js");
/**
* `CryptoProvider which uses the Node `crypto` package for its computations.
*/
class NodeCryptoProvider extends CryptoProvider_js_1.CryptoProvider {
/** @override */
computeHMACSignature(payload, secret) {
return crypto
.createHmac('sha256', secret)
.update(payload, 'utf8')
.digest('hex');
}
/** @override */
async computeHMACSignatureAsync(payload, secret) {
const signature = await this.computeHMACSignature(payload, secret);
return signature;
}
/** @override */
async computeSHA256Async(data) {
return new Uint8Array(await crypto
.createHash('sha256')
.update(data)
.digest());
}
}
exports.NodeCryptoProvider = NodeCryptoProvider;
//# sourceMappingURL=NodeCryptoProvider.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"NodeCryptoProvider.js","sourceRoot":"","sources":["../../src/crypto/NodeCryptoProvider.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,2DAAmD;AAEnD;;GAEG;AACH,MAAa,kBAAmB,SAAQ,kCAAc;IACpD,gBAAgB;IAChB,oBAAoB,CAAC,OAAe,EAAE,MAAc;QAClD,OAAO,MAAM;aACV,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC;aAC5B,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC;aACvB,MAAM,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAED,gBAAgB;IAChB,KAAK,CAAC,yBAAyB,CAC7B,OAAe,EACf,MAAc;QAEd,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACnE,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,gBAAgB;IAChB,KAAK,CAAC,kBAAkB,CAAC,IAAgB;QACvC,OAAO,IAAI,UAAU,CACnB,MAAM,MAAM;aACT,UAAU,CAAC,QAAQ,CAAC;aACpB,MAAM,CAAC,IAAI,CAAC;aACZ,MAAM,EAAE,CACZ,CAAC;IACJ,CAAC;CACF;AA3BD,gDA2BC"}

View File

@@ -0,0 +1,16 @@
import { CryptoProvider } from './CryptoProvider.js';
/**
* `CryptoProvider which uses the SubtleCrypto interface of the Web Crypto API.
*
* This only supports asynchronous operations.
*/
export declare class SubtleCryptoProvider extends CryptoProvider {
subtleCrypto: SubtleCrypto;
constructor(subtleCrypto?: SubtleCrypto);
/** @override */
computeHMACSignature(payload: string, secret: string): string;
/** @override */
computeHMACSignatureAsync(payload: string, secret: string): Promise<string>;
/** @override */
computeSHA256Async(data: Uint8Array): Promise<Uint8Array>;
}

52
node_modules/stripe/cjs/crypto/SubtleCryptoProvider.js generated vendored Normal file
View File

@@ -0,0 +1,52 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SubtleCryptoProvider = void 0;
const CryptoProvider_js_1 = require("./CryptoProvider.js");
/**
* `CryptoProvider which uses the SubtleCrypto interface of the Web Crypto API.
*
* This only supports asynchronous operations.
*/
class SubtleCryptoProvider extends CryptoProvider_js_1.CryptoProvider {
constructor(subtleCrypto) {
super();
// If no subtle crypto is interface, default to the global namespace. This
// is to allow custom interfaces (eg. using the Node webcrypto interface in
// tests).
this.subtleCrypto = subtleCrypto || crypto.subtle;
}
/** @override */
computeHMACSignature(payload, secret) {
throw new CryptoProvider_js_1.CryptoProviderOnlySupportsAsyncError('SubtleCryptoProvider cannot be used in a synchronous context.');
}
/** @override */
async computeHMACSignatureAsync(payload, secret) {
const encoder = new TextEncoder();
const key = await this.subtleCrypto.importKey('raw', encoder.encode(secret), {
name: 'HMAC',
hash: { name: 'SHA-256' },
}, false, ['sign']);
const signatureBuffer = await this.subtleCrypto.sign('hmac', key, encoder.encode(payload));
// crypto.subtle returns the signature in base64 format. This must be
// encoded in hex to match the CryptoProvider contract. We map each byte in
// the buffer to its corresponding hex octet and then combine into a string.
const signatureBytes = new Uint8Array(signatureBuffer);
const signatureHexCodes = new Array(signatureBytes.length);
for (let i = 0; i < signatureBytes.length; i++) {
signatureHexCodes[i] = byteHexMapping[signatureBytes[i]];
}
return signatureHexCodes.join('');
}
/** @override */
async computeSHA256Async(data) {
return new Uint8Array(await this.subtleCrypto.digest('SHA-256', data));
}
}
exports.SubtleCryptoProvider = SubtleCryptoProvider;
// Cached mapping of byte to hex representation. We do this once to avoid re-
// computing every time we need to convert the result of a signature to hex.
const byteHexMapping = new Array(256);
for (let i = 0; i < byteHexMapping.length; i++) {
byteHexMapping[i] = i.toString(16).padStart(2, '0');
}
//# sourceMappingURL=SubtleCryptoProvider.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"SubtleCryptoProvider.js","sourceRoot":"","sources":["../../src/crypto/SubtleCryptoProvider.ts"],"names":[],"mappings":";;;AAAA,2DAG6B;AAE7B;;;;GAIG;AACH,MAAa,oBAAqB,SAAQ,kCAAc;IAGtD,YAAY,YAA2B;QACrC,KAAK,EAAE,CAAC;QAER,0EAA0E;QAC1E,2EAA2E;QAC3E,UAAU;QACV,IAAI,CAAC,YAAY,GAAG,YAAY,IAAI,MAAM,CAAC,MAAM,CAAC;IACpD,CAAC;IAED,gBAAgB;IAChB,oBAAoB,CAAC,OAAe,EAAE,MAAc;QAClD,MAAM,IAAI,wDAAoC,CAC5C,+DAA+D,CAChE,CAAC;IACJ,CAAC;IAED,gBAAgB;IAChB,KAAK,CAAC,yBAAyB,CAC7B,OAAe,EACf,MAAc;QAEd,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;QAElC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,SAAS,CAC3C,KAAK,EACL,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EACtB;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,EAAC,IAAI,EAAE,SAAS,EAAC;SACxB,EACD,KAAK,EACL,CAAC,MAAM,CAAC,CACT,CAAC;QAEF,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAClD,MAAM,EACN,GAAG,EACH,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CACxB,CAAC;QAEF,qEAAqE;QACrE,2EAA2E;QAC3E,4EAA4E;QAC5E,MAAM,cAAc,GAAG,IAAI,UAAU,CAAC,eAAe,CAAC,CAAC;QACvD,MAAM,iBAAiB,GAAG,IAAI,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAE3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC9C,iBAAiB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;SAC1D;QAED,OAAO,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,gBAAgB;IAChB,KAAK,CAAC,kBAAkB,CAAC,IAAgB;QACvC,OAAO,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;IACzE,CAAC;CACF;AA5DD,oDA4DC;AAED,6EAA6E;AAC7E,4EAA4E;AAC5E,MAAM,cAAc,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;AACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;IAC9C,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;CACrD"}