MCPcopy Create free account
hub / github.com/Xenov-X/csbot / executeTokenStoreStealAndUse

Method executeTokenStoreStealAndUse

workflow/executor_credentials.go:147–169  ·  view source on GitHub ↗

executeTokenStoreStealAndUse steals a token, stores it, and immediately applies it

(ctx context.Context, client *csclient.Client, beaconID string, action Action)

Source from the content-addressed store, hash-verified

145
146// executeTokenStoreStealAndUse steals a token, stores it, and immediately applies it
147func (e *Executor) executeTokenStoreStealAndUse(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) {
148 pidVal, ok := action.Parameters["pid"]
149 if !ok {
150 return "", fmt.Errorf("pid parameter required for token_store_steal_use")
151 }
152
153 var pid int
154 switch v := pidVal.(type) {
155 case float64:
156 pid = int(v)
157 case int:
158 pid = v
159 default:
160 return "", fmt.Errorf("pid parameter must be a number")
161 }
162
163 resp, err := client.TokenStoreStealAndUse(ctx, beaconID, pid)
164 if err != nil {
165 return "", err
166 }
167
168 return e.waitForOutput(ctx, client, resp.TaskID)
169}
170
171// executeTokenStoreUse uses a token from the token store
172func (e *Executor) executeTokenStoreUse(ctx context.Context, client *csclient.Client, beaconID string, action Action) (string, error) {

Callers 1

executeActionMethod · 0.95

Calls 1

waitForOutputMethod · 0.95

Tested by

no test coverage detected