forked from amitaymolko/react-native-rsa-native
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
37 lines (33 loc) · 1.67 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
declare module 'react-native-rsa-native' {
interface PublicKey {
public: string;
}
interface KeyPair extends PublicKey {
private: string;
}
namespace RSA {
export function generate(keySize: number): Promise<PublicKey>;
export function generateKeys(keySize: number): Promise<KeyPair>;
export function encrypt(data: string, key: string): Promise<string>;
export function decrypt(data: string, key: string): Promise<string>;
export function sign(data: string, key: string): Promise<string>;
export function signWithAlgorithm(data: string, key: string, signature?: 'SHA256withRSA' | 'SHA512withRSA'): Promise<string>;
export function verify(data: string, secretToVerify: string, key: string): Promise<boolean>;
export const SHA256withRSA: string;
export const SHA512withRSA: string;
}
namespace RSAKeychain {
export function generate(keyTag: string, keySize: number): Promise<PublicKey>;
export function generateKeys(keyTag: string, keySize: number): Promise<PublicKey>;
export function deletePrivateKey(keyTag: string): Promise<boolean>;
export function encrypt(data: string, keyTag: string): Promise<string>;
export function decrypt(data: string, keyTag: string): Promise<string>;
export function sign(data: string, keyTag: string): Promise<string>;
export function signWithAlgorithm(data: string, keyTag: string, signature?: 'SHA256withRSA' | 'SHA512withRSA'): Promise<string>;
export function verify(data: string, secretToVerify: string, keyTag: string): Promise<boolean>;
export function getPublicKey(keyTag: string): Promise<string | undefined>;
export const SHA256withRSA: string;
export const SHA512withRSA: string;
}
export { RSA, RSAKeychain };
}