(ranges)
| 295 | } |
| 296 | |
| 297 | function attachExtractFrame(ranges) { |
| 298 | // check status of PGP ranges |
| 299 | const newRanges = ranges.filter(range => |
| 300 | !isAttached(range.commonAncestorContainer) |
| 301 | ); |
| 302 | // create new decrypt frames for new discovered PGP tags |
| 303 | for (const range of newRanges) { |
| 304 | try { |
| 305 | switch (getMessageType(range.endContainer.textContent)) { |
| 306 | case PGP_MESSAGE: { |
| 307 | const dFrame = new DecryptFrame(); |
| 308 | dFrame.attachTo(range); |
| 309 | break; |
| 310 | } |
| 311 | case PGP_SIGNATURE: { |
| 312 | const vFrame = new VerifyFrame(); |
| 313 | vFrame.attachTo(range); |
| 314 | break; |
| 315 | } |
| 316 | case PGP_PUBLIC_KEY: { |
| 317 | const imFrame = new ImportFrame(); |
| 318 | imFrame.attachTo(range); |
| 319 | break; |
| 320 | } |
| 321 | } |
| 322 | } catch (e) { |
| 323 | console.log('attachExtractFrame failed:', e); |
| 324 | } |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | /** |
| 329 | * attach encrypt frame to element |
no test coverage detected