Ada Binding for the libsecret library
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
regtests
samples
src
.gitignore
LICENSE.txt
Makefile.in
NOTICE.txt
README.md
aclocal.m4
config.gpr
config.guess
config.sub
configure
configure.ac
install-sh
samples.gpr.in
secret.gpr.in
secret_tests.gpr.in

README.md

Ada Libsecret Library

Build Status Test Status License Commits

The libsecret is a library for storing and retrieving passwords and others secrets. The library uses the Secret Service API provided by Gnome Keyring or KDE Wallet. This library provides an Ada binding to the Secret Service API.

Pre-Requisites

On Ubuntu, you may have to install the following packages:

sudo apt-get install libsecret-1-dev libglib2.0-dev

You will also need the Ada compiler and the following libraries:

Building

./configure
make

The unit tests are built and executed with:

make test

And the samples are built using:

gprbuild -p -Psamples

Using the library

First, add a with clause for the secret GNAT project, in your GNAT project file add this line:

with "secret";

Then, store a secret with:

Service : Secret.Services.Service_Type;
List    : Secret.Attributes.Map;
Value   : Secret.Values.Secret_Type;

   Service.Initialize;
   List.Insert ("secret identification key", "secret identification value");
   Value := Secret.Values.Create ("the-secret-to-store");
   Service.Store (List, "The secret label (for the keyring manager)", Value);

And you will retrieve it with:

   Value := Service.Lookup (List);
   if not Value.Is_Null then
      Ada.Text_IO.Put_Line (Value.Get_Value);
   end if;

Running the samples

The samples provide a simple secret-tool program that allows to create, retrieve or delete a secret from the secret service API. You can add a secret using:

bin/secret-tool set my-secret

and retrieve it later with:

bin/secret-tool get

Documentation and References