{"id":25944958,"url":"https://github.com/path-check/cred-sdk.js","last_synced_at":"2025-03-04T08:20:19.185Z","repository":{"id":51359007,"uuid":"366409682","full_name":"Path-Check/cred-sdk.js","owner":"Path-Check","description":"Verifiable QR SDK for PathCheck's URI DataModels","archived":false,"fork":false,"pushed_at":"2021-10-19T16:04:41.000Z","size":1327,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-11-22T21:55:12.410Z","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/Path-Check.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":"2021-05-11T14:26:02.000Z","updated_at":"2022-01-07T21:24:47.000Z","dependencies_parsed_at":"2022-09-09T20:20:48.672Z","dependency_job_id":null,"html_url":"https://github.com/Path-Check/cred-sdk.js","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Path-Check%2Fcred-sdk.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Path-Check%2Fcred-sdk.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Path-Check%2Fcred-sdk.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Path-Check%2Fcred-sdk.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Path-Check","download_url":"https://codeload.github.com/Path-Check/cred-sdk.js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241810046,"owners_count":20023886,"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":"2025-03-04T08:20:18.156Z","updated_at":"2025-03-04T08:20:19.172Z","avatar_url":"https://github.com/Path-Check.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Verifiable QR SDK for PathCheck's URI DataModels\n\nJavaScript Implementation of [PaperCreds](https://github.com/Path-Check/paper-cred), a URI-based Verifiable QR Credentials. \n\n# Install\n```sh\nnpm install @pathcheck/cred-sdk --save\n```\n\n# Setting up the Keys and Key ID Resolver via DNS\n\n## Create a Private/Public Elliptic Curve Key Pair\n\nPrivate Key: \n```sh\nopenssl ecparam -name secp256k1 -genkey -out private.pem\n```\n\nIt will generate something like:\n\n```\n-----BEGIN EC PARAMETERS-----\nBgUrgQQACg==\n-----END EC PARAMETERS-----\n-----BEGIN EC PRIVATE KEY-----\nMHQCAQEEIPWKbSezZMY1gCpvN42yaVv76Lo47FvSsVZpQl0a5lWRoAcGBSuBBAAK\noUQDQgAE6DeIun4EgMBLUmbtjQw7DilMJ82YIvOR2jz/IK0R/F7/zXY1z+gqvFXf\nDcJqR5clbAYlO9lHmvb4lsPLZHjugQ==\n-----END EC PRIVATE KEY-----\n```\n\nPublic Key:\n```sh\nopenssl ec -in private.pem -pubout -out public.pem\n```\n\nResulting in: \n\n```\n-----BEGIN PUBLIC KEY-----\nMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE6DeIun4EgMBLUmbtjQw7DilMJ82YIvOR\n2jz/IK0R/F7/zXY1z+gqvFXfDcJqR5clbAYlO9lHmvb4lsPLZHjugQ==\n-----END PUBLIC KEY-----\n```\n\n## Publish the Public Key in the DNS\n\nSeparate the Base64 component of the public key and replace the new line with `\\\\n`: \n\n```\nMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE6DeIun4EgMBLUmbtjQw7DilMJ82YIvOR\\\\n2jz/IK0R/F7/zXY1z+gqvFXfDcJqR5clbAYlO9lHmvb4lsPLZHjugQ==\n```\n\nInsert a new DNS TXT Record with the base64 Segment. \n\nYou can test the DNS Lookup with: \n\n```sh\ndig -t txt \u003cYOUR DOMAIN\u003e\n```\n\nExample: \n\n```sh\ndig -t txt keys.pathcheck.org\n```\n\n# Usage\n\nWith the keys: \n\n```js\nconst PRIVATE_KEY = `\n-----BEGIN EC PARAMETERS-----\nBgUrgQQACg==\n-----END EC PARAMETERS-----\n-----BEGIN EC PRIVATE KEY-----\nMHQCAQEEIPWKbSezZMY1gCpvN42yaVv76Lo47FvSsVZpQl0a5lWRoAcGBSuBBAAK\noUQDQgAE6DeIun4EgMBLUmbtjQw7DilMJ82YIvOR2jz/IK0R/F7/zXY1z+gqvFXf\nDcJqR5clbAYlO9lHmvb4lsPLZHjugQ==\n-----END EC PRIVATE KEY-----\n`;\n\nconst PUB_KEY_ID = \"KEYS.PATHCHECK.ORG\"\n```\n\nAnd a Payload \n\n```js\nconst BADGE_PAYLOAD = [\"20210511\", \"MODERNA\", \"COVID19\", \"012L20A\", \"28\", \"\", \"C28161\", \"RA\", \"500\", \"JANE DOE\", \"19820321\"];\n```\n\nCall the signAndPack to create the URI for the QR Code: \n\n```js\nconst qrUri = await signAndPack(\"BADGE\", \"2\", PRIVATE_KEY, PUB_KEY_ID, BADGE_PAYLOAD);\n```\n\nAnd call the unpack and verify to convert the URI into the payload: \n\n```js\nconst payloadArray = await unpackAndVerify(qrUri);\n```\n\n# Development\n\n```sh\nnpm install\n``` \n\n# Test\n\n```sh\nnpm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpath-check%2Fcred-sdk.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpath-check%2Fcred-sdk.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpath-check%2Fcred-sdk.js/lists"}