oddsdk / ts-odd

An SDK for building apps with decentralized identity and storage.
https://odd.dev/
Apache License 2.0
179 stars 24 forks source link

doc request — authentication details #319

Closed nichoth closed 3 years ago

nichoth commented 3 years ago

Summary

What does wn.redirectToLobby do? It takes you to the auth-lobby site, and what happens there? I imagine it updates state stored within indexedDB. I would like to be able to mock the call to update indexedDB, so that you could be authenticated just locally, without an external service. This would be using IPFS just on your local computer, not synchronizing with any server.

Detail

The context I am making a module that uses webnative, and I'm trying to run tests -- https://github.com/nichoth/wn-blob/blob/1f7bd69f140fe090cc209f3c302baf6af1eaa1ae/test/index.js#L42

The tests are automated, and start with a brand new browser each time. So how to do authentication?

The call to wn.initialise returns

{
      scenario: 'NOT_AUTHORISED',
      permissions: {
        app: { name: 'test', creator: 'nichoth' },
        fs: { public: [Array] }
      },
      authenticated: false
    }

The readme says to call wn.redirectToLobby. But it's not ideal since the tests are running without a UI.

 case wn.Scenario.NotAuthorised:
    wn.redirectToLobby(state.permissions)
    break;
matheus23 commented 3 years ago

At the moment webnative is designed to only run with a UI.

Getting all of webnative to work in nodejs is planned - but it'll take a while before we support something like that fully.


Documenting what the auth lobby does is an orthogonal issue I think. Logging it is good though, anyway. I think we might need to update the auth lobby's readme.

nichoth commented 3 years ago

✅ Going to close since there is an issue in auth-lobby for this