Code Monkey home page Code Monkey logo

animo-demo's Introduction


screenshot-demo

Animo Self-Sovereign Identity Demo

Continuous Deployment License TypeScript

✨ Hi there!

Welcome to the repository of Animo's Self-Sovereign identity demo. This interactive app demonstrates the use of verifiable credentials. This demo is built using Aries Framework Javascript (AFJ). AFJ is a framework written in TypeScript for building SSI Agents and DIDComm services. This demo uses the REST API, which is part of the Aries Framework JavaScript Extensions repository.

🛠️ Usage

Prerequisites

  • NodeJS v16.X.X - Other versions may work, not tested
  • Yarn
  • Git - You probably already have this

🖥 Client

Copy the .env.example file to a .env file and set the environment variables.

cd client
cp .env.example .env
Variable Description
REACT_APP_HOST_BACKEND Used in the frontend application to connect with the backend. Should be http://localhost:5000 for development.
REACT_APP_HOST_WEBSOCKET Used in the frontend application to connect with the WebSocket server and listen for events. Should be ws://localhost:5000 for development.

🎛️ Server

Copy the .env.example file to a .env file and set the environment variables.

cd server
cp .env.example .env
Variable Description
AGENT_PUBLIC_DID_SEED Used in the backend application for the agent. Should be set to your agent's public DID in development/production.
AGENT_ENDPOINT Used in the backend application for the agent. Should be set to your agent's endpoint in development/production.
AGENT_WALLET_KEY Used in the backend application for the agent. Should be set to your agent's wallet key in development/production.

Node version

nvm use

Install Dependencies

yarn install

Development

yarn dev

Tests

The demo has Cypress integration tests. To run the tests, make sure you have both the client, server and test agent running locally. You can do this by running the commands yarn dev in the root of the project. You can then start the tests with yarn test. This will open up cypress in chrome from where you can run the tests.

🖇️ How To Contribute

You're welcome to contribute to this demo. Please make sure to open an issue first!

This demo is open source and you're more than welcome to customize and use it to create your own self-sovereign identity demo. If you do, an attribution to Animo would be very much appreciated!

animo-demo's People

Contributors

dependabot[bot] avatar genaris avatar janrtvld avatar jimezesinachi avatar lauravuo avatar timoglastra avatar vickysomtee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

animo-demo's Issues

All user characters show all uses-cases as competed after completing just one of them

I detected this while using the deployed version of the demo at demo.animo.id, not the local version I can test from the main branch.

The demo has three (3) characters: Jan, Noah and Joyce.

After completing all the use-cases for Jan, it automatically registers the use-cases for Noah and Joyce, and vice-versa.

Thought it was an error on my side, that I had done the use-cases before, but using private browser windows over multiple runs left me with the same outcome.

Also the reset option from the command+k to reset dashboard didn't seem to affect it.

Definitely needs further investigation, but I thought to mention it here first.

Add configuration screen

