@@ -16,15 +16,8 @@ Library for use openPGP with support for android, ios, macos, windows, linux and
1616- [ OpenPGP] ( #openpgp )
1717 - [ Contents] ( #contents )
1818 - [ Usage] ( #usage )
19- - [ Generate methods] ( #generate-methods )
20- - [ Encrypt methods] ( #encrypt-methods )
21- - [ Decrypt methods] ( #decrypt-methods )
22- - [ Sign methods] ( #sign-methods )
23- - [ Verify methods] ( #verify-methods )
24- - [ Encode methods] ( #encode-methods )
25- - [ Decode methods] ( #decode-methods )
26- - [ Metadata methods] ( #metadata-methods )
27- - [ Convert methods] ( #convert-methods )
19+ - [ Async methods] ( #async-methods )
20+ - [ Sync methods] ( #sync-methods )
2821 - [ Setup] ( #setup )
2922 - [ Android] ( #android )
3023 - [ iOS] ( #ios )
@@ -39,7 +32,9 @@ Library for use openPGP with support for android, ios, macos, windows, linux and
3932
4033## Usage
4134
42- ## Generate methods
35+ ### Async methods
36+
37+ #### Generate methods
4338``` dart
4439
4540void main() async {
@@ -53,7 +48,7 @@ void main() async {
5348}
5449```
5550
56- ### Encrypt methods
51+ #### Encrypt methods
5752
5853``` dart
5954
@@ -69,7 +64,7 @@ void main() async {
6964
7065```
7166
72- ### Decrypt methods
67+ #### Decrypt methods
7368
7469``` dart
7570
@@ -84,7 +79,7 @@ void main() async {
8479}
8580```
8681
87- ### Sign methods
82+ #### Sign methods
8883
8984``` dart
9085
@@ -102,7 +97,7 @@ void main() async {
10297
10398```
10499
105- ### Verify methods
100+ #### Verify methods
106101
107102``` dart
108103
@@ -120,7 +115,7 @@ void main() async {
120115
121116```
122117
123- ### Encode methods
118+ #### Encode methods
124119
125120``` dart
126121
@@ -131,7 +126,7 @@ void main() async {
131126}
132127
133128```
134- ### Decode methods
129+ #### Decode methods
135130
136131``` dart
137132
@@ -142,7 +137,7 @@ void main() async {
142137```
143138
144139
145- ### Metadata methods
140+ #### Metadata methods
146141
147142``` dart
148143
@@ -154,7 +149,7 @@ void main() async {
154149```
155150
156151
157- ### Convert methods
152+ #### Convert methods
158153
159154``` dart
160155
@@ -164,6 +159,133 @@ void main() async {
164159
165160```
166161
162+ ### Sync methods
163+
164+ #### Generate methods
165+ ``` dart
166+
167+ void main() {
168+ var keyOptions = KeyOptions()..rsaBits = 2048;
169+ var keyPair = OpenPGPSync.generate(
170+ options: Options()
171+ ..name = 'test'
172+ ..email = 'test@test.com'
173+ ..passphrase = passphrase
174+ ..keyOptions = keyOptions);
175+ }
176+ ```
177+
178+ #### Encrypt methods
179+
180+ ``` dart
181+
182+ void main() async {
183+ var bytesSample = Uint8List.fromList('data'.codeUnits);
184+
185+ var result = OpenPGPSync.encrypt("text","[publicKey here]");
186+ var result = OpenPGPSync.encryptSymmetric("text","[passphrase here]");
187+ var result = OpenPGPSync.encryptBytes(bytesSample,"[publicKey here]");
188+ var result = OpenPGPSync.encryptSymmetricBytes(bytesSample,"[passphrase here]");
189+
190+ }
191+
192+ ```
193+
194+ #### Decrypt methods
195+
196+ ``` dart
197+
198+ void main() async {
199+ var bytesSample = Uint8List.fromList('data'.codeUnits);
200+
201+ var result = OpenPGPSync.decrypt("text encrypted","[privateKey here]","[passphrase here]");
202+ var result = OpenPGPSync.decryptSymmetric("text encrypted","[passphrase here]");
203+ var result = OpenPGPSync.decryptBytes(bytesSample,"[privateKey here]","[passphrase here]");
204+ var result = OpenPGPSync.decryptSymmetricBytes(bytesSample,"[passphrase here]");
205+
206+ }
207+ ```
208+
209+ #### Sign methods
210+
211+ ``` dart
212+
213+ void main() async {
214+ var bytesSample = Uint8List.fromList('data'.codeUnits);
215+
216+ var result = OpenPGPSync.sign("text","[privateKey here]","[passphrase here]");
217+ var result = OpenPGPSync.signBytesToString(bytesSample,"[privateKey here]","[passphrase here]");
218+
219+ // sign including data
220+ var result = OpenPGPSync.signData("text","[privateKey here]","[passphrase here]");
221+ var result = OpenPGPSync.signDataBytesToString(bytesSample,"[privateKey here]","[passphrase here]");
222+
223+ }
224+
225+ ```
226+
227+ #### Verify methods
228+
229+ ``` dart
230+
231+ void main() async {
232+ var bytesSample = Uint8List.fromList('data'.codeUnits);
233+
234+ var result = OpenPGPSync.verify("text signed","text","[publicKey here]");
235+ var result = OpenPGPSync.verifyBytes("text signed", bytesSample,"[publicKey here]");
236+
237+ // verify signed with data
238+ var result = OpenPGPSync.verifyData("text signed","[publicKey here]");
239+ var result = OpenPGPSync.verifyDataBytes(bytesSample,"[publicKey here]");
240+
241+ }
242+
243+ ```
244+
245+ #### Encode methods
246+
247+ ``` dart
248+
249+ void main() async {
250+ var bytesSample = Uint8List.fromList('data'.codeUnits);
251+
252+ var result = OpenPGPSync.armorEncode("PGP MESSAGE", bytesSample);
253+ }
254+
255+ ```
256+ #### Decode methods
257+
258+ ``` dart
259+
260+ void main() async {
261+ var result = OpenPGPSync.armorDecode("message here");
262+ }
263+
264+ ```
265+
266+
267+ #### Metadata methods
268+
269+ ``` dart
270+
271+ void main() async {
272+ var result = OpenPGPSync.getPrivateKeyMetadata("[privateKey here]");
273+ var result = OpenPGPSync.getPublicKeyMetadata("[publicKey here]");
274+ }
275+
276+ ```
277+
278+
279+ #### Convert methods
280+
281+ ``` dart
282+
283+ void main() async {
284+ var result = OpenPGPSync.convertPrivateKeyToPublicKey("[privateKey here]");
285+ }
286+
287+ ```
288+
167289## Setup
168290
169291### Android
0 commit comments