36
36
37
37
## Usage
38
38
39
+ ### Types
39
40
``` javascript
40
41
import OpenPGP from " react-native-fast-openpgp" ;
41
42
@@ -57,25 +58,65 @@ interface KeyPair {
57
58
publicKey: string;
58
59
privateKey: string;
59
60
}
61
+ ```
62
+
63
+ ### Encrypt methods
64
+ ``` javascript
65
+ import OpenPGP from " react-native-fast-openpgp" ;
60
66
61
- const decrypted = await OpenPGP .decrypt (message: string, privateKey: string, passphrase: string): Promise < string> ;
62
- const outputFile = await OpenPGP .decryptFile (inputFile: string, outputFile: string, privateKey: string, passphrase: string): Promise < string> ;
63
67
const encrypted = await OpenPGP .encrypt (message: string, publicKey: string): Promise < string> ;
64
68
const outputFile = await OpenPGP .encryptFile (inputFile: string, outputFile: string, publicKey: string): Promise < string> ;
69
+
70
+ const encryptedSymmetric = await OpenPGP .encryptSymmetric (message: string, passphrase: string, options?: KeyOptions): Promise < string> ;
71
+ const outputFile = await OpenPGP .encryptSymmetricFile (inputFile: string, outputFile: string, passphrase: string, options?: KeyOptions): Promise < string> ;
72
+ ```
73
+
74
+ ### Decrypt methods
75
+ ``` javascript
76
+ import OpenPGP from " react-native-fast-openpgp" ;
77
+
78
+ const decrypted = await OpenPGP .decrypt (message: string, privateKey: string, passphrase: string): Promise < string> ;
79
+ const outputFile = await OpenPGP .decryptFile (inputFile: string, outputFile: string, privateKey: string, passphrase: string): Promise < string> ;
80
+
81
+ const decryptedSymmetric = await OpenPGP .decryptSymmetric (message: string, passphrase: string, options?: KeyOptions): Promise < string> ;
82
+ const outputFile = await OpenPGP .decryptSymmetricFile (inputFile: string, outputFile: string, passphrase: string, options?: KeyOptions): Promise < string> ;
83
+ ```
84
+
85
+ ### Sign and Verify methods
86
+ ``` javascript
87
+ import OpenPGP from " react-native-fast-openpgp" ;
88
+
65
89
const signed = await OpenPGP .sign (message: string, publicKey: string, privateKey: string, passphrase: string): Promise < string> ;
66
90
const signed = await OpenPGP .signFile (inputFile: string, publicKey: string, privateKey: string, passphrase: string): Promise < string> ;
91
+
67
92
const verified = await OpenPGP .verify (signature: string, message: string, publicKey: string): Promise < boolean> ;
68
93
const verified = await OpenPGP .verifyFile (signature: string, inputFile: string, publicKey: string): Promise < boolean> ;
69
- const decryptedSymmetric = await OpenPGP .decryptSymmetric (message: string, passphrase: string, options?: KeyOptions): Promise < string> ;
70
- const outputFile = await OpenPGP .decryptSymmetricFile (inputFile: string, outputFile: string, passphrase: string, options?: KeyOptions): Promise < string> ;
71
- const encryptedSymmetric = await OpenPGP .encryptSymmetric (message: string, passphrase: string, options?: KeyOptions): Promise < string> ;
72
- const outputFile = await OpenPGP .encryptSymmetricFile (inputFile: string, outputFile: string, passphrase: string, options?: KeyOptions): Promise < string> ;
94
+ ```
95
+
96
+ ### Sign and Verify methods
97
+ ``` javascript
98
+ import OpenPGP from " react-native-fast-openpgp" ;
99
+
100
+ const signed = await OpenPGP .sign (message: string, publicKey: string, privateKey: string, passphrase: string): Promise < string> ;
101
+ const verified = await OpenPGP .verify (signature: string, message: string, publicKey: string): Promise < boolean> ;
102
+
103
+ const signed = await OpenPGP .signFile (inputFile: string, publicKey: string, privateKey: string, passphrase: string): Promise < string> ;
104
+ const verified = await OpenPGP .verifyFile (signature: string, inputFile: string, publicKey: string): Promise < boolean> ;
105
+ ```
106
+
107
+
108
+ ### Generate
109
+ ``` javascript
110
+ import OpenPGP from " react-native-fast-openpgp" ;
111
+
73
112
const generated = await OpenPGP .generate (options: Options): Promise < KeyPair> ;
74
113
```
75
114
76
115
### Encrypt with multiple keys
77
116
78
117
``` javascript
118
+ import OpenPGP from " react-native-fast-openpgp" ;
119
+
79
120
const publicKeys = ` -----BEGIN PGP PUBLIC KEY BLOCK-----
80
121
81
122
mQENBF0Tpe0BCADm+ja4vMKuodkQEhLm/092M/6gt4TaKwzv8QcA53/FrM3g8wab
0 commit comments