Skip to content

Instantly share code, notes, and snippets.

@bennyschmidt
Last active March 20, 2023 04:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bennyschmidt/0b61fffe9540d139d6604d7c03792a4f to your computer and use it in GitHub Desktop.
Save bennyschmidt/0b61fffe9540d139d6604d7c03792a4f to your computer and use it in GitHub Desktop.
URI schemes used in Dusk
/**
* Dusk browser
* Native URI schemes
*
* Non Fungible Records are stored on the public chain as Magnetic Resource Text (MRT)
* which closely inherits from the Magnet URI scheme ("magnet links")
* See: https://en.wikipedia.org/wiki/Magnet_URI_scheme
*
* Data files are stored in directories specified in that node's configuration
* in the following formats.
* See: https://github.com/exactchange/dss
*/
---------------
URI SCHEMES:
XHR: XMLHttpRequest request framework.
HTTP transport between the Node.js process and a target URL.
WSR: WebSocket Relay request framework.
Brokers a WebSocket (WS) connection between the Node.js process and a target IP.
---------------
FILE PROTOCOLS:
DRV: Peer-to-peer blockchain protocol.
---------------
CONTENT TYPES:
Alias: A user who owns content and/or authenticates with applications.
Comment: Short-form text authored by a user alias.
Collectible: A type of content representing collectible items.
Application: An informational summary about an application, and IP at which to connect.
---------------
IDENTIFIERS:
File name: A UUID representing the JSON file name.
Application ID: A UUID representing the Application (summary) JSON file name.
---------------
URI EXAMPLES:
A link to a comment.
User enters:
"drv/comment:1248a559-1e29-395b-10c7-cf1b78704e83"
Vanity URL - auto-prefixes the request framework:
"xhr: drv/comment:1248a559-1e29-395b-10c7-cf1b78704e83"
Not shown - translates to magnet URI:
"magnet:?xt=urn:drv/comment:1248a559-1e29-395b-10c7-cf1b78704e83")
Anatomy:
xhr: magnet: ?xt=urn: drv/comment: 1248a559-1e29-395b-10c7-cf1b78704e83
[framework] [URI scheme] [URN exact topic] [protocol/optional type] [file name]
[ Dusk ]
-----
A link to a comment using ambiguous operator.
User enters:
"drv/comment:1248a559~"
Vanity URL - auto-prefixes the request framework:
"xhr: drv/comment:1248a559~"
Performs lookup:
drv/comment:1248a559~ --> Comment(1248a559~) --> "1248a559-1e29-395b-10c7-cf1b78704e83"
Not shown - translates to magnet URI:
"magnet:?xt=urn:drv/comment:1248a559-1e29-395b-10c7-cf1b78704e83"
Anatomy:
xhr: magnet: ?xt=urn: drv/comment: 1248a559-1e29-395b-10c7-cf1b78704e83
[framework] [URI scheme] [URN exact topic] [protocol/optional type] [file name]
[ Dusk ]
-----
A link to an alias.
User enters:
"@exactchange"
Vanity URL - auto-prefixes the request framework, and suffixes their address:
"xhr: @exactchange (@158fe325-a136-95ff-d92c-d297d50f4e1f)"
Performs lookup:
@exactchange --> Alias(@exactchange) --> "158fe325-a136-95ff-d92c-d297d50f4e1f"
158fe325-a136-95ff-d92c-d297d50f4e1f --> "fc3df170-d153-5832-efdc-42dfda352f01"
Not shown - translates to magnet URI:
"magnet:?xt=urn:drv/alias:fc3df170-d153-5832-efdc-42dfda352f01"
Anatomy:
xhr: magnet: ?xt=urn: drv/alias: fc3df170-d153-5832-efdc-42dfda352f01
[framework] [URI scheme] [URN exact topic] [protocol/optional type] [file name]
[ Dusk ] [@alias]
-----
A link to an application.
User enters:
"@exactchange:Kickflip"
Vanity URL - Auto-prefixes request framework, and suffixes the app's rating
"🔒 wsr: @exactchange: Kickflip" ⭐⭐⭐⭐⭐)
Performs lookup:
@exactchange --> Alias(@exactchange) --> "158fe325-a136-95ff-d92c-d297d50f4e1f"
Kickflip --> Application(158fe325-a136-95ff-d92c-d297d50f4e1f/Kickflip) --> "q22a98f6-55fb-4c52-b7d1-07442ac36b49"
Not shown - translates to magnet URI:
"magnet:?xt=urn:drv/application:q22a98f6-55fb-4c52-b7d1-07442ac36b49"
Anatomy:
wsr: magnet: ?xt=urn: drv/application: q22a98f6-55fb-4c52-b7d1-07442ac36b49
[framework] [URI scheme] [URN exact topic] [protocol/optional type] [application id]
[ Dusk ] [Application]
-----
A link to an anonymous alias.
User enters:
"@148d72b3~"
Vanity URL - auto-prefixes the request framework, and suffixes their address:
"xhr: @148d72b3~ (@148d72b3-a136-95ee-d92c-d297d50f4e7e)"
Performs lookup:
@148d72b3~ --> Alias(@148d72b3~) --> "null"
Alerts:
"No alias found for @148d72b3~."
[ Dusk ]
---------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment