confium 0.3.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +48 -0
- data/Cargo.lock +12 -432
- data/README.adoc +6 -10
- data/ext/confium_native/Cargo.toml +0 -4
- data/ext/confium_native/src/attributes.rs +4 -4
- data/ext/confium_native/src/audit.rs +8 -8
- data/ext/confium_native/src/composite.rs +10 -14
- data/ext/confium_native/src/deployment.rs +7 -6
- data/ext/confium_native/src/ers.rs +7 -11
- data/ext/confium_native/src/lib.rs +0 -2
- data/ext/confium_native/src/path.rs +8 -8
- data/ext/confium_native/src/pki.rs +26 -30
- data/ext/confium_native/src/tc.rs +27 -59
- data/ext/confium_native/src/transparency.rs +16 -57
- data/ext/confium_native/src/util.rs +32 -11
- data/lib/confium/openpgp.rb +138 -16
- data/lib/confium/version.rb +1 -1
- data/lib/confium.rb +7 -0
- metadata +2 -3
- data/ext/confium_native/src/openpgp.rs +0 -55
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
//! Confium::OpenPGP — OpenPGP (RFC 9580) operations via bundled rnp-rs.
|
|
2
|
-
//!
|
|
3
|
-
//! Confium ships RNP functionality baked into the native extension.
|
|
4
|
-
|
|
5
|
-
use magnus::{exception, function, prelude::*, Error, Module, RModule, Ruby, TryConvert, Value};
|
|
6
|
-
use rnp::ops::ArmorType;
|
|
7
|
-
use rnp::{armor_bytes, dearmor_bytes};
|
|
8
|
-
|
|
9
|
-
use crate::util::{bytes_from_value, bytes_to_rstring};
|
|
10
|
-
|
|
11
|
-
/// Native: `Confium::OpenPGP._native_armor(data, type_str)` — 2 args.
|
|
12
|
-
/// The Ruby wrapper `Confium::OpenPGP.armor(data, type = MESSAGE)`
|
|
13
|
-
/// provides the default.
|
|
14
|
-
fn native_armor(ruby: &Ruby, data: Value, type_str: Value) -> Result<magnus::RString, Error> {
|
|
15
|
-
let bytes = bytes_from_value(data)?;
|
|
16
|
-
let ty = if type_str.is_nil() {
|
|
17
|
-
ArmorType::Message
|
|
18
|
-
} else {
|
|
19
|
-
let s: String = TryConvert::try_convert(type_str)?;
|
|
20
|
-
match s.as_str() {
|
|
21
|
-
"public key" => ArmorType::PublicKey,
|
|
22
|
-
"secret key" => ArmorType::SecretKey,
|
|
23
|
-
"signature" => ArmorType::Signature,
|
|
24
|
-
"cleartext signed message" | "cleartext" => ArmorType::Cleartext,
|
|
25
|
-
_ => ArmorType::Message,
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
let armored = armor_bytes(&bytes, ty)
|
|
29
|
-
.map_err(|e| crate::util::parse_error(e.to_string(), "OpenPGP.armor", Some("openpgp"), None))?;
|
|
30
|
-
Ok(bytes_to_rstring(ruby, &armored))
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/// Native: `Confium::OpenPGP._native_dearmor(data)` — 1 arg.
|
|
34
|
-
fn native_dearmor(ruby: &Ruby, data: Value) -> Result<magnus::RString, Error> {
|
|
35
|
-
let bytes = bytes_from_value(data)?;
|
|
36
|
-
let raw = dearmor_bytes(&bytes)
|
|
37
|
-
.map_err(|e| crate::util::parse_error(e.to_string(), "OpenPGP.dearmor", Some("openpgp"), None))?;
|
|
38
|
-
Ok(bytes_to_rstring(ruby, &raw))
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/// Initialize the `Confium::OpenPGP` module.
|
|
42
|
-
pub fn init(_ruby: &Ruby, parent: RModule) -> Result<(), Error> {
|
|
43
|
-
let openpgp = parent.define_module("OpenPGP")?;
|
|
44
|
-
|
|
45
|
-
openpgp.define_singleton_method("_native_armor", function!(native_armor, 2))?;
|
|
46
|
-
openpgp.define_singleton_method("_native_dearmor", function!(native_dearmor, 1))?;
|
|
47
|
-
|
|
48
|
-
openpgp.const_set("MESSAGE", "message")?;
|
|
49
|
-
openpgp.const_set("PUBLIC_KEY", "public key")?;
|
|
50
|
-
openpgp.const_set("SECRET_KEY", "secret key")?;
|
|
51
|
-
openpgp.const_set("SIGNATURE", "signature")?;
|
|
52
|
-
openpgp.const_set("CLEARTEXT", "cleartext signed message")?;
|
|
53
|
-
|
|
54
|
-
Ok(())
|
|
55
|
-
}
|