Skip to content

Commit 70ab6d9

Browse files
authored
chore: updated binaries to fix armor encode and new armor encode method (#64)
* chore: updated binaries * chore: add armorDecode * doc: updated changelog
1 parent 68bddea commit 70ab6d9

17 files changed

+1198
-570
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 3.7.1
2+
3+
- Updated binaries to v1.9.2
4+
- Fixed issue with bad armor encode
5+
- Add ArmorDecode method
6+
17
## 3.7.0
28

39
- Add SignData methods for compatibility with other platform implementations

README.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Library for use openPGP with support for android, ios, macos, windows, linux and
2222
- [Sign methods](#sign-methods)
2323
- [Verify methods](#verify-methods)
2424
- [Encode methods](#encode-methods)
25+
- [Decode methods](#decode-methods)
2526
- [Metadata methods](#metadata-methods)
2627
- [Convert methods](#convert-methods)
2728
- [Setup](#setup)
@@ -132,7 +133,17 @@ import 'package:fast_rsa/rsa.dart';
132133
void main() async {
133134
var bytesSample = Uint8List.fromList('data'.codeUnits);
134135
135-
var result = await OpenPGP.armorEncode(bytesSample);
136+
var result = await OpenPGP.armorEncode("PGP MESSAGE", bytesSample);
137+
}
138+
139+
```
140+
### Decode methods
141+
142+
```dart
143+
import 'package:fast_rsa/rsa.dart';
144+
145+
void main() async {
146+
var result = await OpenPGP.armorDecode("message here");
136147
}
137148
138149
```
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

example/lib/armor.dart

+23-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ class Armor extends StatefulWidget {
2323
}
2424

2525
class _ArmorState extends State<Armor> {
26-
String _result = "";
26+
String _encoded = "";
27+
String _decoded = "";
2728

2829
@override
2930
Widget build(BuildContext context) {
@@ -36,17 +37,36 @@ class _ArmorState extends State<Armor> {
3637
InputWidget(
3738
title: "Armor encode",
3839
key: Key("encode"),
39-
result: _result,
40+
result: _encoded,
4041
onPressed: (controller) async {
4142
var result = await OpenPGP.armorEncode(
43+
"PGP MESSAGE",
4244
Uint8List.fromList(controller.text.codeUnits),
4345
);
4446

4547
setState(() {
46-
_result = result;
48+
_encoded = result;
4749
});
4850
},
4951
),
52+
ButtonWidget(
53+
title: "Decode",
54+
key: Key("decode"),
55+
result: _decoded,
56+
onPressed: () async {
57+
try {
58+
var decoded = await OpenPGP.armorDecode(
59+
_encoded,
60+
);
61+
62+
setState(() {
63+
_decoded = "${decoded.type}: ${utf8.decode(decoded.body)}";
64+
});
65+
} on OpenPGPException catch (e) {
66+
print(e);
67+
}
68+
},
69+
),
5070
],
5171
),
5272
),

example/pubspec.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ packages:
269269
path: ".."
270270
relative: true
271271
source: path
272-
version: "3.7.0"
272+
version: "3.7.1"
273273
package_config:
274274
dependency: transitive
275275
description:

ios/libopenpgp_bridge.a

-274 KB
Binary file not shown.

0 commit comments

Comments
 (0)