{"id":22608956,"url":"https://github.com/bitfinexcom/dazaar-payment-lightning","last_synced_at":"2025-10-06T12:58:11.852Z","repository":{"id":52783464,"uuid":"235370198","full_name":"bitfinexcom/dazaar-payment-lightning","owner":"bitfinexcom","description":null,"archived":false,"fork":false,"pushed_at":"2021-04-19T15:37:37.000Z","size":163,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-24T11:26:50.605Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitfinexcom.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-21T15:07:02.000Z","updated_at":"2022-01-14T10:13:55.000Z","dependencies_parsed_at":"2022-08-23T01:00:55.010Z","dependency_job_id":null,"html_url":"https://github.com/bitfinexcom/dazaar-payment-lightning","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/bitfinexcom/dazaar-payment-lightning","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fdazaar-payment-lightning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fdazaar-payment-lightning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fdazaar-payment-lightning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fdazaar-payment-lightning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitfinexcom","download_url":"https://codeload.github.com/bitfinexcom/dazaar-payment-lightning/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fdazaar-payment-lightning/sbom","scorecard":{"id":240190,"data":{"date":"2025-08-11","repo":{"name":"github.com/bitfinexcom/dazaar-payment-lightning","commit":"7da26f66257260469069ef80d779a88bc91bdf93"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.1,"checks":[{"name":"Code-Review","score":3,"reason":"Found 7/19 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":5,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'master'","Info: 'force pushes' disabled on branch 'master'","Info: 'branch protection settings apply to administrators' is required to merge on branch 'master'","Info: 'stale review dismissal' is required to merge on branch 'master'","Info: required approving review count is 2 on branch 'master'","Warn: codeowners review is not required on branch 'master'","Warn: 'last push approval' is disabled on branch 'master'","Warn: no status checks found to merge onto branch 'master'","Info: PRs are required in order to make changes on branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 18 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T06:34:26.627Z","repository_id":52783464,"created_at":"2025-08-17T06:34:26.627Z","updated_at":"2025-08-17T06:34:26.627Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278614466,"owners_count":26015967,"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-10-06T02:00:05.630Z","response_time":65,"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":"2024-12-08T15:10:22.922Z","updated_at":"2025-10-06T12:58:11.809Z","avatar_url":"https://github.com/bitfinexcom.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @dazaar/payment-lightning\nLightning payment api for Dazaar stream services\n\n## Usage\n### Options\n```js\nconst lightningOpts = {\n  cert: ..., // base64 encoded string of tls.cert\n  macaroon: ..., // base64 encoded string of macaroon\n  network: ..., // mainnet / testnet / regtest\n  host: ..., // \u003chost\u003e:\u003cport\u003e\n  oninvoice: function (invoice) {\n    // handle incoming invoice, e.g. display as QR\n  }\n}\n\nconst paymentCard = {\n  method: 'Lightning',\n  currency: 'BTC', // may also be LightningSats\n  amount: '0.002',\n  unit: 'hours',\n  interval: 1,\n  minSeconds: 1, // minimum amount of streamtime\n}\n```\n\n### Seller\n```js\nconst Payment = require('@dazaar/payment-lightning')\nconst market = require('dazaar')\nconst hypercore = require('hypercore')\n\nconst m = market('./tmp')\nconst feed = hypercore('./tmp/data')\n\nlet payment\n\n// instantiate a seller for a feed and equip it\n// with a validate function\nconst seller = m.sell(feed, {\n  validate (remoteKey, cb) {\n    payee.validate(remoteKey, cb)\n  }\n})\n\nseller.ready(function (err) {\n  payment = new Payment(seller, paymentCard, lightningOpts)\n  \n  // payment now set up. dazaar logic follows ... \n})\n```\n\n### Buyer\nOn a separate machine with the  \n```js\n// instantiate a buyer for a specific feed \nconst buyer = m.buy(seller.key)\n\n// set up pay payment linked to the buyer\nconst payment = new Payment(buyer, null, lightningOpts)\n\n// buy an amount of feed\npayment.buy(800) // oninvoice handles response\n```\n\n## API\n#### `const payment = Payment(seller, payment, options)`\nCreate a new lightning payment instance associated to a seller. `seller` should be a dazaar seller instance, `payment` may either be a dazaar payment card, or a string specifying the per second rate in either `BTC` or `Sats`, such as `200 Sats/s`. Options include:\n```js\n{\n  cert: ..., // base64 encoded string of tls.cert\n  macaroon: ..., // base64 encoded string of macaroon\n  network: ..., // mainnet / testnet / regtest\n  implementation: ..., // 'c-lightning' or 'lnd'\n  oninvoice: function (invoice) {\n    // handle incoming invoice, e.g. display as QR\n  }\n}\n```\n\n#### `payment.validate(buyerKey, cb)`\nA seller can validate the time left for a given buyer. Returns `error` if there is no time left on the subscription. The method shall check whether the given buyer has a subscription set-up and instantiate one not already present.\n\n#### `payment.requestInvoice(amount, cb)`\nRequest a specified amount for the stream that this buyer is registered to. `amount` is specified in satoshis (1 x 10\u003csup\u003e-8\u003c/sup\u003e BTC). The invoice is passed to the user so there is no need for a lightning node to be connected in order to call this API. `oninvoice` handles the returned invoice, which is passed to the constructor.\n\n#### `payment.sell(request, buyerKey, cb)`\nServe an invoice for a given `request`. For this to be called it is required that a lightning node is connected with at least `invoice.macaroon` provided.\n\n#### `payment.buy(seller, amount, auth,cb)`\n`seller` and `auth` should be passed as `null`. Request an invoice and pay it upon receipt. For this to be called it is required that a lightning node is connected with `admin.macaroon` provided.\n\n#### `payment.destroy()`\nDestroy the payment provider\n\n## Setup\n\nRefer to the [setup guide](SETUP.md) for instructions on how to install a lightning node implementation and set up a test environment.\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfinexcom%2Fdazaar-payment-lightning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitfinexcom%2Fdazaar-payment-lightning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfinexcom%2Fdazaar-payment-lightning/lists"}