{"id":25296083,"url":"https://github.com/selfkeyfoundation/relying-party-direct-demo","last_synced_at":"2025-08-19T13:14:15.378Z","repository":{"id":44496439,"uuid":"231421963","full_name":"SelfKeyFoundation/relying-party-direct-demo","owner":"SelfKeyFoundation","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-24T01:04:04.000Z","size":2706,"stargazers_count":0,"open_issues_count":15,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-06T20:49:48.471Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SelfKeyFoundation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-02T16:45:40.000Z","updated_at":"2020-01-03T15:34:40.000Z","dependencies_parsed_at":"2023-02-13T07:45:49.306Z","dependency_job_id":null,"html_url":"https://github.com/SelfKeyFoundation/relying-party-direct-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SelfKeyFoundation/relying-party-direct-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SelfKeyFoundation%2Frelying-party-direct-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SelfKeyFoundation%2Frelying-party-direct-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SelfKeyFoundation%2Frelying-party-direct-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SelfKeyFoundation%2Frelying-party-direct-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SelfKeyFoundation","download_url":"https://codeload.github.com/SelfKeyFoundation/relying-party-direct-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SelfKeyFoundation%2Frelying-party-direct-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271158596,"owners_count":24709097,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-13T02:55:42.123Z","updated_at":"2025-08-19T13:14:15.340Z","avatar_url":"https://github.com/SelfKeyFoundation.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Login With Selfkey Demo for direct integrations\n\n## Contents\n\n- [Usage](#usage)\n- [License](#license)\n\n\u003ca name=\"usage\"\u003e\u003c/a\u003e\n\n## Usage\n\n### Install\n```sh\ngit clone https://github.com/SelfKeyFoundation/relying-party-direct-demo.git\ncd relying-party-direct-demo\nnpm install\n```\n\n### Run\n```sh\nnpm start\n```\n\n### Run dev\n```sh\nnpm run start-dev\n```\n\n### SDK code examples\n\nFrom [routes/lws.js](https://github.com/SelfKeyFoundation/relying-party-direct-demo/blob/master/routes/lws.js)\n\n```js\n// validate jwt token as challenge or access token\nconst decoded = await (tokenType === 'challenge'\n\t? sk.auth.validateChallengeToken(tokenString, JWT_ALGORITHM, JWT_SECRET)\n\t: sk.auth.validateAccessToken(tokenString, JWT_ALGORITHM, JWT_SECRET));\n```\n\n```js\nattributeManager = await sk.identity.AttributeManager.createWithSelfkeyRepository();\n```\n\n```js\nconst challengeToken = await sk.auth.generateChallengeToken(did, JWT_ALGORITHM, JWT_SECRET)\n```\n\n```js\nconst isValid = await sk.auth.verifyChallengeSignature(nonce, signature, did);\n```\n\n```js\nconst accessToken = await sk.auth.generateAccessToken(did, JWT_ALGORITHM, JWT_SECRET);\n```\n\n```js\n// Validate attributes based on requirements (LWS_TEMPLATE)\nconst {\n\tattributes: validated,\n\terrors,\n\tvalid\n} = await req.attributeManager.validateAttributes(attributes, LWS_TEMPLATE);\n```\n\n```js\n// create a human readable attribute map\n// [{schemaId: 'http://platform.selfkey.org/schema/attribute/first-name.json', data: 'first name'}]\n// Becomes\n// { firstName: {schemaId: 'http://platform.selfkey.org/schema/attribute/first-name.json', data: 'first name'}}\nattributes = sk.identity.utils.attributeMapBySchema(validated);\n```\n\n```js\nconst jwt = await sk.jwt.issueJWT(did, JWT_ALGORITHM, JWT_SECRET);\n```\n\n```js\nconst decoded = await sk.jwt.validateJWT(token, JWT_ALGORITHM, JWT_SECRET);\n```\n\n\u003ca name=\"license\"\u003e\u003c/a\u003e\n## License\n\n[The GPL-3.0 License](http://opensource.org/licenses/GPL-3.0)\n\nCopyright (c) 2018 SelfKey Foundation \u003chttps://selfkey.org/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselfkeyfoundation%2Frelying-party-direct-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fselfkeyfoundation%2Frelying-party-direct-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselfkeyfoundation%2Frelying-party-direct-demo/lists"}