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

@accounts/server

Package Overview
Dependencies
Maintainers
5
Versions
204
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@accounts/server - npm Package Compare versions

Comparing version 0.1.0-alpha.9854fbf9 to 0.1.0-alpha.9974ccde

lib/config.d.ts

81

lib/accounts-server.d.ts

@@ -1,26 +0,67 @@

import { UserObjectType, LoginReturnType } from '@accounts/common';
import { ConnectionInformationsType, DBInterface } from './types';
export interface AccountsServerOptions {
db: DBInterface;
tokenSecret: string;
tokenConfigs?: {
accessToken?: {
expiresIn?: string;
};
refreshToken?: {
expiresIn?: string;
};
};
/// <reference types="@types/node" />
import { EventEmitter } from 'events';
import { UserObjectType, LoginReturnType, TokensType, SessionType, ImpersonateReturnType, HookListener } from '@accounts/common';
import { EmailConnector, EmailTemplateType } from './email';
import { AccountsServerOptions, ConnectionInformationsType } from './types';
export interface TokenRecord {
token: string;
address: string;
when: number;
reason: string;
}
export default class AccountsServer {
export declare type RemoveListnerHandle = () => EventEmitter;
export declare const ServerHooks: {
LoginSuccess: string;
LoginError: string;
LogoutSuccess: string;
LogoutError: string;
CreateUserSuccess: string;
CreateUserError: string;
ResumeSessionSuccess: string;
ResumeSessionError: string;
RefreshTokensSuccess: string;
RefreshTokensError: string;
ImpersonationSuccess: string;
ImpersonationError: string;
};
export declare class AccountsServer {
options: AccountsServerOptions;
email: EmailConnector;
private services;
private db;
private options;
constructor(services: any, options: AccountsServerOptions);
private hooks;
constructor(options: AccountsServerOptions, services: any);
getServices(): any;
getOptions(): AccountsServerOptions;
onLoginSuccess(callback: HookListener): RemoveListnerHandle;
onLoginError(callback: HookListener): RemoveListnerHandle;
onLogoutSuccess(callback: HookListener): RemoveListnerHandle;
onLogoutError(callback: HookListener): RemoveListnerHandle;
onCreateUserSuccess(callback: HookListener): RemoveListnerHandle;
onCreateUserError(callback: HookListener): RemoveListnerHandle;
onResumeSessionSuccess(callback: HookListener): RemoveListnerHandle;
onResumeSessionError(callback: HookListener): RemoveListnerHandle;
onRefreshTokensSuccess(callback: HookListener): RemoveListnerHandle;
onRefreshTokensError(callback: HookListener): RemoveListnerHandle;
onImpersonationSuccess(callback: HookListener): RemoveListnerHandle;
onImpersonationError(callback: HookListener): RemoveListnerHandle;
loginWithService(serviceName: string, params: any, infos: ConnectionInformationsType): Promise<LoginReturnType>;
loginWithUser(user: UserObjectType, infos: ConnectionInformationsType): Promise<LoginReturnType>;
resumeSession(accessToken: string): Promise<UserObjectType | null>;
private findSessionByAccessToken(accessToken);
private createTokens(sessionId, isImpersonated?);
private sanitizeUser(user);
impersonate(accessToken: string, username: string, ip: string, userAgent: string): Promise<ImpersonateReturnType>;
refreshTokens(accessToken: string, refreshToken: string, ip: string, userAgent: string): Promise<LoginReturnType>;
createTokens(sessionId: string, isImpersonated?: boolean): TokensType;
logout(accessToken: string): Promise<void>;
resumeSession(accessToken: string): Promise<UserObjectType>;
findSessionByAccessToken(accessToken: string): Promise<SessionType>;
findUserById(userId: string): Promise<UserObjectType>;
setProfile(userId: string, profile: object): Promise<void>;
updateProfile(userId: string, profile: object): Promise<object>;
on(eventName: string, callback: HookListener): RemoveListnerHandle;
isTokenExpired(token: string, tokenRecord?: TokenRecord): boolean;
prepareMail(to: string, token: string, user: UserObjectType, pathFragment: string, emailTemplate: EmailTemplateType, from: string): any;
sanitizeUser(user: UserObjectType): UserObjectType;
private internalUserSanitizer(user);
private defaultPrepareEmail(to, token, user, pathFragment, emailTemplate, from);
private defaultCreateTokenizedUrl(pathFragment, token);
}
export default AccountsServer;

@@ -46,5 +46,11 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var lodash_1 = require("lodash");
var pick = require("lodash/pick");
var omit = require("lodash/omit");
var isString = require("lodash/isString");
var events_1 = require("events");
var jwt = require("jsonwebtoken");
var common_1 = require("@accounts/common");
var config_1 = require("./config");
var tokens_1 = require("./tokens");
var email_1 = require("./email");
var defaultOptions = {

@@ -60,12 +66,78 @@ tokenSecret: 'secret',

},
emailTemplates: email_1.emailTemplates,
userObjectSanitizer: function (user) { return user; },
};
exports.ServerHooks = {
LoginSuccess: 'LoginSuccess',
LoginError: 'LoginError',
LogoutSuccess: 'LogoutSuccess',
LogoutError: 'LogoutError',
CreateUserSuccess: 'CreateUserSuccess',
CreateUserError: 'CreateUserError',
ResumeSessionSuccess: 'ResumeSessionSuccess',
ResumeSessionError: 'ResumeSessionError',
RefreshTokensSuccess: 'RefreshTokensSuccess',
RefreshTokensError: 'RefreshTokensError',
ImpersonationSuccess: 'ImpersonationSuccess',
ImpersonationError: 'ImpersonationError',
};
var AccountsServer = (function () {
function AccountsServer(services, options) {
function AccountsServer(options, services) {
this.options = __assign({}, defaultOptions, options);
if (!this.options.db) {
throw new common_1.AccountsError('A database driver is required');
}
this.services = services;
this.options = __assign({}, defaultOptions, options);
this.db = this.options.db;
for (var service in this.services) {
this.services[service].db = this.db;
this.services[service].server = this;
}
this.email = this.options.sendMail
? { sendMail: this.options.sendMail }
: new email_1.default(this.options.email);
this.hooks = new events_1.EventEmitter();
}
AccountsServer.prototype.getServices = function () {
return this.services;
};
AccountsServer.prototype.getOptions = function () {
return this.options;
};
AccountsServer.prototype.onLoginSuccess = function (callback) {
return this.on(exports.ServerHooks.LoginSuccess, callback);
};
AccountsServer.prototype.onLoginError = function (callback) {
return this.on(exports.ServerHooks.LoginError, callback);
};
AccountsServer.prototype.onLogoutSuccess = function (callback) {
return this.on(exports.ServerHooks.LogoutSuccess, callback);
};
AccountsServer.prototype.onLogoutError = function (callback) {
return this.on(exports.ServerHooks.LogoutError, callback);
};
AccountsServer.prototype.onCreateUserSuccess = function (callback) {
return this.on(exports.ServerHooks.CreateUserSuccess, callback);
};
AccountsServer.prototype.onCreateUserError = function (callback) {
return this.on(exports.ServerHooks.CreateUserError, callback);
};
AccountsServer.prototype.onResumeSessionSuccess = function (callback) {
return this.on(exports.ServerHooks.ResumeSessionSuccess, callback);
};
AccountsServer.prototype.onResumeSessionError = function (callback) {
return this.on(exports.ServerHooks.ResumeSessionError, callback);
};
AccountsServer.prototype.onRefreshTokensSuccess = function (callback) {
return this.on(exports.ServerHooks.RefreshTokensSuccess, callback);
};
AccountsServer.prototype.onRefreshTokensError = function (callback) {
return this.on(exports.ServerHooks.RefreshTokensError, callback);
};
AccountsServer.prototype.onImpersonationSuccess = function (callback) {
return this.on(exports.ServerHooks.ImpersonationSuccess, callback);
};
AccountsServer.prototype.onImpersonationError = function (callback) {
return this.on(exports.ServerHooks.ImpersonationError, callback);
};
AccountsServer.prototype.loginWithService = function (serviceName, params, infos) {

@@ -115,13 +187,24 @@ return __awaiter(this, void 0, void 0, function () {

};
AccountsServer.prototype.resumeSession = function (accessToken) {
AccountsServer.prototype.impersonate = function (accessToken, username, ip, userAgent) {
return __awaiter(this, void 0, void 0, function () {
var session, user, e_1;
var session, user, impersonatedUser, isAuthorized, newSessionId, impersonationTokens, impersonationResult, e_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 4, , 5]);
_a.trys.push([0, 6, , 7]);
if (!isString(accessToken)) {
throw new common_1.AccountsError('An access token is required');
}
try {
jwt.verify(accessToken, this.options.tokenSecret);
}
catch (err) {
throw new common_1.AccountsError('Access token is not valid');
}
return [4, this.findSessionByAccessToken(accessToken)];
case 1:
session = _a.sent();
if (!session.valid) return [3, 3];
if (!session.valid) {
throw new common_1.AccountsError('Session is not valid for user');
}
return [4, this.db.findUserById(session.userId)];

@@ -131,10 +214,35 @@ case 2:

if (!user) {
throw new Error('User not found');
throw new common_1.AccountsError('User not found');
}
return [2, this.sanitizeUser(user)];
case 3: return [2, null];
return [4, this.db.findUserByUsername(username)];
case 3:
impersonatedUser = _a.sent();
if (!impersonatedUser) {
throw new common_1.AccountsError("User " + username + " not found");
}
if (!this.options.impersonationAuthorize) {
return [2, { authorized: false }];
}
return [4, this.options.impersonationAuthorize(user, impersonatedUser)];
case 4:
isAuthorized = _a.sent();
if (!isAuthorized) {
return [2, { authorized: false }];
}
return [4, this.db.createSession(impersonatedUser.id, ip, userAgent, { impersonatorUserId: user.id })];
case 5:
newSessionId = _a.sent();
impersonationTokens = this.createTokens(newSessionId, true);
impersonationResult = {
authorized: true,
tokens: impersonationTokens,
user: this.sanitizeUser(impersonatedUser),
};
this.hooks.emit(exports.ServerHooks.ImpersonationSuccess, user, impersonationResult);
return [2, impersonationResult];
case 6:
e_1 = _a.sent();
this.hooks.emit(exports.ServerHooks.ImpersonationError, e_1);
throw e_1;
case 5: return [2];
case 7: return [2];
}

@@ -144,17 +252,22 @@ });

};
AccountsServer.prototype.findSessionByAccessToken = function (accessToken) {
AccountsServer.prototype.refreshTokens = function (accessToken, refreshToken, ip, userAgent) {
return __awaiter(this, void 0, void 0, function () {
var sessionId, decodedAccessToken, session;
var sessionId, decodedAccessToken, session, user, tokens, result, err_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!lodash_1.isString(accessToken)) {
throw new Error('An accessToken is required');
_a.trys.push([0, 6, , 7]);
if (!isString(accessToken) || !isString(refreshToken)) {
throw new common_1.AccountsError('An accessToken and refreshToken are required');
}
sessionId = void 0;
try {
decodedAccessToken = jwt.verify(accessToken, this.options.tokenSecret);
jwt.verify(refreshToken, this.options.tokenSecret);
decodedAccessToken = jwt.verify(accessToken, this.options.tokenSecret, {
ignoreExpiration: true,
});
sessionId = decodedAccessToken.data.sessionId;
}
catch (err) {
throw new Error('Tokens are not valid');
throw new common_1.AccountsError('Tokens are not valid');
}

@@ -165,5 +278,31 @@ return [4, this.db.findSessionById(sessionId)];

if (!session) {
throw new Error('Session not found');
throw new common_1.AccountsError('Session not found');
}
return [2, session];
if (!session.valid) return [3, 4];
return [4, this.db.findUserById(session.userId)];
case 2:
user = _a.sent();
if (!user) {
throw new common_1.AccountsError('User not found', { id: session.userId });
}
tokens = this.createTokens(sessionId);
return [4, this.db.updateSession(sessionId, ip, userAgent)];
case 3:
_a.sent();
result = {
sessionId: sessionId,
user: this.sanitizeUser(user),
tokens: tokens,
};
this.hooks.emit(exports.ServerHooks.RefreshTokensSuccess, result);
return [2, result];
case 4: throw new common_1.AccountsError('Session is no longer valid', {
id: session.userId,
});
case 5: return [3, 7];
case 6:
err_1 = _a.sent();
this.hooks.emit(exports.ServerHooks.RefreshTokensError, err_1);
throw err_1;
case 7: return [2];
}

@@ -175,3 +314,3 @@ });

if (isImpersonated === void 0) { isImpersonated = false; }
var _a = this.options, tokenSecret = _a.tokenSecret, tokenConfigs = _a.tokenConfigs;
var _a = this.options, _b = _a.tokenSecret, tokenSecret = _b === void 0 ? config_1.default.tokenSecret : _b, _c = _a.tokenConfigs, tokenConfigs = _c === void 0 ? config_1.default.tokenConfigs : _c;
var accessToken = tokens_1.generateAccessToken({

@@ -183,16 +322,192 @@ data: {

secret: tokenSecret,
config: tokenConfigs.accessToken,
config: tokenConfigs.accessToken || {},
});
var refreshToken = tokens_1.generateRefreshToken({
secret: tokenSecret,
config: tokenConfigs.refreshToken,
config: tokenConfigs.refreshToken || {},
});
return { accessToken: accessToken, refreshToken: refreshToken };
};
AccountsServer.prototype.logout = function (accessToken) {
return __awaiter(this, void 0, void 0, function () {
var session, user, error_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 6, , 7]);
return [4, this.findSessionByAccessToken(accessToken)];
case 1:
session = _a.sent();
if (!session.valid) return [3, 4];
return [4, this.db.findUserById(session.userId)];
case 2:
user = _a.sent();
if (!user) {
throw new common_1.AccountsError('User not found', { id: session.userId });
}
return [4, this.db.invalidateSession(session.sessionId)];
case 3:
_a.sent();
this.hooks.emit(exports.ServerHooks.LogoutSuccess, this.sanitizeUser(user), session, accessToken);
return [3, 5];
case 4: throw new common_1.AccountsError('Session is no longer valid', {
id: session.userId,
});
case 5: return [3, 7];
case 6:
error_1 = _a.sent();
this.hooks.emit(exports.ServerHooks.LogoutError, error_1);
throw error_1;
case 7: return [2];
}
});
});
};
AccountsServer.prototype.resumeSession = function (accessToken) {
return __awaiter(this, void 0, void 0, function () {
var session, user, e_2, e_3;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 8, , 9]);
return [4, this.findSessionByAccessToken(accessToken)];
case 1:
session = _a.sent();
if (!session.valid) return [3, 7];
return [4, this.db.findUserById(session.userId)];
case 2:
user = _a.sent();
if (!user) {
throw new common_1.AccountsError('User not found', { id: session.userId });
}
if (!this.options.resumeSessionValidator) return [3, 6];
_a.label = 3;
case 3:
_a.trys.push([3, 5, , 6]);
return [4, this.options.resumeSessionValidator(user, session)];
case 4:
_a.sent();
return [3, 6];
case 5:
e_2 = _a.sent();
throw new common_1.AccountsError(e_2, { id: session.userId }, 403);
case 6:
this.hooks.emit(exports.ServerHooks.ResumeSessionSuccess, user, accessToken);
return [2, this.sanitizeUser(user)];
case 7:
this.hooks.emit(exports.ServerHooks.ResumeSessionError, new common_1.AccountsError('Invalid Session', { id: session.userId }));
return [2, null];
case 8:
e_3 = _a.sent();
this.hooks.emit(exports.ServerHooks.ResumeSessionError, e_3);
throw e_3;
case 9: return [2];
}
});
});
};
AccountsServer.prototype.findSessionByAccessToken = function (accessToken) {
return __awaiter(this, void 0, void 0, function () {
var sessionId, decodedAccessToken, session;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!isString(accessToken)) {
throw new common_1.AccountsError('An accessToken is required');
}
try {
decodedAccessToken = jwt.verify(accessToken, this.options.tokenSecret);
sessionId = decodedAccessToken.data.sessionId;
}
catch (err) {
throw new common_1.AccountsError('Tokens are not valid');
}
return [4, this.db.findSessionById(sessionId)];
case 1:
session = _a.sent();
if (!session) {
throw new common_1.AccountsError('Session not found');
}
return [2, session];
}
});
});
};
AccountsServer.prototype.findUserById = function (userId) {
return this.db.findUserById(userId);
};
AccountsServer.prototype.setProfile = function (userId, profile) {
return __awaiter(this, void 0, void 0, function () {
var user;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, this.db.findUserById(userId)];
case 1:
user = _a.sent();
if (!user) {
throw new common_1.AccountsError('User not found', { id: userId });
}
return [4, this.db.setProfile(userId, profile)];
case 2:
_a.sent();
return [2];
}
});
});
};
AccountsServer.prototype.updateProfile = function (userId, profile) {
return __awaiter(this, void 0, void 0, function () {
var user;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, this.db.findUserById(userId)];
case 1:
user = _a.sent();
if (!user) {
throw new common_1.AccountsError('User not found', { id: userId });
}
return [2, this.db.setProfile(userId, __assign({}, user.profile, profile))];
}
});
});
};
AccountsServer.prototype.on = function (eventName, callback) {
var _this = this;
this.hooks.on(eventName, callback);
return function () { return _this.hooks.removeListener(eventName, callback); };
};
AccountsServer.prototype.isTokenExpired = function (token, tokenRecord) {
return (!tokenRecord ||
Number(tokenRecord.when) + this.options.emailTokensExpiry < Date.now());
};
AccountsServer.prototype.prepareMail = function (to, token, user, pathFragment, emailTemplate, from) {
if (this.options.prepareMail) {
return this.options.prepareMail(to, token, user, pathFragment, emailTemplate, from);
}
return this.defaultPrepareEmail(to, token, user, pathFragment, emailTemplate, from);
};
AccountsServer.prototype.sanitizeUser = function (user) {
return lodash_1.omit(user, ['services']);
var userObjectSanitizer = this.options.userObjectSanitizer;
return userObjectSanitizer(this.internalUserSanitizer(user), omit, pick);
};
AccountsServer.prototype.internalUserSanitizer = function (user) {
return omit(user, ['services']);
};
AccountsServer.prototype.defaultPrepareEmail = function (to, token, user, pathFragment, emailTemplate, from) {
var tokenizedUrl = this.defaultCreateTokenizedUrl(pathFragment, token);
return {
from: emailTemplate.from || from,
to: to,
subject: emailTemplate.subject(user),
text: emailTemplate.text(user, tokenizedUrl),
};
};
AccountsServer.prototype.defaultCreateTokenizedUrl = function (pathFragment, token) {
var siteUrl = this.options.siteUrl || config_1.default.siteUrl;
return siteUrl + "/" + pathFragment + "/" + token;
};
return AccountsServer;
}());
exports.AccountsServer = AccountsServer;
exports.default = AccountsServer;
//# sourceMappingURL=accounts-server.js.map

