()
| 459 | |
| 460 | |
| 461 | def load_gpg_signer() -> Optional[GpgSigner]: |
| 462 | if gpg_id := os.getenv("TEST_PGP_ID"): |
| 463 | gpg_secret_key = os.getenv("TEST_PGP_SECRET_KEY") |
| 464 | gpg_passphrase = os.getenv("TEST_PGP_PASSPHRASE") |
| 465 | if gpg_secret_key is not None and gpg_passphrase is not None: |
| 466 | info("Using test pgp key", gpg_id) |
| 467 | return GpgSigner(gpg_id=gpg_id, gpg_secret_key=gpg_secret_key, gpg_passphrase=gpg_passphrase) |
| 468 | |
| 469 | pgp_secret_arn = os.getenv("SIGNING_PGP_KEY_SECRET_ARN") |
| 470 | info(f"SIGNING_PGP_KEY_SECRET_ARN: {pgp_secret_arn}") |
| 471 | if pgp_secret_arn: |
| 472 | pgp_secret_region = parse_region_from_arn(pgp_secret_arn) |
| 473 | gpg_secret_json = get_secretmanager_json(pgp_secret_arn, pgp_secret_region) |
| 474 | gpg_id = gpg_secret_json["gpg_id"] |
| 475 | gpg_secret_key = gpg_secret_json["gpg_secret_key"] |
| 476 | gpg_passphrase = gpg_secret_json["gpg_passphrase"] |
| 477 | return GpgSigner(gpg_id=gpg_id, gpg_secret_key=gpg_secret_key, gpg_passphrase=gpg_passphrase) |
| 478 | else: |
| 479 | return None |
| 480 | |
| 481 | |
| 482 | def parse_region_from_arn(arn: str) -> str: |
no test coverage detected