Documentation
¶
Overview ¶
Package omniroute reads an OmniRoute data directory read-only and converts it into a remora.yaml document, its secrets and the OAuth credential files remora's accounts import.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUndecryptable = errors.New("value does not decrypt with this STORAGE_ENCRYPTION_KEY")
ErrUndecryptable is returned for a well-formed value that no derived key opens.
Functions ¶
func LoadSecret ¶
LoadSecret lists the STORAGE_ENCRYPTION_KEY values to try, in order: the environment variable, then the STORAGE_ENCRYPTION_KEY= line of <dataDir>/server.env, then of <dataDir>/.env. For a file value, quotes around it are stripped; when it contains "=", the forms OmniRoute's own loader produces (it keeps only the text up to the second "=" of the line: split("=", 2)[1]) follow, with and without a leftover opening quote. Missing files are skipped.
Types ¶
type APIKey ¶
type APIKey struct {
ID, Name, Key string
AllowedModels, AllowedCombos []string
AccessMode string // "all" | "restricted"
Revoked, Expired bool
Disabled bool // is_active = 0 or is_banned = 1
}
APIKey is an api_keys row: a client key, kept in plaintext by OmniRoute.
type Combo ¶
type Combo struct {
Name string
Data json.RawMessage
}
Combo is a combos row; Data is its JSON definition.
type Connection ¶
type Connection struct {
ID, Provider, AuthType, Name, Email, ProjectID string
APIKey, AccessToken, RefreshToken, IDToken string
ExpiresAt string
ExpiresIn int
Active bool
Specific map[string]any // provider_specific_data
}
Connection is a provider_connections row with its secrets decrypted.
type Credential ¶
Credential is an OAuth credential file in the shape the accounts engine stores, ready for POST /api/accounts/import.
type Decrypter ¶
type Decrypter struct {
// contains filtered or unexported fields
}
Decrypter opens OmniRoute's encrypted fields.
func NewDecrypter ¶
NewDecrypter derives both keys OmniRoute may have used: the current one (static salt) and the legacy one (salt = the first 16 bytes of sha256(secret)). scrypt parameters are Node's scryptSync defaults: N=16384, r=8, p=1.
func PickSecret ¶
PickSecret returns a Decrypter for the first candidate that opens probe, any encrypted value from the database.
type Node ¶
type Node struct{ ID, Type, Name, Prefix, BaseURL string }
Node is a provider_nodes row: a custom provider such as an OpenAI-compatible endpoint.
type Result ¶
type Result struct {
Doc config.File
Secrets config.Secrets
Credentials []Credential
Warnings []string
}
Result is what an OmniRoute snapshot becomes: a remora.yaml document whose secrets are env: references, the values of those references, the OAuth credential files to import as accounts, and what could not be carried over.
type Snapshot ¶
type Snapshot struct {
Nodes []Node
Connections []Connection
Keys []APIKey
Combos []Combo
}
Snapshot is what Read finds in an OmniRoute database.
func Read ¶
func Read(ctx context.Context, dataDir string, env func(string) (string, bool), now time.Time) (Snapshot, error)
Read opens <dataDir>/storage.sqlite read-only and immutable (no write, no journal, no WAL checkpoint), decrypts connection secrets with the STORAGE_ENCRYPTION_KEY that LoadSecret finds, and returns every row the importer converts. Columns later OmniRoute versions added are optional. now decides which client keys have expired.