@@ -1,3 +0,6 @@

import AccountsServer from './accounts-server';
export { DBInterface } from './types';
export { AccountsServer };
import { AccountsServer } from './accounts-server';
import * as encryption from './encryption';
import config from './config';
import { generateRandomToken } from './tokens';
import { AuthService, DBInterface } from './types';
export { AccountsServer, AuthService, encryption, config, DBInterface, generateRandomToken };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var accounts_server_1 = require("./accounts-server");
exports.AccountsServer = accounts_server_1.default;
exports.AccountsServer = accounts_server_1.AccountsServer;
var encryption = require("./encryption");
exports.encryption = encryption;
var config_1 = require("./config");
exports.config = config_1.default;
var tokens_1 = require("./tokens");
exports.generateRandomToken = tokens_1.generateRandomToken;
//# sourceMappingURL=index.js.map

@@ -6,3 +6,3 @@ export declare const generateRandomToken: (length?: number) => string;

config: object;
}) => any;
}) => string;
export declare const generateRefreshToken: ({secret, data, config}: {

@@ -12,2 +12,2 @@ secret: string;

config: object;
}) => any;
}) => string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var jwt = require("jsonwebtoken");
var crypto = require("crypto");
var crypto_1 = require("crypto");
exports.generateRandomToken = function (length) {
if (length === void 0) { length = 43; }
return crypto.randomBytes(length).toString('hex');
return crypto_1.randomBytes(length).toString('hex');
};

