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

@nhost/nhost-js

Package Overview
Dependencies
Maintainers
3
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nhost/nhost-js - npm Package Compare versions

Comparing version 0.0.1-2 to 0.0.1-3

4

dist/nhost-auth.d.ts

@@ -22,7 +22,7 @@ import * as types from "./types";

constructor(config: types.AuthConfig, session: UserSession);
register({ email, password, options, }: types.UserCredentials): Promise<{
signUp({ email, password, options, }: types.UserCredentials): Promise<{
session: types.Session | null;
user: types.User;
}>;
login({ email, password, provider, }: types.UserCredentials): Promise<{
signIn({ email, password, provider, }: types.UserCredentials): Promise<{
session: types.Session | null;

@@ -29,0 +29,0 @@ user: types.User | null;

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

// }
Auth.prototype.register = function (_a) {
Auth.prototype.signUp = function (_a) {
var email = _a.email, password = _a.password, _b = _a.options, options = _b === void 0 ? {} : _b;

@@ -114,3 +114,3 @@ return __awaiter(this, void 0, void 0, function () {

_c.trys.push([1, 3, , 4]);
return [4 /*yield*/, this.httpClient.post("/register", {
return [4 /*yield*/, this.httpClient.post("/signup/email-password", {
email: email,

@@ -141,3 +141,3 @@ password: password,

};
Auth.prototype.login = function (_a) {
Auth.prototype.signIn = function (_a) {
var email = _a.email, password = _a.password, provider = _a.provider;

@@ -150,3 +150,3 @@ return __awaiter(this, void 0, void 0, function () {

if (provider) {
window.location.href = this.baseURL + "/auth/providers/" + provider;
window.location.href = this.baseURL + "/signin/provider/" + provider;
return [2 /*return*/, { session: null, user: null }];

@@ -157,3 +157,3 @@ }

_b.trys.push([1, 3, , 4]);
return [4 /*yield*/, this.httpClient.post("/login", {
return [4 /*yield*/, this.httpClient.post("/signin/email-password", {
email: email,

@@ -268,3 +268,3 @@ password: password,

var _a;
return ((_a = this.currentSession.getSession()) === null || _a === void 0 ? void 0 : _a.jwtToken) || null;
return ((_a = this.currentSession.getSession()) === null || _a === void 0 ? void 0 : _a.accessToken) || null;
};

@@ -556,3 +556,3 @@ Auth.prototype.getClaim = function (claim) {

return __awaiter(this, void 0, void 0, function () {
var previouslyAuthenticated, JWTExpiresIn, refreshIntervalTime;
var previouslyAuthenticated, accessTokenExpiresIn, refreshIntervalTime;
var _this = this;

@@ -572,6 +572,6 @@ return __generator(this, function (_a) {

if (!previouslyAuthenticated) {
JWTExpiresIn = session.jwtExpiresIn;
accessTokenExpiresIn = session.accessTokenExpiresIn;
refreshIntervalTime = this.refreshIntervalTime
? this.refreshIntervalTime
: Math.max(30 * 1000, JWTExpiresIn - 45000);
: Math.max(30 * 1000, accessTokenExpiresIn - 45000);
this.refreshInterval = setInterval(this._refreshToken.bind(this), refreshIntervalTime);

@@ -578,0 +578,0 @@ // refresh token after computer has been sleeping

@@ -53,4 +53,4 @@ export interface NhostConfig {

export interface Session {
jwtToken: string;
jwtExpiresIn: number;
accessToken: string;
accessTokenExpiresIn: number;
user: User;

@@ -57,0 +57,0 @@ refreshToken?: string;

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

this.session = session;
var jwtTokenDecoded = jwt_decode_1.default(session.jwtToken);
var jwtTokenDecoded = jwt_decode_1.default(session.accessToken);
this.claims = jwtTokenDecoded["https://hasura.io/jwt/claims"];

@@ -17,0 +17,0 @@ };

{
"name": "@nhost/nhost-js",
"version": "0.0.1-2",
"version": "0.0.1-3",
"description": "Nhost JavaScript SDK",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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