onecore 0.0.43 → 0.0.44

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": "onecore",
3
- "version": "0.0.43",
3
+ "version": "0.0.44",
4
4
  "description": "onecore",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./src/index.ts",
package/src/index.ts CHANGED
@@ -67,6 +67,40 @@ import { ViewService } from './service/ViewService';
67
67
  export type Search<T, F> = (s: F, limit?: number, offset?: number | string, fields?: string[]) => Promise<SearchResult<T>>;
68
68
  export type SearchFunc<T, F> = Search<T, F>;
69
69
 
70
+ export interface KeypairResult {
71
+ rsaEncrypted: string;
72
+ data: {
73
+ shareKey: string;
74
+ salt: string;
75
+ };
76
+ }
77
+ export interface CryptoOption {
78
+ isEncoded64?: boolean;
79
+ convertKey2Bytes?: boolean;
80
+ }
81
+ export interface CryptoPort {
82
+ exchangeKeypair: (pk: string) => Promise<KeypairResult>;
83
+ encryptAESMessage: (aesKey: string, salt: string, dataJSON: string, options?: CryptoOption) => Promise<string>;
84
+ decryptAESMessage: <T>(messageEncrypted: string, clientShKey: string, clientSalt: string, options?: CryptoOption) => Promise<T | string>;
85
+ encrypt: (pk: any, message: string) => string;
86
+ decrypt: (sk: any, data: string) => string;
87
+ encryptAES: (key: string, message: string) => string;
88
+ decryptAES: (key: string, ciphertext: string, iv: string) => string;
89
+ hashHMAC: (key: string, data: string) => string;
90
+ hashData: (text: string) => string;
91
+ }
92
+ export interface CryptoService {
93
+ exchangeKeypair: (pk: string) => Promise<KeypairResult>;
94
+ encryptAESMessage: (aesKey: string, salt: string, dataJSON: string, options?: CryptoOption) => Promise<string>;
95
+ decryptAESMessage: <T>(messageEncrypted: string, clientShKey: string, clientSalt: string, options?: CryptoOption) => Promise<T | string>;
96
+ encrypt: (pk: any, message: string) => string;
97
+ decrypt: (sk: any, data: string) => string;
98
+ encryptAES: (key: string, message: string) => string;
99
+ decryptAES: (key: string, ciphertext: string, iv: string) => string;
100
+ hashHMAC: (key: string, data: string) => string;
101
+ hashData: (text: string) => string;
102
+ }
103
+
70
104
  export interface ExceptionHandler {
71
105
  handleException(rs: string, err: any, i?: number, filename?: string): void;
72
106
  }
package/src/metadata.ts CHANGED
@@ -50,6 +50,7 @@ export interface Attribute {
50
50
  typeof?: Attributes;
51
51
  true?: string|number;
52
52
  false?: string|number;
53
+ noValidate?: boolean;
53
54
  getString?: (v: any) => string;
54
55
  }
55
56
  export interface Attributes {