From e0914a90bd4bbe76364a39634b23454b584d5762 Mon Sep 17 00:00:00 2001 From: Gerson Alexander Pardo Gamez Date: Sun, 12 Apr 2020 12:49:22 -0500 Subject: [PATCH] updated readme --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 78cb9a6..f272c17 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ ## Usage +### Types ```javascript import OpenPGP from "react-native-fast-openpgp"; @@ -57,25 +58,65 @@ interface KeyPair { publicKey: string; privateKey: string; } +``` + +### Encrypt methods +```javascript +import OpenPGP from "react-native-fast-openpgp"; -const decrypted = await OpenPGP.decrypt(message: string, privateKey: string, passphrase: string): Promise; -const outputFile = await OpenPGP.decryptFile(inputFile: string, outputFile: string, privateKey: string, passphrase: string): Promise; const encrypted = await OpenPGP.encrypt(message: string, publicKey: string): Promise; const outputFile = await OpenPGP.encryptFile(inputFile: string, outputFile: string, publicKey: string): Promise; + +const encryptedSymmetric = await OpenPGP.encryptSymmetric(message: string, passphrase: string, options?: KeyOptions): Promise; +const outputFile = await OpenPGP.encryptSymmetricFile(inputFile: string, outputFile: string, passphrase: string, options?: KeyOptions): Promise; +``` + +### Decrypt methods +```javascript +import OpenPGP from "react-native-fast-openpgp"; + +const decrypted = await OpenPGP.decrypt(message: string, privateKey: string, passphrase: string): Promise; +const outputFile = await OpenPGP.decryptFile(inputFile: string, outputFile: string, privateKey: string, passphrase: string): Promise; + +const decryptedSymmetric = await OpenPGP.decryptSymmetric(message: string, passphrase: string, options?: KeyOptions): Promise; +const outputFile = await OpenPGP.decryptSymmetricFile(inputFile: string, outputFile: string, passphrase: string, options?: KeyOptions): Promise; +``` + +### Sign and Verify methods +```javascript +import OpenPGP from "react-native-fast-openpgp"; + const signed = await OpenPGP.sign(message: string, publicKey: string, privateKey: string, passphrase: string): Promise; const signed = await OpenPGP.signFile(inputFile: string, publicKey: string, privateKey: string, passphrase: string): Promise; + const verified = await OpenPGP.verify(signature: string, message: string, publicKey: string): Promise; const verified = await OpenPGP.verifyFile(signature: string, inputFile: string, publicKey: string): Promise; -const decryptedSymmetric = await OpenPGP.decryptSymmetric(message: string, passphrase: string, options?: KeyOptions): Promise; -const outputFile = await OpenPGP.decryptSymmetricFile(inputFile: string, outputFile: string, passphrase: string, options?: KeyOptions): Promise; -const encryptedSymmetric = await OpenPGP.encryptSymmetric(message: string, passphrase: string, options?: KeyOptions): Promise; -const outputFile = await OpenPGP.encryptSymmetricFile(inputFile: string, outputFile: string, passphrase: string, options?: KeyOptions): Promise; +``` + +### Sign and Verify methods +```javascript +import OpenPGP from "react-native-fast-openpgp"; + +const signed = await OpenPGP.sign(message: string, publicKey: string, privateKey: string, passphrase: string): Promise; +const verified = await OpenPGP.verify(signature: string, message: string, publicKey: string): Promise; + +const signed = await OpenPGP.signFile(inputFile: string, publicKey: string, privateKey: string, passphrase: string): Promise; +const verified = await OpenPGP.verifyFile(signature: string, inputFile: string, publicKey: string): Promise; +``` + + +### Generate +```javascript +import OpenPGP from "react-native-fast-openpgp"; + const generated = await OpenPGP.generate(options: Options): Promise; ``` ### Encrypt with multiple keys ```javascript +import OpenPGP from "react-native-fast-openpgp"; + const publicKeys = `-----BEGIN PGP PUBLIC KEY BLOCK----- mQENBF0Tpe0BCADm+ja4vMKuodkQEhLm/092M/6gt4TaKwzv8QcA53/FrM3g8wab