~/bend-docscommunity

store/ops.bend relies on unsafe/foreign

raw source on the hub · import cswap-bend-cli@0.1.0.0/store/ops.bend as Ops

8 imports
import Base
import ../json.bend as Json
import ../act.bend as Act
import ../lock.bend as Lock
import ./base.bend as SBase
import ./seq.bend as SSeq
import ./plan.bend as SPlan
import ./io.bend as SIo

Types

type Eff source · line 24 · raw

Data

The email and slot add-token ends up with. Without an email, the slot is fixed first so the synthesized address is unique.

Definitions

def ActM source · line 11 · raw

@-A:Type -> Type

do ActM<A>: needs the monad defined in the file that uses it.

def ActM.pure source · line 14 · raw

@-A:Type -> @x:A -> 0x0717344745a30ebad1f19045228e8f18/act.of(A)

def ActM.bind source · line 17 · raw

@-A:Type -> @-B:Type -> @m:0x0717344745a30ebad1f19045228e8f18/act.of(A) -> @f:(@_:A -> 0x0717344745a30ebad1f19045228e8f18/act.of(B)) -> 0x0717344745a30ebad1f19045228e8f18/act.of(B)

def eff_slot source · line 27 · raw

@+api_key:Bool -> @+n:U32 -> Eff

def eff_noemail source · line 30 · raw

@+api_key:Bool -> @+slot:Maybe<&2, U32> -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> Eff

def effective source · line 33 · raw

@+email0:Maybe<&2, String> -> @+slot0:Maybe<&2, U32> -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+api_key:Bool -> Eff

def email_ok source · line 40 · raw

@+m:Maybe<&2, String> -> Bool

def is_none source · line 47 · raw

@+m:Maybe<&2, String> -> Bool

def clash3 source · line 54 · raw

@+existing_api:Bool -> @+n:String -> @+email:String -> @+api_key:Bool -> Maybe<&2, String>

def clash2 source · line 64 · raw

@+slot:Maybe<&2, String> -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+email:String -> @+api_key:Bool -> Maybe<&2, String>

def clash source · line 72 · raw

@+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+email:String -> @+api_key:Bool -> Maybe<&2, String>

(email, personal) already stored as the other kind.

def clash_msg source · line 75 · raw

@+m:Maybe<&2, String> -> String

def refresh_slot source · line 78 · raw

@+slot:Maybe<&2, U32> -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+email:String -> Maybe<&2, String>

def moved_line source · line 85 · raw

@+m:Maybe<&2, String> -> @+from:String -> @+to:String -> String

def unverified_reason source · line 92 · raw

@+api_key:Bool -> String

def token_files source · line 95 · raw

@+root:String -> @+token:String -> @+api_key:Bool -> @+email:String -> @+num:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(Unit)

def token_logs source · line 100 · raw

@+root:String -> @+info:String -> @+api_key:Bool -> @+email:String -> @+num:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(Unit)

def token_seq source · line 105 · raw

@+s2:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+num:String -> @+email:String -> @+ts:String -> @+api_key:Bool -> 0x0717344745a30ebad1f19045228e8f18/json.Json

def token_place2 source · line 108 · raw

@+root:String -> @+token:String -> @+api_key:Bool -> @+email:String -> @+ts:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+num:String -> @+displace:Maybe<&2, String> -> @+migrate:Maybe<&2, String> -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def token_place source · line 116 · raw

@+root:String -> @+token:String -> @+api_key:Bool -> @+email:String -> @+ts:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+p:0x0717344745a30ebad1f19045228e8f18/store/plan.SlotPlan -> @+migrate_slot:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def token_refresh source · line 123 · raw

@+root:String -> @+token:String -> @+api_key:Bool -> @+email:String -> @+ts:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+num:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def token_branch2 source · line 130 · raw

@+refresh:Maybe<&2, String> -> @+root:String -> @+token:String -> @+api_key:Bool -> @+email:String -> @+slot:Maybe<&2, U32> -> @+assume_yes:Bool -> @+ts:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def token_branch source · line 137 · raw

@+root:String -> @+token:String -> @+api_key:Bool -> @+e:Eff -> @+assume_yes:Bool -> @+ts:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def token_checked2 source · line 142 · raw

