{
  "_id": "get-nonce",
  "maintainers": [
    {
      "name": "kashey",
      "email": "thekashey@gmail.com"
    }
  ],
  "keywords": [
    "webpack",
    "nonce",
    "__webpack_nonce__"
  ],
  "dist-tags": {
    "latest": "1.0.1"
  },
  "author": {
    "name": "Anton Korzunov",
    "email": "thekashey@gmail.com"
  },
  "_rev": "2-ccf554e8c67823e3065738d6b39f842e",
  "description": "returns nonce",
  "readme": "# get-nonce\n\njust returns a **nonce** (number used once). No batteries included in those 46 bytes of this library.\n\n---\n\n- ✅ build in `webpack` support via `__webpack_nonce__`\n\n# API\n\n- `getNonce(): string|undefined` - returns the current `nonce`\n- `setNonce(newValue)` - set's nonce value\n\n## Why?\n\nWhy we need a library to access `__webpack_nonce__`? Abstractions!\n\n\"I\", as a library author, don't want to \"predict\" the platform \"you\" going to use.\n\"I\", as well, want an easier way to test and control `nonce` value.\n\nLike - `nonce` is supported out of the box only by webpack, what you are going to do?\n\nThis is why this \"man-in-the-middle\" was created.\nYep, think about `left-pad` :)\n\n## Webpack\n\n> https://webpack.js.org/guides/csp/\n\nTo activate the feature set a **webpack_nonce** variable needs to be included in your entry script.\n\n```\n__webpack_nonce__ = uuid(); // for example\n```\n\nWithout `webpack` `__webpack_nonce__` is actually just a global variable,\nwhich makes it actually bundler independent,\nhowever \"other bundlers\" are able to replicate it only setting it as a global variable\n(as here in tests) which violates a \"secure\" nature of `nonce`.\n\n`get-nonce` is not global.\n\n## Used in\n\n- `react-style-singleton` <- `react-remove-scroll` <- `react-focus-on`\n\n## Inspiration\n\n- [this issue](https://github.com/theKashey/react-remove-scroll/issues/21)\n- [styled-components](https://github.com/styled-components/styled-components/blob/147b0e9a1f10786551b13fd27452fcd5c678d5e0/packages/styled-components/src/utils/nonce.js)\n\n# Licence\n\nMIT\n",
  "repository": {
    "type": "git",
    "url": "git+ssh://git@github.com/theKashey/get-nonce.git"
  },
  "bugs": {
    "url": "https://github.com/theKashey/get-nonce/issues"
  },
  "license": "MIT",
  "versions": {
    "1.0.0": {
      "name": "get-nonce",
      "version": "1.0.0",
      "description": "returns nonce",
      "main": "dist/es5/index.js",
      "types": "dist/es5/index.d.ts",
      "sideEffects": false,
      "repository": {
        "type": "git",
        "url": "git+ssh://git@github.com/theKashey/get-nonce.git"
      },
      "homepage": "https://github.com/theKashey/get-nonce",
      "author": {
        "name": "Anton Korzunov",
        "email": "thekashey@gmail.com"
      },
      "license": "MIT",
      "keywords": [
        "webpack",
        "nonce",
        "__webpack_nonce__"
      ],
      "devDependencies": {
        "@theuiteam/lib-builder": "^0.0.10",
        "@size-limit/preset-small-lib": "^2.1.6"
      },
      "module": "dist/es2015/index.js",
      "engines": {
        "node": ">=10"
      },
      "scripts": {
        "dev": "lib-builder dev",
        "test": "jest",
        "test:ci": "jest --runInBand --coverage",
        "build": "lib-builder build && yarn size:report",
        "release": "yarn build && yarn test",
        "size": "npx size-limit",
        "size:report": "npx size-limit --json > .size.json",
        "lint": "lib-builder lint",
        "format": "lib-builder format",
        "update": "lib-builder update",
        "docz:dev": "docz dev",
        "docz:build": "docz build",
        "prepublish": "yarn build && yarn changelog",
        "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
        "changelog:rewrite": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
      },
      "husky": {
        "hooks": {
          "pre-commit": "lint-staged"
        }
      },
      "lint-staged": {
        "*.{ts,tsx}": [
          "prettier --write",
          "tslint --fix",
          "git add"
        ],
        "*.{js,css,json,md}": [
          "prettier --write",
          "git add"
        ]
      },
      "prettier": {
        "printWidth": 120,
        "trailingComma": "es5",
        "tabWidth": 2,
        "semi": true,
        "singleQuote": true
      },
      "gitHead": "c77143eb3c1fe170b1c851e5edb7ce1cf4a8dfc5",
      "bugs": {
        "url": "https://github.com/theKashey/get-nonce/issues"
      },
      "_id": "get-nonce@1.0.0",
      "_nodeVersion": "12.16.1",
      "_npmVersion": "6.13.4",
      "dist": {
        "integrity": "sha512-zaQIwI5ynNwHZdbm98YbHQuCtr6s0nHM+1jbiIVUntwwdrI4p4DfYORynZCE9p/tCm6cXprx6MuWiPnBYh1zOA==",
        "shasum": "ac4439ffe3cb7577e69e86c25fda687f09889b0b",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/get-nonce/-/get-nonce-1.0.0.tgz",
        "fileCount": 8,
        "unpackedSize": 4760,
        "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJemAeXCRA9TVsSAnZWagAACmsQAKGuMg+7AgeCxeWCuGUn\nXH6PhJheQ/DBj6S2cHxxTCU3+BSMuX5sCGjQMZL6co3x51avMHSnPUrmBp61\n9VmTvoCRgPtH32drYKQtGVTVmsGtZWJvuGZzFfb+ooRkepXPp8NUmkOREEzo\nx29MgG1wDiT7iS4KvCoQNHUCOHafudTgA9kF9EgC59GgtZrQCJEQD49t+Pl2\nj5riIFL8ntr5rT6E8REgjvn/ttpe0YpZsn+2QlTJHL8xuFkbtglMfx4l96nc\nLuGm5SEhrLLOH3YkiVYVIz2tLAztfRwRakARyqz/Q866m3TMjd9isL+T96r7\nDXUBOJIjooB14cqm9L501ctKVrTHMIlYiBU4b8KSJELfH9f/+4tTYyFUmUx9\n1qLQHFkwP3+G5jToka0HLRoFG/F1IW+xWKAOr7v7O9r8b1OrIXVGRGy5YuQ0\nhrp97OHEsFNdRaQvOQnDc60Nk8tmgP+BhPiGCQgnRlM7srtifo+QLp9af6Pi\nVclRCKPop80neavNvsUJq/zdJOVxHZ+LFiHDSRe/wXowRE/9ZUjhXULV95ZP\nDruGG+0mtPyxb+XUEMN/f0gwEEb8oOTMuYy3iwsxyQgp1/G52PnSKSLaMGd6\nURa5SzZDP4maXwYfXAfSsHOy5qNNPnDCv0LghBU/6OGKKambHWzpQuD4aAgu\nmGJY\r\n=wu8S\r\n-----END PGP SIGNATURE-----\r\n",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEYCIQCRFK2XT/9sLftkFK2IN/RWhdpv87WMF1rLd2XJNg5MsAIhAOi06sm0p+BXFK2bMeywcvVQkgl8wUmSk5I4ccwVuQKH"
          }
        ]
      },
      "maintainers": [
        {
          "name": "kashey",
          "email": "thekashey@gmail.com"
        }
      ],
      "_npmUser": {
        "name": "kashey",
        "email": "thekashey@gmail.com"
      },
      "directories": {},
      "_npmOperationalInternal": {
        "host": "s3://npm-registry-packages",
        "tmp": "tmp/get-nonce_1.0.0_1587021719374_0.7491662280215585"
      },
      "_hasShrinkwrap": false
    },
    "1.0.1": {
      "name": "get-nonce",
      "version": "1.0.1",
      "description": "returns nonce",
      "main": "dist/es5/index.js",
      "types": "dist/es5/index.d.ts",
      "sideEffects": false,
      "repository": {
        "type": "git",
        "url": "git+ssh://git@github.com/theKashey/get-nonce.git"
      },
      "homepage": "https://github.com/theKashey/get-nonce",
      "author": {
        "name": "Anton Korzunov",
        "email": "thekashey@gmail.com"
      },
      "license": "MIT",
      "keywords": [
        "webpack",
        "nonce",
        "__webpack_nonce__"
      ],
      "devDependencies": {
        "@theuiteam/lib-builder": "^0.0.10",
        "@size-limit/preset-small-lib": "^2.1.6"
      },
      "module": "dist/es2015/index.js",
      "engines": {
        "node": ">=6"
      },
      "scripts": {
        "dev": "lib-builder dev",
        "test": "jest",
        "test:ci": "jest --runInBand --coverage",
        "build": "lib-builder build && yarn size:report",
        "release": "yarn build && yarn test",
        "size": "npx size-limit",
        "size:report": "npx size-limit --json > .size.json",
        "lint": "lib-builder lint",
        "format": "lib-builder format",
        "update": "lib-builder update",
        "docz:dev": "docz dev",
        "docz:build": "docz build",
        "prepublish": "yarn build && yarn changelog",
        "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
        "changelog:rewrite": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
      },
      "husky": {
        "hooks": {
          "pre-commit": "lint-staged"
        }
      },
      "lint-staged": {
        "*.{ts,tsx}": [
          "prettier --write",
          "tslint --fix",
          "git add"
        ],
        "*.{js,css,json,md}": [
          "prettier --write",
          "git add"
        ]
      },
      "prettier": {
        "printWidth": 120,
        "trailingComma": "es5",
        "tabWidth": 2,
        "semi": true,
        "singleQuote": true
      },
      "gitHead": "fe602104915e8a18049dc96dfecbc10a96c03068",
      "bugs": {
        "url": "https://github.com/theKashey/get-nonce/issues"
      },
      "_id": "get-nonce@1.0.1",
      "_nodeVersion": "12.16.1",
      "_npmVersion": "6.13.4",
      "dist": {
        "integrity": "sha512-FJhYRoDaiatfEkUK8HKlicmu/3SGFD51q3itKDGoSTysQJBnfOcxU5GxnhE1E6soB76MbT0MBtnKJuXyAx+96Q==",
        "shasum": "fdf3f0278073820d2ce9426c18f07481b1e0cdf3",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/get-nonce/-/get-nonce-1.0.1.tgz",
        "fileCount": 8,
        "unpackedSize": 5258,
        "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJemTorCRA9TVsSAnZWagAAmxwP/1NgYsfwKa7A69B6INxA\naod0JcfSP6JqlIQA5kn4yrL93q3ArwR49rqukkDwUHByr0XgBZM2Sbw7AY6+\nRN/brpS7S+lCNFRfxYBJRVD/q5Y81kcDLkgNE7sQxZY+X5CRduKFUZOnaN8g\nK+eeChPx1h6H9Zop4BlfEaRTivQDN8+uWOw01b1q7xcli0+Bt0zKBka/TW6n\nTFPYAPka5oI1kt3K6GYRmjVWYDzv1fIOO6z+ew4JJ3zUa5b+wqzT9Z9LWPFx\n2TscUJgxwgdD50OHLgEK/XwpXao0NoKrb0Gww5JO9TwQkhZ5Ql/nFBfrP2hz\nCKLYuDIewYe1d4G43M9ndPgyMFCSUA7q+I2W/nzpdEJPhfb8FO6u93zRXHMC\n6ifF852epClsQsPa1EGs9SwJIaX3RDm6HrW/NrmJe0vTT8VdLI0qx8gHjQuJ\nuYsfu2vSN7zen7bdeaApHV+t2dgiph62h3cGbj+K2RPQ+axFOdVOuT//bndU\ny9OyhhX5APKHRX4Z3bihnANoSg8LDnUKmr0IrDfZqHrxB6AGIMJZW+CZ9JUH\nqaswT2W1cWUVJIcSImG7fzOVhvmZ6OCL1lYekGj2boSTqmeZPfmryiVnX6tt\nCp677ECbZvLHtI/RbuOWVkZrBNJm6oejdZT4acZJr67hvGI/ArxRQcGwpL2b\naiA/\r\n=a0JP\r\n-----END PGP SIGNATURE-----\r\n",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEUCIQDjyxWJJ2nOCYBgUWUtIswxwP346StETJYQ1RqZSHX8IgIgKBO7w8X46IHVFLxr1RNcEaAcrBQKspoZM89DbssgJNA="
          }
        ]
      },
      "maintainers": [
        {
          "name": "kashey",
          "email": "thekashey@gmail.com"
        }
      ],
      "_npmUser": {
        "name": "kashey",
        "email": "thekashey@gmail.com"
      },
      "directories": {},
      "_npmOperationalInternal": {
        "host": "s3://npm-registry-packages",
        "tmp": "tmp/get-nonce_1.0.1_1587100202601_0.5724882883753502"
      },
      "_hasShrinkwrap": false
    }
  },
  "name": "get-nonce",
  "time": {
    "created": "2020-04-16T07:21:59.373Z",
    "1.0.0": "2020-04-16T07:21:59.524Z",
    "modified": "2026-05-12T15:39:05.733Z",
    "1.0.1": "2020-04-17T05:10:02.775Z"
  },
  "readmeFilename": "README.md",
  "homepage": "https://github.com/theKashey/get-nonce"
}