{"_id":"@chainsafe/as-chacha20poly1305","_rev":"4666052","name":"@chainsafe/as-chacha20poly1305","description":"An AssemblyScript implementation of chacha20poly1305","dist-tags":{"latest":"0.1.0"},"maintainers":[{"name":"philknows","email":""},{"name":"wemeetagain","email":""}],"time":{"modified":"2026-04-10T22:42:07.000Z","created":"2022-11-21T21:25:49.014Z","0.1.0":"2022-11-21T21:25:49.014Z"},"users":{},"author":{"name":"ChainSafe Systems"},"repository":{"type":"git","url":"git+https://github.com/chainsafe/as-chacha20poly1305.git"},"versions":{"0.1.0":{"name":"@chainsafe/as-chacha20poly1305","version":"0.1.0","description":"An AssemblyScript implementation of chacha20poly1305","author":{"name":"ChainSafe Systems"},"license":"Apache-2.0","bugs":{"url":"https://github.com/ChainSafe/as-chacha20poly1305/issues"},"homepage":"https://github.com/ChainSafe/as-chacha20poly1305#readme","repository":{"type":"git","url":"git+https://github.com/chainsafe/as-chacha20poly1305.git"},"main":"lib/src/index.js","types":"lib/src/index.d.ts","scripts":{"prebuild":"rm -rf ./dist && node -r ts-node/register ./scripts/codegen.ts","prepublish":"yarn build","build":"yarn asbuild:untouched && yarn asbuild:optimized && yarn build:lib","asbuild:untouched":"asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --runtime none --validate --debug","asbuild:optimized":"asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat --runtime none --validate -O3z --noAssert","build:lib":"tsc -p tsconfig.build.json","build:web":"webpack --mode production --entry ./index.js --output ./dist/as-chacha20poly1305.min.js","test":"yarn run test:unit","test:unit":"yarn run test:unit:node","test:unit:node":"mocha -r ts-node/register test/unit/*.test.ts","test:unit:browser":"karma start --single-run --browsers ChromeHeadless,FirefoxHeadless karma.config.js","benchmark":"node -r ts-node/register node_modules/.bin/benchmark 'test/perf/*.test.ts'","benchmark:local":"yarn benchmark --local"},"devDependencies":{"@as-pect/assembly":"2.8.1","@as-pect/cli":"2.8.1","@as-pect/core":"2.8.1","@stablelib/chacha":"^1.0.1","@stablelib/poly1305":"^1.0.1","@stablelib/chacha20poly1305":"^1.0.1","assemblyscript":"0.9.2","@dapplion/benchmark":"^0.2.2","@types/chai":"^4.2.15","@types/mocha":"^8.2.2","@types/node":"^14.14.17","@typescript-eslint/eslint-plugin":"^4.19.0","@typescript-eslint/parser":"^4.19.0","chai":"^4.3.4","eslint":"^7.30.0","eslint-plugin-import":"^2.23.4","eslint-plugin-no-only-tests":"^2.4.0","eslint-plugin-node":"^11.1.0","eslint-plugin-prettier":"^3.3.1","karma":"^6.3.16","karma-babel-preprocessor":"^8.0.1","karma-chai":"^0.1.0","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^1.2.0","karma-mocha":"^1.3.0","karma-webpack":"^5.0.0","mocha":"^8.3.2","nyc":"^15.0.0","prettier":"^2.2.1","ts-loader":"^9.2.8","ts-node":"^9.1.1","typescript":"~4.2.3","webpack":"^5.43.0","webpack-cli":"^4.7.2","webpack-dev-server":"^3.11.2"},"gitHead":"8f9827af7911f55a1b52d97009113423da5db4cb","_id":"@chainsafe/as-chacha20poly1305@0.1.0","_nodeVersion":"16.15.0","_npmVersion":"8.10.0","dist":{"shasum":"7da6f8796f9b42dac6e830a086d964f1f9189e09","size":39074,"noattachment":false,"key":"/@chainsafe/as-chacha20poly1305/-/@chainsafe/as-chacha20poly1305-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@chainsafe/as-chacha20poly1305/download/@chainsafe/as-chacha20poly1305-0.1.0.tgz"},"_npmUser":{"name":"wemeetagain","email":"caymannava@gmail.com"},"directories":{},"maintainers":[{"name":"philknows","email":""},{"name":"wemeetagain","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/as-chacha20poly1305_0.1.0_1669065948796_0.36350253768012175"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-11-21T21:35:48.759Z","publish_time":1669065949014,"_cnpm_publish_time":1669065949014}},"readme":"# as-chacha20poly1305\n\nAssemblyScript implementation of chacha20poly1305, it's 20% - 60% faster compared to stablelib with no memory allocation in the middle.\n\nThis was ported from the typescript version https://github.com/StableLib/stablelib/tree/master/packages/chacha20poly1305\n\n## Usage\n\n`yarn add @chainsafe/as-chacha20poly1305`\n\n```typescript\nconst ctx = newInstance();\nconst asImpl = new ChaCha20Poly1305(ctx);\nconst key = new Uint8Array(crypto.randomBytes(KEY_LENGTH));\nconst nonce = new Uint8Array(crypto.randomBytes(NONCE_LENGTH));\nconst plainText = new Uint8Array(crypto.randomBytes(512));\nconst ad = new Uint8Array(crypto.randomBytes(32))\nconst asSealed = asImpl.seal(key, nonce, plainText, ad);\n// overwrite sealed to save memory allocation\nconst plainText2 = asImpl.open(key, nonce, sealed, true, ad);\nexpect(plainText2).to.be.deep.equal(plainText);\n```\n\n### License\n\nApache 2.0\n","_attachments":{},"homepage":"https://github.com/ChainSafe/as-chacha20poly1305#readme","bugs":{"url":"https://github.com/ChainSafe/as-chacha20poly1305/issues"},"license":"Apache-2.0"}