Add app owned use WNFS implementation
This commit is contained in:
parent
2f71c44198
commit
7ca0c16f67
|
|
@ -8,7 +8,7 @@
|
||||||
"name": "svelte-elemetary-template",
|
"name": "svelte-elemetary-template",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"webnative": "^0.32.0"
|
"webnative": "0.33.0-alpha-1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/adapter-static": "1.0.0-next.36",
|
"@sveltejs/adapter-static": "1.0.0-next.36",
|
||||||
|
|
@ -4758,9 +4758,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/webnative": {
|
"node_modules/webnative": {
|
||||||
"version": "0.32.0",
|
"version": "0.33.0-alpha-1",
|
||||||
"resolved": "https://registry.npmjs.org/webnative/-/webnative-0.32.0.tgz",
|
"resolved": "https://registry.npmjs.org/webnative/-/webnative-0.33.0-alpha-1.tgz",
|
||||||
"integrity": "sha512-Oz7+WVakUFuMeIivfsCPGTOSaSHS34MM75EaXTL1G3AHIItHfJq67gwoEhSMgYcia7eM7zEx5HS8hmIhYgbTUg==",
|
"integrity": "sha512-g5xg5gkDScTre5IrhcJgWhEgYlI/pri2OTxZxLq832cqgu42gJ9Jzs7B+hgSEDHWB+ROQWCe+RJ9H0dlhTKORw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ipld/dag-cbor": "^7.0.0",
|
"@ipld/dag-cbor": "^7.0.0",
|
||||||
"@ipld/dag-pb": "^2.1.15",
|
"@ipld/dag-pb": "^2.1.15",
|
||||||
|
|
@ -8227,9 +8227,9 @@
|
||||||
"peer": true
|
"peer": true
|
||||||
},
|
},
|
||||||
"webnative": {
|
"webnative": {
|
||||||
"version": "0.32.0",
|
"version": "0.33.0-alpha-1",
|
||||||
"resolved": "https://registry.npmjs.org/webnative/-/webnative-0.32.0.tgz",
|
"resolved": "https://registry.npmjs.org/webnative/-/webnative-0.33.0-alpha-1.tgz",
|
||||||
"integrity": "sha512-Oz7+WVakUFuMeIivfsCPGTOSaSHS34MM75EaXTL1G3AHIItHfJq67gwoEhSMgYcia7eM7zEx5HS8hmIhYgbTUg==",
|
"integrity": "sha512-g5xg5gkDScTre5IrhcJgWhEgYlI/pri2OTxZxLq832cqgu42gJ9Jzs7B+hgSEDHWB+ROQWCe+RJ9H0dlhTKORw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@ipld/dag-cbor": "^7.0.0",
|
"@ipld/dag-cbor": "^7.0.0",
|
||||||
"@ipld/dag-pb": "^2.1.15",
|
"@ipld/dag-pb": "^2.1.15",
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,6 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"webnative": "^0.32.0"
|
"webnative": "0.33.0-alpha-1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,12 @@
|
||||||
import * as webnative from 'webnative'
|
import * as webnative from 'webnative'
|
||||||
|
|
||||||
import type FileSystem from 'webnative/fs/index'
|
import type FileSystem from 'webnative/fs/index'
|
||||||
|
import { USE_WNFS_IMPLEMENTATION } from 'webnative/auth/implementation/use-wnfs'
|
||||||
|
import { setup } from 'webnative'
|
||||||
|
|
||||||
|
setup.endpoints({ api: 'https://runfission.net', user: 'fissionuser.net' })
|
||||||
|
|
||||||
|
setup.setImplementations({ auth: USE_WNFS_IMPLEMENTATION.auth })
|
||||||
|
|
||||||
let state: webnative.State
|
let state: webnative.State
|
||||||
|
|
||||||
|
|
@ -17,7 +23,8 @@ const fissionInit = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
webnative.setup.debug({ enabled: true })
|
// TODO: Add a flag or script to turn debugging on/off
|
||||||
|
setup.debug({ enabled: true })
|
||||||
|
|
||||||
export const initialize = async (): Promise<void> => {
|
export const initialize = async (): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -25,15 +32,16 @@ export const initialize = async (): Promise<void> => {
|
||||||
state = st
|
state = st
|
||||||
|
|
||||||
switch (state.scenario) {
|
switch (state.scenario) {
|
||||||
case webnative.Scenario.AuthCancelled:
|
|
||||||
case webnative.Scenario.NotAuthorised:
|
case webnative.Scenario.NotAuthorised:
|
||||||
console.log('Not logged in')
|
console.log('Not logged in')
|
||||||
break
|
break
|
||||||
|
|
||||||
case webnative.Scenario.AuthSucceeded:
|
|
||||||
case webnative.Scenario.Continuation:
|
case webnative.Scenario.Continuation:
|
||||||
console.log('Logged in')
|
console.log('Logged in')
|
||||||
break
|
break
|
||||||
|
|
||||||
|
default:
|
||||||
|
break
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
switch (error) {
|
switch (error) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue