Skip to content
pi-c Artifact [951d10b7bf]
Login

Artifact [951d10b7bf]

Artifact 951d10b7bf9af03c29eacee88ca977c3742a90eb703347636c5a395eefe8fe7a:


/* pic's only credential code. A credential is fetched into a caller buffer
 * just before use and wiped right after; it is never journaled, logged or put
 * in an error message. See docs/credential-project.md for where this goes. */
#ifndef PIC_CRED_H
#define PIC_CRED_H

#include <stddef.h>

/* Fetches the credential NAME (today "anthropic", from ANTHROPIC_API_KEY)
 * into buf. 0, or -1 with err saying what is missing (never the value). */
int pic_cred_get(const char *name, char *buf, size_t cap, char *err, size_t errcap);
/* Overwrites n bytes in a way the compiler may not remove. */
void pic_cred_wipe(void *p, size_t n);

#endif