Skip to content

Commit e0914a9

Browse files
committed
updated readme
1 parent 43ed6f7 commit e0914a9

File tree

1 file changed

+47
-6
lines changed

1 file changed

+47
-6
lines changed

README.md

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
## Usage
3838

39+
### Types
3940
```javascript
4041
import OpenPGP from "react-native-fast-openpgp";
4142

@@ -57,25 +58,65 @@ interface KeyPair {
5758
publicKey: string;
5859
privateKey: string;
5960
}
61+
```
62+
63+
### Encrypt methods
64+
```javascript
65+
import OpenPGP from "react-native-fast-openpgp";
6066

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>;
6367
const encrypted = await OpenPGP.encrypt(message: string, publicKey: string): Promise<string>;
6468
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+
6589
const signed = await OpenPGP.sign(message: string, publicKey: string, privateKey: string, passphrase: string): Promise<string>;
6690
const signed = await OpenPGP.signFile(inputFile: string, publicKey: string, privateKey: string, passphrase: string): Promise<string>;
91+
6792
const verified = await OpenPGP.verify(signature: string, message: string, publicKey: string): Promise<boolean>;
6893
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+
73112
const generated = await OpenPGP.generate(options: Options): Promise<KeyPair>;
74113
```
75114

76115
### Encrypt with multiple keys
77116

78117
```javascript
118+
import OpenPGP from "react-native-fast-openpgp";
119+
79120
const publicKeys = `-----BEGIN PGP PUBLIC KEY BLOCK-----
80121
81122
mQENBF0Tpe0BCADm+ja4vMKuodkQEhLm/092M/6gt4TaKwzv8QcA53/FrM3g8wab

0 commit comments

Comments
 (0)