oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package provider
2
3import "encoding/json"
4
5// ClaudeOAuthToken reads only the validated runtime copy, never an ambient
6// login or keychain. The caller clears the returned bytes after the request.
7func (l *AccountLease) ClaudeOAuthToken() ([]byte, error) {
8 l.mu.Lock()
9 defer l.mu.Unlock()
10 if l.closed || l.source.Provider != "claude" || l.source.Token {
11 return nil, ErrPolicy
12 }
13 raw, err := l.runtimeSnapshot()
14 if err != nil {
15 return nil, err
16 }
17 defer clear(raw)
18 var v struct {
19 OAuth struct {
20 AccessToken string `json:"accessToken"`
21 } `json:"claudeAiOauth"`
22 }
23 if json.Unmarshal(raw, &v) != nil || !ValidToken([]byte(v.OAuth.AccessToken)) {
24 return nil, ErrPolicy
25 }
26 return []byte(v.OAuth.AccessToken), nil
27}
28