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

@textile/context

Package Overview
Dependencies
Maintainers
5
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@textile/context - npm Package Compare versions

Comparing version 0.6.2 to 0.6.3

CHANGELOG.md

27

dist/index.d.ts

@@ -1,7 +0,7 @@

import { grpc } from '@improbable-eng/grpc-web';
import { UserAuth, KeyInfo } from '@textile/security';
import { grpc } from "@improbable-eng/grpc-web";
import { KeyInfo, UserAuth } from "@textile/security";
/**
* The set of host strings used by any gPRC clients.
*/
export declare type HostString = 'https://api.textile.io:3447' | 'https://api.staging.textile.io:3447' | 'http://127.0.0.1:3007' | string;
export declare type HostString = "https://api.textile.io:3447" | "https://api.staging.textile.io:3447" | "http://127.0.0.1:3007" | string;
export declare const defaultHost: HostString;

@@ -15,19 +15,19 @@ /**

*/
['x-textile-thread-name']?: string;
["x-textile-thread-name"]?: string;
/**
* ThreadID as a string. Should be generated with `ThreadID.toString()` method.
*/
['x-textile-thread']?: string;
["x-textile-thread"]?: string;
/**
* Session key. Used for various session contexts.
*/
['x-textile-session']?: string;
["x-textile-session"]?: string;
/**
* Org slug/name. Used for various org session operations.
*/
['x-textile-org']?: string;
["x-textile-org"]?: string;
/**
* API key. Used for user group/account authentication.
*/
['x-textile-api-key']?: string;
["x-textile-api-key"]?: string;
/**

@@ -40,7 +40,7 @@ * Authorization token for interacting with remote APIs.

*/
['x-textile-api-sig']?: string;
["x-textile-api-sig"]?: string;
/**
* Raw message (date as ISO string) used to generate API signature.
*/
['x-textile-api-sig-msg']?: string;
["x-textile-api-sig-msg"]?: string;
/**

@@ -140,3 +140,3 @@ * The service host address/url. Defaults to https://api.textile.io.

static fromUserAuthCallback(authCallback: () => Promise<UserAuth>, host?: HostString): Context;
get host(): any;
get host(): string;
set(key: keyof ContextKeys, value?: any): this;

@@ -171,6 +171,3 @@ get(key: keyof ContextKeys): any;

*/
toJSON(): {
[x: string]: any;
[x: number]: any;
};
toJSON(): Record<string | number, any>;
/**

@@ -177,0 +174,0 @@ * Convert Context to grpc Metadata object.

@@ -26,3 +26,3 @@ "use strict";

const security_1 = require("@textile/security");
exports.defaultHost = 'https://api.textile.io:3447';
exports.defaultHost = "https://api.textile.io:3447";
/**

@@ -40,3 +40,3 @@ * Context provides context management for gRPC credentials and config settings.

this._context = {};
this._context['host'] = host;
this._context["host"] = host;
}

@@ -55,4 +55,5 @@ static fromUserAuth(auth, host = exports.defaultHost) {

get host() {
return this._context['host'];
return this._context["host"];
}
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
set(key, value) {

@@ -68,3 +69,3 @@ this._context[key] = value;

return this;
this._context['x-textile-session'] = value;
this._context["x-textile-session"] = value;
return this;

@@ -75,3 +76,3 @@ }

return this;
this._context['x-textile-thread'] = value.toString();
this._context["x-textile-thread"] = value.toString();
return this;

@@ -82,3 +83,3 @@ }

return this;
this._context['x-textile-thread-name'] = value;
this._context["x-textile-thread-name"] = value;
return this;

@@ -89,3 +90,3 @@ }

return this;
this._context['x-textile-org'] = value;
this._context["x-textile-org"] = value;
return this;

@@ -96,3 +97,3 @@ }

return this;
this._context['authorization'] = `bearer ${value}`;
this._context["authorization"] = `bearer ${value}`;
return this;

@@ -103,3 +104,3 @@ }

return this;
this._context['x-textile-api-key'] = value;
this._context["x-textile-api-key"] = value;
return this;

@@ -111,4 +112,4 @@ }

const { sig, msg } = value;
this._context['x-textile-api-sig-msg'] = msg;
this._context['x-textile-api-sig'] = sig;
this._context["x-textile-api-sig-msg"] = msg;
this._context["x-textile-api-sig"] = sig;
return this;

@@ -139,3 +140,3 @@ }

get isExpired() {
const msg = this.get('x-textile-api-sig-msg');
const msg = this.get("x-textile-api-sig-msg");
const notAuthed = msg === undefined && this.authCallback !== undefined;

@@ -157,3 +158,3 @@ const isExpired = msg !== undefined && new Date(msg) <= new Date();

if (this.authCallback === undefined) {
throw new Error('Missing authCallback. See Context.fromUserAuthCallback for details.');
throw new Error("Missing authCallback. See Context.fromUserAuthCallback for details.");
}

@@ -205,3 +206,3 @@ // Now do the renewal and return self...

const newContext = Object.assign({}, json);
newContext['host'] = host;
newContext["host"] = host;
const ctx = new Context();

@@ -208,0 +209,0 @@ ctx._context = newContext;

{
"name": "@textile/context",
"version": "0.6.2",
"version": "0.6.3",
"main": "dist/index",

@@ -37,5 +37,5 @@ "types": "dist/index",

"dependencies": {
"@textile/security": "^0.2.2"
"@textile/security": "^0.2.3"
},
"gitHead": "6e6a1a1acc861b61bb5318b8b3beec765bd960ac"
"gitHead": "473e60efc27c691c6e002eeb08af7b9751afcc6d"
}

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