Add app owned use WNFS implementation

This commit is contained in:
Brian Ginsburg 2022-07-19 12:58:49 -07:00
parent 2f71c44198
commit 7ca0c16f67
No known key found for this signature in database
GPG Key ID: B7A01B90EB115B2D
3 changed files with 19 additions and 11 deletions

14
package-lock.json generated
View File

@ -8,7 +8,7 @@
"name": "svelte-elemetary-template",
"version": "0.1.0",
"dependencies": {
"webnative": "^0.32.0"
"webnative": "0.33.0-alpha-1"
},
"devDependencies": {
"@sveltejs/adapter-static": "1.0.0-next.36",
@ -4758,9 +4758,9 @@
}
},
"node_modules/webnative": {
"version": "0.32.0",
"resolved": "https://registry.npmjs.org/webnative/-/webnative-0.32.0.tgz",
"integrity": "sha512-Oz7+WVakUFuMeIivfsCPGTOSaSHS34MM75EaXTL1G3AHIItHfJq67gwoEhSMgYcia7eM7zEx5HS8hmIhYgbTUg==",
"version": "0.33.0-alpha-1",
"resolved": "https://registry.npmjs.org/webnative/-/webnative-0.33.0-alpha-1.tgz",
"integrity": "sha512-g5xg5gkDScTre5IrhcJgWhEgYlI/pri2OTxZxLq832cqgu42gJ9Jzs7B+hgSEDHWB+ROQWCe+RJ9H0dlhTKORw==",
"dependencies": {
"@ipld/dag-cbor": "^7.0.0",
"@ipld/dag-pb": "^2.1.15",
@ -8227,9 +8227,9 @@
"peer": true
},
"webnative": {
"version": "0.32.0",
"resolved": "https://registry.npmjs.org/webnative/-/webnative-0.32.0.tgz",
"integrity": "sha512-Oz7+WVakUFuMeIivfsCPGTOSaSHS34MM75EaXTL1G3AHIItHfJq67gwoEhSMgYcia7eM7zEx5HS8hmIhYgbTUg==",
"version": "0.33.0-alpha-1",
"resolved": "https://registry.npmjs.org/webnative/-/webnative-0.33.0-alpha-1.tgz",
"integrity": "sha512-g5xg5gkDScTre5IrhcJgWhEgYlI/pri2OTxZxLq832cqgu42gJ9Jzs7B+hgSEDHWB+ROQWCe+RJ9H0dlhTKORw==",
"requires": {
"@ipld/dag-cbor": "^7.0.0",
"@ipld/dag-pb": "^2.1.15",

View File

@ -50,6 +50,6 @@
]
},
"dependencies": {
"webnative": "^0.32.0"
"webnative": "0.33.0-alpha-1"
}
}

View File

@ -1,6 +1,12 @@
import * as webnative from 'webnative'
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
@ -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> => {
try {
@ -25,15 +32,16 @@ export const initialize = async (): Promise<void> => {
state = st
switch (state.scenario) {
case webnative.Scenario.AuthCancelled:
case webnative.Scenario.NotAuthorised:
console.log('Not logged in')
break
case webnative.Scenario.AuthSucceeded:
case webnative.Scenario.Continuation:
console.log('Logged in')
break
default:
break
}
} catch (error) {
switch (error) {