MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / callHostAuthGetRuntime

Method callHostAuthGetRuntime

internal/pluginhost/auth_callbacks.go:95–114  ·  view source on GitHub ↗
(ctx context.Context, request []byte)

Source from the content-addressed store, hash-verified

93}
94
95func (h *Host) callHostAuthGetRuntime(ctx context.Context, request []byte) ([]byte, error) {
96 _ = ctx
97 var req rpcHostAuthGetRequest
98 if errUnmarshal := json.Unmarshal(request, &req); errUnmarshal != nil {
99 return nil, fmt.Errorf("decode host auth get runtime request: %w", errUnmarshal)
100 }
101 authIndex := strings.TrimSpace(req.AuthIndex)
102 if authIndex == "" {
103 return nil, fmt.Errorf("auth_index is required")
104 }
105 auth, errGet := h.authByIndex(authIndex)
106 if errGet != nil {
107 return nil, errGet
108 }
109 entry := h.buildHostAuthFileEntry(auth)
110 if entry == nil {
111 return nil, fmt.Errorf("auth runtime info not found for auth_index %s", authIndex)
112 }
113 return marshalRPCResult(pluginapi.HostAuthGetRuntimeResponse{Auth: *entry})
114}
115
116func (h *Host) callHostAuthSave(ctx context.Context, request []byte) ([]byte, error) {
117 var req pluginapi.HostAuthSaveRequest

Callers 1

callFromPluginMethod · 0.95

Calls 3

authByIndexMethod · 0.95
marshalRPCResultFunction · 0.85

Tested by

no test coverage detected