MCPcopy Create free account
hub / github.com/53AI/53AIHub / CreateOwnedAPIKey

Method CreateOwnedAPIKey

api/service/mcp/key_service.go:19–33  ·  view source on GitHub ↗
(ctx context.Context, eid, userID int64, name, description string)

Source from the content-addressed store, hash-verified

17}
18
19func (s *APIKeyService) CreateOwnedAPIKey(ctx context.Context, eid, userID int64, name, description string) (*model.APIKey, string, error) {
20 keyValue := model.GenerateAPIKey(eid, userID)
21 apiKey := &model.APIKey{
22 Key: keyValue,
23 Name: name,
24 Description: description,
25 Eid: eid,
26 CreatorID: userID,
27 Status: model.APIKeyStatusActive,
28 }
29 if err := apiKey.Save(); err != nil {
30 return nil, "", err
31 }
32 return apiKey, keyValue, nil
33}
34
35func (s *APIKeyService) ListOwnedAPIKeys(ctx context.Context, eid, userID int64) ([]model.APIKey, error) {
36 return model.GetAPIKeysByEidAndCreatorID(eid, userID)

Callers 1

registerMCPKeyToolsFunction · 0.95

Calls 1

SaveMethod · 0.95

Tested by

no test coverage detected