しとく comes from しておく, which in turn comes from して置く. The literal translation of して置く would be, "do it, and then put [the results]". Basically it describes the act of doing something and storing the result of that so that when that result becomes useful, you can use it.
EDIT:
This literal meaning changed overtime (I presume) and しておく became to mean "do something to prepare for something that might happen". In case of 秘密にしておく
, the speaker is saying that he/she will keep it secret in case it turns out whatever thing they were discussing indeed needed to be kept secret. I guess it makes some sense, as you could think that the state of that thing being kept secret, is "stored" or "put" somewhere, and then it turns out that that state was useful, or something like that.
The nuance further changed (I presume!), and it became ok to use it almost as a softner. For example, a Japanese speaker might say 今日飲んどく?
instead of 今日飲みに行く?
. Technically it still means to drink "just in case", but here it's just used to soften the speech. 秘密にしておく could also be a softner, depending on the context.
え、また泥酔して記憶なくなったの? 大丈夫!秘密にしとくから(笑)
-> Softner
今のところ会社の人には秘密にしておいてください
-> Let's keep it secret for the time being, in case it it wise to keep it as a secret.
しておく is frequently used with とりあえず, which translates to "for the time being".
今日は台風が来ているから、飛行機が飛ぶか分からないけど、取りあえず準備だけはしておこう。
今日は台風が来ているから、飛行機が飛ぶか分からないけど、取りあえず準備だけはしとこう。
Both are ok, while the latter is colloquial.
次いつ駐車できるかわからないから、ここでお昼ごはんにしとくか?
次いつ駐車できるかわからないので、ここでお昼ご飯にしておきましょうか?
Above is another example. しとく is more frank/colloquial form of しておく.
~おく can also work with other verbs. Here are some examples:
ここ、塗っとこうか?
ここ、塗っておきましょうか?
飯、食っとけ。
ご飯食べておいてください
EDIT2
Apparently it's even more complex than that. Here is a Japanese paper on ~ておく's meaning.