Store your Dat archive's secret key in the macOS keychain.
This is an extremely simple module wrapping dat-storage, which does all the heavy lifting of storing files in the right places.
npm install dat-keychain-storage
You can use this anywhere that Dat or Hyperdrive expects a "storage".
const hyperdrive = require('hyperdrive')
const storage = require('dat-keychain-storage')
const archive = hyperdrive(storage('example-archive'), {latest: true})
Check out example.js
for a very basic example.