{"_id":"@attocash/commons-core","_rev":"5-c149324d66f697c56bc28aa11ab14295","name":"@attocash/commons-core","dist-tags":{"latest":"8.0.0"},"versions":{"6.7.0":{"name":"@attocash/commons-core","version":"6.7.0","keywords":["atto","kotlin","kotlin-js","cryptocurrency"],"license":"BSD-3-Clause","_id":"@attocash/commons-core@6.7.0","maintainers":[{"name":"attocash","email":"felipe@atto.cash"}],"homepage":"https://atto.cash","bugs":{"url":"https://github.com/attocash/commons/issues"},"dist":{"shasum":"44d43d716b8def9f77079bba7c70c770332e1107","tarball":"https://registry.npmjs.org/@attocash/commons-core/-/commons-core-6.7.0.tgz","fileCount":6,"integrity":"sha512-4z/FlIkxeFDdkLND3Hfvb+lauMn6CYy1friH6qZae2tvaCJDnqQcJzA2ri0Nu49gMNocVPqeuhT4mzLpMTxn1Q==","signatures":[{"sig":"MEUCIG56W9mxyofogQCTUSLFOUsV89PIfTMD8alHXhoC+9KaAiEA+HVUdSTqB0tKbFAeDURJmvDUJQBWZvkOGpQm/fa6jX8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1405196},"main":"commons-commons-core.mjs","_from":"file:commons-core/build/packages/attocash-commons-core-6.7.0.tgz","types":"commons-commons-core.d.mts","_npmUser":{"name":"attocash","email":"felipe@atto.cash"},"_resolved":"/var/home/felipe/IdeaProjects/commons/commons-core/build/packages/attocash-commons-core-6.7.0.tgz","_integrity":"sha512-4z/FlIkxeFDdkLND3Hfvb+lauMn6CYy1friH6qZae2tvaCJDnqQcJzA2ri0Nu49gMNocVPqeuhT4mzLpMTxn1Q==","repository":{"url":"git+https://github.com/attocash/commons.git","type":"git","directory":"commons-core"},"_npmVersion":"10.9.7","description":"Core Atto primitives, serialization, hashing, signing, keys, addresses, blocks, and transactions.","directories":{},"_nodeVersion":"22.22.2","dependencies":{"@js-joda/core":"3.2.0","@stablelib/hmac":"1.0.1","@stablelib/sha256":"1.0.1","@stablelib/sha512":"1.0.1","@stablelib/blake2b":"1.0.1","@stablelib/ed25519":"1.0.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/commons-core_6.7.0_1779911962961_0.2580294708141335","host":"s3://npm-registry-packages-npm-production"}},"6.7.1":{"name":"@attocash/commons-core","version":"6.7.1","keywords":["atto","kotlin","kotlin-js","cryptocurrency"],"license":"BSD-3-Clause","_id":"@attocash/commons-core@6.7.1","maintainers":[{"name":"attocash","email":"felipe@atto.cash"}],"homepage":"https://atto.cash","bugs":{"url":"https://github.com/attocash/commons/issues"},"dist":{"shasum":"56d202796ed671086de0d3d3a83f559c0e0b2c16","tarball":"https://registry.npmjs.org/@attocash/commons-core/-/commons-core-6.7.1.tgz","fileCount":22,"integrity":"sha512-NdIIBKR1novfRTs1p4npwJgDZBVbycNhgKyEvkHLsYdXh1o81pxV/ru1donPkWDtdEWPkYqsNRJxtWALjl0QSQ==","signatures":[{"sig":"MEYCIQDY7yomwjufcxovR7WK9Fb3x+MQNJwwrBYRbeOdlx9LggIhANiurJsqSFzlSBL6NABCSVPApHfd8/9Le3+X+1JTTwb/","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1443159},"main":"commons-commons-core.mjs","types":"commons-commons-core.d.mts","gitHead":"1a3e41024f75a8372be02aab0eb9e6ed7b92d87f","_npmUser":{"name":"attocash","email":"felipe@atto.cash"},"repository":{"url":"git+https://github.com/attocash/commons.git","type":"git","directory":"commons-core"},"_npmVersion":"11.5.1","description":"Core Atto primitives, serialization, hashing, signing, keys, addresses, blocks, and transactions.","directories":{},"_nodeVersion":"24.6.0","dependencies":{"@js-joda/core":"3.2.0","@stablelib/hmac":"1.0.1","@stablelib/sha256":"1.0.1","@stablelib/sha512":"1.0.1","@stablelib/blake2b":"1.0.1","@stablelib/ed25519":"1.0.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/commons-core_6.7.1_1779996257241_0.11960260977825765","host":"s3://npm-registry-packages-npm-production"}},"6.7.1-patch.1":{"name":"@attocash/commons-core","version":"6.7.1-patch.1","keywords":["atto","kotlin","kotlin-js","cryptocurrency"],"license":"BSD-3-Clause","_id":"@attocash/commons-core@6.7.1-patch.1","maintainers":[{"name":"attocash","email":"felipe@atto.cash"}],"homepage":"https://atto.cash","bugs":{"url":"https://github.com/attocash/commons/issues"},"dist":{"shasum":"fa8158e18c95dda7471eecdd06c0d67bf2d7bba1","tarball":"https://registry.npmjs.org/@attocash/commons-core/-/commons-core-6.7.1-patch.1.tgz","fileCount":22,"integrity":"sha512-nQgDXEyBN9sAu1S3B6F2nVTnShhveu0+JuNRHrTvI75FlZQ8d33J/ZStvvp0Gi/sQg3KF+RxT0NoF6PDj1YcEQ==","signatures":[{"sig":"MEQCIFdV7a2ae0rRD5CQpgBr8XAWw8E9P0ppHQA4XOpAAKjcAiBWLJ02l8OAuW28Xb5M8v1l0Jl20vMquT7WLWJXvxfmxg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":2642706},"main":"commons-commons-core.mjs","_from":"file:commons-core/build/tmp/packJsPackage/attocash-commons-core-6.7.1-patch.1.tgz","types":"commons-commons-core.d.mts","_npmUser":{"name":"attocash","email":"felipe@atto.cash"},"_resolved":"/var/home/felipe/IdeaProjects/commons/commons-core/build/tmp/packJsPackage/attocash-commons-core-6.7.1-patch.1.tgz","_integrity":"sha512-nQgDXEyBN9sAu1S3B6F2nVTnShhveu0+JuNRHrTvI75FlZQ8d33J/ZStvvp0Gi/sQg3KF+RxT0NoF6PDj1YcEQ==","repository":{"url":"git+https://github.com/attocash/commons.git","type":"git","directory":"commons-core"},"_npmVersion":"11.5.1","description":"Core Atto primitives, serialization, hashing, signing, keys, addresses, blocks, and transactions.","directories":{},"_nodeVersion":"22.22.2","dependencies":{"@js-joda/core":"3.2.0","@stablelib/hmac":"1.0.1","@stablelib/sha256":"1.0.1","@stablelib/sha512":"1.0.1","@stablelib/blake2b":"1.0.1","@stablelib/ed25519":"1.0.1"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/commons-core_6.7.1-patch.1_1780002731109_0.1746300853964844","host":"s3://npm-registry-packages-npm-production"}},"7.0.2":{"name":"@attocash/commons-core","version":"7.0.2","keywords":["atto","kotlin","kotlin-js","cryptocurrency"],"license":"BSD-3-Clause","_id":"@attocash/commons-core@7.0.2","maintainers":[{"name":"attocash","email":"felipe@atto.cash"}],"homepage":"https://atto.cash","bugs":{"url":"https://github.com/attocash/commons/issues"},"dist":{"shasum":"3eec1be3ea4d9c98f117f9f311cb0cc060dd8d7e","tarball":"https://registry.npmjs.org/@attocash/commons-core/-/commons-core-7.0.2.tgz","fileCount":20,"integrity":"sha512-EtHr7cDETXgtjDjPLvVgvwlfAzaHWje7DLf27TxL4cH63Gbf6xcbB0Za/xb4eQqNli2RbgilCqPrrPqEDAVy6g==","signatures":[{"sig":"MEUCICMZSeXvx79lvdGgES+gyNHOR8zlK/sps90cf2paYqTiAiEAhptSuIZ45dHZkzE4fWM6ArXJlVJqUcaFi68HYf4s+00=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@attocash%2fcommons-core@7.0.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":2439345},"main":"commons-commons-core.mjs","_from":"file:commons-core/build/packages/attocash-commons-core-7.0.2.tgz","types":"commons-commons-core.d.mts","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:b90ad4d8-43d0-4f2a-bd12-a56ec5ac5964"}},"_resolved":"/home/runner/work/commons/commons/commons-core/build/packages/attocash-commons-core-7.0.2.tgz","_integrity":"sha512-EtHr7cDETXgtjDjPLvVgvwlfAzaHWje7DLf27TxL4cH63Gbf6xcbB0Za/xb4eQqNli2RbgilCqPrrPqEDAVy6g==","repository":{"url":"git+https://github.com/attocash/commons.git","type":"git","directory":"commons-core"},"_npmVersion":"11.16.0","description":"Core Atto primitives, serialization, hashing, signing, keys, addresses, blocks, and transactions.","directories":{},"_nodeVersion":"24.18.0","dependencies":{"@js-joda/core":"3.2.0","@noble/hashes":"2.2.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/commons-core_7.0.2_1785094472644_0.79844634530353","host":"s3://npm-registry-packages-npm-production"}},"8.0.0":{"_id":"@attocash/commons-core@8.0.0","bugs":{"url":"https://github.com/attocash/commons/issues"},"dist":{"shasum":"df0d9bbec4153230bef4a99d32aefb38c570f460","tarball":"https://registry.npmjs.org/@attocash/commons-core/-/commons-core-8.0.0.tgz","fileCount":20,"integrity":"sha512-II02mZspmGynupF6jOkahGVbs1pd2NaGX/tD7WqcHw94MfquNHvfzuTKKP1O48q4ukBHU4z40uLJKF6iBU24AQ==","signatures":[{"sig":"MEYCIQC9YSWLmgwQRjV0okcRB+Jk0v5POT//mDCKwB0nOLnIQgIhAJF2t1/rL+tTa4qwK5PtQ9BUb3nKljIpIYkwE62FgsMo","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIF8Ls09vY69KNmVP/cALJNq+/skJkQLxuRccUDOI67qwAiBMa3QKUIHnVlHgB14DBuqUz2/ydmqHNvUD1l3V90t5Rg=="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@attocash%2fcommons-core@8.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":2439345},"main":"commons-commons-core.mjs","name":"@attocash/commons-core","_from":"file:commons-core/build/packages/attocash-commons-core-8.0.0.tgz","types":"commons-commons-core.d.mts","license":"BSD-3-Clause","version":"8.0.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:b90ad4d8-43d0-4f2a-bd12-a56ec5ac5964"}},"homepage":"https://atto.cash","keywords":["atto","kotlin","kotlin-js","cryptocurrency"],"_resolved":"/home/runner/work/commons/commons/commons-core/build/packages/attocash-commons-core-8.0.0.tgz","_integrity":"sha512-II02mZspmGynupF6jOkahGVbs1pd2NaGX/tD7WqcHw94MfquNHvfzuTKKP1O48q4ukBHU4z40uLJKF6iBU24AQ==","repository":{"url":"git+https://github.com/attocash/commons.git","type":"git","directory":"commons-core"},"_npmVersion":"11.19.0","description":"Core Atto primitives, serialization, hashing, signing, keys, addresses, blocks, and transactions.","directories":{},"maintainers":[{"name":"attocash","email":"felipe@atto.cash"}],"_nodeVersion":"24.20.0","dependencies":{"@js-joda/core":"3.2.0","@noble/hashes":"2.2.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/commons-core_8.0.0_1788898477197_0.6997157496746254"}}},"time":{"created":"2026-05-27T19:59:22.781Z","modified":"2026-09-08T20:14:37.594Z","6.7.0":"2026-05-27T19:59:23.183Z","6.7.1":"2026-05-28T19:24:17.439Z","6.7.1-patch.1":"2026-05-28T21:12:11.379Z","7.0.2":"2026-07-26T19:34:32.835Z","8.0.0":"2026-09-08T20:14:37.311Z"},"bugs":{"url":"https://github.com/attocash/commons/issues"},"license":"BSD-3-Clause","homepage":"https://atto.cash","keywords":["atto","kotlin","kotlin-js","cryptocurrency"],"repository":{"url":"git+https://github.com/attocash/commons.git","type":"git","directory":"commons-core"},"description":"Core Atto primitives, serialization, hashing, signing, keys, addresses, blocks, and transactions.","maintainers":[{"name":"attocash","email":"felipe@atto.cash"}],"readme":"# commons-core\n\nCore primitives and utilities used across the Atto ecosystem. Multiplatform (JVM/JS/Wasm).\n\nWhat you get:\n\n- Mnemonic and seed derivation (BIP‑39 style)\n- Keys and addresses\n- Blocks and transactions (send/receive/open)\n- Serialization (buffer/JSON/Protobuf) and validation helpers\n- Hashing and proof‑of‑work interfaces\n\n## Installation\n\nGradle:\n\n```kotlin\nimplementation(\"cash.atto:commons-core:<version>\")\n```\n\nNPM:\n\n```sh\nnpm install @attocash/commons-core\n```\n\n## Examples (from tests)\n\n### Generate mnemonic, derive seed, and keys\n\n```kotlin\nval mnemonic = AttoMnemonic.generate()\nval seed = mnemonic.toSeed()\n\nval privateKey = seed.toPrivateKey(0U)\nval publicKey = privateKey.toPublicKey()\nval address = AttoAddress(AttoAlgorithm.V1, publicKey)\n```\n\n### Sign and verify a message\n\n```kotlin\nval message = \"atto message\".encodeToByteArray()\nval signature = privateKey.signMessage(message)\n\ncheck(signature.isValidMessage(publicKey, message))\n```\n\n### Build and validate a transaction\n\n```kotlin\nval receiveBlock = AttoReceiveBlock(\n  version = 0U.toAttoVersion(),\n  network = AttoNetwork.LOCAL,\n  algorithm = AttoAlgorithm.V1,\n  publicKey = publicKey,\n  height = 2U.toAttoHeight(),\n  balance = AttoAmount.MAX,\n  timestamp = AttoInstant.now(),\n  previous = AttoHash(Random.nextBytes(ByteArray(32))),\n  sendHashAlgorithm = AttoAlgorithm.V1,\n  sendHash = AttoHash(Random.Default.nextBytes(ByteArray(32))),\n)\n\nval tx = AttoTransaction(\n  block = receiveBlock,\n  signature = privateKey.sign(receiveBlock.hash),\n  work = AttoWorker.cpu().work(receiveBlock),\n)\n\ncheck(tx.isValid())\n```\n\nTransaction decoding is structural only: `fromByteArray`, `fromBuffer`, and serializers parse the payload without\nperforming cryptographic verification. Call the suspend `validate()` or `isValid()` method when verification is\nrequired.\n\n### Serialize/deserialize\n\n```kotlin\nval bytes = tx.toByteArray()\nval txFromBytes = AttoTransaction.fromByteArray(bytes)\n\nval json = tx.toJson()\nval txFromJson = AttoTransaction.fromJson(json)\n```\n\n### CPU proof‑of‑work\n\nThis example also requires `commons-worker` or `@attocash/commons-worker`.\n\n```kotlin\nval work = AttoWorker.cpu().work(receiveBlock)\n```\n\nSee `commons-core/src/commonTest/kotlin/cash/atto/commons/AttoTransactionTest.kt` for more end‑to‑end examples.\n\n## Suspend crypto API\n\nBrowser implementations use WebCrypto, whose digest, key import, signing, and verification operations are\nasynchronous. The common Kotlin API therefore suspends for every operation that can reach those platform APIs:\n\n- mnemonic creation and generation: `AttoMnemonic.fromWords`, `fromPhrase`, `fromEntropy`, and `generate`;\n- private-key derivation: `AttoSeed.toPrivateKey`;\n- Ed25519 key loading and signing: `AttoPrivateKey.toPublicKey`, `toSigner`, `sign`, and `signMessage`;\n- Ed25519 verification: `AttoSignature.isValid` and `isValidMessage`;\n- verification that depends on a signature: `AttoSignedVote.isValid`, `AttoTransaction.validate`, and\n  `AttoTransaction.isValid`.\n\nPure parsing, serialization, BLAKE2b hashing, address operations, block validation, and proof-of-work checks remain\nsynchronous. The suspend methods are hidden from Java. JVM callers can use the corresponding `*Blocking` methods\nexposed by `AttoMnemonics`, `AttoSeeds`, `AttoPrivateKeys`, `AttoPublicKeys`, `AttoSigners`, `AttoSignatures`,\n`AttoVotes`, and `AttoTransactions`. Java callers that need asynchronous execution can schedule those operations on\ntheir own executor.\n\nJavaScript exports suspend members directly as Promise-returning methods, for example\n`await mnemonic.toSeedAsync()`, `await seed.toPrivateKey(index)`, and `await privateKey.toPublicKey()`.\nDeprecated top-level compatibility functions remain available throughout 7.x and will be removed in 8.0.\n","readmeFilename":"README.md"}