{"id":21519128,"url":"https://github.com/dcspark/catalyst-registration-js","last_synced_at":"2025-10-28T03:02:34.163Z","repository":{"id":57106534,"uuid":"454394291","full_name":"dcSpark/catalyst-registration-js","owner":"dcSpark","description":null,"archived":false,"fork":false,"pushed_at":"2023-06-02T02:48:38.000Z","size":94,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-25T14:54:37.608Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dcSpark.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":"2022-02-01T13:16:43.000Z","updated_at":"2023-11-29T20:09:00.000Z","dependencies_parsed_at":"2022-08-20T23:50:26.607Z","dependency_job_id":null,"html_url":"https://github.com/dcSpark/catalyst-registration-js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcSpark%2Fcatalyst-registration-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcSpark%2Fcatalyst-registration-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcSpark%2Fcatalyst-registration-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcSpark%2Fcatalyst-registration-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcSpark","download_url":"https://codeload.github.com/dcSpark/catalyst-registration-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244073710,"owners_count":20393877,"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-11-24T00:55:56.690Z","updated_at":"2025-10-28T03:02:34.099Z","avatar_url":"https://github.com/dcSpark.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Catalyst Registration\n\nThis is a JS implementation of the Catalyst registration logic as defined in [CIP15](https://github.com/cardano-foundation/CIPs/tree/master/CIP-0015).\n\nThis package requires you to inject [cardano-serialization-lib](https://github.com/Emurgo/cardano-serialization-lib/) for the cryptography.\n\n## Install\n\n```sh\nnpm i @dcSpark/catalyst-registration-js --save\n```\n\n## Usage\n\n### Create encrypted key\n\n```ts\nimport * as cip15 from \"@dcSpark/catalyst-registration-js\";\nimport CSL from \"@emurgo/cardano-serialization-lib-nodejs\";\n\n// either get a user-selected PIN code or random one\nconst pin = cip15.generatePin(); // ex: [1,1,1,1]\n\n// encryption key from the pin\nconst passBuff = Buffer.from(pin);\n\n// generate a key for Catalyst\nconst catalystKey = cip15.generatePrivateKeyForCatalyst(CSL);\n\n// encrypt the key with the pin\nconst encryptedKey = await cip15.encryptWithPassword(passBuff, catalystKey.as_bytes());\n```\n\n### Create registration metadata (software wallet)\n\n```ts\nimport * as cip15 from \"@dcSpark/catalyst-registration-js\";\nimport CSL from \"@emurgo/cardano-serialization-lib-nodejs\";\n\nconst catalystKey = ... // CSL.PrivateKey\nconst stakePrivateKey = ... // CSL.PrivateKey\nconst rewardAddresss = ... // CSL.RewardAddress\nconst slotNumber = ... // number\n\nconst metadata = cip15.generateRegistrationMetadata(\n    CSL,\n    Buffer.from(catalystKey.to_public().as_bytes()).toString(\n      \"hex\"\n    ),\n    Buffer.from(stakePrivateKey.to_public().as_bytes()).toString(\"hex\"),\n    Buffer.from(rewardAddresss.to_address().to_bytes()),\n    slotNumber,\n    (hashedMetadata) =\u003e stakePrivateKey.sign(hashedMetadata).to_hex()\n  );\n```\n\n### Create registration metadata (hardware wallet)\n\n```ts\nimport * as cip15 from \"@dcSpark/catalyst-registration-js\";\nimport CSL from \"@emurgo/cardano-serialization-lib-nodejs\";\n\nconst catalystKey = ... // CSL.PrivateKey\nconst stakePrivateKey = ... // CSL.PrivateKey\nconst rewardAddresss = ... // CSL.RewardAddress\nconst slotNumber = ... // number\n\nconst metadata = cip15.generateRegistrationMetadata(\n    CSL,\n    Buffer.from(catalystKey.to_public().as_bytes()).toString(\n      \"hex\"\n    ),\n    Buffer.from(stakePrivateKey.to_public().as_bytes()).toString(\"hex\"),\n    Buffer.from(rewardAddresss.to_address().to_bytes()),\n    slotNumber,\n    (_hashedMetadata) =\u003e {\n      // for hardware wallets, we have to include dummy data\n      // since the signature will be replaced later by the hardware wallet itself\n      return '0'.repeat(64 * 2);\n    }\n  );\n \n// you will have to call the above-function twice. Once with mock data (as shown) and once with data you get from the hw wallet\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcspark%2Fcatalyst-registration-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcspark%2Fcatalyst-registration-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcspark%2Fcatalyst-registration-js/lists"}