{"action":"created","issue":{"url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/issues/566","repository_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib","labels_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/issues/566/labels{/name}","comments_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/issues/566/comments","events_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/issues/566/events","html_url":"https://github.com/bitcoinjs/bitcoinjs-lib/issues/566","id":146956086,"number":566,"title":"Can I use bitcoinjs to authenticate with bitid?","user":{"login":"dicoy","id":420863,"avatar_url":"https://avatars.githubusercontent.com/u/420863?v=3","gravatar_id":"","url":"https://api.github.com/users/dicoy","html_url":"https://github.com/dicoy","followers_url":"https://api.github.com/users/dicoy/followers","following_url":"https://api.github.com/users/dicoy/following{/other_user}","gists_url":"https://api.github.com/users/dicoy/gists{/gist_id}","starred_url":"https://api.github.com/users/dicoy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dicoy/subscriptions","organizations_url":"https://api.github.com/users/dicoy/orgs","repos_url":"https://api.github.com/users/dicoy/repos","events_url":"https://api.github.com/users/dicoy/events{/privacy}","received_events_url":"https://api.github.com/users/dicoy/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-08T15:13:58Z","updated_at":"2016-04-08T19:52:59Z","closed_at":null,"body":""},"comment":{"url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/issues/comments/207576448","html_url":"https://github.com/bitcoinjs/bitcoinjs-lib/issues/566#issuecomment-207576448","issue_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/issues/566","id":207576448,"user":{"login":"coreyphillips","id":8532651,"avatar_url":"https://avatars.githubusercontent.com/u/8532651?v=3","gravatar_id":"","url":"https://api.github.com/users/coreyphillips","html_url":"https://github.com/coreyphillips","followers_url":"https://api.github.com/users/coreyphillips/followers","following_url":"https://api.github.com/users/coreyphillips/following{/other_user}","gists_url":"https://api.github.com/users/coreyphillips/gists{/gist_id}","starred_url":"https://api.github.com/users/coreyphillips/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coreyphillips/subscriptions","organizations_url":"https://api.github.com/users/coreyphillips/orgs","repos_url":"https://api.github.com/users/coreyphillips/repos","events_url":"https://api.github.com/users/coreyphillips/events{/privacy}","received_events_url":"https://api.github.com/users/coreyphillips/received_events","type":"User","site_admin":false},"created_at":"2016-04-08T19:52:59Z","updated_at":"2016-04-08T19:52:59Z","body":"Yes, but you will also need bitcoinjs-message located here (https://github.com/bitcoinjs/bitcoinjs-message) to create the signature.\r\n\r\nI've successfully implemented bitcoinjs-lib and bitcoinjs-message for use with BitId in a react native app so that's what I'll use as the example. The implementation is pretty straight forward and summed up below:\r\n```\r\nvar msgkeyPair = bitcoin.ECPair.fromWIF(privkey);\r\nvar message = uri;\r\nvar signature = bitcoinMessage.sign(msgkeyPair, message);\r\nvar signature = signature.toString('base64');\r\nfetch(url, {\r\n  method: \"POST\",\r\n  headers: {'Accept': 'application/json', 'Content-Type': 'application/json'},\r\n  body: JSON.stringify({uri: uri, address: address, signature: signature})\r\n})\r\n```\r\n\r\nThe best example I could find for the callback format is located here (https://docs.google.com/presentation/d/19iODrgKsVigsA17csNF3HU75UG9eiI5Z6cX2OczvIsw/pub?slide=id.g12ca75bea_0117) from the BitId docs. Hopefully this helps."}}