{"nyc":{"all":true,"cache":false,"exclude":["**/*.d.ts"],"include":["src/**/*.ts"],"require":["ts-node/register/transpile-only","source-map-support/register"],"reporter":["text","lcov"],"extension":[".ts"]},"bugs":{"url":"https://github.com/blockstack/c32check/issues"},"dist":{"shasum":"4360e573a2118a7364909bd3e49c12adc88168d8","tarball":"https://registry.npmjs.org/c32check/-/c32check-1.1.1.tgz","fileCount":20,"integrity":"sha512-2ozbzwJtBeNmv2Y/v01t9z65reI8f8B+IeVHkTGl4TDIqbVMEmE0drSZL8CtaUn1Xpgxshto+8DDnNJikMoV/w==","signatures":[{"sig":"MEUCIQC587JYg5YxCJPwo6OnbEqV6C/3Xf2hNc5rFDo0NofkOAIgbmvAXz+g3R6qVqwomrO5d9E6aJDYrrANklmjNtmhbKo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":219089,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfPYlZCRA9TVsSAnZWagAAg/gP/2PB6VyXQZDyXWAJO1CA\nvrqPk5ITsJMe/DIdOcCpNM+nk/gOueRk4ef9PI0bl21x5bqGDTLWCk19/fgZ\ncie97i9ZBk5KXFnICtZQXi3DAtYtmuQZ1noIYfDD0NALKOz534NPolYCKG5Z\n7tpJ271VBcEfekz0cyCTfGHmTEUZ8HHdyTsHR6UE2lRFqnhZRM8DAYN5y5XO\nFw9+2VzSHuvWTb+BrLS9oWICY1pYzD139vDzzpWob3AND6z7u1ZtQsXpl13t\nkB+2WYAvOnIDaVd0U7Lfh619EKetJiRpOQZ+ZyjGInBmlY2PKYzovaV0wF7G\nDrXKEkE6irETfC7eSRPU8zIQo/nTpNd8LjuiNwzThYNk5+ISCjNz+vzylKFS\nbI1WKeJb+29erguDCSMH+X0nPxt5LVCPWzHrH2bnbmREW0HrzyyTQ7/dxofZ\nhpARGE2pKZwEvf1RHxmL4XyKnbzs7hhhieI0hiXRnW7in3qC4gO16rGDni1f\n3ZCfhnWLI4w+jsYDyj/EudU8hLvsT+ylspeJ/lRkhUH8RT0LfTgldgCrvsVx\ni1Y5I88c6nFcX8Vkbh37H85X0ygxNT5P9DMJC2wi1stE+by+rEml8r4J9sau\n6xuG+ulR/ib+jTazxNuW6kT28Z9PNO7FQr0tYk/n5WAMegSBFy10XjsS256s\nnoK8\r\n=/7kc\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/index","name":"c32check","unpkg":"dist/c32check.js","author":{"url":"https://blockstack.com","name":"Jude Nelson","email":"jude@blockstack.com"},"readme":"# c32check\n\n[Crockford base-32](https://en.wikipedia.org/wiki/Base32#Crockford's_Base32) encoding library\nwith 4-byte checksum.\n\nThis library is meant for generating and decoding Stacks addresses on the\nBlockstack blockchain.\n\n## How it works\n\nEach c32check string encodes a 1-byte version and a 4-byte checksum.  When\ndecoded as a hex string, the wire format looks like this:\n\n```\n0      1                             n+1             n+5\n|------|-----------------------------|---------------|\nversion     n-byte hex payload          4-byte hash\n```\n\nIf `version` is the version byte (a 1-byte `number`) and `payload` is the raw \nbytes (e.g. as a `string`), then the `checksum` is calculated as follows:\n\n```\nchecksum = sha256(sha256(version + payload)).substring(0,4)\n```\n\nIn other words, the checksum is the first four bytes of the\ndouble-sha256 of the bytestring concatenation of the `version` and `payload`.\nThis is similar to base58check encoding, for example.\n\n## c32 Addresses\n\nSpecific to Blockstack, the Stacks blockchain uses c32-encoded public key\nhashes as addresses.  Specifically, a **c32check address** is a c32check-encoded\nripemd160 hash.\n\n# Examples\n\n```\n> c32 = require('c32check')\n{ c32encode: [Function: c32encode],\n  c32decode: [Function: c32decode],\n  c32checkEncode: [Function: c32checkEncode],\n  c32checkDecode: [Function: c32checkDecode],\n  c32address: [Function: c32address],\n  c32addressDecode: [Function: c32addressDecode],\n  versions: \n   { mainnet: { p2pkh: 22, p2sh: 20 },\n     testnet: { p2pkh: 26, p2sh: 21 } },\n  c32ToB58: [Function: c32ToB58],\n  b58ToC32: [Function: b58ToC32] }\n```\n\n## c32encode, c32decode\n\n```\n> c32check.c32encode(Buffer.from('hello world').toString('hex'))\n'38CNP6RVS0EXQQ4V34'\n> c32check.c32decode('38CNP6RVS0EXQQ4V34')\n'68656c6c6f20776f726c64'\n> Buffer.from('68656c6c6f20776f726c64', 'hex').toString()\n'hello world'\n```\n\n## c32checkEncode, c32checkDecode\n\n```\n> version = 12\n12\n> c32check.c32checkEncode(version, Buffer.from('hello world').toString('hex'))\n'CD1JPRV3F41VPYWKCCGRMASC8'\n> c32check.c32checkDecode('CD1JPRV3F41VPYWKCCGRMASC8')\n[ 12, '68656c6c6f20776f726c64' ] \n> Buffer.from('68656c6c6f20776f726c64', 'hex').toString()\n'hello world'\n```\n\n## c32address, c32addressDecode\n\n**NOTE**: these methods only work on ripemd160 hashes\n\n```\n> hash160 = 'a46ff88886c2ef9762d970b4d2c63678835bd39d'\n'a46ff88886c2ef9762d970b4d2c63678835bd39d'\n> version = c32check.versions.mainnet.p2pkh\n22\n> c32check.c32address(version, hash160)\n'SP2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKNRV9EJ7'\n> c32check.c32addressDecode('SP2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKNRV9EJ7')\n[ 22, 'a46ff88886c2ef9762d970b4d2c63678835bd39d' ]\n```\n\n## c32ToB58, b58ToC32\n\n**NOTE**: Common address versions are converted between c32check\nand base58check seamlessly, in order to accomodate Stacks addresses.\n\n```\n> b58addr = '16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg'\n'16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg'\n> c32check.b58ToC32(b58addr)\n'SPWNYDJ3STG7XH7ERWXMV6MQ7Q6EATWVY5Q1QMP8'\n> c32check.c32ToB58('SPWNYDJ3STG7XH7ERWXMV6MQ7Q6EATWVY5Q1QMP8')\n'16EMaNw3pkn3v6f2BgnSSs53zAKH4Q8YJg'\n```\n```\n> b58addr = '3D2oetdNuZUqQHPJmcMDDHYoqkyNVsFk9r'\n'3D2oetdNuZUqQHPJmcMDDHYoqkyNVsFk9r'\n> c32check.b58ToC32(b58addr)\n'SM1Y6EXF21RZ9739DFTEQKB1H044BMM0XVCM4A4NY'\n> c32check.c32ToB58('SM1Y6EXF21RZ9739DFTEQKB1H044BMM0XVCM4A4NY')\n3D2oetdNuZUqQHPJmcMDDHYoqkyNVsFk9r'\n```\n","browser":{"crypto":false},"engines":{"node":">=8"},"gitHead":"89070a05b2c228d37532273b1ca337c84b2b64a5","license":"MIT","scripts":{"lint":"eslint --ext=.ts -f=codeframe ./src ./tests","test":"nyc node ./tests/unitTests/src/index.ts","build":"npm run lint && npm run test && npm run webpack && npm run compile","compile":"rimraf lib && tsc","webpack":"rimraf lib dist && webpack --mode=production","prettier":"prettier --write ./src/**/*.ts","codecovUpload":"codecov","data-set-test":"cross-env BIG_DATA_TESTS=1 nyc node ./tests/unitTests/src/index.ts","prepublishOnly":"npm run build","webpack:analyze":"rimraf dist && cross-env NODE_ENV=production ANALYZE=true webpack --mode=production"},"_npmUser":{"name":"zone117x","email":"zone117x@gmail.com"},"homepage":"https://blockstack.org","jsdelivr":"dist/c32check.js","keywords":["blockchain","id","auth","authentication","bitcoin","blockchain auth","blockchain authentication","blockchainid","blockchain id","bitcoin auth","bitcoin authentication","bitcoin login","blockchain login","authorization","login","signin","sso","crypto","cryptography","token","blockstack","blockstack auth","profile","identity","ethereum"],"prettier":"@blockstack/prettier-config","repository":{"url":"git+https://github.com/blockstack/c32check.git","type":"git"},"_npmVersion":"6.14.4","description":"Crockford base-32 checksum encoding","directories":{},"maintainers":[{"name":"ablankstein","email":"aaron@blockstack.com"},{"name":"aulneau","email":"hello@ineffable.co"},{"name":"hstove","email":"hstove@gmail.com"},{"name":"jcnelson","email":"jude@blockstack.com"},{"name":"kyranjamie","email":"kyran@blockstack.com"},{"name":"reedrosenbluth","email":"reed@blockstack.com"},{"name":"yknl","email":"yukanliao@gmail.com"},{"name":"zone117x","email":"zone117x@gmail.com"}],"_nodeVersion":"13.14.0","contributors":[{"name":"Jude Nelson","email":"jude@blockstack.com"},{"name":"Aaron Blankstein","email":"aaron@blockstack.com"},{"name":"Matthew Little","email":"matt@blockstack.com"}],"dependencies":{"base-x":"^3.0.8","buffer":"^5.6.0","cross-sha256":"^1.1.2"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","tape":"^5.0.1","eslint":"^7.7.0","rimraf":"^3.0.2","codecov":"^3.7.2","ts-node":"^8.10.2","webpack":"^4.44.1","prettier":"^2.0.5","cross-env":"^7.0.2","ts-loader":"^8.0.2","typescript":"^3.9.7","@babel/core":"^7.11.1","@types/bs58":"^4.0.1","@types/node":"^8.0.0","webpack-cli":"^3.3.12","babel-loader":"^8.1.0","tape-promise":"^4.0.0","@babel/preset-env":"^7.11.0","source-map-support":"^0.5.19","webpack-bundle-analyzer":"^3.8.0","@typescript-eslint/parser":"^3.9.1","@blockstack/prettier-config":"0.0.6","@typescript-eslint/eslint-plugin":"^3.9.1"},"_npmOperationalInternal":{"tmp":"tmp/c32check_1.1.1_1597868377287_0.6431791976897154","host":"s3://npm-registry-packages"},"_id":"c32check@1.1.1","version":"1.1.1"}