/claim #2

Summary

Implements persistent credential storage for the Permify CLI as described in #2.

What this PR does:

  • Credential storage at ~/.permify/credentials - Stores endpoint, API token, certificate path, and certificate key in a YAML file with restrictive permissions (0600 file, 0700 directory) for security
  • Updated configure command - Now prompts for API token, certificate path, and certificate key alongside the existing URL prompt. Pre-fills values from previously stored credentials for convenience
  • TLS and token authentication in gRPC client - The New() function now reads stored credentials and automatically configures:
    • Client TLS certificates when cert_path and cert_key are provided
    • TLS transport for https:// and grpcs:// endpoints
    • Bearer token authentication using the existing secureTokenCredentials / nonSecureTokenCredentials types based on TLS state
  • Cross-platform support - Uses os.UserHomeDir() as fallback for home directory resolution (Windows USERPROFILE, macOS/Linux HOME)
  • Validation - Ensures certificate path and key are provided together; fails fast on invalid TLS key pairs
  • Unit tests - Tests for credential serialization/deserialization, missing file handling, and endpoint security detection

Files changed:

File Change
core/client/credentials.go New: credential storage with YAML serialization, OS-aware path resolution
core/client/credentials_test.go New: 4 unit tests for credential operations
core/client/grpc.go Updated: loads stored credentials, builds TLS/token dial options
core/cli/configure.go Updated: prompts for token + certs, stores credentials before connecting
cmd/permctl/permctl.go Updated: cross-platform home directory resolution

Credential file format (~/.permify/credentials):

endpoint: localhost:3478
token: your-api-token
cert_path: /path/to/cert.pem
cert_key: /path/to/key.pem

Closes #2

Claim

Total prize pool $200
Total paid $0
Status Pending
Submitted February 10, 2026
Last updated February 10, 2026

Contributors

BU

buildingvibes

@buildingvibes

100%

Sponsors

PE

Permify.co

@Permify

$200