MCPcopy Create free account
hub / github.com/ether/etherpad / upsert

Method upsert

src/node/security/OIDCAdapter.ts:78–94  ·  view source on GitHub ↗
(id: string, payload: AdapterPayload, expiresIn: number)

Source from the content-addressed store, hash-verified

76 }
77
78 upsert(id: string, payload: AdapterPayload, expiresIn: number) {
79 const key = this.key(id);
80
81 if (payload.grantId) {
82 const grantKey = grantKeyFor(payload.grantId);
83 const grant = (storage.get(grantKey) as string[]) || [];
84 if (!grant.includes(key)) grant.push(key);
85 storage.set(grantKey, grant);
86 }
87
88 if (payload.userCode) {
89 storage.set(userCodeKeyFor(payload.userCode), id);
90 }
91
92 storage.set(key, payload, {ttl: expiresIn * 1000});
93 return Promise.resolve();
94 }
95
96 findByUid(uid: string): Promise<AdapterPayload | void | undefined> {
97 for (const [_, value] of storage.entries()) {

Callers 1

OIDCAdapter.tsFile · 0.80

Calls 6

keyMethod · 0.95
grantKeyForFunction · 0.85
userCodeKeyForFunction · 0.85
getMethod · 0.80
pushMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected