curtain-web-api 1.0.60 → 1.0.62

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.
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="TypeScriptCompiler">
4
+ <option name="useServicePoweredTypesWasEnabledByExperiment" value="true" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="AgentMigrationStateService">
4
+ <option name="migrationStatus" value="COMPLETED" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="AskMigrationStateService">
4
+ <option name="migrationStatus" value="COMPLETED" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Ask2AgentMigrationStateService">
4
+ <option name="migrationStatus" value="COMPLETED" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="EditMigrationStateService">
4
+ <option name="migrationStatus" value="COMPLETED" />
5
+ </component>
6
+ </project>
@@ -18,49 +18,53 @@ export declare class CurtainWebAPI {
18
18
  login(username: string, password: string): Promise<User>;
19
19
  getUserInfo(): Promise<User>;
20
20
  logout(): Promise<void>;
21
- refresh(): Promise<import("axios").AxiosResponse<any, any>>;
21
+ refresh(): Promise<import("axios").AxiosResponse<any, any, {}>>;
22
22
  ORCIDLogin(authorizationCode: string, redirectURI: string): Promise<User>;
23
23
  checkIfRefreshTokenExpired(): boolean;
24
- deleteCurtainLink(curtainLinkID: string): Promise<import("axios").AxiosResponse<any, any>>;
25
- putSettings(settings: any, enable?: boolean, description?: string, sessionType?: string, encryption?: CurtainEncryption, permanent?: boolean, onUploadProgress?: any): Promise<import("axios").AxiosResponse<any, any>>;
26
- postSettings(id: string, token: string, onDownloadProgress?: any, url?: string | undefined): Promise<import("axios").AxiosResponse<any, any>>;
27
- getPrideData(accession: string): Promise<import("axios").AxiosResponse<any, any>>;
28
- generateTemporarySession(linkId: string, lifetime: number): Promise<import("axios").AxiosResponse<any, any>>;
29
- updateSession(sessionData: any, linkId: string, encryption?: CurtainEncryption): Promise<import("axios").AxiosResponse<any, any>>;
30
- getSessionSettings(linkId: string): Promise<import("axios").AxiosResponse<any, any>>;
31
- getOwnership(linkId: string): Promise<import("axios").AxiosResponse<any, any>>;
32
- getOwners(linkId: string): Promise<import("axios").AxiosResponse<any, any>>;
33
- addOwner(linkId: string, owner: string): Promise<import("axios").AxiosResponse<any, any>>;
34
- getCurtainLinks(username: string, sessionDescription?: string, offset?: number, sessionType?: string): Promise<import("axios").AxiosResponse<any, any>>;
35
- getSiteProperties(): Promise<import("axios").AxiosResponse<any, any>>;
36
- saveDataFilterList(name: string, data: string, category?: string): Promise<import("axios").AxiosResponse<any, any>>;
37
- getDataFilterListByID(id: number, limit?: number): Promise<import("axios").AxiosResponse<any, any>>;
38
- getDataFilterList(title?: string, searchTerm?: string, category?: string, limit?: number): Promise<import("axios").AxiosResponse<any, any>>;
39
- getDataFilterListByCategory(category: string): Promise<import("axios").AxiosResponse<any, any>>;
40
- deleteDataFilterList(id: number): Promise<import("axios").AxiosResponse<any, any>>;
41
- downloadStats(): Promise<import("axios").AxiosResponse<any, any>>;
42
- postInteractomeAtlasProxy(genes: string[], filterParameter: string): Promise<import("axios").AxiosResponse<any, any>>;
43
- postPrimitiveStatsTest(data: any, type?: string): Promise<import("axios").AxiosResponse<any, any>>;
44
- getDataAllListCategory(): Promise<import("axios").AxiosResponse<any, any>>;
45
- postCompareSession(idList: string[], matchType: string, studyList: string[], sessionId: string): Promise<import("axios").AxiosResponse<any, any>>;
46
- getStatsSummary(lastNDays: number): Promise<import("axios").AxiosResponse<any, any>>;
47
- postEncryptionFactors(encryptedAESKey: string, encryptedIV: string, linkId: string): Promise<import("axios").AxiosResponse<any, any>>;
48
- getEncryptionFactors(linkId: string): Promise<import("axios").AxiosResponse<any, any>>;
49
- createCurtainAPIKey(name: string): Promise<import("axios").AxiosResponse<any, any>>;
50
- getCurtainAPIKeys(): Promise<import("axios").AxiosResponse<any, any>>;
51
- deleteCurtainAPIKey(id: number): Promise<import("axios").AxiosResponse<any, any>>;
52
- getRandomDataCiteSuffix(): Promise<import("axios").AxiosResponse<any, any>>;
53
- submitDataCite(data: any): Promise<import("axios").AxiosResponse<any, any>>;
54
- getDataCite(id: number): Promise<import("axios").AxiosResponse<any, any>>;
55
- getDataCites(url?: string, title?: string, status?: string, limit?: number, offset?: number, manage?: boolean, curtain_type?: string): Promise<import("axios").AxiosResponse<any, any>>;
56
- getDataCiteTimeLimitedPermissionToken(suffix: string): Promise<import("axios").AxiosResponse<any, any>>;
57
- getDataCiteProxyOrcidPublicRecord(orcid: string): Promise<import("axios").AxiosResponse<any, any>>;
24
+ deleteCurtainLink(curtainLinkID: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
25
+ putSettings(settings: any, enable?: boolean, description?: string, sessionType?: string, encryption?: CurtainEncryption, permanent?: boolean, onUploadProgress?: any): Promise<import("axios").AxiosResponse<any, any, {}>>;
26
+ postSettings(id: string, token: string, onDownloadProgress?: any, url?: string | undefined): Promise<import("axios").AxiosResponse<any, any, {}>>;
27
+ getPrideData(accession: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
28
+ generateTemporarySession(linkId: string, lifetime: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
29
+ updateSession(sessionData: any, linkId: string, encryption?: CurtainEncryption): Promise<import("axios").AxiosResponse<any, any, {}>>;
30
+ getSessionSettings(linkId: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
31
+ getOwnership(linkId: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
32
+ getOwners(linkId: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
33
+ addOwner(linkId: string, owner: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
34
+ getCurtainLinks(username: string, sessionDescription?: string, offset?: number, sessionType?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
35
+ getSiteProperties(): Promise<import("axios").AxiosResponse<any, any, {}>>;
36
+ saveDataFilterList(name: string, data: string, category?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
37
+ getDataFilterListByID(id: number, limit?: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
38
+ getDataFilterList(title?: string, searchTerm?: string, category?: string, limit?: number, offset?: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
39
+ getDataFilterListByCategory(category: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
40
+ deleteDataFilterList(id: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
41
+ updateDataFilterList(id: number, name?: string, data?: string, category?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
42
+ downloadStats(): Promise<import("axios").AxiosResponse<any, any, {}>>;
43
+ postInteractomeAtlasProxy(genes: string[], filterParameter: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
44
+ postPrimitiveStatsTest(data: any, type?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
45
+ getDataAllListCategory(): Promise<import("axios").AxiosResponse<any, any, {}>>;
46
+ postCompareSession(idList: string[], matchType: string, studyList: string[], sessionId: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
47
+ getStatsSummary(lastNDays: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
48
+ postEncryptionFactors(encryptedAESKey: string, encryptedIV: string, linkId: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
49
+ getEncryptionFactors(linkId: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
50
+ createCurtainAPIKey(name: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
51
+ getCurtainAPIKeys(): Promise<import("axios").AxiosResponse<any, any, {}>>;
52
+ deleteCurtainAPIKey(id: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
53
+ getRandomDataCiteSuffix(): Promise<import("axios").AxiosResponse<any, any, {}>>;
54
+ submitDataCite(data: any): Promise<import("axios").AxiosResponse<any, any, {}>>;
55
+ getDataCite(id: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
56
+ getDataCites(url?: string, title?: string, status?: string, limit?: number, offset?: number, manage?: boolean, curtain_type?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
57
+ getDataCiteTimeLimitedPermissionToken(suffix: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
58
+ getDataCiteProxyOrcidPublicRecord(orcid: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
58
59
  getDataCiteQuota(): Promise<import("axios").AxiosResponse<{
59
60
  quota: number;
60
61
  max_quota: number;
61
- }, any>>;
62
- updateDataCite(id: number, data: any): Promise<import("axios").AxiosResponse<any, any>>;
63
- deleteDataCite(id: number): Promise<import("axios").AxiosResponse<any, any>>;
64
- changeDataCiteStatus(id: number, status: string): Promise<import("axios").AxiosResponse<any, any>>;
65
- lockDataCite(id: number, lock: boolean): Promise<import("axios").AxiosResponse<any, any>>;
62
+ }, any, {}>>;
63
+ updateDataCite(id: number, data: any): Promise<import("axios").AxiosResponse<any, any, {}>>;
64
+ deleteDataCite(id: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
65
+ changeDataCiteStatus(id: number, status: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
66
+ lockDataCite(id: number, lock: boolean): Promise<import("axios").AxiosResponse<any, any, {}>>;
67
+ getKinaseLibraryProxy(sequence: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
68
+ getJobResult(job_id: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
69
+ getDataCiteFile(datacite_id: number): Promise<import("axios").AxiosResponse<any, any, {}>>;
66
70
  }
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -452,7 +462,7 @@ class CurtainWebAPI {
452
462
  return response;
453
463
  });
454
464
  }
455
- getDataFilterList(title = "", searchTerm = "", category = "", limit = 99999999) {
465
+ getDataFilterList(title = "", searchTerm = "", category = "", limit = 99999999, offset = 0) {
456
466
  let params = new URLSearchParams();
457
467
  if (title != "") {
458
468
  params.append("name", title);
@@ -464,6 +474,7 @@ class CurtainWebAPI {
464
474
  params.append("category", category);
465
475
  }
466
476
  params.append("limit", limit.toString());
477
+ params.append("offset", offset.toString());
467
478
  return this.axiosInstance.get(this.baseURL + "data_filter_list/", { responseType: "json", params });
468
479
  }
469
480
  getDataFilterListByCategory(category) {
@@ -478,6 +489,21 @@ class CurtainWebAPI {
478
489
  return response;
479
490
  });
480
491
  }
492
+ updateDataFilterList(id, name, data, category) {
493
+ let headers = new axios_1.AxiosHeaders();
494
+ headers["Accept"] = "application/json";
495
+ headers["Content-Type"] = "application/json";
496
+ const updateData = {};
497
+ if (name !== undefined)
498
+ updateData.name = name;
499
+ if (data !== undefined)
500
+ updateData.data = data;
501
+ if (category !== undefined)
502
+ updateData.category = category;
503
+ return this.axiosInstance.patch(this.baseURL + "data_filter_list/" + id + "/", updateData, { headers: headers, responseType: "json" }).then((response) => {
504
+ return response;
505
+ });
506
+ }
481
507
  downloadStats() {
482
508
  let headers = new axios_1.AxiosHeaders();
483
509
  headers["Accept"] = "application/json";
@@ -638,5 +664,22 @@ class CurtainWebAPI {
638
664
  headers["Content-Type"] = "application/json";
639
665
  return this.axiosInstance.post(this.baseURL + "datacite/" + id + "/lock/", { lock: lock }, { headers: headers, responseType: "json" });
640
666
  }
667
+ getKinaseLibraryProxy(sequence) {
668
+ let headers = new axios_1.AxiosHeaders();
669
+ headers["Accept"] = "application/json";
670
+ let params = new URLSearchParams();
671
+ params.append("sequence", sequence);
672
+ return this.axiosInstance.get(this.baseURL + "kinase_library_proxy/", { headers: headers, params: params, responseType: "json" });
673
+ }
674
+ getJobResult(job_id) {
675
+ let headers = new axios_1.AxiosHeaders();
676
+ headers["Accept"] = "application/json";
677
+ return this.axiosInstance.get(this.baseURL + "job/" + job_id + "/", { headers: headers, responseType: "json" });
678
+ }
679
+ getDataCiteFile(datacite_id) {
680
+ let headers = new axios_1.AxiosHeaders();
681
+ headers["Accept"] = "application/json";
682
+ return this.axiosInstance.get(this.baseURL + "datacite/file/" + datacite_id + "/", { headers: headers, responseType: "blob" });
683
+ }
641
684
  }
642
685
  exports.CurtainWebAPI = CurtainWebAPI;
@@ -16,8 +16,8 @@ export interface CurtainEncryption {
16
16
  }
17
17
  export declare function arrayBufferToBase64String(arrayBuffer: ArrayBuffer): string;
18
18
  export declare function removeLines(str_data: string): string;
19
- export declare function base64ToArrayBuffer(b64: string): Uint8Array;
20
- export declare function pemToArrayBuffer(pem: string): Uint8Array;
19
+ export declare function base64ToArrayBuffer(b64: string): ArrayBuffer;
20
+ export declare function pemToArrayBuffer(pem: string): ArrayBuffer;
21
21
  export declare function encryptAESKey(publicKey: CryptoKey, aesKey: ArrayBuffer): Promise<ArrayBuffer>;
22
22
  export declare function generateAESKey(): Promise<CryptoKey>;
23
23
  export declare function encryptAESData(aesKey: CryptoKey, data: string): Promise<{
@@ -124,7 +124,7 @@ function base64ToArrayBuffer(b64) {
124
124
  for (let i = 0; i < byteString.length; i++) {
125
125
  byteArray[i] = byteString.charCodeAt(i);
126
126
  }
127
- return byteArray;
127
+ return byteArray.buffer;
128
128
  }
129
129
  function pemToArrayBuffer(pem) {
130
130
  const b64Lines = removeLines(pem);
@@ -156,7 +156,7 @@ function encryptAESData(aesKey, data) {
156
156
  const enc = new TextEncoder();
157
157
  const encoded = enc.encode(data);
158
158
  const encrypted = yield crypto.subtle.encrypt({ name: "AES-GCM", iv: iv }, aesKey, encoded);
159
- return { encrypted: arrayBufferToBase64String(encrypted), iv: arrayBufferToBase64String(iv) };
159
+ return { encrypted: arrayBufferToBase64String(encrypted), iv: arrayBufferToBase64String(iv.buffer) };
160
160
  });
161
161
  }
162
162
  // a function to decrypt a string with an aes key
@@ -1,5 +1,5 @@
1
- export declare function getProteomicsData(acc: string, tissueType: string): Promise<import("axios").AxiosResponse<any, any>>;
2
- export declare function getPrideData(acc: string): Promise<import("axios").AxiosResponse<any, any>>;
3
- export declare function getEBIAlpha(id: string): Promise<import("axios").AxiosResponse<any, any>>;
4
- export declare function getStringDBInteractions(genes: string[], organism: string, score?: number, networkType?: string): Promise<import("axios").AxiosResponse<any, any>>;
1
+ export declare function getProteomicsData(acc: string, tissueType: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
2
+ export declare function getPrideData(acc: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
3
+ export declare function getEBIAlpha(id: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
4
+ export declare function getStringDBInteractions(genes: string[], organism: string, score?: number, networkType?: string): Promise<import("axios").AxiosResponse<any, any, {}>>;
5
5
  export declare function getInteractomeAtlas(genes: string[], filterParameter?: string): Promise<any>;
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.getProteomicsData = getProteomicsData;
27
37
  exports.getPrideData = getPrideData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "curtain-web-api",
3
- "version": "1.0.60",
3
+ "version": "1.0.62",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -449,7 +449,8 @@ export class CurtainWebAPI {
449
449
  title: string = "",
450
450
  searchTerm: string = "",
451
451
  category: string = "",
452
- limit: number = 99999999
452
+ limit: number = 99999999,
453
+ offset: number = 0
453
454
  ) {
454
455
  let params = new URLSearchParams();
455
456
  if (title != "") {
@@ -463,6 +464,7 @@ export class CurtainWebAPI {
463
464
  }
464
465
 
465
466
  params.append("limit", limit.toString())
467
+ params.append("offset", offset.toString())
466
468
  return this.axiosInstance.get(this.baseURL + "data_filter_list/", {responseType:"json", params})
467
469
  }
468
470
 
@@ -480,6 +482,19 @@ export class CurtainWebAPI {
480
482
  });
481
483
  }
482
484
 
485
+ updateDataFilterList(id: number, name?: string, data?: string, category?: string) {
486
+ let headers = new AxiosHeaders();
487
+ headers["Accept"] = "application/json";
488
+ headers["Content-Type"] = "application/json";
489
+ const updateData: {name?: string, data?: string, category?: string} = {};
490
+ if (name !== undefined) updateData.name = name;
491
+ if (data !== undefined) updateData.data = data;
492
+ if (category !== undefined) updateData.category = category;
493
+ return this.axiosInstance.patch(this.baseURL + "data_filter_list/" + id + "/", updateData, {headers: headers, responseType:"json"}).then((response) => {
494
+ return response;
495
+ });
496
+ }
497
+
483
498
  downloadStats() {
484
499
  let headers = new AxiosHeaders();
485
500
  headers["Accept"] = "application/json";
@@ -659,5 +674,25 @@ export class CurtainWebAPI {
659
674
  headers["Content-Type"] = "application/json"
660
675
  return this.axiosInstance.post(this.baseURL + "datacite/" + id + "/lock/", {lock: lock}, {headers: headers, responseType: "json"})
661
676
  }
677
+
678
+ getKinaseLibraryProxy(sequence: string) {
679
+ let headers = new AxiosHeaders();
680
+ headers["Accept"] = "application/json";
681
+ let params = new URLSearchParams();
682
+ params.append("sequence", sequence);
683
+ return this.axiosInstance.get(this.baseURL + "kinase_library_proxy/", {headers: headers, params: params, responseType: "json"});
684
+ }
685
+
686
+ getJobResult(job_id: string) {
687
+ let headers = new AxiosHeaders();
688
+ headers["Accept"] = "application/json";
689
+ return this.axiosInstance.get(this.baseURL + "job/" + job_id + "/", {headers: headers, responseType: "json"});
690
+ }
691
+
692
+ getDataCiteFile(datacite_id: number) {
693
+ let headers = new AxiosHeaders();
694
+ headers["Accept"] = "application/json";
695
+ return this.axiosInstance.get(this.baseURL + "datacite/file/" + datacite_id + "/", {headers: headers, responseType: "blob"});
696
+ }
662
697
  }
663
698
 
@@ -21,7 +21,7 @@ export async function generateKeyPair(modulusLength: number = 2048, publicExpone
21
21
  modulusLength: modulusLength,
22
22
  publicExponent: publicExponent,
23
23
  hash: "SHA-256",
24
- },
24
+ } as RsaHashedKeyGenParams,
25
25
  true,
26
26
  ["encrypt", "decrypt"],
27
27
  )
@@ -85,14 +85,14 @@ export function removeLines(str_data: string) {
85
85
  return str_data.replace("\n", "");
86
86
  }
87
87
 
88
- export function base64ToArrayBuffer(b64: string) {
88
+ export function base64ToArrayBuffer(b64: string): ArrayBuffer {
89
89
  const byteString = atob(b64);
90
90
  const byteArray = new Uint8Array(byteString.length);
91
91
  for(let i=0; i < byteString.length; i++) {
92
92
  byteArray[i] = byteString.charCodeAt(i);
93
93
  }
94
94
 
95
- return byteArray;
95
+ return byteArray.buffer;
96
96
  }
97
97
 
98
98
  export function pemToArrayBuffer(pem: string) {
@@ -128,7 +128,7 @@ export async function encryptAESData(aesKey: CryptoKey, data: string) {
128
128
  const enc = new TextEncoder()
129
129
  const encoded = enc.encode(data)
130
130
  const encrypted = await crypto.subtle.encrypt({name: "AES-GCM", iv: iv}, aesKey, encoded)
131
- return {encrypted: arrayBufferToBase64String(encrypted), iv: arrayBufferToBase64String(iv)}
131
+ return {encrypted: arrayBufferToBase64String(encrypted), iv: arrayBufferToBase64String(iv.buffer)}
132
132
  }
133
133
 
134
134
  // a function to decrypt a string with an aes key