It would be nice to add a configuration screen (accessed by cmd+k) that allows to configure which features to use for the demo. This way you can use the demo with some of the new feautres, without breaking interop with old wallets. Kind of like flags in your browser (very hidden, but possible to change if you know what you're doing).

The features I'm currently thinking of:

  • ledger
  • issue credential protocol version
  • present proof protocol version
  • oob vs legacy invitation

We can add custom configuration to the cmd/ctrl+k screen like we already have with change theme (see screenshot)

image

Invalid store hydration state on mobile

There are occurrences when people are getting stuck in the demo during the onboarding. This happens in the connection screen as well as the credential screen.

Sometimes when you refresh the page, the state is not properly rehydrated. The state keeps the old connection id in their preferences, but onboarding flow is restarted. We should check if the store is properly rehydrated after a user refreshes the page.

This primarily happens on mobile, probably because users use the cmd+k menu to reset the state on desktop instead of refreshing the page.

Flaky tests

The tests are failing constantly and it seems like a coin flip if every test will pass at the same time. Below are some solutions i came up with:

  • Run the cypress tests from the CI
  • Add a start state to the tests so that not every tests needs to complete the onboarding process. This also makes the tests more efficient.
  • Look into the performance of cypress tests

Unexpected shutdown

I think this is the cause:

httpInbound.app.get('/', async (req, res) => {
// eslint-disable-next-line no-console
if (typeof req.query.c_i === 'string') {
const invitation = await ConnectionInvitationMessage.fromUrl(req.url.replace('d_m=', 'c_i='))
res.send(invitation.toJSON())
}
if (typeof req.query.d_m === 'string') {
const base64 = req.query.d_m.split('?')[0]
const proof = JsonEncoder.fromBase64(base64)
res.send(proof)
}
if (typeof req.query.id === 'string') {
const proof = await agent.proofs.getById(req.query.id)
let message = ''
if (proof.requestMessage) {
message = JsonEncoder.toBase64URL(proof.requestMessage.toJSON())
}
res.redirect(agent.config.endpoints[0] + '/?d_m=' + message)
}
})

We should add error handling (catch) to this method and also add a generic uncaught promise rejections handler: https://thecodebarbarian.com/unhandled-promise-rejections-in-node.js.html to prevent the server from crashing

undefined:1
{"@t

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at Function.fromString (/www/node_modules/@aries-framework/core/build/utils/JsonEncoder.js:45:21)
    at Function.fromBuffer (/www/node_modules/@aries-framework/core/build/utils/JsonEncoder.js:61:28)
    at Function.fromBase64 (/www/node_modules/@aries-framework/core/build/utils/JsonEncoder.js:29:28)
    at Function.fromUrl (/www/node_modules/@aries-framework/core/build/modules/connections/messages/ConnectionInvitationMessage.js:79:62)
    at /www/build/index.js:64:73
    at Generator.next (<anonymous>)
    at /www/build/index.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/www/build/index.js:4:12)

Scrollable wallets and characters on mobile feel flaky

The wallets and character list are scrollable. This leads to a annoying effect on mobile because on some screen sizes you also have to scroll the page. This makes it so you have two scrollable elements:

RPReplay_Final1675847944.MP4

Sending a new credential request keeps loading.

Screen.Recording.2022-11-10.at.14.03.50.mov

Here with the state: it isn't removing the previously issued credential and there is also a dupe in there.

Screen.Recording.2022-11-10.at.14.06.35.mov

Visible action to reset animo demo

I think we should consider having a reset button for a particular Demo in case a user wants to retake the demo.

My suggestion is either putting a notice of what the ctrl + k command does or simply putting a reset button for easy access.

Screenshot from 2022-11-09 09-06-17

Change slogan to be more accessible

When the demo was released (almost 1 year ago) we branded it as a way to see the future. I think we should change it to something more accessible/current.

I will think of suggestions but also: suggestions welcome

Image after setup same for all use cases

Currently the image at "You're all set!" is the same for all use cases. Because it features some characters with their back turned and one central character, it seems especially suited to customize it with the chosen player, instead of a generic pic.

Screenshot from 2022-01-04 11-34-15

We can do this by dynamically changing the images that we add to the final screen based on the character selected. Images can be found on here.

We can change the getComponentToRender in OnboardingContainer to add an image to the Progress.SETUP_COMPLETED based on the character chosen.

Add test coverage integration

We'd like to get insights in the test coverage % of the animo demo.

  • Get the % coverage on tests after each test run
  • Comment the % coverage on each PR
  • Display a badge in the readme of this repo with the % coverage

We can use tools for this like codecov.io, or look for a custom way to do it with just Github actions (if possible?)

ld: library not found for -lindy

Great project.

Been trying to run the demo on my local machine (MacOS). I have the latest libindy for my platform, together with other libraries it depends on.

On running

yarn install

I keep getting the

ld: library not found for -lindy

error.

Any leads on what I might be missing?

gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
CXX(target) Release/obj.target/indynodejs/src/indy.o
SOLINK_MODULE(target) Release/indynodejs.node
ld: library not found for -lindy
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/indynodejs.node] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/imac/Documents/newflex/animo-demo/node_modules/indy-sdk/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (node:events:394:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Darwin 19.6.0

Change button redirect to characters screen

Currently, when you're on the dashboard of the demo and you'll press change character it just wipes the state and starts fresh. It would be nice if we can drop the user directly into the onboarding flow at the character selection step.

We also keep track of the characters that the user has completed. We could add a checkmark to the characters that are already done?

  • The onboardingSlice keeps track of the onboarding step that the user is on.
  • We should create an redux action named something like 'demo/CHANGECHARACTER' that resets the current state and changes the onboarding step to 2 (PICK_CHARACTER).

Alternative option of creating credential definitions

Currently when you run the server the credential definitions are created. This can take quite some time. There also isn't something that checks if the credential definitions already exist. In addition, when you change something on the server side, the server restarts and all the credential definitions are created again.

We should find a better way of creating credential definitions.

Toggle between oob and legacy invitations

See #87 for general context

  1. Add useLegacyInvitations boolean type to the connectionSlice.ts. True should be the default
  2. add setUseLegacyInvitations to the reducers in the connections slice that sets wheter to use legacy invitations on the state.
  3. Add option "Change Connection Invitation Type" with options "Legacy (RFC 0160)" and "Out Of Band" to the KBar.tsx file.
  4. (ideally) add a way to see if we're using legacy / oob invitation from kbar (timc1/kbar)
  5. Whenever we create an invitation we should call /oob/create-legacy-invitation if legacy is enabled, and /oob/create-invitation otherwise. In both cases we should use the return invitaiton url and encode is as a QR (as is already happening)

AGENT_PUBLIC_DID_SEED

Hello. Great app. I am learning and trying to set up my env. But I do not know what to use in this parameter.
Besides, when y scan de code with the Trinsic wallet I get an error. I follow the url and get:
{"@type":"https://didcomm.org/connections/1.0/invitation","@id":"4a2c35fa-e9f5-4793-91ea-8e27f3e0e085","label":"justech-wallet","imageUrl":"https://i.imgur.com/g3abcCO.png","recipientKeys":["6NuFTh6kkWfDdmp7fJFQB3aqdQFaMy7qAuP1bYY5iRv2"],"serviceEndpoint":"https://825d-181-231-126-165.ngrok.io","routingKeys":[]}
Thank you for your help.
S.

It is possible to get the same credential twice

Submitted by an user from the cheqd telegram group. This is possible when you press "I didn't receive anything" but you did. If new credential offers are sent, we should delete (or make inactive) the old ones.

Make sure the dashboards are reset after a new version is deployed that resets the AFJ database

Currently if you finished the demo for a part, and then go back the next time you won't be able to finish as new credential definitions are created after each restart. We should add some counter to the frontend (in addition to the redux store version) and redux store that will be updated every time we do a new release that resets the database on the backend.

We can set this using an environment variable on the server side and use that to know if the current persistence version number is equal to the latest stored persistence version number

Show where base credentials come from

Feedback we got from the cheqd telegram group:

I would add one thing though, which is to show who actually issued the initial credentials to begin with. Now you’re kind of just “airdropped” some random credentials. The part where a lot of questions pop up is how you get your initial base credentials in your wallet. Adding this part would make it more “end-to-end”

Onboarding credentials showing loading spinner without credentials

Lately when going through the onboarding flow, sometimes the issuance of the started credentials shows the following page. When resetting the dashboard and starting over it is often resolved, but I've had occurrences where it will happen twice in a row.

Not sure what is going on here. No errors are logged in the browser console.

image

@janrtvld any idea what is happening here?

Redux persists store version

Currently, when we update the redux store with some new functionality we have to up the version. This is because if the store differs from the store that is being replenished from the localStorage there might be issues.

This is quite annoying and easy to forget. I think we can fix this with the following:

Currently we do a check in App.tsx to check if the server has been reset. This is because we wipe the server over the weekend to not clutter it up with billions of connections. What if we also save the current date in the store and then check before replenishing if this date is after the last server reset. If the server has been reset we don't replenish the store.

Does this make sense? It does feel a bit hacky so open to other suggestions.

Make a credential loading card

Currently, when we issue a credential it shows a loading spinner when the request is being processed. Then, after the credential request is completed the credential card is shown with a loading spinner waiting for the user to accept it.

There is a small flicker in between:

Screen.Recording.2022-09-02.at.14.23.37.mov

It would be nice if we have a placeholder credential card where the card indicates that the credential is loading (presumably with a pulsing effect). Like this:

image

We should add an 'empty' credential card as a placeholder while the isLoading property is true.

Change issue credential protocol version

See #87 for general context

  1. Add protocolVersion with type "v1" | "v2" to the credentialSlice.ts. V1 should be the default.
  2. Add setProtocolVersion to the reducers in the credential slice that sets the protocol version on the state. input must be "v1" | "v2".
  3. Add option "Change Issue Credential Protocol Version" with options "V1" (v1) and "V2" (v2) to the KBar.tsx file.
  4. (ideally) add a way to see the currently selected protocol version when choosing from kbar (https://github.com/timc1/kbar)
  5. Whenever we call the /credentials/offer-credential we should take the protocolVersion that is configured in the credential slice.

Add ledger used to the wallet selection page

Got an inquiry from someone about which ledger the demo uses so they can test it for interop with their wallet. Even though it's mentioned in the trinsic modal, it maybe be good to add a small hint to the wallet selection page about the ledger being used. This will make it easier to use a wallet not in the list

Not able to run Demo on my local system

Hi team ,

I am trying to run this demo on my local system.
When I run Yarn Dev command

Command is running successfully but localhost:3000 is not returning anything (blank Front end)
Localhost:5000 is working fine .
Could you please help me with this?

Best Regards
Sethi Shivam

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.