This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocols = (() => { | |
const definitions = {}; | |
const functions = { | |
alias: (path, map) => { | |
// Handling alias definitions, store the protocol URI with each alias | |
for (const alias in map) { | |
definitions[alias] = map[alias]; | |
console.log(`Alias '${alias}' added with protocol URI: ${map[alias].protocol}`); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://dweb/${DID}/read/protocols/encodeURIComponent(this.profileProtocolUri)/avatar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
published: true, | |
protocol: 'https://areweweb5yet.com/protocols/blog', | |
types: { | |
follow: { | |
schema: "https://areweweb5yet.com/protocols/follow", | |
dataFormats: ["application/json"] | |
}, | |
post: { | |
schema: "https://areweweb5yet.com/protocols/post", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Web5 } from '@web5/api'; | |
import { DidJwk, DidDht, BearerDid } from '@web5/dids'; | |
import { DwnRegistrar } from '@web5/agent'; | |
import { Web5UserAgent } from '@web5/user-agent'; | |
let initialize; | |
const instances = {}; | |
const didLabelRegex = /(?:[^@]*@)?(did:[a-z0-9]+:[a-zA-Z0-9-]+)/; | |
const storage = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppChannel { | |
static channels = {}; | |
constructor(name, options = {}) { | |
this.name = name; | |
this.sender = new BroadcastChannel(name); | |
this.receiver = new BroadcastChannel(name); | |
this.store = options.store || false; | |
this.data = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('Hello world!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { UniversalResolver, DidDht, DidWeb } from '@web5/dids'; | |
if (self instanceof ServiceWorkerGlobalScope) { | |
const DidResolver = new UniversalResolver({ didResolvers: [DidDht, DidWeb] }); | |
const didUrlRegex = /^https?:\/\/dweb\/(([^\/]+)\/.*)?$/; | |
const httpToHttpsRegex = /^http:/; | |
const trailingSlashRegex = /\/$/; | |
self.addEventListener('fetch', event => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"uri": "https://slick.app", | |
"schemas": { | |
"invite": "https://slick.app/schemas/invite", | |
"community": "https://slick.app/schemas/community", | |
"details": "https://slick.app/schemas/details", | |
"channel": "https://slick.app/schemas/channel", | |
"message": "https://slick.app/schemas/message", | |
"reaction": "https://slick.app/schemas/reaction", | |
"admin": "https://slick.app/schemas/admin", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
types: { | |
invitation: { | |
schema: "https://example.com/protocols/signdocs/invitation" | |
dataFormats: ['application/json'] | |
} | |
}, | |
structure: { | |
invitation: { | |
$actions: [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ npm run test:browser | |
> @web5/api@0.8.3 test:browser | |
> karma start karma.conf.cjs | |
Firefox 115.0 (Windows 10) WARN: 'failed to get tech preview dwn endpoints:', 'Network error' | |
18 11 2023 10:40:30.385:INFO [launcher]: Starting browser WebkitHeadless | |
18 11 2023 10:40:30.850:INFO [WebKit 605.1.15 (Windows 8)]: Connected on socket nFNGv_D5KWu4ABEUAAAF with id 17526702 | |
WebKit 605.1.15 (Windows 8) LOG: 'STATUS CODE: 400 --> SchemaValidationFailure: /descriptor: must have required property 'schema'' |
NewerOlder