RangerMauve / hyper-sdk

Make your own hyper apps!
https://www.youtube.com/watch?v=HyHk4aImd_I&list=PL7sG5SCUNyeYx8wnfMOUpsh7rM_g0w_cu&index=20
MIT License
290 stars 46 forks source link

Hypercore Secret Key option #27

Closed urgent closed 4 years ago

urgent commented 4 years ago

My platform starts up a new container for each build and I keep loosing write permissions.

In the dat-sdk, is it possible to:

I was thinking of something like:

const myArchive = await DatArchive.create({
  title: 'My Archive'
})

const archive = await DatArchive.load(myArchive.url, {secretKey: myArchive.secretKey})

That way, I can set secretKey as an env variable, and maintain write permissions between containers.

RangerMauve commented 4 years ago

Would you be comfortable with an API like 'archive.getSecretKey()` which returns a promise?

cc @pfrazee since this might be a divergence from Beaker's API.

pfrazee commented 4 years ago

Sure go ahead

RangerMauve commented 4 years ago

Cool, I might get to it next week, but in the meantime a PR with a unit test would be very much welcome. It could look something like

async getSecretKey() {
await this._loadPromise
return this._archive.secretKey
}