-
Notifications
You must be signed in to change notification settings - Fork 115
/
index.d.ts
76 lines (69 loc) · 3.77 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
declare module 'react-native-rsa-native' {
interface PublicKey {
public: string;
}
interface CSRKey {
csr: string;
}
interface KeyPair extends PublicKey {
private: string;
}
type TypeCrypto =
'SHA256withRSA'|
'SHA512withRSA'|
'SHA1withRSA'|
'SHA256withECDSA'|
'SHA512withECDSA'|
'SHA1withECDSA'
namespace RSA {
export function generate(): 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 encrypt64(data: string, key: string): Promise<string>;
export function decrypt64(data: string, key: string): Promise<string>;
export function sign(data: string, key: string): Promise<string>;
export function signWithAlgorithm(data: string, key: string, signature?: TypeCrypto): Promise<string>;
export function sign64(data: string, key: string): Promise<string>;
export function sign64WithAlgorithm(data: string, key: string, signature?: TypeCrypto): Promise<string>;
export function verify(data: string, secretToVerify: string, key: string): Promise<boolean>;
export function verifyWithAlgorithm(data: string, secretToVerify: string, key: string, signature?: TypeCrypto): Promise<boolean>;
export function verify64(data: string, secretToVerify: string, key: string): Promise<boolean>;
export function verify64WithAlgorithm(data: string, secretToVerify: string, key: string, signature?: TypeCrypto): Promise<boolean>;
export const SHA256withRSA: string;
export const SHA512withRSA: string;
export const SHA1withRSA: string;
export const SHA256withECDSA: string;
export const SHA512withECDSA: string;
export const SHA1withECDSA: string;
}
namespace RSAKeychain {
export function generate(keyTag: string): Promise<PublicKey>;
export function generateEC(keyTag: string): Promise<PublicKey>;
export function generateCSR(keyTag: string, CN: string, signature?: TypeCrypto): Promise<CSRKey>;
export function generateKeys(keyTag: string, keySize: number): Promise<PublicKey>;
export function generateCSRWithEC(cn: String,keyTag: string, keySize: number): Promise<PublicKey & CSRKey>;
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 encrypt64(data: string, keyTag: string): Promise<string>;
export function decrypt64(data: string, keyTag: string): Promise<string>;
export function sign(data: string, keyTag: string): Promise<string>;
export function signWithAlgorithm(data: string, keyTag: string, signature?: TypeCrypto): Promise<string>;
export function sign64WithAlgorithm(data: string, keyTag: string, signature?: TypeCrypto): Promise<string>;
export function verify(data: string, secretToVerify: string, keyTag: string): Promise<boolean>;
export function verifyWithAlgorithm(data: string, secretToVerify: string, keyTag: string, signature?: TypeCrypto): Promise<boolean>;
export function verify64WithAlgorithm(data: string, secretToVerify: string, keyTag: string, signature?: TypeCrypto): Promise<boolean>;
export function getPublicKey(keyTag: string): Promise<string | undefined>;
export function getPublicKeyDER(keyTag: string): Promise<string | undefined>;
export function getPublicKeyRSA(keyTag: string): Promise<string | undefined>;
export function deletePrivateKey(keyTag: string): Promise<boolean>;
export const SHA256withRSA: string;
export const SHA512withRSA: string;
export const SHA1withRSA: string;
export const SHA256withECDSA: string;
export const SHA512withECDSA: string;
export const SHA1withECDSA: string;
}
export { RSA, RSAKeychain, KeyPair, CSRKey };
}