The senator was not identified in the court documents, but a person with knowledge of the matter said the senator was John L. Sampson, a Brooklyn Democrat and former Senate leader who has long been under investigation. Mr. Sampson has not been charged, and neither Mr. Sampson nor his lawyer responded to requests for comment.

Mark G. Peters, a former chief of the public integrity unit in the state attorney general’s office, said that a sitting legislator wearing a hidden recording device was “one of the most powerful tools available to a prosecutor,” and that the cooperation of Ms. Huntley and Mr. Castro raised the question of whether another lawmaker or multiple others could also be making recordings.

“I’ve never seen a situation in which there were two investigations going on and there were two different sitting legislators wearing wires,” said Mr. Peters, who is now a partner at the law firm Edwards Wildman Palmer L.L.P. “That just speaks to how widespread the problem is — that two different prosecutors would manage to have this going on at the same time.”

Senator James Sanders Jr., a Queens Democrat who defeated Ms. Huntley, 74, in a primary last year after she had been indicted, said he was “not the least bit surprised” that she had worked with law enforcement. “There are few among us who can stand up to 20, 30, 40 years without, as the streets call, snitching,” he said.

“I think that it is tragic that one finds themselves in a world of pain and even more tragic if you’re trying to buy down your sentence by ensnaring others,” Mr. Sanders added. “Now, if you are merely speaking of what they have done, then you’re probably doing a public service. But if you are ensnaring people, then it just proves you have no honor.”