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

Method executeTokenStoreUse

workflow/executor_credentials.go:172–194  ·  view source on GitHub ↗

executeTokenStoreUse uses a token from the token store

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

Source from the content-addressed store, hash-verified

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) {
173 idVal, ok := action.Parameters["id"]
174 if !ok {
175 return "", fmt.Errorf("id parameter required for token_store_use")
176 }
177
178 var id int
179 switch v := idVal.(type) {
180 case float64:
181 id = int(v)
182 case int:
183 id = v
184 default:
185 return "", fmt.Errorf("id parameter must be a number")
186 }
187
188 resp, err := client.TokenStoreUse(ctx, beaconID, id)
189 if err != nil {
190 return "", err
191 }
192
193 return e.waitForOutput(ctx, client, resp.TaskID)
194}
195
196// executeTokenStoreRemove removes a specific token from the token store
197func (e *Executor) executeTokenStoreRemove(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