Socket
Socket
Sign inDemoInstall

@subql/apollo-links

Package Overview
Dependencies
Maintainers
2
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@subql/apollo-links - npm Package Compare versions

Comparing version 0.5.8 to 0.5.9-0

8

dist/auth/authHelper.js

@@ -39,9 +39,5 @@ "use strict";

async function requestAuthToken(authUrl, msg, sk, chainId) {
if (!sk)
const signature = signMessage(msg, sk, chainId);
if (!signature)
return '';
const signature = (0, eth_sig_util_1.signTypedData)({
privateKey: Buffer.from(sk, 'hex'),
data: (0, eip712_1.buildTypedMessage)(msg, chainId),
version: eth_sig_util_1.SignTypedDataVersion.V4,
});
const body = (0, eip712_1.createAuthRequestBody)(msg, signature, chainId);

@@ -48,0 +44,0 @@ const res = await (0, query_1.POST)(authUrl, body);

@@ -13,3 +13,3 @@ import { ApolloLink, FetchResult, NextLink, Observable, Operation } from '@apollo/client/core';

private _token;
constructor(options: AuthOptions, logger: Logger);
constructor(options: AuthOptions, logger: Logger, token?: string);
request(operation: Operation, forward?: NextLink): Observable<FetchResult> | null;

@@ -16,0 +16,0 @@ get queryEndpoint(): string;

@@ -9,7 +9,7 @@ "use strict";

class AuthLink extends core_1.ApolloLink {
constructor(options, logger) {
constructor(options, logger, token = '') {
super();
this._options = options;
this._logger = logger;
this._token = '';
this._token = token;
}

@@ -16,0 +16,0 @@ request(operation, forward) {

@@ -13,5 +13,4 @@ import { ApolloLink, FetchResult, NextLink, Observable, Operation } from '@apollo/client/core';

get logger(): Logger | undefined;
tokenToStateChannel(authToken: string): ChannelState | undefined;
syncChannelState(state: ChannelState): Promise<void>;
request(operation: Operation, forward: NextLink): Observable<FetchResult> | null;
}

@@ -18,12 +18,2 @@ "use strict";

}
tokenToStateChannel(authToken) {
var _a;
try {
const token = JSON.parse(authToken);
return token;
}
catch (e) {
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.debug(`invalid token: ${authToken} ${e}`);
}
}
async syncChannelState(state) {

@@ -30,0 +20,0 @@ var _a, _b;

@@ -7,4 +7,3 @@ "use strict";

function silentLogger() {
// eslint-disable-next-line @typescript-eslint/no-empty-function
const logfn = () => { };
const logfn = () => undefined;
return {

@@ -11,0 +10,0 @@ debug: logfn,

@@ -27,2 +27,3 @@ "use strict";

catch (e) {
// it seems cannot reach this code, fetchOrders already handle the errors.
this.logger.error(`fetch orders failed: ${String(e)}`);

@@ -29,0 +30,0 @@ this.healthy = false;

{
"name": "@subql/apollo-links",
"version": "0.5.8",
"version": "0.5.9-0",
"description": "SubQuery Network - graphql links",

@@ -28,3 +28,3 @@ "main": "dist/index.js",

},
"stableVersion": "0.5.8-0"
"stableVersion": "0.5.8"
}

@@ -41,10 +41,5 @@ // Copyright 2020-2022 SubQuery Pte Ltd authors & contributors

): Promise<string> {
if (!sk) return '';
const signature = signMessage(msg, sk, chainId);
if (!signature) return '';
const signature = signTypedData({
privateKey: Buffer.from(sk, 'hex'),
data: buildTypedMessage(msg, chainId),
version: SignTypedDataVersion.V4,
});
const body = createAuthRequestBody(msg, signature, chainId);

@@ -51,0 +46,0 @@ const res = await POST<{ token: string }>(authUrl, body);

@@ -22,7 +22,7 @@ // Copyright 2020-2022 SubQuery Pte Ltd authors & contributors

constructor(options: AuthOptions, logger: Logger) {
constructor(options: AuthOptions, logger: Logger, token = '') {
super();
this._options = options;
this._logger = logger;
this._token = '';
this._token = token;
}

@@ -29,0 +29,0 @@

@@ -26,11 +26,2 @@ // Copyright 2020-2022 SubQuery Pte Ltd authors & contributors

tokenToStateChannel(authToken: string): ChannelState | undefined {
try {
const token = JSON.parse(authToken) as ChannelState;
return token;
} catch (e) {
this.logger?.debug(`invalid token: ${authToken} ${e}`);
}
}
async syncChannelState(state: ChannelState): Promise<void> {

@@ -37,0 +28,0 @@ try {

@@ -19,4 +19,3 @@ // Copyright 2020-2022 SubQuery Pte Ltd authors & contributors

export function silentLogger(): Logger {
// eslint-disable-next-line @typescript-eslint/no-empty-function
const logfn = () => {};
const logfn = (): void => undefined;
return {

@@ -23,0 +22,0 @@ debug: logfn,

@@ -53,2 +53,3 @@ // Copyright 2020-2022 SubQuery Pte Ltd authors & contributors

} catch (e) {
// it seems cannot reach this code, fetchOrders already handle the errors.
this.logger.error(`fetch orders failed: ${String(e)}`);

@@ -55,0 +56,0 @@ this.healthy = false;

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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