commit 664cd180f65c314bae731743dbd481e4314a8ed7
parent c1de21a6fed81c424564aaee60e6ecc82fc9572b
Author: Antoine A <>
Date: Wed, 27 May 2026 13:20:05 +0200
config: add encoded value
Diffstat:
1 file changed, 21 insertions(+), 0 deletions(-)
diff --git a/common/taler-common/src/config.rs b/common/taler-common/src/config.rs
@@ -820,6 +820,27 @@ impl<'cfg, 'arg> Section<'cfg, 'arg> {
self.value("string", option, |it| Ok::<_, CompactString>(it.into()))
}
+ /** Access [option] as hex encode bytes */
+ pub fn hex(&self, option: &'arg str) -> Value<'arg, Vec<u8>> {
+ self.value("hex", option, |it| {
+ crate::encoding::hex::decode(it.as_bytes())
+ })
+ }
+
+ /** Access [option] as base32 encode bytes */
+ pub fn b32(&self, option: &'arg str) -> Value<'arg, Vec<u8>> {
+ self.value("hex", option, |it| {
+ crate::encoding::base32::decode(it.as_bytes())
+ })
+ }
+
+ /** Access [option] as base64 encode bytes */
+ pub fn b64(&self, option: &'arg str) -> Value<'arg, Vec<u8>> {
+ self.value("hex", option, |it| {
+ crate::encoding::base64::decode(it.as_bytes())
+ })
+ }
+
/** Access [option] as path */
pub fn path(&self, option: &'arg str) -> Value<'arg, String> {
self.value("path", option, |it| self.config.pathsub(it, 0))