{"id":23050206,"url":"https://github.com/questnetwork/quest-crypto-js","last_synced_at":"2025-04-03T03:27:27.181Z","repository":{"id":105958919,"uuid":"296383275","full_name":"QuestNetwork/quest-crypto-js","owner":"QuestNetwork","description":"Crypto For The Quest Network","archived":false,"fork":false,"pushed_at":"2020-10-20T18:13:22.000Z","size":39,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-13T23:16:12.343Z","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":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QuestNetwork.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-17T16:32:08.000Z","updated_at":"2020-10-17T12:37:03.000Z","dependencies_parsed_at":"2023-03-13T14:42:59.397Z","dependency_job_id":null,"html_url":"https://github.com/QuestNetwork/quest-crypto-js","commit_stats":{"total_commits":17,"total_committers":2,"mean_commits":8.5,"dds":0.05882352941176472,"last_synced_commit":"c47eb92640497ca9d4435e34fc15c7a9c3da1a15"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuestNetwork%2Fquest-crypto-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuestNetwork%2Fquest-crypto-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuestNetwork%2Fquest-crypto-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuestNetwork%2Fquest-crypto-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QuestNetwork","download_url":"https://codeload.github.com/QuestNetwork/quest-crypto-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246930628,"owners_count":20856645,"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-12-15T23:20:27.828Z","updated_at":"2025-04-03T03:27:27.155Z","avatar_url":"https://github.com/QuestNetwork.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Quest Crypto JS\n\u003e Shared Crypto Interface For The Quest Network\n\n## Lead Maintainer\n\n[StationedInTheField](https://github.com/StationedInTheField)\n\n## Description\n\nThe Crypto class for the [Quest Network Operating System](https://github.com/QuestNetwork/quest-os-js) offers shared crypto functionality.\n\n## Installation \u0026 Usage\n```\nnpm install @questnetwork/quest-utilities-js@0.9.4\n```\n\n## API\n\n### aes\n\n#### generatePassphrase(length)\n\nReturns a new secure AES passphrase.\n```javascript\nlet pwd = \u003cos\u003e.crypto.aes.generatePassphrase(length);\n```\n\n#### hashSecret(message,newSecret, rounds = 10)\n\nHashes a secret for the specified amount of rounds, anything below 5000 rounds will default to 5000.\n```javascript\nlet hashed = \u003cos\u003e.crypto.aes.hashSecret(message,newSecret, rounds = 10);\n```\n\n#### encrypt(utf8OrObject, whistle = undefined)\n\nEncrypts an object or utf8 string either with the whistle supplied or with a generated new whistle.\nReturns Base64.\n```javascript\nlet { secret, aesEncryptedB64 } = \u003cos\u003e.crypto.aes.encrypt('test');\n```\n\n#### decryptB64(aesEncryptedB64, secret, format = 'utf8')\n\nDecrypts a B64 string with the whistle\nReturns String or Object.\n```javascript\nlet { secret, aesEncryptedB64 } = \u003cos\u003e.crypto.aes.decryptB64(aesEncryptedB64, secret, format = 'utf8')\n```\n\n#### decryptHex(enc,secret, format = 'utf8'\n\nDecrypts a Hex string with the whistle\nReturns String or Object.\n```javascript\nlet { secret, aesEncryptedB64 } = \u003cos\u003e.crypto.aes.decryptHex(aesEncryptedHex, secret, format = 'utf8')\n```\n\n### convert\n\n#### stringToArrayBuffer(string,format)\n\nReturns an ArrayBuffer of the input string.\n```javascript\nlet aB = \u003cos\u003e.crypto.convert.stringToArrayBuffer(string,'utf8');\n```\n\n#### bufferToArrayBuffer(buf)\n\nReturns an ArrayBuffer of the input butter\n```javascript\nlet hashed = \u003cos\u003e.crypto.convert.bufferToArrayBuffer(buf);\n```\n\n#### async importKey(alg,format,keyenc,key)\n\nImports a key for WebCrypto.\n```javascript\nawait \u003cos\u003e.crypto.convert.importKey(alg,format,keyenc,key);\n```\n\n### ec\n\n#### async digest(algo,data)\n\nDigests data using the supplied algorithm.\n```javascript\nlet digest = await \u003cos\u003e.crypto.ec.digest('SHA-256',data);\n```\n\n#### async generateKeyPair()\n\nGenerates an EC keypair with maximum security according to the Quest Network protocol.\n```javascript\nlet keys = await \u003cos\u003e.crypto.ec.generateKeyPair();\n```\n\n#### async sign(obj, keyHex)\nSigns an object with an EC private Hex key according to the Quest Network protocol.\n```javascript\nlet signedObject = await \u003cos\u003e.crypto.ec.sign(obj,keyHex);\n```\n\n#### verify(obj, keyHex)\nVerifies a signed object with an EC public Hex key according to the Quest Network protocol.\n```javascript\nif(await \u003cos\u003e.crypto.ec.verify(obj,keyHex)){\n  console.log('Signature Checks Out!');\n}\n```\n\n### rsa\n\n#### async generateKeyPair()\n\nGenerates an RSA keypair with maximum security according to the Quest Network protocol.\n```javascript\nlet keys = await \u003cos\u003e.crypto.rsa.generateKeyPair();\n```\n\n#### async fullEncrypt(plain,pubKey)\n\nEncrypts a string with an RSA private key\n```javascript\nlet encrypted = await \u003cos\u003e.crypto.rsa.fullEncrypt(plain,pubKey);\n```\n\n\n#### async fullDecrypt(enc,pk)\nDecrypts a string with an RSA public key\n```javascript\nlet decrypted = await \u003cos\u003e.crypto.rsa.fullDecrypt(encrypted,pk);\n```\n\n\n## Support Us\nPlease consider supporting us, so that we can build a non-profit for this project (ツ)\n\n| Ethereum| Bitcoin |\n|---|---|\n| `0xBC2A050E7B87610Bc29657e7e7901DdBA6f2D34E` | `bc1qujrqa3s34r5h0exgmmcuf8ejhyydm8wwja4fmq`   |\n|  \u003cimg src=\"https://github.com/QuestNetwork/qDesk/raw/master/doc/images/eth-qr.png\" \u003e   | \u003cimg src=\"https://github.com/QuestNetwork/qDesk/raw/master/doc/images/btc-qr.png\" \u003e |\n\n## License\n\nGNU AGPLv3\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquestnetwork%2Fquest-crypto-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquestnetwork%2Fquest-crypto-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquestnetwork%2Fquest-crypto-js/lists"}