From 9b57728892080c4e5b0ee4bcf35c66d3af4a8dd1 Mon Sep 17 00:00:00 2001 From: Fabian Stamm Date: Fri, 18 Jan 2019 15:58:47 +0100 Subject: [PATCH] Disable jwt request collecting --- .gitignore | 1 + lib/index.d.ts | 62 ------------- lib/index.js | 208 ------------------------------------------ lib/index.js.map | 1 - lib/lock.d.ts | 12 --- lib/lock.js | 49 ---------- lib/lock.js.map | 1 - lib/observable.d.ts | 14 --- lib/observable.js | 40 -------- lib/observable.js.map | 1 - lib/test.d.ts | 1 - lib/test.js | 122 ------------------------- lib/test.js.map | 1 - package.json | 2 +- src/index.ts | 2 +- 15 files changed, 3 insertions(+), 514 deletions(-) delete mode 100644 lib/index.d.ts delete mode 100644 lib/index.js delete mode 100644 lib/index.js.map delete mode 100644 lib/lock.d.ts delete mode 100644 lib/lock.js delete mode 100644 lib/lock.js.map delete mode 100644 lib/observable.d.ts delete mode 100644 lib/observable.js delete mode 100644 lib/observable.js.map delete mode 100644 lib/test.d.ts delete mode 100644 lib/test.js delete mode 100644 lib/test.js.map diff --git a/.gitignore b/.gitignore index 18c3786..0d6b477 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules/ yarn.lock private.pem +lib/ diff --git a/lib/index.d.ts b/lib/index.d.ts deleted file mode 100644 index d49a8c8..0000000 --- a/lib/index.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -import Lock from "./lock"; -export interface IFileVersion { - version: string; - time: Date; - preview: string; - deleted: boolean; -} -export interface IFile { - _id: string; - type: string; - name: string; - folder: string; - deleted: boolean; - active: IFileVersion; - versions: IFileVersion[]; - user: string; - application: string; -} -export interface IHistory { - file: IFile; - history: IFileVersion[]; -} -export declare class NoConnection extends Error { - type: string; - constructor(); -} -export declare class Unauthorized extends Error { - type: string; - constructor(); -} -export declare class NoPermission extends Error { - type: string; - constructor(); -} -export declare class NotFound extends Error { - type: string; - constructor(); -} -export declare class BadRequest extends Error { - type: string; - constructor(); -} -export default class SecureFileWrapper { - private server; - private _jwtObservableServer; - jwtObservable: { - subscribe: (callback: import("./observable").ObserverCallback<((jwt: string) => void)[]>) => void; - unsubscribe: (callback: import("./observable").ObserverCallback<((jwt: string) => void)[]>) => void; - }; - jwt: string; - auth_lock: Lock; - constructor(server: string); - getJWT(): Promise; - makeRequest(endpoint: string, method: "POST" | "GET" | "PUT" | "DELETE", query: any, body?: ArrayBuffer | ArrayBufferView, second?: boolean): any; - list(folder?: string): Promise; - create(name: string, data: ArrayBuffer | ArrayBufferView, type: "text" | "binary", folder?: string, preview?: string): Promise; - get(id: string, version?: string): Promise; - update(id: string, data: ArrayBuffer | ArrayBufferView, preview?: string): Promise; - delete(id: string): Promise; - history(id: string): Promise; - restore(id: string, version: string): Promise; -} diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 8755220..0000000 --- a/lib/index.js +++ /dev/null @@ -1,208 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const observable_1 = require("./observable"); -const lock_1 = require("./lock"); -class NoConnection extends Error { - constructor() { - super("No connection"); - this.type = "noconnection"; - } -} -exports.NoConnection = NoConnection; -class Unauthorized extends Error { - constructor() { - super("Not authorized"); - this.type = "unauthorized"; - } -} -exports.Unauthorized = Unauthorized; -class NoPermission extends Error { - constructor() { - super("No permission"); - this.type = "nopermission"; - } -} -exports.NoPermission = NoPermission; -class NotFound extends Error { - constructor() { - super("Not found"); - this.type = "notfound"; - } -} -exports.NotFound = NotFound; -class BadRequest extends Error { - constructor() { - super("Bad request"); - this.type = "badrequest"; - } -} -exports.BadRequest = BadRequest; -const fetch = require("isomorphic-fetch"); -function statusParser(res) { - if (res.status !== 200) { - switch (res.status) { - case 400: - throw new BadRequest(); - case 404: - throw new NotFound(); - case 403: - throw new NoPermission(); - case 401: - throw new Unauthorized(); - default: - throw new Error(res.statusText); - } - } -} -class SecureFileWrapper { - constructor(server) { - this.server = server; - this._jwtObservableServer = new observable_1.default(); - this.jwtObservable = this._jwtObservableServer.getPublicApi(); - this.auth_lock = new lock_1.default(); - if (this.server.endsWith("/")) { - this.server += "api/v1"; - } - else { - this.server += "/api/v1"; - } - } - getJWT() { - return __awaiter(this, void 0, void 0, function* () { - if (!this.auth_lock.locked) { - let lock = yield this.auth_lock.getLock(); - this._jwtObservableServer.send((jwt) => { - this.jwt = jwt; - lock.release(); - }); - } - yield this.auth_lock.getLock().then(lock => lock.release()); - }); - } - makeRequest(endpoint, method, query, body, second = false) { - return __awaiter(this, void 0, void 0, function* () { - if (!this.jwt || this.jwt === undefined) { - yield this.getJWT(); - } - query.jwt = this.jwt; - let query_str = "?"; - let first = true; - for (let key in query) { - if (!first) - query_str += "&"; - query_str += encodeURIComponent(key) + "=" + encodeURIComponent(query[key]); - first = false; - } - var headers = { - "pragme": "no-cache", - "cache-control": "no-cache" - }; - let body_n; - if (body) { - headers["Content-Type"] = "application/octet-stream"; - body_n = Buffer ? Buffer.from(body instanceof ArrayBuffer ? body : body.buffer) : body; - } - try { - let res = yield fetch(this.server + endpoint + query_str, { method, body: body_n, headers }); - if (res.status === 401 && !second) { - yield this.getJWT(); - return this.makeRequest(endpoint, method, query, body, true); - } - else { - statusParser(res); - return res; - } - } - catch (err) { - if (err instanceof TypeError || err.errno === "ECONNREFUSED") - throw new NoConnection(); - throw err; - } - }); - } - // async test(jwt): Promise<{ user: string, test: true }> { - // let res = await this.makeRequest("/test", "GET", {}, undefined, this.jwt_enabled); - // statusParser(res); - // return await res.json(); - // } - list(folder) { - return __awaiter(this, void 0, void 0, function* () { - let query = {}; - if (folder) - query.folder = folder; - let res = yield this.makeRequest("/files", "GET", query); - let d = yield res.json(); - return d.files; - }); - } - create(name, data, type, folder, preview) { - return __awaiter(this, void 0, void 0, function* () { - let params = { type: type, name: name }; - if (preview) { - params.preview = preview; - } - if (folder) { - params.folder = folder; - } - let res = yield this.makeRequest("/files", "POST", params, data); - return (yield res.json()).file; - }); - } - get(id, version) { - return __awaiter(this, void 0, void 0, function* () { - let res; - if (typeof version === "string") { - res = yield this.makeRequest(`/files/${id}/history/${version}`, "GET", {}); - } - else { - res = yield this.makeRequest("/files/" + id, "GET", {}); - } - if (res.arrayBuffer) { - return res.arrayBuffer(); - } - else { - let blob = yield res.buffer(); - // console.log(blob.length); - return Uint8Array.from(blob).buffer; - } - }); - } - update(id, data, preview) { - return __awaiter(this, void 0, void 0, function* () { - let put = {}; - if (preview) - put.preview = preview; - let res = yield this.makeRequest("/files/" + id, "PUT", put, data); - let json = yield res.json(); - return json.file; - }); - } - delete(id) { - return __awaiter(this, void 0, void 0, function* () { - let res = yield this.makeRequest("/files/" + id, "DELETE", {}); - return res.json(); - }); - } - history(id) { - return __awaiter(this, void 0, void 0, function* () { - let res = yield this.makeRequest(`/files/${id}/history`, "GET", {}); - statusParser(res); - return res.json(); - }); - } - restore(id, version) { - return __awaiter(this, void 0, void 0, function* () { - yield this.makeRequest(`/files/${id}/history/${version}/restore`, "PUT", {}); - }); - } -} -exports.default = SecureFileWrapper; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/index.js.map b/lib/index.js.map deleted file mode 100644 index bcfd97d..0000000 --- a/lib/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,6CAAsC;AACtC,iCAA0B;AA2B1B,MAAa,YAAa,SAAQ,KAAK;IAEpC;QACG,KAAK,CAAC,eAAe,CAAC,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,cAAc,CAAA;IAC7B,CAAC;CACH;AAND,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-export declare type Release = { - release: () => void; -}; -export default class Lock { - private _locked; - readonly locked: boolean; - private toCome; - constructor(); - getLock(): Promise; - private lock; - private release; -} diff --git a/lib/lock.js b/lib/lock.js deleted file mode 100644 index 19f88a8..0000000 --- a/lib/lock.js +++ /dev/null @@ -1,49 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -class Lock { - constructor() { - this._locked = false; - this.toCome = []; - this.release = this.release.bind(this); - } - get locked() { - return this._locked; - } - getLock() { - return __awaiter(this, void 0, void 0, function* () { - if (!this._locked) - return { release: this.lock() }; - else { - return new Promise((resolve) => { - this.toCome.push(() => { - resolve({ release: this.lock() }); - }); - }); - } - }); - } - lock() { - this._locked = true; - return this.release; - } - release() { - return __awaiter(this, void 0, void 0, function* () { - if (this.toCome.length > 0) { - this.toCome.shift()(); - } - else { - this._locked = false; - } - }); - } -} -exports.default = Lock; -//# sourceMappingURL=lock.js.map \ No newline at end of file diff --git a/lib/lock.js.map b/lib/lock.js.map deleted file mode 100644 index 235b5a2..0000000 --- a/lib/lock.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"lock.js","sourceRoot":"","sources":["../src/lock.ts"],"names":[],"mappings":";;;;;;;;;;AACA,MAAqB,IAAI;IAOtB;QANQ,YAAO,GAAY,KAAK,CAAC;QAIzB,WAAM,GAAmB,EAAE,CAAC;QAGjC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAPD,IAAI,MAAM;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACvB,CAAC;IAOK,OAAO;;YACV,IAAI,CAAC,IAAI,CAAC,OAAO;gBAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;iBAC9C;gBACF,OAAO,IAAI,OAAO,CAAU,CAAC,OAAO,EAAE,EAAE;oBACrC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;wBACnB,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;oBACrC,CAAC,CAAC,CAAA;gBACL,CAAC,CAAC,CAAA;aACJ;QACJ,CAAC;KAAA;IAEO,IAAI;QACT,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC;IACvB,CAAC;IAEa,OAAO;;YAClB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;gBACzB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;aACxB;iBAAM;gBACJ,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;aACvB;QACJ,CAAC;KAAA;CACH;AAlCD,uBAkCC"} \ No newline at end of file diff --git a/lib/observable.d.ts b/lib/observable.d.ts deleted file mode 100644 index 9c5f6b2..0000000 --- a/lib/observable.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -export declare type ObserverCallback = (data: T) => void; -export default class Observable { - private collect; - private collect_intervall; - private subscriber; - private events; - private timeout; - constructor(collect?: boolean, collect_intervall?: number); - getPublicApi(): { - subscribe: (callback: ObserverCallback) => void; - unsubscribe: (callback: ObserverCallback) => void; - }; - send(data: T): void; -} diff --git a/lib/observable.js b/lib/observable.js deleted file mode 100644 index c38af8f..0000000 --- a/lib/observable.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -class Observable { - constructor(collect = true, collect_intervall = 100) { - this.collect = collect; - this.collect_intervall = collect_intervall; - this.subscriber = []; - this.events = []; - this.timeout = undefined; - } - getPublicApi() { - return { - subscribe: (callback) => { - if (this.subscriber.indexOf(callback) < 0) - this.subscriber.push(callback); - }, - unsubscribe: (callback) => { - let idx = this.subscriber.indexOf(callback); - if (idx >= 0) { - this.subscriber.splice(idx, 1); - } - } - }; - } - send(data) { - if (!this.collect) - this.subscriber.forEach(e => e([data])); - else { - this.events.push(data); - if (!this.timeout) { - this.timeout = setTimeout(() => { - this.subscriber.forEach(e => e(this.events)); - this.timeout = 0; - }, this.collect_intervall); - } - } - } -} -exports.default = Observable; -//# sourceMappingURL=observable.js.map \ No newline at end of file diff --git a/lib/observable.js.map b/lib/observable.js.map deleted file mode 100644 index 1259ae3..0000000 --- a/lib/observable.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"observable.js","sourceRoot":"","sources":["../src/observable.ts"],"names":[],"mappings":";;AAEA,MAAqB,UAAU;IAK5B,YAAoB,UAAmB,IAAI,EAAU,oBAA4B,GAAG;QAAhE,YAAO,GAAP,OAAO,CAAgB;QAAU,sBAAiB,GAAjB,iBAAiB,CAAc;QAJ5E,eAAU,GAA4B,EAAE,CAAC;QACzC,WAAM,GAAQ,EAAE,CAAC;QACjB,YAAO,GAAG,SAAS,CAAC;IAE4D,CAAC;IAEzF,YAAY;QACT,OAAO;YACJ,SAAS,EAAE,CAAC,QAA+B,EAAE,EAAE;gBAC5C,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;oBACtC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YACpC,CAAC;YACD,WAAW,EAAE,CAAC,QAA+B,EAAE,EAAE;gBAC9C,IAAI,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAC5C,IAAI,GAAG,IAAI,CAAC,EAAE;oBACX,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;iBACjC;YACJ,CAAC;SACH,CAAA;IACJ,CAAC;IAED,IAAI,CAAC,IAAO;QACT,IAAI,CAAC,IAAI,CAAC,OAAO;YACd,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACtC;YACF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACvB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;gBAChB,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;oBAC5B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;oBAC7C,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;gBACpB,CAAC,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;aAC7B;SACH;IACJ,CAAC;CACH;AAnCD,6BAmCC"} \ No newline at end of file diff --git a/lib/test.d.ts b/lib/test.d.ts deleted file mode 100644 index cb0ff5c..0000000 --- a/lib/test.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/lib/test.js b/lib/test.js deleted file mode 100644 index deb3055..0000000 --- a/lib/test.js +++ /dev/null @@ -1,122 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const index_1 = require("./index"); -const util_1 = require("util"); -const testname = "ouiavgbsop687463743"; -const encoder = new util_1.TextEncoder(); -const decoder = new util_1.TextDecoder(); -const testdata = encoder.encode("Ich bin ein Test"); -const newTestData = encoder.encode("neue test daten"); -const testprev = "Ich bin..."; -const testfolder = "iabos"; -let ftestid; -const chai_1 = require("chai"); -function test(sf) { - let testid; - let testver; - let testver2; - it("create", () => __awaiter(this, void 0, void 0, function* () { - let res = yield sf.create(testname, testdata, "text", undefined, testprev); - chai_1.expect(res, "Res isnnot set").to.exist; - chai_1.expect(res._id, "Res has no _id").to.exist; - testid = res._id; - testver = res.active.version; - })); - it("get", () => __awaiter(this, void 0, void 0, function* () { - let res = yield sf.get(testid); - chai_1.expect(res, "No data returned").to.exist; - chai_1.expect(decoder.decode(res), "Returned data not equal to stored").to.be.equal(decoder.decode(testdata)); - })); - it("get - fail", () => __awaiter(this, void 0, void 0, function* () { - const inverr = new Error("Should have failed!"); - try { - yield sf.get(testid + "asod"); - throw inverr; - } - catch (err) { - if (err !== inverr) { - chai_1.expect(err).to.be.instanceOf(index_1.NotFound); - } - } - })); - it("list", () => __awaiter(this, void 0, void 0, function* () { - let res = yield sf.list(); - chai_1.expect(Array.isArray(res), "Is not from type Array").to.be.true; - chai_1.expect(res.length, "No elements returned").to.greaterThan(0); - let found = !!res.find(e => e._id === testid); - chai_1.expect(found, "Element not in List").to.be.true; - })); - it("update", () => __awaiter(this, void 0, void 0, function* () { - let res = yield sf.update(testid, newTestData, undefined); - chai_1.expect(res, "No data returned").to.exist; - chai_1.expect(res._id, "_id missing").to.exist; - chai_1.expect(res.active.version, "No new version was created").to.not.equal(testver); - testver2 = res.active.version; - let res2 = yield sf.get(testid); - chai_1.expect(decoder.decode(res2), "Fetched data not updated").to.be.equal(decoder.decode(newTestData)); - })); - it("history", () => __awaiter(this, void 0, void 0, function* () { - let his = yield sf.history(testid); - chai_1.expect(his, "no data returned").to.exist; - chai_1.expect(his.file, "file not set").to.exist; - chai_1.expect(his.history, "history not set").to.exist; - chai_1.expect(his.history.length, `Not expected history length. Expected 1 got ${his.history.length}`).to.be.equal(1); - chai_1.expect(his.history[0].version, "Wrong version on history").to.be.equal(testver); - chai_1.expect(his.file.active.version, "Wrong version on file").to.be.equal(testver2); - })); - it("history get old", () => __awaiter(this, void 0, void 0, function* () { - let arch = yield sf.get(testid, testver); - chai_1.expect(decoder.decode(arch), "Old version has wrong data").to.be.equal(decoder.decode(testdata)); - })); - it("history restore", () => __awaiter(this, void 0, void 0, function* () { - yield sf.restore(testid, testver); - let res = yield sf.get(testid); - chai_1.expect(res, "No data returned").to.exist; - chai_1.expect(decoder.decode(res), "Returned data not equal to stored").to.be.equal(decoder.decode(testdata)); - })); - it("delete", () => __awaiter(this, void 0, void 0, function* () { - let res = yield sf.delete(testid); - chai_1.expect(res, "Res not set").to.exist; - })); - describe("folder", () => { - it("create", () => __awaiter(this, void 0, void 0, function* () { - let res = yield sf.create(testname, testdata, "text", testfolder, testprev); - chai_1.expect(res, "Res not set").to.exist; - chai_1.expect(res._id, "No _id field").to.exist; - ftestid = res._id; - testver = res.active.version; - })); - it("list", () => __awaiter(this, void 0, void 0, function* () { - let res = yield sf.list(testfolder); - chai_1.expect(Array.isArray(res), "Is from type Array").to.be.true; - chai_1.expect(res.length, "Do elements exist?").to.be.greaterThan(0); - let found = false; - res.forEach(e => { - if (e._id === ftestid) { - found = true; - } - }); - chai_1.expect(found, "Element is not in List").to.exist; - })); - it("delete", () => __awaiter(this, void 0, void 0, function* () { - let res = yield sf.delete(ftestid); - chai_1.expect(res, "Res not set").to.exist; - })); - }); -} -describe("SecureFile Tests", function () { - let sf = new index_1.default("http://localhost:3004"); - sf.jwtObservable.subscribe((callback) => { - callback[0]("TESTJWT"); - }); - test(sf); -}); -//# sourceMappingURL=test.js.map \ No newline at end of file diff --git a/lib/test.js.map b/lib/test.js.map deleted file mode 100644 index 37b3a1d..0000000 --- a/lib/test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":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,IAAI,GAAG,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACnC,aAAM,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;QACvC,CAAC,CAAA,CAAC,CAAC;IACN,CAAC,CAAC,CAAA;AACL,CAAC;AAED,QAAQ,CAAC,kBAAkB,EAAE;IAC1B,IAAI,EAAE,GAAG,IAAI,eAAU,CAAC,uBAAuB,CAAC,CAAC;IACjD,EAAE,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,EAAE;QACrC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAA;IACF,IAAI,CAAC,EAAE,CAAC,CAAA;AACX,CAAC,CAAC,CAAA"} \ No newline at end of file diff --git a/package.json b/package.json index 43e38fb..af2e739 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hibas123/secure-file-wrapper", - "version": "2.0.1", + "version": "2.0.2", "main": "lib/index.js", "author": "Fabian Stamm ", "license": "MIT", diff --git a/src/index.ts b/src/index.ts index 6221a51..37cf56a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -86,7 +86,7 @@ function statusParser(res: Response) { } export default class SecureFileWrapper { - private _jwtObservableServer: Observable<(jwt: string) => void> = new Observable(); + private _jwtObservableServer: Observable<(jwt: string) => void> = new Observable(false); jwtObservable = this._jwtObservableServer.getPublicApi(); private jwt: string;