Comparing version 0.4.14 to 0.4.15
@@ -73,3 +73,3 @@ import { Inngest } from "../components/Inngest"; | ||
constructor(nameOrInngest: string | Inngest<any>, signingKey: string, functions: InngestFunction<any>[], { inngestRegisterUrl }?: RegisterOptions); | ||
private get hashedSigningKey(); | ||
private hashedSigningKey; | ||
createHandler(): any; | ||
@@ -76,0 +76,0 @@ protected runStep(functionId: string, stepId: string, data: any): Promise<StepRunResponse>; |
@@ -7,8 +7,6 @@ "use strict"; | ||
exports.InngestCommHandler = exports.serve = void 0; | ||
// Grab crypto polyfill | ||
const crypto_1 = require("../helpers/crypto"); | ||
// Regular imports | ||
const axios_1 = __importDefault(require("axios")); | ||
const zod_1 = require("zod"); | ||
const consts_1 = require("../helpers/consts"); | ||
const crypto_1 = require("../helpers/crypto"); | ||
const version_1 = require("../version"); | ||
@@ -84,3 +82,3 @@ /** | ||
// same signing key prefix. | ||
get hashedSigningKey() { | ||
async hashedSigningKey() { | ||
var _a; | ||
@@ -91,5 +89,4 @@ if (!this.signingKey) { | ||
const prefix = ((_a = this.signingKey.match(/^signkey-(test|prod)-/)) === null || _a === void 0 ? void 0 : _a.shift()) || ""; | ||
const key = Buffer.from(this.signingKey.replace(/^signkey-(test|prod)-/, ""), "hex"); | ||
// Decode the key from its hex representation into a bytestream | ||
return `${prefix}${(0, crypto_1.createHash)("sha256").update(key).digest("hex")}`; | ||
return `${prefix}${await (0, crypto_1.sha256Hash)(this.signingKey.replace(/^signkey-(test|prod)-/, ""))}`; | ||
} | ||
@@ -177,3 +174,3 @@ createHandler() { | ||
headers: { | ||
Authorization: `Bearer ${this.hashedSigningKey}`, | ||
Authorization: `Bearer ${await this.hashedSigningKey()}`, | ||
}, | ||
@@ -180,0 +177,0 @@ }; |
@@ -1,4 +0,2 @@ | ||
/// <reference types="node" /> | ||
import type { createHash as createHashT } from "crypto"; | ||
export declare const createHash: typeof createHashT; | ||
export declare const sha256Hash: (data: string) => Promise<string>; | ||
//# sourceMappingURL=crypto.d.ts.map |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createHash = void 0; | ||
if (typeof global === "undefined") { | ||
global = { crypto }; | ||
} | ||
if (typeof window !== "undefined") { | ||
window.global = global; | ||
} | ||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ | ||
exports.sha256Hash = void 0; | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-call */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ | ||
const isomorphic_crypto_1 = __importDefault(require("isomorphic-crypto")); | ||
global.crypto = isomorphic_crypto_1.default; | ||
if (typeof window !== "undefined") { | ||
window.crypto = isomorphic_crypto_1.default; | ||
} | ||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ | ||
exports.createHash = isomorphic_crypto_1.default.createHash; | ||
/* eslint-disable @typescript-eslint/no-unsafe-return */ | ||
/* eslint-disable @typescript-eslint/require-await */ | ||
exports.sha256Hash = typeof crypto === "undefined" | ||
? /** | ||
* Node land - use `crypto` via an import | ||
*/ | ||
async (data) => { | ||
return require("crypto") | ||
.createHash("sha256") | ||
.update(data) | ||
.digest("hex"); | ||
} | ||
: /** | ||
* Browser/SW land - use web APIs | ||
*/ | ||
async (data) => { | ||
return Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(data)))) | ||
.map((b) => b.toString(16).padStart(2, "0")) | ||
.join(""); | ||
}; | ||
//# sourceMappingURL=crypto.js.map |
{ | ||
"name": "inngest", | ||
"version": "0.4.14", | ||
"version": "0.4.15", | ||
"description": "Official SDK for Inngest.com", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -1,2 +0,2 @@ | ||
export declare const version = "0.4.14"; | ||
export declare const version = "0.4.15"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -5,3 +5,3 @@ "use strict"; | ||
// Generated by genversion. | ||
exports.version = "0.4.14"; | ||
exports.version = "0.4.15"; | ||
//# sourceMappingURL=version.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
129338