| 17 | |
| 18 | export default class ImportController extends SubController { |
| 19 | constructor(port) { |
| 20 | super(port); |
| 21 | if (!port) { |
| 22 | this.mainType = 'importKeyDialog'; |
| 23 | this.id = getUUID(); |
| 24 | } |
| 25 | this.armored = ''; |
| 26 | this.popupPromise = null; |
| 27 | this.importPopup = null; |
| 28 | this.keyringId = ''; |
| 29 | this.keyring = null; |
| 30 | this.key = null; |
| 31 | this.keyDetails = null; |
| 32 | this.importError = false; |
| 33 | this.invalidated = false; |
| 34 | // register event handlers |
| 35 | this.on('imframe-armored-key', this.onArmoredKey); |
| 36 | this.on('key-import-dialog-init', () => this.emit('key-details', {key: this.keyDetails, invalidated: this.invalidated, rotation: this.rotation})); |
| 37 | this.on('key-import-dialog-ok', this.onImportOk); |
| 38 | this.on('key-import-dialog-cancel', this.handleCancel); |
| 39 | this.on('key-import-user-input', msg => uiLog.push(msg.source, msg.type)); |
| 40 | } |
| 41 | |
| 42 | onArmoredKey({data}) { |
| 43 | const slotId = getUUID(); |