{"id":23115093,"url":"https://github.com/singhhp1069/authonomy-sdk-js","last_synced_at":"2025-04-04T01:11:29.770Z","repository":{"id":215908986,"uuid":"740038421","full_name":"singhhp1069/authonomy-sdk-js","owner":"singhhp1069","description":"Authonomy javascript sdk for the demo.","archived":false,"fork":false,"pushed_at":"2024-01-07T14:34:43.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-11T16:46:12.320Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/singhhp1069.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-07T10:37:01.000Z","updated_at":"2024-01-07T10:39:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"375fbde7-a693-46a1-b9d8-822757e00fa4","html_url":"https://github.com/singhhp1069/authonomy-sdk-js","commit_stats":null,"previous_names":["singhhp1069/authonomy-sdk-js"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/singhhp1069%2Fauthonomy-sdk-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/singhhp1069%2Fauthonomy-sdk-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/singhhp1069%2Fauthonomy-sdk-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/singhhp1069%2Fauthonomy-sdk-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/singhhp1069","download_url":"https://codeload.github.com/singhhp1069/authonomy-sdk-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247103307,"owners_count":20884023,"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","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":"2024-12-17T03:39:18.683Z","updated_at":"2025-04-04T01:11:29.765Z","avatar_url":"https://github.com/singhhp1069.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AuthonomySDK\n\n[![npm version](https://badge.fury.io/js/authonomysdk.svg)](https://badge.fury.io/js/authonomysdk)\n\nAuthonomySDK is a JavaScript library providing easy integration with the Authonomy service for web applications. It simplifies user authentication and authorization processes, leveraging Authonomy's secure backend.\n\n## Features\n\n- User Sign-up and Authentication\n- Access Token Generation\n- Access List Retrieval\n- Access Verification\n\n## Installation\n\nTo install AuthonomySDK, use npm:\n\n```bash\nnpm install authonomysdk\n```\n\n## Usage\n\nHere's a quick example to get you started:\n\n```js\nimport { AuthonomySDK } from 'authonomysdk';\n\nconst sdk = new AuthonomySDK({\n  appDid: \"your_app_did\",\n  appSecret: \"your_app_secret\",\n  serviceUrl: \"http://localhost:8081\"\n});\n\n// Sign up or authenticate a user\nsdk.signUp((data) =\u003e {\n  console.log(\"User data:\", data);\n});\n\n// Fetch access token\nsdk.getAccessToken(\"your_oauth_credential\", \"your_policy_credential\", (error, data) =\u003e {\n  if (error) {\n    console.error(\"Error:\", error);\n  } else {\n    console.log(\"Access token:\", data.access_token);\n  }\n});\n\n// Verify access\n// Developer can use it as a middleware too\n// response: \"true\" / \"false\" \nsdk.verifyAccess(accessToken, attribute, (error, data) =\u003e {\n    if (error) {\n        console.error('Failed to verify access:', error);\n        return;\n    }\n    console.log('Access verification:', data);\n});\n\n\n// Get access list\n// example response:\n// {\n//   \"application_policy\": {\n//     \"id\": \"did:key:z6MkmrniEq3Cg7bv21BVbX8qkgJUPsAT6yPcBXoMKBvYtMAu\",\n//     \"roles\": [\n//       {\n//         \"permissions\": [\n//           \"create_user\",\n//           \"delete_user\",\n//           \"edit_settings\"\n//         ],\n//         \"roleName\": \"admin\"\n//       },\n//       {\n//         \"permissions\": [\n//           \"view_content\",\n//           \"comment\"\n//         ],\n//         \"roleName\": \"user\"\n//       }\n//     ]\n//   },\n//   \"user_access_list\": {\n//     \"id\": \"did:key:z6Mkqw8Lz1UVwx9U12CUJ9gQdo7Xsuf75YeM9Zkc52hSw2Xn\",\n//     \"roles\": [\n//       {\n//         \"permissions\": [\n//           \"view_content\",\n//           \"comment\"\n//         ],\n//         \"roleName\": \"user\"\n//       }\n//     ]\n//   }\n// }\nsdk.getAccessList(accessToken, (error, data) =\u003e {\n    if (error) {\n        console.error('Failed to get access list:', error);\n        return;\n    }\n    console.log('Access list:', data);\n});\n```\n\n### important: this is a proof-of-concept for demo purpose only not for production\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinghhp1069%2Fauthonomy-sdk-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsinghhp1069%2Fauthonomy-sdk-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinghhp1069%2Fauthonomy-sdk-js/lists"}