MCPcopy Create free account
hub / github.com/pydio/cells / GetKey

Method GetKey

idm/key/grpc/handler.go:77–111  ·  view source on GitHub ↗
(ctx context.Context, req *enc.GetKeyRequest)

Source from the content-addressed store, hash-verified

75}
76
77func (ukm *userKeyStore) GetKey(ctx context.Context, req *enc.GetKeyRequest) (*enc.GetKeyResponse, error) {
78
79 dao, err := manager.Resolve[key.DAO](ctx)
80 if err != nil {
81 return nil, err
82 }
83 rsp := &enc.GetKeyResponse{}
84
85 // TODO: Extract user / password info from Context
86 user := common.PydioSystemUsername
87
88 var version int
89 rsp.Key, version, err = dao.GetKey(ctx, user, req.KeyID)
90 if err != nil {
91 return nil, err
92 }
93
94 if rsp.Key == nil {
95 return nil, nil
96 }
97
98 pwd, err := ukm.masterFromCache(ctx)
99 if err != nil {
100 return nil, err
101 }
102 if version < 4 {
103 if p, e := ukm.legacyFromCache(ctx, pwd); e == nil {
104 pwd = p
105 } else {
106 return nil, e
107 }
108 }
109
110 return rsp, open(rsp.Key, pwd)
111}
112
113func (ukm *userKeyStore) AdminListKeys(ctx context.Context, req *enc.AdminListKeysRequest) (*enc.AdminListKeysResponse, error) {
114 dao, err := manager.Resolve[key.DAO](ctx)

Callers

nothing calls this directly

Calls 4

masterFromCacheMethod · 0.95
legacyFromCacheMethod · 0.95
openFunction · 0.70
GetKeyMethod · 0.65

Tested by

no test coverage detected