def public_keyset(stub: testing_api_pb2_grpc.KeysetStub, private_keyset: bytes) -> bytes: request = testing_api_pb2.KeysetPublicRequest(private_keyset=private_keyset) response = stub.Public(request) if response.err: raise tink.TinkError(response.err) return response.public_keyset
def public_keyset_handle( stub: testing_api_pb2_grpc.KeysetStub, private_keyset_handle: tink.KeysetHandle) -> tink.KeysetHandle: request = testing_api_pb2.KeysetPublicRequest( private_keyset=_keyset(private_keyset_handle)) response = stub.Public(request) if response.err: raise tink.TinkError(response.err) return cleartext_keyset_handle.read( tink.BinaryKeysetReader(response.public_keyset))