KimiTokenStorage stores OAuth2 token information for Kimi API authentication.
| 15 | |
| 16 | // KimiTokenStorage stores OAuth2 token information for Kimi API authentication. |
| 17 | type KimiTokenStorage struct { |
| 18 | // AccessToken is the OAuth2 access token used for authenticating API requests. |
| 19 | AccessToken string `json:"access_token"` |
| 20 | // RefreshToken is the OAuth2 refresh token used to obtain new access tokens. |
| 21 | RefreshToken string `json:"refresh_token"` |
| 22 | // TokenType is the type of token, typically "Bearer". |
| 23 | TokenType string `json:"token_type"` |
| 24 | // Scope is the OAuth2 scope granted to the token. |
| 25 | Scope string `json:"scope,omitempty"` |
| 26 | // DeviceID is the OAuth device flow identifier used for Kimi requests. |
| 27 | DeviceID string `json:"device_id,omitempty"` |
| 28 | // Expired is the RFC3339 timestamp when the access token expires. |
| 29 | Expired string `json:"expired,omitempty"` |
| 30 | // Type indicates the authentication provider type, always "kimi" for this storage. |
| 31 | Type string `json:"type"` |
| 32 | |
| 33 | // Metadata holds arbitrary key-value pairs injected via hooks. |
| 34 | // It is not exported to JSON directly to allow flattening during serialization. |
| 35 | Metadata map[string]any `json:"-"` |
| 36 | } |
| 37 | |
| 38 | // SetMetadata allows external callers to inject metadata into the storage before saving. |
| 39 | func (ts *KimiTokenStorage) SetMetadata(meta map[string]any) { |
nothing calls this directly
no outgoing calls
no test coverage detected