A will of a testator (i.e. person who writes a will) who is not yet deceased, must be revealed to two witnesses at the time of signing. The testator cannot refuse to disclose it to the witnesses who need not (and should not) be heirs or devisee of the testator. The witnesses are under no particular duty to scrutinize its content closely while witnessing it, although better practice is for witnesses and the testator to initial each page.
It would be extraordinarily unusual, but not improper, for a testator to have the witnesses sign non-disclosure agreements related to the will signing that cease to be effective upon the testator's death.
In the alternative, a holographic will can be kept entirely secret because it does not require any witnesses. A holographic will is generally valid if it is entirely or substantially, and in all material portions, written in the handwriting of the testator, and it is signed by the testator (ideally, it should be dated as well). Not even its existence need be disclosed to anyone so long as arrangements are made that insure that it is promptly discovered after the testator dies.
Holographic wills are a real thing, even in the modern era, even though they are uncommon. I've probated perhaps a dozen over them over twice as many years.
Options That Can Be Dispensed With
There are procedural benefits in the probate process to also having a notary notarize the signatures of the witnesses and testator with certain boilerplate safe harbor language, which makes a will "self-proving" (i.e. admissible to probate without witness testimony) in many states, but this is strictly speaking optional.
A will can be lodged with a public official in some cases prior to death, but this is also optional and is quite uncommon in the U.S.
There are additional procedural benefits of having an attorney make certain representations about a will in a certificate that will make it an "international will" but this is also optional.
No Other Duties To Disclose Prior To Death
Otherwise, there is no duty to disclose the contents of, or existence of, the will to anyone. There is also no obligation to make any copies of the will.
But, of course, if no one can find the original will (not a copy, a will is like a dollar bill and a copy is not as good as the original) after the testator dies, then it can't be admitted to probate and is basically worthless.
Until fairly recently, Louisiana law was an exception to this rule, and a testator could put the testator's will in a sealed envelope, present the sealed envelope to seven witnesses and attest to them that it contained the testator's will, and the instrument in the envelope that was the will itself would not have to be disclosed. This was called a "mystic will". But, Louisiana discontinued this distinctive non-common law practice in the late 20th century.
These rules have been the same, for the most part, since before the Revolutionary War in the United States in common law states, apart from Louisiana, although Maine and Florida have in some historical periods required three rather than two witnesses.
Technology Doesn't Help And Can Hurt
This rule has not been influenced by technology in any meaningful way pertinent to Bob's objectives in the question. Indeed, the lower technology method of writing your own will by hand, rather than typing it or having it types and merely signing it, is the most private option.
Attempting to use an "electronic will" is an exceedingly risky option that has a very low chance of being effective at death, although there have been some outlier cases where this has been allowed. Of these, a handwritten with a stylus will that merely substitutes "electronic paper" for dead tree paper, is most likely to be recognized, but even that has a grave risk of recognition because you are presenting a copy rather than an original will when you do so.
It can also be quite hard to keep any electronic file that is backed up, or on a machine connected to the Internet, absolutely secret.
Answer Only Applicable To The Common Law Tradition
Most of these rules draw heavily on the common law tradition, however, and I am not confident of their applicability in Puerto Rico, or in other civil law countries or countries other than civil law countries that do not have a common law legal tradition.