swcreds.bend relies on unsafe/foreign
raw source on the hub · import cswap-bend-cli@0.1.0.0/swcreds.bend as Swcreds
6 imports
import Base import ./json.bend as Json import ./swbase.bend as B import ./store/base.bend as SBase import ./store/plan.bend as SPlan import ./store/seq.bend as SSeq
Types
type CKind source · line 12 · raw
Data
KOwnBytesCKind
KOwnFamilyCKind
KWipedCKind
KForeignSynced@slot:String -> CKind
KForeign@slot:String -> CKind
KAlienCKind
KUnresolvedCKind
type Other source · line 22 · raw
Data
Another slot's stored credential.
Other@slot:String -> @creds:String -> Other
Definitions
def keep_field source · line 28 · raw
@+drop:Bool -> @+k:String -> @+v:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+rest:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/json.Json
def pick_fields source · line 36 · raw
@+fields:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+shared:Bool -> 0x0717344745a30ebad1f19045228e8f18/json.Json
The fields of an object chain that are (or are not) shared across accounts.
def append_fields source · line 43 · raw
@+a:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+b:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/json.Json
def has_oauth source · line 50 · raw
@+fields:0x0717344745a30ebad1f19045228e8f18/json.Json -> Bool
def merge3 source · line 57 · raw
@+oauth:Bool -> @+lf:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+tf:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+target_text:String -> String
def merge2 source · line 64 · raw
@+live:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+target:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+target_text:String -> String
def merge1 source · line 71 · raw
@live:Result<&2, &2, String, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> @target:Result<&2, &2, String, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> @+target_text:String -> String
def prepare_activation source · line 81 · raw
@+target:String -> @+live:String -> String
The credential to write for target while live is replaced: Claude Code's
account-independent fields (MCP logins, plugin secrets) ride along from the
live one. A live API key or non-JSON leaves the target as is.
def oauth_of source · line 84 · raw
@+creds:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/json.Json
def refresh_of2 source · line 87 · raw
@r:Result<&2, &2, String, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> String
def refresh_of source · line 94 · raw
@+text:String -> String
def access_of2 source · line 97 · raw
@r:Result<&2, &2, String, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> String
def access_of source · line 104 · raw
@+text:String -> String
def is_object source · line 107 · raw
@+j:0x0717344745a30ebad1f19045228e8f18/json.Json -> Bool
def is_oauth_obj2 source · line 114 · raw
@r:Result<&2, &2, String, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> Bool
def is_oauth_obj source · line 121 · raw
@+text:String -> Bool
def same_lineage2 source · line 124 · raw
@+ra:String -> @+rb:String -> @+a:String -> @+b:String -> Bool
def same_lineage source · line 129 · raw
@+a:String -> @+b:String -> Bool
The credential fingerprint rule: the refresh token when there is one, else the whole text. Equal fingerprints are equal tokens, so compare the tokens.
def wiped source · line 133 · raw
@+text:String -> Bool
Claude Code empties both tokens in place when a refresh is rejected.
def foreign_slot source · line 136 · raw
@+live:String -> @+others:List<&2, Other> -> Maybe<&2, String>
def classify3 source · line 143 · raw
@+foreign:Maybe<&2, String> -> CKind
def classify2b source · line 150 · raw
@+is_wiped:Bool -> @+foreign:Maybe<&2, String> -> CKind
def classify2 source · line 157 · raw
@+backup_nonempty:Bool -> @+eq:Bool -> @+family:Bool -> @+is_wiped:Bool -> @+foreign:Maybe<&2, String> -> CKind
def classify source · line 169 · raw
@+live:String -> @+backup:String -> @+others:List<&2, Other> -> CKind
_classify_outgoing_credential without the profile oracle: byte equality,
refresh-token lineage, wiped tokens, another slot already holding this
lineage, else unresolved.
def kind_warning source · line 172 · raw
@+k:CKind -> @+cur:String -> List<&2, String>
def org_compatible source · line 185 · raw
@+r_org:String -> @+own_org:String -> Bool
def sel_ck source · line 188 · raw
@+c:Bool -> @+x:CKind -> @+y:CKind -> CKind
def foreign_or_synced source · line 195 · raw
@+n:String -> @+live:String -> @+others:List<&2, Other> -> CKind
def stored_uuid source · line 198 · raw
@+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+slot:String -> String
def resolved_kind4 source · line 201 · raw
@+is_cur:Bool -> @+n:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+live:String -> @+others:List<&2, Other> -> @+uuid:String -> CKind
def resolved_kind3 source · line 208 · raw
@+own:Bool -> @+slot:Maybe<&2, String> -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+cur:String -> @+live:String -> @+others:List<&2, Other> -> @+uuid:String -> @+email:String -> @+has_org:Bool -> CKind
def drop_mismatch source · line 218 · raw
@+m:Maybe<&2, String> -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+uuid:String -> Maybe<&2, String>
An email match whose stored uuid disagrees is not a match.
def uuid_in source · line 226 · raw
@+fields:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+uuid:String -> @+org:String -> Maybe<&2, String>
The slot holding (uuid, org), if any.
def resolved_slot3 source · line 233 · raw
@+m:Maybe<&2, String> -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+uuid:String -> @+org:String -> Maybe<&2, String>
def resolved_slot2 source · line 240 · raw
@+by_email:Maybe<&2, String> -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+uuid:String -> @+org:String -> Maybe<&2, String>
def resolved_slot source · line 243 · raw
@+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+email:String -> @+org:String -> @+uuid:String -> Maybe<&2, String>
def stored_org source · line 246 · raw
@+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+slot:String -> String
def resolved_kind2 source · line 249 · raw
@+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+cur:String -> @+live:String -> @+others:List<&2, Other> -> @+uuid:String -> @+email:String -> @+org:String -> @+has_org:Bool -> CKind
def resolved_kind source · line 253 · raw
@+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+cur:String -> @+live:String -> @+others:List<&2, Other> -> @+p:0x0717344745a30ebad1f19045228e8f18/store/plan.Prof -> CKind
def final_kind source · line 260 · raw
@+base:CKind -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+cur:String -> @+live:String -> @+others:List<&2, Other> -> @+p:0x0717344745a30ebad1f19045228e8f18/store/plan.Prof -> CKind
def preserve source · line 268 · raw
@+k:CKind -> Bool
Alien and foreign live credentials are kept aside, never written into a slot.