{"id":19426394,"url":"https://github.com/ar-nelson/monocypher-wasm","last_synced_at":"2025-04-24T17:31:05.340Z","repository":{"id":57302525,"uuid":"324442626","full_name":"ar-nelson/monocypher-wasm","owner":"ar-nelson","description":"WebAssembly port and JS wrapper library for Monocypher (https://monocypher.org)","archived":false,"fork":false,"pushed_at":"2022-08-09T17:39:20.000Z","size":2978,"stargazers_count":21,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-19T01:57:41.783Z","etag":null,"topics":["cryptography","monocypher","nodejs","webassembly"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ar-nelson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-25T22:28:13.000Z","updated_at":"2025-03-05T06:09:32.000Z","dependencies_parsed_at":"2022-09-06T00:20:09.260Z","dependency_job_id":null,"html_url":"https://github.com/ar-nelson/monocypher-wasm","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ar-nelson%2Fmonocypher-wasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ar-nelson%2Fmonocypher-wasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ar-nelson%2Fmonocypher-wasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ar-nelson%2Fmonocypher-wasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ar-nelson","download_url":"https://codeload.github.com/ar-nelson/monocypher-wasm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250674259,"owners_count":21469186,"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":["cryptography","monocypher","nodejs","webassembly"],"created_at":"2024-11-10T14:07:30.554Z","updated_at":"2025-04-24T17:31:04.801Z","avatar_url":"https://github.com/ar-nelson.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Monocypher WebAssembly Port\n\nThis is a Typescript+WASM port of [Monocypher][monocypher], a new cryptography library similar to\nlibsodium. It consists of a WASM-compiled Monocypher library and a Typescript wrapper for functions\nexported by this library.\n\nMost of Monocypher's functions are available, with the exception of the \"incremental\" functions that\nrequire counters or context pointers. The APIs of these functions have been changed to remove most\nlength arguments, and to create and return output buffers directly rather than taking them as\narguments.\n\n## Usage\n\nMonocypher can be used from Node, Deno, and the browser:\n\n```javascript\n// Node\nconst { crypto_blake2b } = require('monocypher-wasm');\n\n// Deno\nimport { crypto_blake2b } from 'https://deno.land/x/monocypher@v3.1.2-4/mod.ts';\n\n// Browser (only 24KB gzipped!)\nimport { crypto_blake2b } from 'https://raw.githubusercontent.com/ar-nelson/monocypher-wasm/v3.1.2-4/monocypher.min.js';\n```\n\nUnlike previous versions of this package, the API is synchronous, and no `ready` promise is needed.\n`ready` is still included for backward compatibility.\n\n## API\n\n\u003e **Note:** An `InputBuffer` is either a `Uint8Array`, an array of numbers, or `null`.\n\n```typescript\ncrypto_blake2b(message: InputBuffer): Uint8Array\ncrypto_blake2b_general(hash_size: number, key: InputBuffer, message: InputBuffer): Uint8Array\n\ncrypto_chacha20(plain_text: InputBuffer, key: InputBuffer, nonce: InputBuffer): Uint8Array\ncrypto_xchacha20(plain_text: InputBuffer, key: InputBuffer, nonce: InputBuffer): Uint8Array\n\n// crypto_curve_to_hidden returns null on failure\ncrypto_curve_to_hidden(curve: InputBuffer, tweak: number): Uint8Array | null\ncrypto_hidden_to_curve(hidden: InputBuffer): Uint8Array\ncrypto_hidden_key_pair(seed: InputBuffer): { hidden: Uint8Array, secret_key: Uint8Array }\n\ncrypto_from_eddsa_private(eddsa: InputBuffer): Uint8Array\ncrypto_from_eddsa_public(eddsa: InputBuffer): Uint8Array\n\ncrypto_hchacha20(key: InputBuffer, in_: InputBuffer): Uint8Array\n\ncrypto_ietf_chacha20(plain_text: InputBuffer, key: InputBuffer, nonce: InputBuffer): Uint8Array\n\ncrypto_key_exchange(your_secret_key: InputBuffer, their_public_key: InputBuffer): Uint8Array\ncrypto_key_exchange_public_key(your_secret_key: InputBuffer): Uint8Array\n\n// crypto_unlock functions return null on failure\ncrypto_lock(key: InputBuffer, nonce: InputBuffer, plain_text: InputBuffer): Uint8Array\ncrypto_unlock(key: InputBuffer, nonce: InputBuffer, cipher_text: InputBuffer): Uint8Array | null\ncrypto_lock_aead(key: InputBuffer, nonce: InputBuffer, ad: InputBuffer, plain_text: InputBuffer): Uint8Array\ncrypto_unlock_aead(key: InputBuffer, nonce: InputBuffer, ad: InputBuffer, cipher_text: InputBuffer): Uint8Array | null\n\ncrypto_poly1305(message: InputBuffer, key: InputBuffer): Uint8Array\n\ncrypto_sign_public_key(secret_key: InputBuffer): Uint8Array\ncrypto_sign(secret_key: InputBuffer, public_key: InputBuffer, message: InputBuffer): Uint8Array\ncrypto_check(signature: InputBuffer, public_key: InputBuffer, message: InputBuffer): boolean\n\ncrypto_verify16(a: InputBuffer, b: InputBuffer): boolean\ncrypto_verify32(a: InputBuffer, b: InputBuffer): boolean\ncrypto_verify64(a: InputBuffer, b: InputBuffer): boolean\n\ncrypto_x25519(your_secret_key: InputBuffer, their_public_key: InputBuffer): Uint8Array\ncrypto_x25519_public_key(your_secret_key: InputBuffer): Uint8Array\n\ncrypto_x25519_dirty_fast(sk: InputBuffer): Uint8Array\ncrypto_x25519_dirty_small(sk: InputBuffer): Uint8Array\n\ncrypto_x25519_inverse(private_key: InputBuffer, curve_point: InputBuffer): Uint8Array\n\nHASH_BYTES: 64\nKEY_BYTES: 32\nNONCE_BYTES: 24\nMAC_BYTES: 16\nCHACHA20_NONCE_BYTES: 8\n```\n\n## Compilation and Testing\n\nThe repo contains the Deno (`mod.ts`) and browser (`monocypher.min.js`) modules. The Node module\nmust be built with `dnt`.\n\nThe build process is defined in a GNU Makefile.\n\n`make` will rebuild everything, including the Node module, and run tests in both Deno and Node. It\nwill even redownload the Monocypher sources from [monocypher.org][monocypher].\n\n`make` requires `clang`, `lld`, `deno`, `npm`, `esbuild`, `curl`, and a Unix environment.\n\n## License\n\nLike Monocypher itself, this project is public domain, via the [CC0][cc0] license.\n\nThis project contains code from [`wingo/walloc`][walloc], which is available under\n[a permissive MIT-style license][walloc-license].\n\n[monocypher]: https://monocypher.org/\n[cc0]: https://creativecommons.org/share-your-work/public-domain/cc0/\n[walloc]: https://github.com/wingo/walloc\n[walloc-license]: https://github.com/wingo/walloc/blob/a93409f5ebd49c875514c5fee30d3b151f7b0882/LICENSE.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Far-nelson%2Fmonocypher-wasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Far-nelson%2Fmonocypher-wasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Far-nelson%2Fmonocypher-wasm/lists"}