@+c:Maybe<&2, String> -> @+e:Eff -> @+root:String -> @+token:String -> @+api_key:Bool -> @+assume_yes:Bool -> @+ts:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def token_checked source · line 147 · raw

@+e:Eff -> @+root:String -> @+token:String -> @+api_key:Bool -> @+assume_yes:Bool -> @+ts:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def add_token4 source · line 152 · raw

@+root:String -> @+token:String -> @+email0:Maybe<&2, String> -> @+slot0:Maybe<&2, U32> -> @+assume_yes:Bool -> @+ts:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def add_token3 source · line 155 · raw

@+root:String -> @+token:String -> @+email0:Maybe<&2, String> -> @+slot0:Maybe<&2, U32> -> @+assume_yes:Bool -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def add_token2 source · line 162 · raw

@+root:String -> @+token:String -> @+email0:Maybe<&2, String> -> @+slot0:Maybe<&2, U32> -> @+assume_yes:Bool -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def add_token source · line 173 · raw

@+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+token:String -> @+email0:Maybe<&2, String> -> @+slot0:Maybe<&2, U32> -> @+assume_yes:Bool -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

Register a raw setup-token or sk-ant- API key (no HTTP call). assume_yes stands for the "Overwrite slot N?" answer; without it an occupied slot is Fail{(10, ...)} for the CLI to confirm and retry. The record is written with an empty identity and logged as unverified: a setup-token has no profile scope, so the oracle cannot resolve it.

def is_some_str source · line 178 · raw

@+m:Maybe<&2, String> -> Bool

def valid_ident source · line 181 · raw

@+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+ident:String -> Bool

def scalar_text source · line 184 · raw

@+m:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> String

def field_json source · line 194 · raw

@+rec:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+key:String -> String

A JSON scalar as text: numbers as written, strings as is, "" otherwise.

def active_is source · line 197 · raw

@+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+num:String -> Bool

def active_warning source · line 200 · raw

@+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+num:String -> @+email:String -> String

def removal3 source · line 203 · raw

@+root:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+num:String -> @+ts:String -> @+email:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def removal2 source · line 210 · raw

@+root:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+num:String -> @+ts:String -> @+rec:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def removal source · line 217 · raw

@+root:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+num:String -> @+ts:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def remove_resolved source · line 220 · raw

@+root:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+ident:String -> @+ts:String -> @+r:0x0717344745a30ebad1f19045228e8f18/store/seq.Resolved -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def remove3 source · line 229 · raw

@+root:String -> @+ident:String -> @+ts:String -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def remove4 source · line 234 · raw

@+root:String -> @+ident:String -> @+m:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def remove2 source · line 243 · raw

@+root:String -> @+ident:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def remove source · line 255 · raw

@+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+ident:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

Take an account out of rotation by slot number, alias or email. Its credential is moved to credentials/.removed/<utc-ts>-<slot>-<email>.enc (0600), never deleted. The confirmation prompt belongs to the CLI. When the account is the active one the answer starts with the reference's warning line. Several accounts sharing an email are an error here (the reference asks interactively).

def read_resolved source · line 259 · raw

@+root:String -> @+r:0x0717344745a30ebad1f19045228e8f18/store/seq.Resolved -> @+seq:0x0717344745a30ebad1f19045228e8f18/json.Json -> @+ident:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def read_slot2 source · line 268 · raw

@+root:String -> @+ident:String -> @+m:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

def read_slot source · line 277 · raw

@+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+ident:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(String)

A slot's stored credential text by slot number, alias or email; "" when the slot has none.

def write_slot2 source · line 282 · raw

@+root:String -> @+creds:String -> @+num:String -> @+m:Maybe<&2, 0x0717344745a30ebad1f19045228e8f18/json.Json> -> 0x0717344745a30ebad1f19045228e8f18/act.of(Unit)

def write_slot source · line 290 · raw

@+ctx:0x0717344745a30ebad1f19045228e8f18/store/base.Ctx -> @+num:String -> @+creds:String -> 0x0717344745a30ebad1f19045228e8f18/act.of(Unit)

Replace the credential of an existing slot (keeping the old one as .prev).