New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@line/bot-sdk

Package Overview
Dependencies
Maintainers
4
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@line/bot-sdk - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

.github/ISSUE_TEMPLATE.md

6

dist/client.d.ts
/// <reference types="node" />
export default class Client {
config: Line.Config;
constructor(config: Line.Config & {
channelAccessToken: string;
});
config: Line.ClientConfig;
constructor(config: Line.Config & Line.ClientConfig);
pushMessage(to: string, messages: Line.Message | Line.Message[]): Promise<any>;

@@ -8,0 +6,0 @@ replyMessage(replyToken: string, messages: Line.Message | Line.Message[]): Promise<any>;

@@ -9,4 +9,2 @@ /// <reference types="node" />

export declare type Middleware = (req: Request, res: Response, next: NextCallback) => void;
export default function middleware(config: Line.Config & {
channelSecret: string;
}): Middleware;
export default function middleware(config: Line.Config & Line.MiddlewareConfig): Middleware;

@@ -19,8 +19,8 @@ "use strict";

}
body_parser_1.raw({ type: "*/*" })(req, res, (() => {
if (!validate_signature_1.default(req.body, secret, signature)) {
const validate = (body) => {
if (!validate_signature_1.default(body, secret, signature)) {
next(new exceptions_1.SignatureValidationFailed("signature validation failed", signature));
return;
}
const strBody = req.body.toString();
const strBody = Buffer.isBuffer(body) ? body.toString() : body;
try {

@@ -33,5 +33,10 @@ req.body = JSON.parse(strBody);

}
}));
};
if (typeof req.body === "string" || Buffer.isBuffer(req.body)) {
return validate(req.body);
}
// if body is not parsed yet, parse it to a buffer
body_parser_1.raw({ type: "*/*" })(req, res, () => validate(req.body));
};
}
exports.default = middleware;

@@ -6,5 +6,5 @@ import { get, post, stream } from "./http";

export default class Client {
public config: Line.Config;
public config: Line.ClientConfig;
constructor(config: Line.Config & { channelAccessToken: string }) {
constructor(config: Line.Config & Line.ClientConfig) {
if (!config.channelAccessToken) {

@@ -11,0 +11,0 @@ throw new Error("no channel access token");

@@ -12,3 +12,3 @@ import { raw } from "body-parser";

export default function middleware(config: Line.Config & { channelSecret: string }): Middleware {
export default function middleware(config: Line.Config & Line.MiddlewareConfig): Middleware {
if (!config.channelSecret) {

@@ -30,21 +30,25 @@ throw new Error("no channel secret");

raw({ type: "*/*" })(
req as any,
res as any,
(() => {
if (!validateSignature(req.body, secret, signature)) {
next(new SignatureValidationFailed("signature validation failed", signature));
return;
}
const validate = (body: string | Buffer) => {
if (!validateSignature(body, secret, signature)) {
next(new SignatureValidationFailed("signature validation failed", signature));
return;
}
const strBody = req.body.toString();
try {
req.body = JSON.parse(strBody);
next();
} catch (err) {
next(new JSONParseError(err.message, strBody));
}
}) as any,
);
const strBody = Buffer.isBuffer(body) ? body.toString() : body;
try {
req.body = JSON.parse(strBody);
next();
} catch (err) {
next(new JSONParseError(err.message, strBody));
}
};
if (typeof req.body === "string" || Buffer.isBuffer(req.body)) {
return validate(req.body);
}
// if body is not parsed yet, parse it to a buffer
raw({ type: "*/*" })(req as any, res as any, () => validate(req.body));
};
}
{
"name": "@line/bot-sdk",
"version": "1.0.0",
"version": "1.1.0",
"description": "Node.js SDK for LINE Messaging API",

@@ -5,0 +5,0 @@ "engines": {

@@ -1,3 +0,5 @@

# line-bot-sdk-nodejs [![Travis CI](https://travis-ci.org/line/line-bot-sdk-nodejs.svg?branch=master)](https://travis-ci.org/line/line-bot-sdk-nodejs)
# line-bot-sdk-nodejs
[![Travis CI](https://travis-ci.org/line/line-bot-sdk-nodejs.svg?branch=master)](https://travis-ci.org/line/line-bot-sdk-nodejs) [![npmjs](https://badge.fury.io/js/%40line%2Fbot-sdk.svg)](https://www.npmjs.com/package/@line/bot-sdk)
Node.js SDK for LINE Messaging API

@@ -4,0 +6,0 @@

@@ -8,7 +8,12 @@ /* tslint:disable interface-over-type-literal no-namespace */

declare namespace Line {
export type Config = {
channelAccessToken?: string,
channelSecret?: string,
export type ClientConfig = {
channelAccessToken: string,
};
export type MiddlewareConfig = {
channelSecret: string,
};
export type Config = ClientConfig | MiddlewareConfig;
export type Profile = {

@@ -35,4 +40,4 @@ displayName: string,

export type User = Typed & { userId: string };
export type Group = Typed & { groupId: string };
export type Room = Typed & { roomId: string };
export type Group = Typed & { groupId: string, userId?: string };
export type Room = Typed & { roomId: string, userId?: string };

@@ -39,0 +44,0 @@ export type ReplyableEvent = EventBase & { replyToken: string };

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