oddsdk / ts-odd

An SDK for building apps with decentralized identity and storage.
https://odd.dev/
Apache License 2.0
178 stars 24 forks source link

Internal symlinks/softlinks #328

Open icidasset opened 2 years ago

icidasset commented 2 years ago

We have external symlinks already, pointing to a public or private part of another filesystem.

This would look something like this:

{
  ipns: "icidasset.files.fission.name",
  name: "example.file",
  key: aes_key,
  privateName: "..."
}

There's several routes we can take here:

  1. We could check if this ipns address is ours (check our username + tld in webnative setup)
  2. We replace ipns with an "internal property", like wnfs for example.
  3. We could set ipns to a constant, identifying an internal link, eg. ipns: "internal"

(1) requires the least amount of code, but has the downside of being restricted to a specific TLD. The external lookup will still work however, and I don't think this is a big issue with the current architecture.

What needs to happen

  1. Implement one of the internal link structures suggested above.
  2. The resolveSoftLink methods in the filesystem need to do the internal lookup when needed. Here: https://github.com/fission-suite/webnative/blob/fa245a0a550b62c1322485a70851b0fe16841c83/src/fs/v1/PublicTree.ts#L204 And here: https://github.com/fission-suite/webnative/blob/fa245a0a550b62c1322485a70851b0fe16841c83/src/fs/v1/PrivateTree.ts#L255
matheus23 commented 2 years ago

(1) requires the least amount of code, but has the downside of being restricted to a specific TLD.

To add to that: (1) means the filesystem contains information about where it's supposed to be hosted. So e.g. if we had some way to rename fission accounts or ways to transfer a fission filesystem between usernames, then the filesystem would break more than if the links were agnostic about that.

expede commented 2 years ago

@icidasset did this get shipped as part of shared private files? 🤞

icidasset commented 2 years ago

It didn’t sadly, only external symlinks.