Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Keychain

Securely store sensitive data like tokens, passwords, and API keys using the platform’s secure storage.

Usage

import { keychainSet, keychainGet } from "perry/system";

// Store a secret
keychainSet("api-token", "sk-abc123...");

// Retrieve a secret
const token = keychainGet("api-token");

Platform Storage

PlatformBackend
macOSSecurity.framework (Keychain)
iOSSecurity.framework (Keychain)
AndroidAndroid Keystore
WindowsWindows Credential Manager (CredWrite/CredRead/CredDelete)
Linuxlibsecret
WeblocalStorage (not truly secure)

Web: The web platform uses localStorage, which is not encrypted. For web apps handling sensitive data, consider server-side storage instead.

Next Steps