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

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boxyhq/saml-jackson",
3
- "version": "0.2.3-beta.225",
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",
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);
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