libssh2_agent_get_identity(3)

πŸ“¦
version 1.11.1 Β· 3 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, debian trixie, epel 10, epel 9, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– libssh2_agent_get_identity(3) πŸ’–

okay bestie, welcome to the libssh2 manual, and today's main character is libssh2_agent_get_identity β€” no cap, she's the one who lets you scroll through your whole public key collection like it's your fyp πŸ¦‹


✨ NAME ✨

libssh2_agent_get_identity β€” get a public key off the collection of public keys managed by ssh-agent πŸ”‘


🌸 SYNOPSIS 🌸

#include <libssh2.h>

int
libssh2_agent_get_identity(LIBSSH2_AGENT *agent,
                           struct libssh2_agent_publickey **store,
                           struct libssh2_agent_publickey *prev);

πŸŽ€ DESCRIPTION πŸŽ€

so like, libssh2_agent_get_identity(3) lets your application iterate over every single public key in the collection that ssh-agent is managing. it's giving "one at a time, bestie, we're doing a little loop" πŸ’…

  • store β€” should point to a pointer that gets filled in to point to the public key data. like, you hand her a pointer-to-a-pointer and she hands you back the goods πŸ“¬
  • prev β€” a pointer to a previous struct libssh2_agent_publickey as returned by a previous invoke of this function, or NULL to get the first entry in the internal collection. that NULL is your "start from the top, queen" move πŸ‘‘

πŸ”₯ RETURN VALUE πŸ”₯

  • Returns 0 if everything is fine and information about a host was stored in the store struct. slay, you got one 🫢
  • Returns 1 if it reached the end of public keys. that's the "no more left, bestie" signal, not an error πŸ’€
  • Returns negative values for error. yeah, negative = something went wrong, don't ignore her 😭

⭐ AVAILABILITY ⭐

Added in libssh2 1.2 β€” so she's been iconic since way back, fr fr 🌈


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, babe πŸ’œ this was libssh2 version 1.2-era energy, dated 23 Dec 2009, and it lives in the libssh2_agent_get_identity(3) manual. go loop through those keys, you absolute legend βœ¨πŸŽ€