Additional information

Become an ODD SDK jedi 🧘

Debugging

Version

Check the ODD SDK version.

console.log(odd.VERSION)

Debug Logs

Debug logging can be enabled through the configuration object.

{ ...configuration, debug: true }

When ODD SDK makes a change to the user's filesystem, it logs:

📓 Adding to the CID ledger

Next, ODD SDK links the change to make it available across the web.

🌊 Updating your DNSLink

When linking completes, the change is published and available to other browsers.

ðŸŠī DNSLink updated:

Program

When debug mode is enabled, the program is added to the global context object (window for example):

const appInfo = { creator: "Nullsoft", name: "Winamp" }

await odd.program({
  namespace: appInfo,
  debug: true
})

// Program is exposed in debug mode
const program = globalThis.__odd[ odd.namespace(appInfo) ] // namespace: "Nullsoft/Winamp"

Shorthands

An ODD program provides shorthand utility functions for easy access:

export type ShortHands = {
  accountDID: (username: string) => Promise<string>
  agentDID: () => Promise<string>
  sharingDID: () => Promise<string>
}

The shorthands include:

  • accountDID. Retrieves the account DID associated with the user's account.

  • agentDID. Retrieves the agent DID for the current device.

  • sharingDID. Retrieves the sharing DID for the current device.

WNFS File System Roots

WNFS comes with three separate top-level file systems "roots": public, pretty, and private.

Public

Not encrypted. Full metadata support. Starts with /public.

Pretty

Not encrypted. No metadata. Represented simply as /p to be nice and short when creating public URLs like /p/path/to/file.img. It does not support versioning, use the Public or Private trees for that.

Private

Encrypted. Structured so that file metadata as well as contents are obscured. Starts with /private.

More about roots. Learn more about roots in the Fission whitepaper.

Web Worker

Can I use my file system in a web worker? Yes, but depending on which type of session you want you may need to adjust your setup. To be more specific, when working without capabilities you can just create a program in your web worker. But when working with capabilities, it'll depend on how your chosen capabilities flow works. In the case of the current Fission auth lobby, access to the window object is needed when requesting capabilities, so that'll need to happen on the UI/main thread.

Feel free to reach out on our Discord if you need help.

Versions

Since the file system may evolve over time, a "version" is associated with each node in the file system (tracked with semver).

Last updated