Skip to main content

SDKs

Arcan provides official client SDKs for Go, Python, and Node.js. All SDKs have zero external dependencies and use only standard library modules.

Install

go get getarcan.dev/arcan/sdk/go

Quick Start

package main

import (
"fmt"
"log"

arcan "getarcan.dev/arcan/sdk/go"
)

func main() {
client, err := arcan.New(
arcan.WithURL("https://arcan.internal:9797"),
arcan.WithToken("arc_xxx"),
arcan.WithRealm("production"),
arcan.WithEnv("prod"),
)
if err != nil {
log.Fatal(err)
}

dbURL, err := client.Get("DATABASE_URL")
if err != nil {
log.Fatal(err)
}
fmt.Println(dbURL)
}

Environment Variable Auto-Config

All SDKs support automatic configuration from environment variables. Set ARCAN_URL, ARCAN_TOKEN, ARCAN_REALM, and ARCAN_ENV, then create a client with no arguments:

client, err := arcan.New()
if err != nil {
log.Fatal(err)
}
dbURL := client.MustGet("DATABASE_URL")

API Reference

Client Options

OptionDefaultDescription
WithURL(url)ARCAN_URL or https://localhost:9797Server URL
WithToken(token)ARCAN_TOKENAuth token (required)
WithRealm(realm)ARCAN_REALM or "default"Realm/namespace
WithEnv(env)ARCAN_ENV or "dev"Environment
WithInsecureSkipVerify(bool)trueAccept self-signed certs
WithCacheTTL(duration)5mCache TTL (0 to disable)

Methods

All SDKs provide the same core methods:

MethodDescription
Get(key) / get(key)Fetch a secret value
GetWithMeta(key) / get_meta(key) / getMeta(key)Fetch secret with metadata
List() / list()Fetch all secrets
Set(key, value) / set(key, value)Create or update a secret
Delete(key) / delete(key)Delete a secret
Health() / health()Check server health

Go additionally has MustGet(key) which panics on error (useful for initialization).

Error Handling

import "errors"

val, err := client.Get("MY_SECRET")
if errors.Is(err, arcan.ErrNotFound) {
// Secret does not exist
} else if errors.Is(err, arcan.ErrAuth) {
// Invalid or expired token
} else if errors.Is(err, arcan.ErrConnection) {
// Cannot reach server
} else if errors.Is(err, arcan.ErrServer) {
// Server returned 5xx
}

Caching

All SDKs cache secrets in memory for 5 minutes by default. The cache is thread-safe. Write operations (Set, Delete) automatically invalidate relevant cache entries.

// Disable caching
client, _ := arcan.New(arcan.WithCacheTTL(0))

// Cache for 30 seconds
client, _ := arcan.New(arcan.WithCacheTTL(30 * time.Second))

Security

  • Use valid TLS certificates in production (not self-signed)
  • Store API tokens in your platform's secret management (not hardcoded)
  • Use read-only tokens (arcan token create --scopes read) for applications that only need to read secrets
  • Enable audit logging on the Arcan server to track all secret access