{"id":21743940,"url":"https://github.com/telefonica/latch-sdk-nodejs","last_synced_at":"2025-04-13T05:06:51.475Z","repository":{"id":18469069,"uuid":"21663949","full_name":"Telefonica/latch-sdk-nodejs","owner":"Telefonica","description":"NodeJS SDK for latch","archived":false,"fork":false,"pushed_at":"2024-11-29T16:37:40.000Z","size":1787,"stargazers_count":6,"open_issues_count":3,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-13T05:06:44.508Z","etag":null,"topics":["dir-cto","org-cdo","public","srv-latch","srv-livingapps"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Telefonica.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":"2014-07-09T18:33:44.000Z","updated_at":"2024-11-29T11:36:36.000Z","dependencies_parsed_at":"2024-11-15T11:19:41.553Z","dependency_job_id":null,"html_url":"https://github.com/Telefonica/latch-sdk-nodejs","commit_stats":null,"previous_names":["elevenpaths/latch-sdk-nodejs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Telefonica%2Flatch-sdk-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Telefonica%2Flatch-sdk-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Telefonica%2Flatch-sdk-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Telefonica%2Flatch-sdk-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Telefonica","download_url":"https://codeload.github.com/Telefonica/latch-sdk-nodejs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248665748,"owners_count":21142123,"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":["dir-cto","org-cdo","public","srv-latch","srv-livingapps"],"created_at":"2024-11-26T07:09:28.551Z","updated_at":"2025-04-13T05:06:51.469Z","avatar_url":"https://github.com/Telefonica.png","language":"JavaScript","readme":"### latch-sdk-nodejs ###\n\n\n#### Prerequisites ####\n\n* NodeJS.\n\n* Read API documentation https://latch.tu.com/www/developers/doc_api\n\n* To get the \"Application ID\" and \"Secret\", (fundamental values for integrating Latch in any application), it’s necessary to register a developer account in Latch's website: https://latch.tu.com. On the upper right side, click on \"Developer area\".\n\n\n#### USING THE SDK IN NODEJS ####\n\n* You need to include the npm package 'latch-sdk' in your package.json file and then require the \"latch-sdk\" in your NodeJS file.\n```\n    var latch = require('latch-sdk');\n```\n\n* Initialize latch with your AppId and SecretKey. Hostname and port are optional.\n```\n    latch.init({ appId: 'MY_APP_ID', secretKey: 'MY_SECRET_KEY', hostname: 'HOSTNAME:PORT' });\n```\n\n* Call to Latch Server. Pairing will return an account id that you should store for future api calls\n```\n    let PAIRING_CODE = \"\u003cPAIRING_CODE\u003e\"\n    \n    let response = latch.pair(PAIRING_CODE, function (err, result) {\n        if (err) {\n            console.log(util.inspect(err, {showHidden: true, depth: null, colors: true}));\n        } else {\n            console.log(util.inspect(result, {showHidden: true, depth: null, colors: true}));\n        }\n    });\n```\n\n#### USING THE SDK IN NODEJS FOR WEB3 SERVICES ####\n\nFor using the NodeJS SDK within an Web3 service, you must complain with the following:\n\n* It is necessary to have a developer subscription that allows you to create web3 apps.\n* You need metamask extension for Google Chrome [Download metamask](https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn)\n* You need a wallet to operate on Polygon. You can easily create one through Metamask.\n\n### Creation of a WEB3 Latch app ###\n[Creation of a WEB3 Latch app](doc/Latch_WEB3_Apps.pdf)\n\nOnce you have your developer Latch account created, you must logging in the website, and you see your application list (you could have it empty):\n\nThe two additional parameters are:\n- WEB3WALLET: The Ethereum-based address wallet for the user that wants to pair the service.\n- WEB3SIGNATURE: A proof-of-ownership signature of a constant, in order to verify that the user owns the private key of the wallet. You can use https://etherscan.io/verifiedSignatures# to sign the following message:\n- MESSAGE TO SIGN : \"Latch-Web3\"\n\n* Call to Latch Server for pairing as usual, but with the newly methods:\n```\n    let MY_APPID = \"\u003cMY_APPID\u003e\"\n    let MY_SECRETKEY = \"\u003cMY_SECRETKEY\u003e\"\n    \n    let WEB3WALLET = \"\u003cWEB3WALLET\u003e\"\n    let WEB3SIGNATURE = \"\u003cWEB3SIGNATURE\u003e\"\n    let PAIRING_CODE = \"\u003cPAIRING_CODE\u003e\"\n    \n    latch.init({ appId: MY_APPID, secretKey: MY_SECRETKEY });\n    \n    let response = latch.pair(PAIRING_CODE, function (err, result) {\n        if (err) {\n            console.log(util.inspect(err, {showHidden: true, depth: null, colors: true}));\n        } else {\n            console.log(util.inspect(result, {showHidden: true, depth: null, colors: true}));\n        }\n    }, WEB3WALLET, WEB3SIGNATURE);\n```\n\nYou have an example of use in the file [example](examples/example.js)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelefonica%2Flatch-sdk-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftelefonica%2Flatch-sdk-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelefonica%2Flatch-sdk-nodejs/lists"}