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

namirasoft-account

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

namirasoft-account - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

dist/NamirasoftAccountReqHeader.d.ts

14

dist/NamirasoftAccountHeader.d.ts

@@ -0,10 +1,8 @@

import { NamirasoftAccountReqHeader } from "./NamirasoftAccountReqHeader";
import { NamirasoftAccountResHeader } from "./NamirasoftAccountResHeader";
export declare class NamirasoftAccountHeader {
private static getX;
static SERVER_TO_SERVER_SIGNATURE(): string;
static API_JWT(): string;
static API_INFO(): string;
static API_REFRESH(): string;
static API_DENY(): string;
static API_USER(): string;
static API_IP(): string;
static req: NamirasoftAccountReqHeader;
static res: NamirasoftAccountResHeader;
protected getX(): string;
S2S(): string;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NamirasoftAccountHeader = void 0;
const NamirasoftAccountReqHeader_1 = require("./NamirasoftAccountReqHeader");
const NamirasoftAccountResHeader_1 = require("./NamirasoftAccountResHeader");
class NamirasoftAccountHeader {
static getX() {
getX() {
return `x-namirasoft-account-`;
}
static SERVER_TO_SERVER_SIGNATURE() {
return NamirasoftAccountHeader.getX() + `s2s-signature`;
S2S() {
return this.getX() + `s2s`;
}
static API_JWT() {
return NamirasoftAccountHeader.getX() + `api-jwt`;
}
static API_INFO() {
return NamirasoftAccountHeader.getX() + `api-info`;
}
static API_REFRESH() {
return NamirasoftAccountHeader.getX() + `api-refresh`;
}
static API_DENY() {
return NamirasoftAccountHeader.getX() + `api-deny`;
}
static API_USER() {
return NamirasoftAccountHeader.getX() + `api-user`;
}
static API_IP() {
return NamirasoftAccountHeader.getX() + `api-ip`;
}
}
exports.NamirasoftAccountHeader = NamirasoftAccountHeader;
NamirasoftAccountHeader.req = new NamirasoftAccountReqHeader_1.NamirasoftAccountReqHeader();
NamirasoftAccountHeader.res = new NamirasoftAccountResHeader_1.NamirasoftAccountResHeader();
//# sourceMappingURL=NamirasoftAccountHeader.js.map

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

static onBeforeRequest_SetToken(manager, config) {
let name = NamirasoftAccountHeader_1.NamirasoftAccountHeader.API_JWT();
let header = NamirasoftAccountHeader_1.NamirasoftAccountHeader.req.JWT();
let token = manager.getValue();
if (token)
if (config === null || config === void 0 ? void 0 : config.headers)
config.headers[name] = token;
config.headers[header] = token;
}

@@ -18,4 +18,4 @@ static onAfterRequest_SetUser(manager, response) {

if (token) {
let name = NamirasoftAccountHeader_1.NamirasoftAccountHeader.API_USER();
let user = response.headers[name];
let header = NamirasoftAccountHeader_1.NamirasoftAccountHeader.res.USER();
let user = response.headers[header];
if (user)

@@ -22,0 +22,0 @@ manager.setUser(JSON.parse(user));

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

getText() {
let name = NamirasoftAccountHeader_1.NamirasoftAccountHeader.API_JWT();
let name = NamirasoftAccountHeader_1.NamirasoftAccountHeader.req.JWT();
return this.storage.get(name, "");
}
setText(text, isTheSameUser) {
let name = NamirasoftAccountHeader_1.NamirasoftAccountHeader.API_JWT();
let name = NamirasoftAccountHeader_1.NamirasoftAccountHeader.req.JWT();
this.storage.set(name, text);

@@ -32,3 +32,3 @@ if (!isTheSameUser)

del() {
let name = NamirasoftAccountHeader_1.NamirasoftAccountHeader.API_JWT();
let name = NamirasoftAccountHeader_1.NamirasoftAccountHeader.req.JWT();
this.storage.del(name);

@@ -35,0 +35,0 @@ }

{
"name": "namirasoft-account",
"description": "Namira Software Corporation Account NPM Package",
"version": "1.0.1",
"version": "1.0.2",
"main": "./dist/index.js",

@@ -6,0 +6,0 @@ "types": "./dist/index.d.ts",

@@ -0,35 +1,16 @@

import { NamirasoftAccountReqHeader } from "./NamirasoftAccountReqHeader";
import { NamirasoftAccountResHeader } from "./NamirasoftAccountResHeader";
export class NamirasoftAccountHeader
{
private static getX()
static req: NamirasoftAccountReqHeader = new NamirasoftAccountReqHeader();
static res: NamirasoftAccountResHeader = new NamirasoftAccountResHeader();
protected getX()
{
return `x-namirasoft-account-`;
}
static SERVER_TO_SERVER_SIGNATURE()
S2S()
{
return NamirasoftAccountHeader.getX() + `s2s-signature`;
return this.getX() + `s2s`;
}
static API_JWT()
{
return NamirasoftAccountHeader.getX() + `api-jwt`;
}
static API_INFO()
{
return NamirasoftAccountHeader.getX() + `api-info`;
}
static API_REFRESH()
{
return NamirasoftAccountHeader.getX() + `api-refresh`;
}
static API_DENY()
{
return NamirasoftAccountHeader.getX() + `api-deny`;
}
static API_USER()
{
return NamirasoftAccountHeader.getX() + `api-user`;
}
static API_IP()
{
return NamirasoftAccountHeader.getX() + `api-ip`;
}
}

@@ -10,7 +10,7 @@ import { BaseServer } from "namirasoft-core";

{
let name = NamirasoftAccountHeader.API_JWT();
let header = NamirasoftAccountHeader.req.JWT();
let token = manager.getValue();
if (token)
if (config?.headers)
config.headers[name] = token;
config.headers[header] = token;
}

@@ -22,4 +22,4 @@ static onAfterRequest_SetUser<ResData>(manager: TokenManager, response: AxiosResponse<ResData, any>): void

{
let name = NamirasoftAccountHeader.API_USER();
let user = response.headers[name];
let header = NamirasoftAccountHeader.res.USER();
let user = response.headers[header];
if (user)

@@ -26,0 +26,0 @@ manager.setUser(JSON.parse(user));

@@ -19,3 +19,3 @@ import { IStorage } from "namirasoft-core";

{
let name: string = NamirasoftAccountHeader.API_JWT();
let name: string = NamirasoftAccountHeader.req.JWT();
return this.storage.get(name, "");

@@ -25,3 +25,3 @@ }

{
let name: string = NamirasoftAccountHeader.API_JWT();
let name: string = NamirasoftAccountHeader.req.JWT();
this.storage.set(name, text);

@@ -45,3 +45,3 @@ if (!isTheSameUser)

{
let name: string = NamirasoftAccountHeader.API_JWT();
let name: string = NamirasoftAccountHeader.req.JWT();
this.storage.del(name);

@@ -48,0 +48,0 @@ }

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