Secretada

Website:

https://gitlab.com/stcarrez/ada-libsecret

Author:
  • Stephane.Carrez@gmail.com
Maintainer:
  • Stephane.Carrez@gmail.com
License:

Apache-2.0

Version:

1.0.0

Alire CI:

Dependencies: Dependents:

No dependents.

Badge:

Secret service Ada binding

#secret #bindings

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.

You can store a secret by using the following code extract:

with Secret.Services;
with Secret.Attributes;
with Secret.Values;
...
   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;