oddsdk / ts-odd Goto Github PK
View Code? Open in Web Editor NEWAn SDK for building apps with decentralized identity and storage.
Home Page: https://odd.dev/
License: Apache License 2.0
An SDK for building apps with decentralized identity and storage.
Home Page: https://odd.dev/
License: Apache License 2.0
/pins
node off of the FS rootsha(filename + did)
{ name: sha("private/index/file" + did), cid: "Qm123..." },
{ name: sha("private/index/file/index" + did), cid: "Qm456..." },
{ name: sha("private/index/file/isFile" + did), cid: "Qm789..." },
{ name: sha("private/index/file/mtime" + did), cid: "Qmabc..." },
...
Probably will live in its own library, but tracking for now:
Needs to be able to:
_did.someusername.fission.name
TXT recordUser feedback π
With the StrictNullCheck
enabled in Typescript, users are required to do:
case Scenario.AuthSucceeded:
case Scenario.Continuation:
if (state.fs != null) {
if (state.fs.appPath != null) {
const appPath = state.fs.appPath();
...
}
}
Ideally we would not need to do these "null" checks, but not sure how much we could eliminate these. Seeing that the presence of these things depends on the options given to initialise
. state.fs
can be undefined if given the loadFileSystem: false
option (which one may do to load the file system themselves in a web worker), and fs.appPath
can be undefined if the permissions.app
option was not set.
Traversing the filesystem can take a long time especially for deeply nested & private files which require multiple back and forths to the network with decryption in between.
Note: implementation is similar to the current "pins" implementation that is used to track nested pins for the private tree
We're deprecating https://github.com/fission-suite/typescript-client/ and moving most of that here.
Notes:
sdk.lobby.createAccount
, lobby/index.ts
)sdk.dataRoot.update
, data-root/index.ts
)I would add this under sdk.apps
GET /app
β sdk.apps.index
POST /app
β sdk.apps.create
PATCH /app/{App URL}/{New CID}
β sdk.apps.setContent
DELETE /app/associated/{url}
β sdk.apps.deleteByUrl
DELETE /app/{appId}
β sdk.apps.deleteById
GET /user/whoami
β sdk.lobby.whoami
or sdk.lobby.lookupUsername
(not sure which)PATCH /user/did
β sdk.did.update
PUT /user/exchange/keys/{did}
β sdk.exchange.addPublicKey
(not a 100 on this)DELETE /user/exchange/keys/{did}
β sdk.exchange.removePublicKey
(not a 100 on this)The following occurs when I try to run:
var wnfs = await FileSystem.empty();
const cid = await wnfs.mkdir("private/gunclear/safe")
Error:
Unhandled Rejection (TypeError): o[Symbol.iterator] is not a function
./node_modules/fission-sdk/ipfs/basic.js/</__asyncValues<
http://localhost:3000/static/js/1.chunk.js:105016:96
./node_modules/fission-sdk/ipfs/basic.js/</add/</<
src/ipfs/basic.ts:11
8 | });
9 | };
10 | var __generator = (this && this.__generator) || function (thisArg, body) {
> 11 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13 | function verb(n) { return function (v) { return step([n, v]); }; }
14 | function step(op) {
step
http://localhost:3000/static/js/1.chunk.js:104996:17
./node_modules/fission-sdk/ipfs/basic.js/</__generator</verb/<
http://localhost:3000/static/js/1.chunk.js:104927:14
fulfilled
We should move generated docs to a separate branch. Open to other solutions :)
Getting a 422
status with the error message:
Time bounds are not a subset
Data-root update request fails.
See
docs/
for more detailed documentation based on the source code.
I get a 404. Is this just outdated? Should it perhaps only link to the gitbook?
Needs to check if the user is online before doing any DNS lookups.
Self-signed tokens with auth delegated via macaroons
We need to walk
trees for a few different features:
mv
between branches of the FSconst { app, state } = await sdk.initialise({
permissions: {
app: {
creator: "Creator",
name: "AppName"
}
}
})
// Clone the app to the user's filesystem (haven't decided how this will work yet)
app.clone()
// If the currently authed user has a copy of this app (ie. they cloned it), update those app files.
app.update()
// A sub graph, aka. scoped filesystem, of the app.
//
// ie. where you'd normally have `fs.ls("/private/Apps/Creator/AppName/...")`,
// or `fs.ls(fs.appPath("..."))`
// instead you would do:
app.fs.ls("...")
// Database
app.db()
API blocklist was recently updated, need to match it here.
Creating IPLD folders is cumbersome and not intuitive
IPFS DNS resolver was offline today, we should have a fallback.
Currently metadata for a node is encrypted with that node's parent key (the key used to encrypt that node), not the node's own key (the key contained as a header value in that node). Thus, when a user is given access to a file, they don't get access to the metadata that goes with it
Encrypt metadata with the node's ownKey
instead of the parentKey
Depends on fission-codes/fission#348 and the file system refactor.
Instead of using the Cloudflare API with query params, use https://dohjs.org/ and then send a DoH request using that library. This way we can easily switch between servers for looking up DNS TXT records and it's safer. Ideally we'd have a few fallback servers in case Cloudflare doesn't work.
https://github.com/curl/curl/wiki/DNS-over-HTTPS#publicly-available-servers
Try it out at https://dohjs.org/ to see what the results are of a DNS lookup.
So the filesystem doesnβt suddenly stop working. That said, window.ipfs is outside our control as well. Maybe switch entirely to js-ipfs (intead of get-ipfs), like we discussed before? π€·ββοΈ
In the auth redirect flow readKey
, is confusing and could be interpreted as the symmKey
Change name to readPubkey
or similar
The README should be short and have some dev stuff in it, the getting-started portion and the tutorial should be moved to Fission Guide. Besides that we also have the docs in this repo generated from the Typescript code, done by https://typedoc.org/ That cli tool can generate a JSON file as well, and we could make an app that takes such a JSON file and presents it nicely.
Right now the Filesystem is requires absolute paths to be passed to every function
Add a stateful Session
class encapsulated by FileSystem
so that a user can navigate the directory structure and use relative links
Some ideas here:
isUsernameAvailable
checks if dataRoot.lookup
returns null
, but dataRoot.lookup
also returns null
now for the initial appointed CID.
When creating an account it shows the username as available when the user hasn't created a file system yet. Thus falsy advertising the username as available.
Every file system change I make adds a few MB to the indexed db.
200MB and I only have 30 quotes and a small list of quote ids on the file system.
Here's a video (from a different session) that shows the storage-usage going up.
http://icidasset-public.s3.amazonaws.com/Kapture%202020-08-04%20at%2021.53.05.mp4
https://github.com/icidasset/quotes/blob/6cd2d1ee5058548eae744bfb0bcc3c8a9c2716ed/src/Main.js#L49
hardLink :: Name -> VNode
softLink :: Name -> Maybe VNode
This means that hard links are guaranteed to have some data at the pointer. Soft links may not, hence the Maybe.
Upgrade IPFS CIDs to v1
We need to do this for dag nodes & for files
Currently you can make a UCAN that expires later than its proof. This shouldn't be possible. Additionally, less important, but still should be validated as well, the nbf
should be greater than or equal to the nbf
of the proof. To be precise regarding the exp
field, it should be less than or equal to the exp
of the proof.
When making a UCAN, get the exp
and nbf
of the proof (if it is present), and then adjust the default values if needed.
This line, and the other similar ones for the other requests, should be something along the lines of:
proof: ucan_string
(see update-data-root function as an example: https://github.com/fission-suite/webnative/blob/a4347b31cfec987ff718882e29cc88cff696091e/src/data-root.ts)
This is the "difficult" part of the changes need to be made.
We need to get the actual UCAN to use as the proof
.
The easiest way to get this is by doing:
import * as ucanInternal from "./ucan/internal"
const proof = await ucanInternal.lookupFilesystemUcan("*")
We're revising various UCAN stuff soon, so this is just a temporary solution (hence the TODO's in the code).
PS.
In case you were wondering, this workaround works because the auth lobby returns a UCAN with the *
resource. That UCAN is stored in indexeddb, which we then lookup by using lookupFilesystemUcan
.
I am in the process of switching out the old Fission Typescript client with the new webnative sdk in https://github.com/fission-suite/ipfs-photo-gallery/ and have run into a Typescript error:
/ipfs-photo-gallery/node_modules/webnative/index.d.ts
TypeScript error in /Users/patdryburgh/Development/ipfs-photo-gallery/node_modules/webnative/index.d.ts(49,10):
'from' expected. TS1005
47 | export * from './filesystem';
48 | export declare const fs: typeof FileSystem;
> 49 | export * as dataRoot from './data-root';
| ^
50 | export * as did from './did';
51 | export * as lobby from './lobby';
52 | export * as setup from './setup';
Not sure how to proceed until this error is fixed and not sure exactly what's causing it. I've created a PR in the IPFS Photo Gallery repo so you can see what I've done so far and suggest what I might be doing wrong. Happy to provide any other details you require :)
A user of the SDK shouldn't have to know about the "data root".
To do:
Filesystem supports directories & files with a bare minimum of metadata (currently just mtime
)
Add metadata layer:
index
link to the actual file/dir contentsCreating a new user on the Brave browser
fails.
Throws this error Public key MIIB...QAB already exists
Which is when the function call mkdir
fails out.
Brave users can not register to the service
Desktop (please complete the following information):
Smartphone (please complete the following information):
The API can return a 504 status when the IPFS gateway is still fetching the data from your in-browser js-ipfs node. We should retry this until it succeeds.
Additionally we should cancel long-running data-root requests, whenever a new request is made.
And other querying methods.
When setting the data root, we'll want to wait on the API to tell us the content was successfully fetched from our local js-ipfs node. In other words, the data from our file system lives on our local js-ipfs node and we need to wait until that is transferred to the Fission gateway.
More notes:
We have a DNSLink-lookup fallback that uses Cloudflare, but instead of returning the CID (like ipfs.io's api does), it returns an IPNS reference (eg. ipns=icidasset-test-6.fissionuser.net/public
)
Encrypted DAG nodes are not dag-pb
/dag-cbor
formatted. They may be formatted as such under the hood but you won't be able to do file paths like Qm.../path/to/file
.
We could define our own IPLD format for encrypted folders/files. This would also eliminate the need for a header
subdir on every folder (thereby decreasing the # of objects needed to fetch by 2x)
Relevant discussion: ipld/ipld#64
Issue here is that connections can timeout and be closed.
This should be solved by libp2p soon-ish, see "keep alive" libp2p/js-libp2p#744
Seems to be a goal for the next libp2p release:
libp2p/js-libp2p#655
Adding a file to a folder needs to recurse up through the IPLD tree
header
folder w/ a key in itObject API is being (slowly) deprecated.
Need to prefix the path with /ipfs/
though.
See conversation ipfs/js-ipfs#3252 (comment)
FFS does not support file streaming. This is a limitation from WebCrypto. Large files have to currently be held in memory in their entirety.
Add file streaming
Contingent on: fission-codes/keystore-idb#16
Right now the structure of FLOOFS in IPFS mimics its structure locally (tree). We should serialize the private filesystem into a list before adding to IPFS
Details here: https://talk.fission.codes/t/floofs-restructuring/718
FFS should handle CIDv1. Right now this causes conflicts when accessing uploading files from the gateway or through ipfs UnixFS commands (such as ipfs.ls
)
See #16 for more details
Investigate some solutions to get this working. It might be as simple as upgrading the server node to the latest version of IPFS (a good practice regardless)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.