{"id":26665315,"url":"https://github.com/elsehow/halite","last_synced_at":"2025-06-12T02:43:47.693Z","repository":{"id":57260359,"uuid":"54798742","full_name":"elsehow/halite","owner":"elsehow","description":"a small wrapper for tweetnacl","archived":false,"fork":false,"pushed_at":"2016-03-31T20:19:22.000Z","size":10,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-16T19:14:08.855Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elsehow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-26T20:44:21.000Z","updated_at":"2021-10-07T05:49:42.000Z","dependencies_parsed_at":"2022-08-26T13:11:50.236Z","dependency_job_id":null,"html_url":"https://github.com/elsehow/halite","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/elsehow%2Fhalite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elsehow%2Fhalite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elsehow%2Fhalite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elsehow%2Fhalite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elsehow","download_url":"https://codeload.github.com/elsehow/halite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245511366,"owners_count":20627376,"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-25T17:36:49.811Z","updated_at":"2025-03-25T17:36:50.380Z","avatar_url":"https://github.com/elsehow.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# halite\n\nencrypt and decrypt UTF-8 strings with [tweetnacl](https://github.com/dchest/tweetnacl-js)\n\n## usage \n\n```javascript\nvar halite = require('halite')\n\nvar message = 'hi guys'\n// make a nonce\nvar n = halite.makenonce()\n// generate two keypairs\nvar kp1 = halite.keypair()\nvar kp2 = halite.keypair()\n// kp1 encrypts a message for kp2\nvar enc = halite.encrypt(message, n, halite.pk(kp2), halite.sk(kp1))\n// kp2 decrypts the message with kp1's public key\nvar dec = halite.decrypt(enc, n, halite.pk(kp1), halite.sk(kp2))\nconsole.log(dec)\n// \u003e 'hi guys'\n```\n \n## encrypt / decrypt api\n\n### halte.keypair()\n\ngenerate a keypair\n\n### halite.makenonce()\n\ngenerate a nonce\n\n### halite.encrypt(str, nonce, pubkey, secretkey)\n\nreturns encrypted message as a Uint8Array\n\n### halite.encrypt(arr, nonce, pubkey, secretkey)\n\nreturns a string. arr should be a Unit8Array\n\n## sign / verify api\n\n### halite.signKeypair()\n\ngenerate a keypair for signing\n\n### sign(str, sk)\n\nreturns signed message as a Uint8Array\n\n### verify(arr, pk)\n\nreturns a clertext message if arr (a Uint8Arr) is signed from pk. returns `null` if validation fails.\n\n### helper functions\n\n### halite.pk(kp)\n\nget the public key of a keypair `kp`\n\n### halite.sk(kp)\n\nget the secret key of a keypair `kp`\n\n### halite.serialize(u8a) / halite.deserialize(arr)\n\nconverts u8a to str and back again. this is convenient for seding uint8arrays over the wire. e.g.,\n\n```javascript\n// this doesnt work!\nvar a= new Uint8Array([1, 2,3])\nJSON.parse(JSON.stringify(a)) === a\n// \u003e false\n\n// but this works!!\nvar overWire = JSON.stringify(halite.serialize(a)) \nhalite.deserialize(JSON.parse(overWire)) === a\n// \u003e true\n```\n## developing\n\nto run the tests\n\n    npm test\n\nwhen developing, you can watch for changes and re-run tests automatically\n\n    npm run watch\n\n## license\n\nBSD\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felsehow%2Fhalite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felsehow%2Fhalite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felsehow%2Fhalite/lists"}