@jbrowse/plugin-grid-bookmark 4.0.4 → 4.1.3

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.
@@ -220,8 +220,8 @@ export default function f(_pluginManager: PluginManager): import("@jbrowse/mobx-
220
220
  } & {
221
221
  afterAttach(): void;
222
222
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, {
223
- id: string;
224
223
  type: "GridBookmarkWidget";
224
+ id: string;
225
225
  }>;
226
226
  export type GridBookmarkStateModel = ReturnType<typeof f>;
227
227
  export type GridBookmarkModel = Instance<GridBookmarkStateModel>;
@@ -1,3 +1,4 @@
1
+ import { aesDecrypt, aesEncrypt } from '@jbrowse/core/util';
1
2
  import { toUrlSafeB64 } from "./utils.js";
2
3
  function generateUID(length) {
3
4
  return window
@@ -7,16 +8,6 @@ function generateUID(length) {
7
8
  .replaceAll(/[+/]/g, '')
8
9
  .slice(0, length);
9
10
  }
10
- const encrypt = async (text, password) => {
11
- const AES = await import('crypto-js/aes');
12
- return AES.encrypt(text, password).toString();
13
- };
14
- const decrypt = async (text, password) => {
15
- const AES = await import('crypto-js/aes');
16
- const Utf8 = await import('crypto-js/enc-utf8');
17
- const bytes = AES.decrypt(text, password);
18
- return bytes.toString(Utf8);
19
- };
20
11
  function getErrorMsg(err) {
21
12
  try {
22
13
  const obj = JSON.parse(err);
@@ -29,7 +20,7 @@ function getErrorMsg(err) {
29
20
  export async function shareSessionToDynamo(session, url, referer) {
30
21
  const sess = await toUrlSafeB64(JSON.stringify(session));
31
22
  const password = generateUID(5);
32
- const encryptedSession = await encrypt(sess, password);
23
+ const encryptedSession = await aesEncrypt(sess, password);
33
24
  const data = new FormData();
34
25
  data.append('session', encryptedSession);
35
26
  data.append('dateShared', `${Date.now()}`);
@@ -58,5 +49,5 @@ export async function readSessionFromDynamo(baseUrl, sessionQueryParam, password
58
49
  throw new Error(getErrorMsg(await response.text()));
59
50
  }
60
51
  const json = await response.json();
61
- return decrypt(json.session, password);
52
+ return aesDecrypt(json.session, password);
62
53
  }
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-grid-bookmark",
3
- "version": "4.0.4",
3
+ "version": "4.1.3",
4
+ "type": "module",
4
5
  "description": "JBrowse 2 grid bookmark widget",
5
6
  "keywords": [
6
7
  "jbrowse",
@@ -21,9 +22,9 @@
21
22
  ],
22
23
  "dependencies": {
23
24
  "@jbrowse/mobx-state-tree": "^5.5.0",
24
- "@mui/icons-material": "^7.3.6",
25
- "@mui/material": "^7.3.6",
26
- "@mui/x-data-grid": "^8.25.0",
25
+ "@mui/icons-material": "^7.3.7",
26
+ "@mui/material": "^7.3.7",
27
+ "@mui/x-data-grid": "^8.26.0",
27
28
  "@types/file-saver-es": "^2.0.3",
28
29
  "base64-js": "^1.5.1",
29
30
  "copy-to-clipboard": "^3.3.3",
@@ -32,8 +33,8 @@
32
33
  "mobx": "^6.15.0",
33
34
  "mobx-react": "^9.2.1",
34
35
  "pako-esm2": "^2.0.2",
35
- "@jbrowse/core": "^4.0.4",
36
- "@jbrowse/plugin-linear-genome-view": "^4.0.4"
36
+ "@jbrowse/core": "^4.1.3",
37
+ "@jbrowse/plugin-linear-genome-view": "^4.1.3"
37
38
  },
38
39
  "peerDependencies": {
39
40
  "react": ">=18.0.0"