({srcKey, destKey, store = true})
| 290 | } |
| 291 | |
| 292 | async updateKey({srcKey, destKey, store = true}) { |
| 293 | const fingerprint = srcKey.getFingerprint(); |
| 294 | destKey ??= this.getPrivateKeyByFpr(fingerprint); |
| 295 | if (!destKey) { |
| 296 | throw new Error(`Key for update not found in store: ${fingerprint}`); |
| 297 | } |
| 298 | const updatedKey = await destKey.update(srcKey); |
| 299 | super.removeKey(fingerprint, destKey.isPrivate() ? 'private' : 'public'); |
| 300 | this.addKey(updatedKey); |
| 301 | await this.sync.add(fingerprint, keyringSync.UPDATE); |
| 302 | if (store) { |
| 303 | await this.keystore.store(); |
| 304 | await this.sync.commit(); |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | isRFC2822UserId(user) { |
| 309 | const {userID} = UserIDPacket.fromObject(user.userID); |
no test coverage detected