@sockethub/data-layer 1.0.0-alpha.3 → 1.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API.md +23 -0
- package/QUEUE.md +130 -0
- package/README.md +114 -0
- package/package.json +22 -43
- package/src/credentials-store.test.ts +140 -123
- package/src/credentials-store.ts +116 -68
- package/src/index.ts +27 -3
- package/src/job-base.ts +58 -0
- package/src/job-queue.test.ts +265 -237
- package/src/job-queue.ts +210 -131
- package/src/job-worker.test.ts +128 -0
- package/src/job-worker.ts +97 -0
- package/src/types.ts +21 -23
- package/typedoc.json +11 -0
- package/dist/credentials-store.d.ts +0 -31
- package/dist/credentials-store.js +0 -64
- package/dist/credentials-store.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -41
- package/dist/index.js.map +0 -1
- package/dist/job-queue.d.ts +0 -32
- package/dist/job-queue.js +0 -129
- package/dist/job-queue.js.map +0 -1
- package/dist/store.d.ts +0 -3
- package/dist/store.js +0 -17
- package/dist/store.js.map +0 -1
- package/dist/types.d.ts +0 -29
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { IActivityStream } from "@sockethub/schemas";
|
|
2
|
-
import { RedisConfigProps, RedisConfigUrl } from "./types";
|
|
3
|
-
/**
|
|
4
|
-
* Encapsulates the storing and fetching of credential objects.
|
|
5
|
-
*/
|
|
6
|
-
export default class CredentialsStore {
|
|
7
|
-
readonly uid: string;
|
|
8
|
-
private readonly store;
|
|
9
|
-
private readonly log;
|
|
10
|
-
protected initialized: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* @param parentId - The ID of the parent instance (eg. sockethub itself)
|
|
13
|
-
* @param sessionId - The ID of the session (socket.io connection)
|
|
14
|
-
* @param secret - The encryption secret (parent + session secrets)
|
|
15
|
-
* @param redisConfig - Connect info for redis
|
|
16
|
-
*/
|
|
17
|
-
constructor(parentId: string, sessionId: string, secret: string, redisConfig: RedisConfigProps | RedisConfigUrl);
|
|
18
|
-
init(): Promise<void>;
|
|
19
|
-
/**
|
|
20
|
-
* Gets the credentials for a given actor ID
|
|
21
|
-
* @param actor
|
|
22
|
-
* @param credentialHash
|
|
23
|
-
*/
|
|
24
|
-
get(actor: string, credentialHash?: string): Promise<IActivityStream>;
|
|
25
|
-
/**
|
|
26
|
-
* Saves the credentials for a given actor ID
|
|
27
|
-
* @param actor
|
|
28
|
-
* @param creds
|
|
29
|
-
*/
|
|
30
|
-
save(actor: string, creds: IActivityStream): Promise<void>;
|
|
31
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const secure_store_redis_1 = __importDefault(require("secure-store-redis"));
|
|
7
|
-
const debug_1 = __importDefault(require("debug"));
|
|
8
|
-
const crypto_1 = __importDefault(require("@sockethub/crypto"));
|
|
9
|
-
/**
|
|
10
|
-
* Encapsulates the storing and fetching of credential objects.
|
|
11
|
-
*/
|
|
12
|
-
class CredentialsStore {
|
|
13
|
-
/**
|
|
14
|
-
* @param parentId - The ID of the parent instance (eg. sockethub itself)
|
|
15
|
-
* @param sessionId - The ID of the session (socket.io connection)
|
|
16
|
-
* @param secret - The encryption secret (parent + session secrets)
|
|
17
|
-
* @param redisConfig - Connect info for redis
|
|
18
|
-
*/
|
|
19
|
-
constructor(parentId, sessionId, secret, redisConfig) {
|
|
20
|
-
this.initialized = false;
|
|
21
|
-
this.uid = `sockethub:data-layer:credentials-store:${parentId}:${sessionId}`;
|
|
22
|
-
this.store = new secure_store_redis_1.default(this.uid, secret, { redis: redisConfig });
|
|
23
|
-
this.log = (0, debug_1.default)(this.uid);
|
|
24
|
-
}
|
|
25
|
-
async init() {
|
|
26
|
-
this.initialized = true;
|
|
27
|
-
await this.store.init();
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Gets the credentials for a given actor ID
|
|
31
|
-
* @param actor
|
|
32
|
-
* @param credentialHash
|
|
33
|
-
*/
|
|
34
|
-
async get(actor, credentialHash = undefined) {
|
|
35
|
-
this.log(`get credentials for ${actor}`);
|
|
36
|
-
if (!this.initialized) {
|
|
37
|
-
throw new Error('CredentialsStore not initialized');
|
|
38
|
-
}
|
|
39
|
-
const credentials = await this.store.get(actor);
|
|
40
|
-
if (!credentials) {
|
|
41
|
-
return undefined;
|
|
42
|
-
}
|
|
43
|
-
if (credentialHash) {
|
|
44
|
-
if (credentialHash !== crypto_1.default.objectHash(credentials.object)) {
|
|
45
|
-
throw new Error(`provided credentials do not match existing platform instance for actor ${actor}`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return credentials;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Saves the credentials for a given actor ID
|
|
52
|
-
* @param actor
|
|
53
|
-
* @param creds
|
|
54
|
-
*/
|
|
55
|
-
async save(actor, creds) {
|
|
56
|
-
if (!this.initialized) {
|
|
57
|
-
throw new Error('CredentialsStore not initialized');
|
|
58
|
-
}
|
|
59
|
-
await this.store.save(actor, creds);
|
|
60
|
-
this.log(`credentials encrypted and saved`);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
exports.default = CredentialsStore;
|
|
64
|
-
//# sourceMappingURL=/credentials-store.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"credentials-store.js","sourceRoot":"/","sources":["credentials-store.ts"],"names":[],"mappings":";;;;;AAAA,4EAA6C;AAC7C,kDAAsC;AAEtC,+DAAuC;AAGvC;;GAEG;AACH,MAAqB,gBAAgB;IAMnC;;;;;OAKG;IACH,YACE,QAAgB,EAChB,SAAiB,EACjB,MAAc,EACd,WAA8C;QAZtC,gBAAW,GAAG,KAAK,CAAC;QAc5B,IA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CAAC,CAAC;QACpC,IAAI,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;IAC9C,CAAC;CACF;AA3DD,mCA2DC"}
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.JobQueue = exports.CredentialsStore = void 0;
|
|
21
|
-
var credentials_store_1 = require("./credentials-store");
|
|
22
|
-
Object.defineProperty(exports, "CredentialsStore", { enumerable: true, get: function () { return __importDefault(credentials_store_1).default; } });
|
|
23
|
-
var job_queue_1 = require("./job-queue");
|
|
24
|
-
Object.defineProperty(exports, "JobQueue", { enumerable: true, get: function () { return __importDefault(job_queue_1).default; } });
|
|
25
|
-
__exportStar(require("./types"), exports);
|
|
26
|
-
// export default class DataLayer {
|
|
27
|
-
// readonly uid: string;
|
|
28
|
-
// readonly jobQueue: JobQueue;
|
|
29
|
-
// readonly credentialStore: CredentialsStore;
|
|
30
|
-
//
|
|
31
|
-
// constructor(instanceId: string, sessionId: string, secret: string, redisConfig: RedisConfig) {
|
|
32
|
-
// this.uid = `sockethub:data-layer:job-queue:${instanceId}:${sessionId}`;
|
|
33
|
-
// this.jobQueue = new JobQueue(
|
|
34
|
-
// instanceId, sessionId, secret, redisConfig
|
|
35
|
-
// ),
|
|
36
|
-
// this.credentialStore = new CredentialsStore(
|
|
37
|
-
// instanceId, sessionId, secret, redisConfig
|
|
38
|
-
// );
|
|
39
|
-
// }
|
|
40
|
-
// }
|
|
41
|
-
//# sourceMappingURL=/index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,yDAAgE;AAAxD,sIAAA,OAAO,OAAoB;AACnC,yCAAgD;AAAxC,sHAAA,OAAO,OAAY;AAC3B,0CAAwB;AAExB,mCAAmC;AACnC,0BAA0B;AAC1B,iCAAiC;AACjC,gDAAgD;AAChD,EAAE;AACF,mGAAmG;AACnG,8EAA8E;AAC9E,oCAAoC;AACpC,mDAAmD;AACnD,SAAS;AACT,mDAAmD;AACnD,mDAAmD;AACnD,SAAS;AACT,MAAM;AACN,IAAI"}
|
package/dist/job-queue.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { JobDataDecrypted, JobDataEncrypted, JobDecrypted, RedisConfig } from "./types";
|
|
3
|
-
import EventEmitter from "events";
|
|
4
|
-
import { IActivityStream } from "@sockethub/schemas";
|
|
5
|
-
interface JobHandler {
|
|
6
|
-
(job: JobDataDecrypted, done: CallableFunction): any;
|
|
7
|
-
}
|
|
8
|
-
export default class JobQueue extends EventEmitter {
|
|
9
|
-
readonly uid: string;
|
|
10
|
-
private readonly bull;
|
|
11
|
-
private readonly debug;
|
|
12
|
-
private readonly secret;
|
|
13
|
-
private handler;
|
|
14
|
-
private counter;
|
|
15
|
-
constructor(instanceId: string, sessionId: string, secret: string, redisConfig: RedisConfig);
|
|
16
|
-
add(socketId: string, msg: IActivityStream): Promise<JobDataEncrypted>;
|
|
17
|
-
initResultEvents(): void;
|
|
18
|
-
getJob(jobId: string): Promise<JobDecrypted>;
|
|
19
|
-
onJob(handler: JobHandler): void;
|
|
20
|
-
pause(): Promise<void>;
|
|
21
|
-
resume(): Promise<void>;
|
|
22
|
-
shutdown(): Promise<void>;
|
|
23
|
-
private createJob;
|
|
24
|
-
private jobHandler;
|
|
25
|
-
/**
|
|
26
|
-
* @param job
|
|
27
|
-
* @private
|
|
28
|
-
*/
|
|
29
|
-
private decryptJobData;
|
|
30
|
-
private decryptActivityStream;
|
|
31
|
-
}
|
|
32
|
-
export {};
|
package/dist/job-queue.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const bull_1 = __importDefault(require("bull"));
|
|
7
|
-
const crypto_1 = __importDefault(require("@sockethub/crypto"));
|
|
8
|
-
const debug_1 = __importDefault(require("debug"));
|
|
9
|
-
const events_1 = __importDefault(require("events"));
|
|
10
|
-
class JobQueue extends events_1.default {
|
|
11
|
-
constructor(instanceId, sessionId, secret, redisConfig) {
|
|
12
|
-
super();
|
|
13
|
-
this.counter = 0;
|
|
14
|
-
this.bull = new bull_1.default(instanceId + sessionId, { redis: redisConfig });
|
|
15
|
-
this.uid = `sockethub:data-layer:job-queue:${instanceId}:${sessionId}`;
|
|
16
|
-
this.secret = secret;
|
|
17
|
-
this.debug = (0, debug_1.default)(this.uid);
|
|
18
|
-
this.debug('initialized');
|
|
19
|
-
}
|
|
20
|
-
async add(socketId, msg) {
|
|
21
|
-
const job = this.createJob(socketId, msg);
|
|
22
|
-
const isPaused = await this.bull.isPaused();
|
|
23
|
-
if (isPaused) {
|
|
24
|
-
this.bull.emit('failed', job, 'queue closed');
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
this.debug(`adding ${job.title} ${msg.type}`);
|
|
28
|
-
this.bull.add(job);
|
|
29
|
-
return job;
|
|
30
|
-
}
|
|
31
|
-
initResultEvents() {
|
|
32
|
-
this.bull.on('global:completed', async (jobId, result) => {
|
|
33
|
-
const r = result ? JSON.parse(result) : "";
|
|
34
|
-
const job = await this.getJob(jobId);
|
|
35
|
-
if (job) {
|
|
36
|
-
this.debug(`completed ${job.data.title} ${job.data.msg.type}`);
|
|
37
|
-
this.emit('global:completed', job.data, r);
|
|
38
|
-
await job.remove();
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
this.bull.on('global:error', async (jobId, result) => {
|
|
42
|
-
this.debug("unknown queue error", jobId, result);
|
|
43
|
-
});
|
|
44
|
-
this.bull.on('global:failed', async (jobId, result) => {
|
|
45
|
-
const job = await this.getJob(jobId);
|
|
46
|
-
if (job) {
|
|
47
|
-
this.debug(`failed ${job.data.title} ${job.data.msg.type}`);
|
|
48
|
-
this.emit('global:failed', job.data, result);
|
|
49
|
-
await job.remove();
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
this.bull.on('failed', (job, result) => {
|
|
53
|
-
// locally failed jobs (eg. due to paused queue)
|
|
54
|
-
const unencryptedJobData = {
|
|
55
|
-
title: job.title,
|
|
56
|
-
msg: this.decryptActivityStream(job.msg),
|
|
57
|
-
sessionId: job.sessionId
|
|
58
|
-
};
|
|
59
|
-
this.debug(`failed ${unencryptedJobData.title} ${unencryptedJobData.msg.type}`);
|
|
60
|
-
this.emit('global:failed', unencryptedJobData, result);
|
|
61
|
-
});
|
|
62
|
-
this.bull.on('completed', (job) => {
|
|
63
|
-
console.log("completed ", job);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
async getJob(jobId) {
|
|
67
|
-
const job = await this.bull.getJob(jobId);
|
|
68
|
-
if (job) {
|
|
69
|
-
job.data = this.decryptJobData(job);
|
|
70
|
-
try {
|
|
71
|
-
delete job.data.msg.sessionSecret;
|
|
72
|
-
}
|
|
73
|
-
catch (e) {
|
|
74
|
-
// this property should never be exposed externally
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return job;
|
|
78
|
-
}
|
|
79
|
-
onJob(handler) {
|
|
80
|
-
this.handler = handler;
|
|
81
|
-
this.bull.process(this.jobHandler.bind(this));
|
|
82
|
-
}
|
|
83
|
-
async pause() {
|
|
84
|
-
await this.bull.pause();
|
|
85
|
-
this.debug('paused');
|
|
86
|
-
}
|
|
87
|
-
async resume() {
|
|
88
|
-
await this.bull.resume();
|
|
89
|
-
this.debug('resumed');
|
|
90
|
-
}
|
|
91
|
-
async shutdown() {
|
|
92
|
-
this.debug('shutdown');
|
|
93
|
-
const isPaused = await this.bull.isPaused(true);
|
|
94
|
-
if (!isPaused) {
|
|
95
|
-
await this.bull.pause();
|
|
96
|
-
}
|
|
97
|
-
await this.bull.obliterate({ force: true });
|
|
98
|
-
await this.bull.removeAllListeners();
|
|
99
|
-
}
|
|
100
|
-
createJob(socketId, msg) {
|
|
101
|
-
const title = `${msg.context}-${(msg.id) ? msg.id : this.counter++}`;
|
|
102
|
-
return {
|
|
103
|
-
title: title,
|
|
104
|
-
sessionId: socketId,
|
|
105
|
-
msg: crypto_1.default.encrypt(msg, this.secret)
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
jobHandler(encryptedJob, done) {
|
|
109
|
-
const job = this.decryptJobData(encryptedJob);
|
|
110
|
-
this.debug(`handling ${job.title} ${job.msg.type}`);
|
|
111
|
-
this.handler(job, done);
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* @param job
|
|
115
|
-
* @private
|
|
116
|
-
*/
|
|
117
|
-
decryptJobData(job) {
|
|
118
|
-
return {
|
|
119
|
-
title: job.data.title,
|
|
120
|
-
msg: this.decryptActivityStream(job.data.msg),
|
|
121
|
-
sessionId: job.data.sessionId
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
decryptActivityStream(msg) {
|
|
125
|
-
return crypto_1.default.decrypt(msg, this.secret);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
exports.default = JobQueue;
|
|
129
|
-
//# sourceMappingURL=/job-queue.js.map
|
package/dist/job-queue.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"job-queue.js","sourceRoot":"/","sources":["job-queue.ts"],"names":[],"mappings":";;;;;AAAA,gDAAyB;AACzB,+DAAuC;AAOvC,kDAAsC;AACtC,oDAAkC;AAOlC,MAAqB,QAAS,SAAQ,gBAAY;IAQhD,YAAY,UAAkB,EAAE,SAAiB,EAAE,MAAc,EAAE,WAAwB;QACzF,KAAK,EAAE,CAAC;QAHF,YAAO,GAAG,CAAC,CAAC;QAIlB,IAAI,CAAC,IAAI,GAAG,IAAI,cAAK,CAAC,UAAU,GAAG,SAAS,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;QACtE,IAAI,CAAC,GAAG,GAAG,kCAAkC,UAAU,IAAI,SAAS,EAAE,CAAC;QACvE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,IAAA,eAAK,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAE7B,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,QAAgB,EAAE,GAAoB;QAC9C,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAC1C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC5C,IAAI,QAAQ,EAAE;YACZ,IAAI,CAAC,IAAI,CAAC,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C;QACrE,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,SAAS,EAAE,QAAQ;YACnB,GAAG,EAAE,gBAAM,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC;SACtC,CAAC;IACJ,CAAC;IAEO,UAAU,CAAC,YAA0B,EAAE,IAAsB;QACnE,MAAM,GAAG,GAAG,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;QAC9C,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;QACpD,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACK,cAAc,CAAC,GAAiB;QACtC,OAAO;YACL,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK;YACrB,GAAG,EAAE,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;YAC7C,SAAS,EAAE,GAAG,CAAC,IAAI,CAAC,SAAS;SAC9B,CAAC;IACJ,CAAC;IAEO,qBAAqB,CAAC,GAAW;QACvC,OAAO,gBAAM,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1C,CAAC;CACF;AAtID,2BAsIC"}
|
package/dist/store.d.ts
DELETED
package/dist/store.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getSessionStore = void 0;
|
|
7
|
-
const secure_store_redis_1 = __importDefault(require("secure-store-redis"));
|
|
8
|
-
const config_1 = __importDefault(require("../../server/src/config"));
|
|
9
|
-
function getSessionStore(parentId, parentSecret, sessionId, sessionSecret) {
|
|
10
|
-
return new secure_store_redis_1.default({
|
|
11
|
-
namespace: 'sockethub:' + parentId + ':session:' + sessionId + ':store',
|
|
12
|
-
secret: parentSecret + sessionSecret,
|
|
13
|
-
redis: config_1.default.get('redis')
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
exports.getSessionStore = getSessionStore;
|
|
17
|
-
//# sourceMappingURL=/store.js.map
|
package/dist/store.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"/","sources":["store.ts"],"names":[],"mappings":";;;;;;AAAA,4EAA6C;AAC7C,qEAA6C;AAI7C,SAAgB,eAAe,CAAC,QAAgB,EAAE,YAAoB,EACtC,SAAiB,EAAE,aAAqB;IACtE,OAAO,IAAI,4BAAW,CAAC;QACrB,SAAS,EAAE,YAAY,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ;QACvE,MAAM,EAAE,YAAY,GAAG,aAAa;QACpC,KAAK,EAAE,gBAAM,CAAC,GAAG,CAAC,OAAO,CAAC;KAC3B,CAAC,CAAC;AACL,CAAC;AAPD,0CAOC"}
|
package/dist/types.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { IActivityStream } from "@sockethub/schemas";
|
|
2
|
-
export declare type RedisConfigUrl = string;
|
|
3
|
-
export interface RedisConfigProps {
|
|
4
|
-
host: string;
|
|
5
|
-
port: string;
|
|
6
|
-
}
|
|
7
|
-
export declare type RedisConfig = RedisConfigProps | RedisConfigUrl;
|
|
8
|
-
export interface JobDataEncrypted {
|
|
9
|
-
title?: string;
|
|
10
|
-
msg: string;
|
|
11
|
-
sessionId: string;
|
|
12
|
-
}
|
|
13
|
-
export interface JobDataDecrypted {
|
|
14
|
-
title?: string;
|
|
15
|
-
msg: IActivityStream;
|
|
16
|
-
sessionId: string;
|
|
17
|
-
}
|
|
18
|
-
export interface JobEncrypted {
|
|
19
|
-
data: JobDataEncrypted;
|
|
20
|
-
remove?: {
|
|
21
|
-
(): void;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
export interface JobDecrypted {
|
|
25
|
-
data: JobDataDecrypted;
|
|
26
|
-
remove?: {
|
|
27
|
-
(): void;
|
|
28
|
-
};
|
|
29
|
-
}
|
package/dist/types.js
DELETED
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"/","sources":["types.ts"],"names":[],"mappings":""}
|