netlify-onegraph-internal
Advanced tools
Comparing version 0.3.5 to 0.3.6
@@ -1,3 +0,2 @@ | ||
export function verifySignature(input: any): boolean; | ||
export function verifyRequestSignature(request: any, options: any): boolean; | ||
export function verifyRequestSignature(request: any, options: any): any; | ||
export function executeCreateGraphQLSchemaMutation(variables: any, options: any): Promise<any>; | ||
@@ -4,0 +3,0 @@ export function executeCreateApiTokenMutation(variables: any, options: any): Promise<any>; |
@@ -50,46 +50,9 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.handler = exports.fetchListNetlifyEnabledServicesQuery = exports.fetchSharedDocumentQuery = exports.executeCreateSharedDocumentMutation = exports.fetchListSharedDocumentsQuery = exports.executeMarkCLISessionInactive = exports.executeMarkCLISessionActiveHeartbeat = exports.executeCreateNewSchemaMutation = exports.executeUpsertAppForSiteMutation = exports.fetchAppSchemaQuery = exports.executeAckCLISessionEventMutation = exports.fetchCLISessionQuery = exports.executeCreateCLISessionEventMutation = exports.executeUpdateCLISessionMetadataMutation = exports.executeCreateCLISessionMutation = exports.fetchPersistedQueryQuery = exports.fetchListPersistedQueries = exports.executeCreatePersistedQueryMutation = exports.executeCreateApiTokenMutation = exports.executeCreateGraphQLSchemaMutation = exports.verifyRequestSignature = exports.verifySignature = void 0; | ||
exports.handler = exports.fetchListNetlifyEnabledServicesQuery = exports.fetchSharedDocumentQuery = exports.executeCreateSharedDocumentMutation = exports.fetchListSharedDocumentsQuery = exports.executeMarkCLISessionInactive = exports.executeMarkCLISessionActiveHeartbeat = exports.executeCreateNewSchemaMutation = exports.executeUpsertAppForSiteMutation = exports.fetchAppSchemaQuery = exports.executeAckCLISessionEventMutation = exports.fetchCLISessionQuery = exports.executeCreateCLISessionEventMutation = exports.executeUpdateCLISessionMetadataMutation = exports.executeCreateCLISessionMutation = exports.fetchPersistedQueryQuery = exports.fetchListPersistedQueries = exports.executeCreatePersistedQueryMutation = exports.executeCreateApiTokenMutation = exports.executeCreateGraphQLSchemaMutation = exports.verifyRequestSignature = void 0; | ||
/* eslint-disable */ | ||
// @ts-nocheck | ||
// GENERATED VIA NETLIFY AUTOMATED DEV TOOLS, EDIT WITH CAUTION! | ||
var buffer = require("buffer"); | ||
var crypto = require("crypto"); | ||
var fetch = require('node-fetch'); | ||
var internalConsole = require("./internalConsole").internalConsole; | ||
var netlifyGraphHost = process.env.NETLIFY_GRAPH_HOST || "graph.netlify.com"; | ||
var verifySignature = function (input) { | ||
var secret = input.secret; | ||
var body = input.body; | ||
var signature = input.signature; | ||
if (!signature) { | ||
console.error("Missing signature"); | ||
return false; | ||
} | ||
var sig = {}; | ||
for (var _i = 0, _a = signature.split(","); _i < _a.length; _i++) { | ||
var pair = _a[_i]; | ||
var _b = pair.split("="), key = _b[0], value = _b[1]; | ||
sig[key] = value; | ||
} | ||
if (!sig.t || !sig.hmac_sha256) { | ||
console.error("Invalid signature header"); | ||
return false; | ||
} | ||
var hash = crypto | ||
.createHmac("sha256", secret) | ||
.update(sig.t) | ||
.update(".") | ||
.update(body) | ||
.digest("hex"); | ||
if (!crypto.timingSafeEqual(Buffer.from(hash, "hex"), Buffer.from(sig.hmac_sha256, "hex"))) { | ||
console.error("Invalid signature"); | ||
return false; | ||
} | ||
if (parseInt(sig.t, 10) < Date.now() / 1000 - 300 /* 5 minutes */) { | ||
console.error("Request is too old"); | ||
return false; | ||
} | ||
return true; | ||
}; | ||
exports.verifySignature = verifySignature; | ||
// Basic LRU cache implementation | ||
@@ -214,3 +177,3 @@ var makeLRUCache = function (max) { | ||
} | ||
return (0, exports.verifySignature)({ secret: secret, signature: signature, body: body || "" }); | ||
return verifySignature({ secret: secret, signature: signature, body: body || "" }); | ||
}; | ||
@@ -217,0 +180,0 @@ exports.verifyRequestSignature = verifyRequestSignature; |
{ | ||
"name": "netlify-onegraph-internal", | ||
"version": "0.3.5", | ||
"version": "0.3.6", | ||
"description": "Internal tools for use by Netlify", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
460286
5991