### ----------------------------------------------------
### -- GPGME
### -- Licenses: Artistic-2.0
### -- Authors: Curt Tilmes <curt@tilmes.org>
### -- File: lib/GPGME.rakumod
### ----------------------------------------------------
### -- Chunk 2 of 2
oe@foo.bar>, :Passphrase<abc);

See L<GPG Key Generation|https://gnupg.org/documentation/manuals/gnupg/Unattended-GPG-key-generation.html> and L<CSR and Certificate Creation|https://www.gnupg.org/documentation/manuals/gnupg/CSR-and-certificate-creation.html> for more details on the parameters.

=item method B<get-key>(GPGME:D: Str:D $fpr, Bool :$secret --> GPGME::Key)

Look up and retrieve a key by fingerprint or key ID.

Set I<:secret> to retrieve the secret key.  The currently active
keylist mode is used to retrieve the key.

=item method B<keylist>(GPGME:D: *@pattern, Bool :$secret --> Seq)

Lists keys matching any of the specified patterns (or all keys if no
patterns).

Until the C<Seq> is fully retrieved, the context will be busy and
should not be used for other actions.  Either retrieve the whole list
first, or use another context.

=item multi method B<signers>(GPGME:D: *@keys, Bool :$clear --> GPGME:D)
=item multi method B<signers>(GPGME:D: --> List)

Set or retrieve a list of key signers to be used for signing actions.

Use C<:clear> to clear the list.

=item method B<notation>(GPGME:D: Bool :$clear, *%notations)

Set or retrieve signature notations.

=item method B<keysign>(GPGME:D: GPGME::Key:D $key, *@userid,
                   :$expires = 0, Bool :$local,
                   Bool :$noexpire --> GPGME:D)

Specifying no user IDs will sign with all valid user IDs.

I<expires> can be an posix time int or a C<DateTime>

See L<Signing Keys|https://gnupg.org/documentation/manuals/gpgme/Signing-Keys.html> for more information.

=item method B<export>(GPGME:D: *@patterns, :$out = GPGME::Data.new(Str); Bool :$extern, Bool :$minimal, Bool :$secret, Bool :$raw, Bool :$pkcs12 --> GPGME::Data)

C<$out> can be anything a C<GPGME::Data> can write to -- a C<Str> with
a filename, an C<IO::Path> of a file to write to, a C<IO::Handle>.
The C<GPGME::Data> object is returned regardless.

See L<Exporting Keys|https://gnupg.org/documentation/manuals/gpgme/Exporting-Keys.html> for more information.

Some examples:

  put $gpg.export('joe@foo.bar');                # Stringify and print out
  $gpg.export('joe@foo.bar', :out<outputfile>);  # Export to filename
  $gpg.export('joe@foo.bar', out => $*OUT);      # Send to a file handle

=item method B<import>(GPGME:D: $keydata --> GPGME::ImportResult)

I<$keydata> can be anything that can be used for a <GPGME::Data>
object: a C<Str>, an C<IO::Path> of a file with the keys, or a
C<IO::Handle> of a file with the data.

See L<Importing Keys|https://gnupg.org/documentation/manuals/gpgme/Importing-Keys.html> for more information

Returns a C<GPGME::ImportResult>

=item multi method B<delete-key>(GPGME:D: Str:D $fpr, |opts)
=item multi method B<delete-key>(GPGME:D: GPGME::Key:D $key, Bool :$secret, Bool :$force --> Nil)

Deletes a key.

See L<Deleting Keys|https://gnupg.org/documentation/manuals/gpgme/Deleting-Keys.html> for more information

=item method B<sign>(GPGME:D: $plain, $sig?, Bool :$detach, Bool :$clear)

Creates a signature for the text in the data object I<$plain>.

I<$plain> can be anything that can be used for a <GPGME::Data> object:
a C<Buf> or C<Str> with the actual data, an C<IO::Path> of a file with
the plaintext, or a C<IO::Handle> of a file with the data.

Similarly, if specified, I<$sig> can also be a <GPGME::Data> writable
object: a C<Str> filename, an C<IO::Path> filename, or a C<IO::Handle>
to write the signature to.

The signed data is returned in a <GPGME::Data> object.

Some examples:

  my $sig = $gpg.sign('some plain text');
  put $sig;                                     # Stringify

  $gpg.sign('inputfile'.IO, 'outputfile'.IO);   # Use filenames
  $gpg.sign($*IN, $*OUT);                       # Sign STDIN, write to STDOUT

A C<GPGME::SignResult> is stored in the context and can be queried.

=item method B<verify>(GPGME:D: $sig, $signed?, $plain?)

Verify a signature in a C<GPGME::Data> object.  Can optionally specify
C<GPGME::Data> objects in I<$signed> and $<plain> as well.

If the signature is detached, specify the I<$signed> data.

I<$sig> and I<$signed> can be anything that a <GPGME::Data> object can
read from: A C<Buf> or C<Str> with the data, or a C<IO::Path> or
C<IO::Handle> with the data.

I<$plain> will get the returned plain text from the signature.  It can
be a <Str> or an <IO::Path> with a filename, or an <IO::Handle>.  By
default, a memory buffer is used and returned in a C<GPGME::Data>
object which can be stringified or read from.

A C<GPGME::VerifyReuslt> is stored in the context and can be queried.

See L<Verify|https://gnupg.org/documentation/manuals/gpgme/Verify.html> for more information.

=item method B<encrypt>(GPGME:D: $plain, *@keys, :$out, Bool :$always-trust, Bool :$no-encrypt-to, Bool :$prepare, Bool :$expect-sign, Bool :$no-compress, Bool :$symmetric, Bool :$throw-keyids, Bool :$wrap --> GPGME::Data)

I<$plain> can be anything that a <GPGME::Data> object can
read from: A C<Buf> or C<Str> with the data, or a C<IO::Path> or
C<IO::Handle> with the data.

I<$out> can be a <Str> or an <IO::Path> with a filename, or an
<IO::Handle>.  By default, a memory buffer is used and returned in a
C<GPGME::Data> object which can be stringified or read from.

A C<GPGME::EncryptResult> is stored in the context and can be queried.

See L<Encrypt|https://gnupg.org/documentation/manuals/gpgme/Encrypting-a-Plaintext.html> for more information.

=item method B<decrypt>(GPGME:D: $cipher, :$out, Bool :$verify, Bool :$unwrap, --> GPGME::Data)

I<$cipher> can be anything that a <GPGME::Data> object can
read from: A C<Buf> or C<Str> with the data, or a C<IO::Path> or
C<IO::Handle> with the data.

I<$out> can be a <Str> or an <IO::Path> with a filename, or an
<IO::Handle>.  By default, a memory buffer is used and returned in a
C<GPGME::Data> object which can be stringified or read from.

A C<GPGME::DecryptResult> is stored in the context and can be queried.

See L<Decrypt|https://gnupg.org/documentation/manuals/gpgme/Decrypt.html> for more information.

=end pod


