All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.purejava.kwallet.Static Maven / Gradle / Ivy

Go to download

A Java library for storing secrets on linux in a KDE wallet over D-Bus, implements kwallet.

The newest version!
package org.purejava.kwallet;

import org.freedesktop.dbus.DBusPath;
import org.freedesktop.dbus.ObjectPath;

import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;

public class Static {

    public static final String DEFAULT_WALLET = "kdewallet";

    public static class DBus {
        public static class Interfaces {
            public static final String DBUS_PROPERTIES = "org.freedesktop.DBus.Properties";
        }
    }

    public static class Service {
        public static final String KWALLETD5 = "org.kde.kwalletd5";
        public static final String KWALLETD6 = "org.kde.kwalletd6";
    }

    public static class ObjectPaths {
        public static final String KWALLETD5 = "/modules/kwalletd5";
        public static final String KWALLETD6 = "/modules/kwalletd6";
    }

    public static class Interfaces {
        public static final String KWALLET = "org.kde.KWallet";
    }

    public static class Convert {

        public static byte[] toByteArray(List list) {
            var result = new byte[list.size()];
            for (var i = 0; i < list.size(); i++) {
                result[i] = list.get(i);
            }
            return result;
        }

        public static String toString(byte[] bytes) {
            return new String(bytes, StandardCharsets.UTF_8);
        }

        public static ObjectPath toObjectPath(String path) {
            return new ObjectPath("", path);
        }

        public static List toStrings(List paths) {
            ArrayList ps = new ArrayList();
            for (ObjectPath p : paths) {
                ps.add(p.getPath());
            }
            return ps;
        }

        public static List toDBusPaths(List paths) {
            ArrayList ps = new ArrayList();
            for (ObjectPath p : paths) {
                ps.add(p);
            }
            return ps;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy