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 +1 -1
- package/src/index.ts +34 -0
- package/src/metadata.ts +1 -0
package/package.json
CHANGED
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
|
}
|