Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@blockfrost/blockfrost-js

Package Overview
Dependencies
Maintainers
3
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blockfrost/blockfrost-js - npm Package Compare versions

Comparing version 6.0.0-beta.0 to 6.0.0-beta.1

29

lib/utils/helpers.js

@@ -167,2 +167,13 @@ "use strict";

exports.parseAsset = parseAsset;
const parseWebhookPayload = (payload) => {
if (Buffer.isBuffer(payload)) {
return JSON.parse(payload.toString('utf8'));
}
else if (typeof payload === 'string') {
return JSON.parse(payload);
}
else {
return payload;
}
};
/**

@@ -190,6 +201,4 @@ * Verifies webhook signature

}
// Stringified webhook payload
const decodedWebhookPayload = Buffer.isBuffer(webhookPayload)
? webhookPayload.toString('utf8')
: webhookPayload;
const parsedWebhookPayload = parseWebhookPayload(webhookPayload);
const stringifiedWebhookPayload = JSON.stringify(parsedWebhookPayload);
const decodedSignatureHeader = Buffer.isBuffer(signatureHeader)

@@ -218,3 +227,3 @@ ? signatureHeader.toString('utf8')

signatureHeader: decodedSignatureHeader,
webhookPayload: decodedWebhookPayload,
webhookPayload: stringifiedWebhookPayload,
});

@@ -225,3 +234,3 @@ }

signatureHeader: decodedSignatureHeader,
webhookPayload: decodedWebhookPayload,
webhookPayload: stringifiedWebhookPayload,
});

@@ -233,3 +242,3 @@ }

// then compute HMAC using sha256 and provided secret (auth token)
const signaturePayload = `${timestamp}.${decodedWebhookPayload}`;
const signaturePayload = `${timestamp}.${stringifiedWebhookPayload}`;
const hmac = (0, crypto_1.createHmac)('sha256', secret)

@@ -246,3 +255,3 @@ .update(signaturePayload)

signatureHeader: decodedSignatureHeader,
webhookPayload: decodedWebhookPayload,
webhookPayload: stringifiedWebhookPayload,
});

@@ -255,3 +264,3 @@ }

signatureHeader: decodedSignatureHeader,
webhookPayload: decodedWebhookPayload,
webhookPayload: stringifiedWebhookPayload,
});

@@ -261,3 +270,3 @@ }

// Successfully validate the signature only if it is within timestamp_tolerance_seconds tolerance
const webhookEvent = JSON.parse(decodedWebhookPayload);
const webhookEvent = parsedWebhookPayload;
return webhookEvent;

@@ -264,0 +273,0 @@ }

{
"name": "@blockfrost/blockfrost-js",
"version": "6.0.0-beta.0",
"version": "6.0.0-beta.1",
"description": "A JavaScript/TypeScript SDK for interacting with the https://blockfrost.io API",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc