Documentation
¶
Overview ¶
Package store contains a minimal, read-only SQLite reader, used to read credentials out of a kiro-cli database without taking on a dependency.
It implements only what that job needs: the file header, table B-tree pages, record decoding and overflow chains. There is no query planner, no index support and no write path. Nothing here ever modifies the file.
Index ¶
Constants ¶
const ProfileStateKey = "api.codewhisperer.profile"
ProfileStateKey is the state row holding the selected CodeWhisperer profile.
Variables ¶
var ErrNotFound = errors.New("key not found")
ErrNotFound reports that a key is absent.
var ErrWALPresent = errors.New("the database is in WAL mode, so the main file may be stale")
ErrWALPresent reports that the database has an active write-ahead log.
The reader deliberately refuses these: the committed pages in the main file can be older than the contents of the WAL, so reading it would hand back a stale token that has already been replaced.
var RegistrationKeys = []string{
"kirocli:odic:device-registration",
"codewhisperer:odic:device-registration",
}
RegistrationKeys are the auth_kv keys that may hold a device registration.
var TokenKeys = []string{
"kirocli:social:token",
"kirocli:odic:token",
"codewhisperer:odic:token",
}
TokenKeys are the auth_kv keys that may hold a token, in priority order.
The "odic" spelling is a typo in kiro-cli itself. It is reproduced exactly, because that is the key the data is actually stored under.
Functions ¶
Types ¶
type Credentials ¶
type Credentials struct {
AccessToken string
RefreshToken string
ProfileARN string
Region string
ExpiresAt time.Time
ClientID string
ClientSecret string
// SourceKey records which auth_kv key the token came from, for logging.
SourceKey string
}
Credentials is what a kiro-cli database yields.
It mirrors the fields the auth layer needs, without importing it, so the two packages stay independent.
func LoadCredentials ¶
func LoadCredentials(path string) (*Credentials, error)
LoadCredentials reads credentials from a kiro-cli database.
It never writes: token rotation stays kiro-cli's responsibility, so kirogo keeps a refreshed token in memory only.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is an open, read-only SQLite database held in memory.
kiro-cli databases are small, so the whole file is read at once. That avoids any chance of observing a half-written page mid-read.
func (*DB) Lookup ¶
Lookup returns the value column of the row whose key column matches key.
It is the whole query surface this reader needs: kiro-cli stores credentials as key/value rows in small tables, so a scan is both simpler and fast enough. Column positions come from the table's CREATE statement rather than being assumed, so a schema change does not silently read the wrong column.