MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / load_gpg_signer

Function load_gpg_signer

scripts/build.py:461–479  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

459
460
461def 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
482def parse_region_from_arn(arn: str) -> str:

Callers 1

buildFunction · 0.85

Calls 4

infoFunction · 0.90
GpgSignerClass · 0.85
parse_region_from_arnFunction · 0.85
get_secretmanager_jsonFunction · 0.85

Tested by

no test coverage detected