@@ -9,0 +9,0 @@ exports.generateAccessToken = function (_a) {

@@ -1,2 +0,38 @@

import { SessionType, CreateUserType, UserObjectType } from '@accounts/common';
import { UserObjectType, CreateUserType, SessionType } from '@accounts/common';
import { EmailTemplatesType, EmailTemplateType } from './email';
import { AccountsServer } from './accounts-server';
export interface AuthService {
db: DBInterface;
server: AccountsServer;
serviceName: string;
authenticate(params: any): Promise<UserObjectType | null>;
}
export declare type UserObjectSanitizerFunction = (userObject: UserObjectType, omitFunction: (userDoc: object) => UserObjectType, pickFunction: (userDoc: object) => UserObjectType) => any;
export declare type ResumeSessionValidator = (user: UserObjectType, session: SessionType) => Promise<any>;
export declare type PrepareMailFunction = (to: string, token: string, user: UserObjectType, pathFragment: string, emailTemplate: EmailTemplateType, from: string) => object;
export declare type EmailType = EmailTemplateType & {
to: string;
};
export declare type SendMailFunction = (emailConfig: EmailType | object) => Promise<object>;
export interface AccountsServerOptions {
db: DBInterface;
tokenSecret: string;
tokenConfigs?: {
accessToken?: {
expiresIn?: string;
};
refreshToken?: {
expiresIn?: string;
};
};
emailTokensExpiry?: number;
emailTemplates?: EmailTemplatesType;
userObjectSanitizer?: UserObjectSanitizerFunction;
impersonationAuthorize?: (user: UserObjectType, impersonateToUser: UserObjectType) => Promise<any>;
resumeSessionValidator?: ResumeSessionValidator;
siteUrl?: string;
prepareMail?: PrepareMailFunction;
sendMail?: SendMailFunction;
email?: object;
}
export interface ConnectionInformationsType {

@@ -10,11 +46,12 @@ ip?: string;

findUserById(userId: string): Promise<UserObjectType | null>;
findUserByOAuthId(service: string, id: string): Promise<UserObjectType | null>;
createUser(user: CreateUserType): Promise<string>;
setUsername(userId: string, newUsername: string): Promise<void>;
setProfile(userId: string, profile: object): Promise<object>;
findPasswordHash(userId: string): Promise<string | null>;
findUserByServiceId(serviceName: string, pickBy: object): Promise<UserObjectType | null>;
setService(userId: string, serviceName: string, data: object): Promise<void>;
findPasswordHash(userId: string): Promise<string>;
findUserByResetPasswordToken(token: string): Promise<UserObjectType | null>;
setPasssword(userId: string, newPassword: string): Promise<void>;
setPassword(userId: string, newPassword: string): Promise<void>;
addResetPasswordToken(userId: string, email: string, token: string, reason?: string): Promise<void>;
setResetPasssword(userId: string, email: string, newPassword: string, token: string): Promise<void>;
setResetPassword(userId: string, email: string, newPassword: string, token: string): Promise<void>;
findUserByEmailVerificationToken(token: string): Promise<UserObjectType | null>;

@@ -25,7 +62,7 @@ addEmail(userId: string, newEmail: string, verified: boolean): Promise<void>;

addEmailVerificationToken(userId: string, email: string, token: string): Promise<void>;
findSessionById(sessionId: string): Promise<SessionType | null>;
createSession(userId: string, ip?: string, userAgent?: string): Promise<string>;
updateSession(sessionId: string, ip: string, userAgent: string): Promise<void>;
findSessionById(sessionId: string): Promise<SessionType>;
createSession(userId: string, ip?: string, userAgent?: string, extraData?: object): Promise<string>;
updateSession(sessionId: string, ip?: string, userAgent?: string): Promise<void>;
invalidateSession(sessionId: string): Promise<void>;
invalidateAllSessions(userId: string): Promise<void>;
}
{
"name": "@accounts/server",
"version": "0.1.0-alpha.9854fbf9",
"license": "MIT",
"version": "0.1.0-alpha.9974ccde",
"description": "Fullstack authentication and accounts-management",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"publishConfig": {
"access": "public"
},
"scripts": {
"clean": "rimraf lib",
"start": "tsc --watch",
"precompile": "npm run clean",
"compile": "tsc",
"prepublish": "npm run compile",
"test": "npm run testonly",
"test-ci": "npm lint && npm coverage",
"testonly": "jest",
"coverage": "jest --coverage"
"coverage": "npm run testonly -- --coverage",
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
},
"jest": {
"transform": {
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
".(ts|tsx)": "<rootDir>/../../node_modules/ts-jest/preprocessor.js"
},
"testRegex": "./__tests__/.*.(ts|tsx)$",
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js"

@@ -24,8 +33,33 @@ ],

},
"repository": {
"type": "git",
"url": "https://github.com/js-accounts/accounts/tree/master/packages/server"
},
"keywords": [
"rest",
"graphql",
"grant",
"auth",
"authentication",
"accounts",
"users",
"oauth"
],
"author": "Tim Mikeladze",
"license": "MIT",
"dependencies": {
"jsonwebtoken": "^7.4.1"
"@accounts/common": "^0.1.0-alpha.9974ccde",
"babel-polyfill": "^6.23.0",
"bcryptjs": "^2.4.0",
"crypto": "^0.0.3",
"emailjs": "^1.0.8",
"jsonwebtoken": "^7.2.1",
"jwt-decode": "^2.1.0",
"lodash": "^4.16.4"
},
"peerDependencies": {
"@accounts/common": "^0.1.0"
"devDependencies": {
"@types/jsonwebtoken": "^7.2.3",
"@types/jwt-decode": "^2.2.1",
"coveralls": "^2.11.14"
}
}

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