original_docstring: Verifies that |blob| was signed by Primary.
docstring: Verifies that |blob| was signed by Primary.
docstring_tokens: Verifies that |blob| was signed by Primary .
code: def is_signed_by_primary(blob, key_name, sig):
    """Verifies that |blob| was signed by Primary."""
    # Assert that running on Replica.
    state = model.get_replication_state()
    assert state and state.primary_url, state
    # Grab the cert from primary and verify the signature. We are signing SHA512
    # hashes, since AuthDB blob is too large.
    certs = signature.get_service_public_certificates(state.primary_url)
    digest = hashlib.sha512(blob).digest()
    return certs.check_signature(digest, key_name, sig)
code_tokens: def is_signed_by_primary ( blob , key_name , sig ) : state = model . get_replication_state ( ) assert state and state . primary_url , state certs = signature . get_service_public_certificates ( state . primary_url ) digest = hashlib . sha512 ( blob ) . digest ( ) return certs . check_signature ( digest , key_name , sig )
short_docstring: Verifies that |blob| was signed by Primary.
short_docstring_tokens: Verifies that |blob| was signed by Primary .
comment: """Verifies that |blob| was signed by Primary."""$SEP$# Assert that running on Replica.$SEP$# Grab the cert from primary and verify the signature. We are signing SHA512$SEP$# hashes, since AuthDB blob is too large.