@boxyhq/saml-jackson 0.2.3-beta.222 → 0.2.3-beta.226

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boxyhq/saml-jackson",
3
- "version": "0.2.3-beta.222",
3
+ "version": "0.2.3-beta.226",
4
4
  "license": "Apache 2.0",
5
5
  "description": "SAML 2.0 service",
6
6
  "main": "dist/index.js",
@@ -17,12 +17,12 @@
17
17
  ],
18
18
  "scripts": {
19
19
  "build": "tsc -p tsconfig.build.json",
20
- "start": "cross-env IDP_ENABLED=true node src/jackson.js",
21
- "dev": "cross-env IDP_ENABLED=true nodemon src/jackson.js",
22
- "mongo": "cross-env JACKSON_API_KEYS=secret DB_ENGINE=mongo DB_URL=mongodb://localhost:27017/jackson DB_ENCRYPTION_KEY=RiVoTxDoLUUoIUOp224abMxK6PGGfFuF nodemon --config nodemon.json src/jackson.ts",
23
- "sql": "cross-env JACKSON_API_KEYS=secret DB_ENGINE=sql DB_TYPE=postgres DB_URL=postgres://postgres:postgres@localhost:5432/jackson DB_ENCRYPTION_KEY=RiVoTxDoLUUoIUOp224abMxK6PGGfFuF nodemon src/jackson.js",
24
- "pre-loaded": "cross-env JACKSON_API_KEYS=secret DB_ENGINE=mem PRE_LOADED_CONFIG='./_config' nodemon src/jackson.js",
25
- "pre-loaded-db": "cross-env JACKSON_API_KEYS=secret PRE_LOADED_CONFIG='./_config' nodemon src/jackson.js",
20
+ "start": "cross-env IDP_ENABLED=true node dist/jackson.js",
21
+ "dev": "cross-env IDP_ENABLED=true nodemon --config nodemon.json src/jackson.ts",
22
+ "mongo": "cross-env JACKSON_API_KEYS=secret DB_ENGINE=mongo DB_URL=mongodb://localhost:27017/jackson nodemon --config nodemon.json src/jackson.ts",
23
+ "sql": "cross-env JACKSON_API_KEYS=secret DB_ENGINE=sql DB_TYPE=postgres DB_URL=postgres://postgres:postgres@localhost:5432/jackson nodemon --config nodemon.json src/jackson.ts",
24
+ "pre-loaded": "cross-env JACKSON_API_KEYS=secret DB_ENGINE=mem PRE_LOADED_CONFIG='./_config' nodemon --config nodemon.json src/jackson.ts",
25
+ "pre-loaded-db": "cross-env JACKSON_API_KEYS=secret PRE_LOADED_CONFIG='./_config' nodemon --config nodemon.json src/jackson.ts",
26
26
  "test": "tap --ts --timeout=100 src/**/*.test.ts",
27
27
  "dev-dbs": "docker-compose -f ./_dev/docker-compose.yml up -d",
28
28
  "dev-dbs-destroy": "docker-compose -f ./_dev/docker-compose.yml down --volumes --remove-orphans"
package/src/db/mem.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // This is an in-memory implementation to be used with testing and prototyping only
2
2
 
3
- import { DatabaseDriver, DatabaseOption, Index } from 'saml-jackson';
3
+ import { DatabaseDriver, DatabaseOption, Index, Encrypted } from 'saml-jackson';
4
4
  import * as dbutils from './utils';
5
5
 
6
6
  class Mem implements DatabaseDriver {
@@ -65,7 +65,7 @@ class Mem implements DatabaseDriver {
65
65
  async put(
66
66
  namespace: string,
67
67
  key: string,
68
- val: string,
68
+ val: Encrypted,
69
69
  ttl: number = 0,
70
70
  ...indexes: any[]
71
71
  ): Promise<any> {
package/src/db/mongo.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { MongoClient } from 'mongodb';
2
- import { DatabaseDriver, DatabaseOption, Index } from 'saml-jackson';
2
+ import { DatabaseDriver, DatabaseOption, Encrypted, Index } from 'saml-jackson';
3
3
  import * as dbutils from './utils';
4
4
 
5
5
  type Document = {
6
- value: string;
6
+ value: Encrypted;
7
7
  expiresAt: Date;
8
8
  indexes: string[];
9
9
  };
@@ -64,7 +64,7 @@ class Mongo implements DatabaseDriver {
64
64
  async put(
65
65
  namespace: string,
66
66
  key: string,
67
- val: string,
67
+ val: Encrypted,
68
68
  ttl: number = 0,
69
69
  ...indexes: any[]
70
70
  ): Promise<void> {
package/src/db/redis.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as redis from 'redis';
2
- import { DatabaseDriver, DatabaseOption, Index } from 'saml-jackson';
2
+ import { DatabaseDriver, DatabaseOption, Encrypted, Index } from 'saml-jackson';
3
3
  import * as dbutils from './utils';
4
4
 
5
5
  class Redis implements DatabaseDriver {
@@ -54,7 +54,7 @@ class Redis implements DatabaseDriver {
54
54
  async put(
55
55
  namespace: string,
56
56
  key: string,
57
- val: string,
57
+ val: Encrypted,
58
58
  ttl: number = 0,
59
59
  ...indexes: any[]
60
60
  ): Promise<void> {
@@ -1,8 +1,8 @@
1
1
  export class JacksonStore {
2
2
  constructor(
3
3
  public key: string,
4
- public value: any,
5
- public iv: any,
6
- public tag: any
4
+ public value: string,
5
+ public iv?: string,
6
+ public tag?: string
7
7
  ) {}
8
8
  }
package/src/db/sql/sql.ts CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require('reflect-metadata');
4
4
 
5
- import { DatabaseDriver, DatabaseOption, Index } from 'saml-jackson';
5
+ import { DatabaseDriver, DatabaseOption, Index, Encrypted } from 'saml-jackson';
6
6
  import { Connection, createConnection } from 'typeorm';
7
7
  import * as dbutils from '../utils';
8
8
  import { JacksonIndex } from './model/JacksonIndex';
@@ -29,8 +29,6 @@ class Sql implements DatabaseDriver {
29
29
  async init(): Promise<Sql> {
30
30
  while (true) {
31
31
  try {
32
- // TODO: Fix it
33
- // @ts-ignore
34
32
  this.connection = await createConnection({
35
33
  name: this.options.type + Math.floor(Math.random() * 100000),
36
34
  type: this.options.type,
@@ -116,11 +114,10 @@ class Sql implements DatabaseDriver {
116
114
  key: dbutils.keyForIndex(namespace, idx),
117
115
  });
118
116
 
119
- const ret: string[] = [];
117
+ const ret: Encrypted[] = [];
120
118
 
121
119
  if (res) {
122
120
  res.forEach((r) => {
123
- // @ts-ignore
124
121
  ret.push({
125
122
  value: r.store.value,
126
123
  iv: r.store.iv,
@@ -135,14 +132,13 @@ class Sql implements DatabaseDriver {
135
132
  async put(
136
133
  namespace: string,
137
134
  key: string,
138
- val: string,
135
+ val: Encrypted,
139
136
  ttl: number = 0,
140
137
  ...indexes: any[]
141
138
  ): Promise<void> {
142
139
  await this.connection.transaction(async (transactionalEntityManager) => {
143
140
  const dbKey = dbutils.key(namespace, key);
144
141
 
145
- // @ts-ignore
146
142
  const store = new JacksonStore(dbKey, val.value, val.iv, val.tag);
147
143
 
148
144
  await transactionalEntityManager.save(store);
@@ -16,8 +16,7 @@ const OPTIONS = {
16
16
  samlAudience: 'https://saml.boxyhq.com',
17
17
  samlPath: '/sso/oauth/saml',
18
18
  db: {
19
- engine: 'mongo',
20
- url: 'mongodb://localhost:27017/jackson-demo',
19
+ engine: 'mem',
21
20
  } as DatabaseOption,
22
21
  };
23
22
 
package/src/typings.ts CHANGED
@@ -118,8 +118,8 @@ declare module 'saml-jackson' {
118
118
  }
119
119
 
120
120
  export interface Encrypted {
121
- iv: string;
122
- tag: string;
121
+ iv?: string;
122
+ tag?: string;
123
123
  value: string;
124
124
  }
125
125