{"_id":"@0g-brier/zg-storage","_rev":"3-461becaaabf16de5d600acc41c1df623","name":"@0g-brier/zg-storage","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@0g-brier/zg-storage","version":"0.1.0","keywords":["0g","storage","merkle","verification"],"author":{"name":"0g-brier"},"license":"MIT","_id":"@0g-brier/zg-storage@0.1.0","maintainers":[{"name":"0g-brier","email":"madilog2411@gmail.com"}],"homepage":"https://github.com/hevDev7/0g-brier#readme","bugs":{"url":"https://github.com/hevDev7/0g-brier/issues"},"dist":{"shasum":"cf302843bff74da615707fe91314122691c9e152","tarball":"https://registry.npmjs.org/@0g-brier/zg-storage/-/zg-storage-0.1.0.tgz","fileCount":6,"integrity":"sha512-YI40qJ7xElEiZUORFG6wxdWb5oqiG8+uLxBafOZpCpxB4x7PZpQRDO7fRAClhOdGGszNb7QG9hafZRjwOoJ/cg==","signatures":[{"sig":"MEQCIF0SOpUd2E3YGuq+iB8clFykGc7IHBRo/1mAXr35gYAWAiBVOXGiIqTvjT0VWJEUcBskO1jlE7VqqdSzOT3mrBi9fQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27718},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"gitHead":"0e4fda9535b37bcd6299164d322601ddeacab73f","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","prepare":"npm run build","typecheck":"tsc --noEmit"},"_npmUser":{"name":"0g-brier","email":"madilog2411@gmail.com"},"repository":{"url":"git+https://github.com/hevDev7/0g-brier.git","type":"git","directory":"packages/zg-storage"},"_npmVersion":"10.9.8","description":"Read documents from 0G Storage and prove they are the ones a Merkle root names.","directories":{},"_nodeVersion":"22.23.1","dependencies":{"viem":"^2.56.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.0.5","typescript":"^5.7.2","@types/node":"^22.10.0"},"_npmOperationalInternal":{"tmp":"tmp/zg-storage_0.1.0_1787971807002_0.9370970725548575","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@0g-brier/zg-storage","version":"0.1.1","keywords":["0g","storage","merkle","verification"],"author":{"name":"0g-brier"},"license":"MIT","_id":"@0g-brier/zg-storage@0.1.1","maintainers":[{"name":"0g-brier","email":"madilog2411@gmail.com"}],"homepage":"https://github.com/hevDev7/0g-brier#readme","bugs":{"url":"https://github.com/hevDev7/0g-brier/issues"},"dist":{"shasum":"bd6d2faa733563ca52e0f990d74b6e1952a55abc","tarball":"https://registry.npmjs.org/@0g-brier/zg-storage/-/zg-storage-0.1.1.tgz","fileCount":6,"integrity":"sha512-2IO5c/wKwOXybgaWRxthsN1B8MV94LC2R+WtYn25MHHKUu8AwCDLhXLjW4fYjeLa9cF7UCG2wTxy0+JWayCFLQ==","signatures":[{"sig":"MEUCIQCVZrAhRtGz6Q+SSy/XRD93LWtduPdEKiQTyuNkjGCNzwIgOpH+6lva1Njcg7AeqTVJsaMa2+mALQdE7YAqqKC7Nwg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27718},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"gitHead":"d8733db9aa0fbfe3da0d8bf177b355e5b752e8e5","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","prepare":"npm run build","typecheck":"tsc --noEmit"},"_npmUser":{"name":"0g-brier","email":"madilog2411@gmail.com"},"repository":{"url":"git+https://github.com/hevDev7/0g-brier.git","type":"git","directory":"packages/zg-storage"},"_npmVersion":"10.9.8","description":"Read documents from 0G Storage and prove they are the ones a Merkle root names.","directories":{},"_nodeVersion":"22.23.1","dependencies":{"viem":"^2.56.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.0.5","typescript":"^5.7.2","@types/node":"^22.10.0"},"_npmOperationalInternal":{"tmp":"tmp/zg-storage_0.1.1_1788250151256_0.28173938275215304","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@0g-brier/zg-storage","version":"0.1.2","type":"module","main":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","typecheck":"tsc --noEmit","prepare":"npm run build"},"dependencies":{"viem":"^2.56.0"},"devDependencies":{"@types/node":"^22.10.0","typescript":"^5.7.2","vitest":"^3.0.5"},"description":"Read documents from 0G Storage and prove they are the ones a Merkle root names.","keywords":["0g","storage","merkle","verification"],"license":"MIT","author":{"name":"0g-brier"},"repository":{"type":"git","url":"git+https://github.com/hevDev7/0g-brier.git","directory":"packages/zg-storage"},"homepage":"https://github.com/hevDev7/0g-brier#readme","bugs":{"url":"https://github.com/hevDev7/0g-brier/issues"},"engines":{"node":">=20"},"publishConfig":{"access":"public"},"types":"./dist/index.d.ts","_id":"@0g-brier/zg-storage@0.1.2","gitHead":"9ef884348561f41360908bdda7f3ec9e8e6db048","_nodeVersion":"22.23.1","_npmVersion":"10.9.8","dist":{"integrity":"sha512-2aLek4hRPTunb6YJYYSWQVQWSddBL6SgzxKmNdaGB+4prZcNz5YWFgTxxPQR+HOzhP1QEFzR2Q7ztgku/tZ7fw==","shasum":"d82767cfd3b3800cc4c14cb23a9bfc7b3b70af6e","tarball":"https://registry.npmjs.org/@0g-brier/zg-storage/-/zg-storage-0.1.2.tgz","fileCount":6,"unpackedSize":27866,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDjGXyp5lWGwQE/nbvpiwYGkuHztwWQSfNDGVll0Ob7VwIhAJmSTMwHzWw+BU9ohnpegpjkdD2n1F98cIbrRpFIrXlL"}]},"_npmUser":{"name":"0g-brier","email":"madilog2411@gmail.com"},"directories":{},"maintainers":[{"name":"0g-brier","email":"madilog2411@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/zg-storage_0.1.2_1788259089116_0.005494026520620254"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-29T02:50:06.824Z","modified":"2026-09-01T10:38:09.387Z","0.1.0":"2026-08-29T02:50:07.150Z","0.1.1":"2026-09-01T08:09:11.397Z","0.1.2":"2026-09-01T10:38:09.240Z"},"bugs":{"url":"https://github.com/hevDev7/0g-brier/issues"},"author":{"name":"0g-brier"},"license":"MIT","homepage":"https://github.com/hevDev7/0g-brier#readme","keywords":["0g","storage","merkle","verification"],"repository":{"type":"git","url":"git+https://github.com/hevDev7/0g-brier.git","directory":"packages/zg-storage"},"description":"Read documents from 0G Storage and prove they are the ones a Merkle root names.","maintainers":[{"name":"0g-brier","email":"madilog2411@gmail.com"}],"readme":"# @0g-brier/zg-storage\n\nRead documents from [0G Storage](https://docs.0g.ai/concepts/storage) and **prove\nthey are the ones a Merkle root names**.\n\n```bash\nnpm i @0g-brier/zg-storage\n```\n\n```ts\nimport {ZgStore, zgMerkleRoot} from \"@0g-brier/zg-storage\";\n\nconst store = new ZgStore(\"https://indexer-storage-turbo.0g.ai\"); // mainnet;\n// Galileo is indexer-storage-testnet-turbo.0g.ai. The two networks share no data,\n// and a root stored on one is not fetchable from the other.\nconst doc = await store.get(\"0x5da31d27…\"); // throws unless the bytes hash back\n```\n\nFetching is the easy half. `get` recomputes the root from the bytes it received\nand refuses anything else — without that step you are rendering *whatever the\nindexer said*, while the whole claim of a content-addressed document is that\neveryone reads the same immutable text.\n\n`zgMerkleRoot` is the root by itself. It is not a textbook Merkle tree: 0G pads\nthe chunk count to a multiple of a sixteenth of the next power of two, and an odd\nnode is carried to the *back* of the queue rather than duplicated. A wrong rule\nagrees with the right one on most inputs and disagrees just past a power of two,\nwhich is why this is pinned to 19 vectors from 0G's own SDK.\n\nCaching is unconditionally safe here in a way it almost never is: the key IS the\nhash of the value. Pass a Web Storage-like object to keep proved documents across\nsessions — they are re-verified on the way out.\n\nMIT.\n","readmeFilename":"README.md"}