MCPcopy
hub / github.com/mailvelope/mailvelope / removeUser

Method removeUser

src/modules/KeyringLocal.js:225–241  ·  view source on GitHub ↗
(privateKey, userId)

Source from the content-addressed store, hash-verified

223 }
224
225 async removeUser(privateKey, userId) {
226 const index = privateKey.users.findIndex(({userID: {userID}}) => userID === userId);
227 if (index !== -1) {
228 privateKey.users.splice(index, 1);
229 }
230 const fingerprint = privateKey.getFingerprint();
231 const defaultKeyFpr = await this.keystore.getDefaultKeyFpr();
232 const isDefault = fingerprint === defaultKeyFpr;
233 await this.removeKey(fingerprint, 'private');
234 await this.sync.add(fingerprint, keyringSync.INSERT);
235 this.addKey(privateKey);
236 await this.keystore.store();
237 await this.sync.commit();
238 if (isDefault) {
239 await this.setDefaultKey(fingerprint);
240 }
241 }
242
243 async revokeUser(unlockedKey, userId) {
244 const user = unlockedKey.users.find(({userID: {userID}}) => userID === userId);

Callers

nothing calls this directly

Calls 7

removeKeyMethod · 0.95
addMethod · 0.80
addKeyMethod · 0.80
commitMethod · 0.80
getDefaultKeyFprMethod · 0.45
storeMethod · 0.45
setDefaultKeyMethod · 0.45

Tested by

no test coverage detected