{"_id":"@0xpass/key-signer","_rev":"4-9991cefb90de07ebe486104ad3b7a91b","name":"@0xpass/key-signer","description":"The KeySigner library is designed to simplify cryptographic operations involving the generation of digital signatures and the verification of those signatures. Built on top of Node.js's native `crypto` module, it abstracts away some of the complexities in","dist-tags":{"latest":"2.0.1"},"versions":{"0.0.2":{"name":"@0xpass/key-signer","version":"0.0.2","_id":"@0xpass/key-signer@0.0.2","maintainers":[{"name":"k-xo","email":"alkassimk@gmail.com"},{"name":"whatmanathinks","email":"manasgoel@hotmail.com"},{"name":"kwk236","email":"kwk236@gmail.com"}],"dist":{"shasum":"684c9d004179ee0f668a5ecfa12ec78581192ea7","tarball":"https://registry.npmjs.org/@0xpass/key-signer/-/key-signer-0.0.2.tgz","fileCount":7,"integrity":"sha512-GdWK11lEhXjgTBgzmaEH/uS/v8hy9ySnVXMfV/zsChvi+sun8t6iZbX+nQcLJ6s8MOCSYEq9cJmOaeCVXjKnOQ==","signatures":[{"sig":"MEUCIQD1dvosmyUxMNW3takINGPqTwQm9gP74EaCHONxTZJ+CQIgE3FNma+pr3hIX7zqvITF58pyOPlp5WFHCCXYDJuldMk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4279},"main":"dist/index.js","type":"module","_from":"file:0xpass-key-signer-0.0.2.tgz","types":"dist/index.d.ts","exports":{".":"./dist/index.js"},"scripts":{"test":"jest","build":"pnpm run clean && pnpm run compile","clean":"rimraf ./dist","compile":"rollup --config rollup.config.js","generate-keys":"passport-scope generate-keys --name passport"},"_npmUser":{"name":"kwk236","email":"kwk236@gmail.com"},"_resolved":"/tmp/342315f5c195eaec140025f16252f0d7/0xpass-key-signer-0.0.2.tgz","_integrity":"sha512-GdWK11lEhXjgTBgzmaEH/uS/v8hy9ySnVXMfV/zsChvi+sun8t6iZbX+nQcLJ6s8MOCSYEq9cJmOaeCVXjKnOQ==","_npmVersion":"10.2.4","directories":{},"_nodeVersion":"20.11.0","dependencies":{"elliptic":"^6.5.4","node-forge":"^1.3.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","tslib":"^2.3.0","eslint":"^7.32.0","rimraf":"~5.0.0","rollup":"^3.21.3","ts-jest":"^29.1.1","typescript":"^5.0.4","@types/jest":"^29.5.11","@types/node":"~18.16.0","@types/elliptic":"^6.4.18","@types/node-forge":"^1.3.5","passport-scope-cli":"0.0.8","@0xpass/eslint-config":"0.0.1","@0xpass/typescript-config":"0.0.1","rollup-plugin-typescript2":"^0.34.1","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/key-signer_0.0.2_1707905030330_0.5379798321492837","host":"s3://npm-registry-packages"}},"0.0.3":{"name":"@0xpass/key-signer","version":"0.0.3","_id":"@0xpass/key-signer@0.0.3","maintainers":[{"name":"k-xo","email":"alkassimk@gmail.com"},{"name":"whatmanathinks","email":"manasgoel@hotmail.com"},{"name":"kwk236","email":"kwk236@gmail.com"}],"dist":{"shasum":"d3133780fb05b95de799b8fec590bf65a70e0825","tarball":"https://registry.npmjs.org/@0xpass/key-signer/-/key-signer-0.0.3.tgz","fileCount":18,"integrity":"sha512-Chu+wbgwC/idO9WM8LCP1LNLAswX2TsyNbRh1Rk69iWNMLPRoeFo06r5IWI0FJeK0CFlShKZaCDa6QixctHEOg==","signatures":[{"sig":"MEUCIHHU5QIIurB0pNZwQIxhWMnDe4eWJVJj9KTsd7IYz9u9AiEA6xqTEGCMo64Gh/j0oKqDNYFUGzcdDTr06gicuFoQqDQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15182},"main":"dist/index.js","type":"module","_from":"file:0xpass-key-signer-0.0.3.tgz","types":"dist/index.d.ts","exports":{".":"./dist/index.js"},"scripts":{"dev":"rollup --config rollup.config.js --watch","test":"jest","build":"pnpm run clean && pnpm run compile","clean":"rimraf ./dist","compile":"rollup --config rollup.config.js","generate-keys":"passport-scope generate-keys --name passport"},"_npmUser":{"name":"kwk236","email":"kwk236@gmail.com"},"_resolved":"/tmp/d34cd8cfccef3b8f02038e9155a5ffb1/0xpass-key-signer-0.0.3.tgz","_integrity":"sha512-Chu+wbgwC/idO9WM8LCP1LNLAswX2TsyNbRh1Rk69iWNMLPRoeFo06r5IWI0FJeK0CFlShKZaCDa6QixctHEOg==","_npmVersion":"10.2.4","description":"The KeySigner library is designed to simplify cryptographic operations involving the generation of digital signatures and the verification of those signatures. Built on top of Node.js's native `crypto` module, it abstracts away some of the complexities in","directories":{},"_nodeVersion":"20.11.1","dependencies":{"@0xpass/models":"0.0.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","tslib":"^2.3.0","eslint":"^7.32.0","rimraf":"~5.0.0","rollup":"^3.21.3","ts-jest":"^29.1.1","typescript":"^5.0.4","@types/jest":"^29.5.11","@types/node":"~18.16.0","@types/elliptic":"^6.4.18","@types/node-forge":"^1.3.5","@0xpass/eslint-config":"0.0.1","@0xpass/typescript-config":"0.0.1","rollup-plugin-typescript2":"^0.34.1","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/key-signer_0.0.3_1708863984632_0.8090152673105626","host":"s3://npm-registry-packages"}},"1.0.0":{"name":"@0xpass/key-signer","version":"1.0.0","_id":"@0xpass/key-signer@1.0.0","maintainers":[{"name":"k-xo","email":"alkassimk@gmail.com"},{"name":"whatmanathinks","email":"manasgoel@hotmail.com"},{"name":"kwk236","email":"kwk236@gmail.com"}],"dist":{"shasum":"b5f311c07151c883eae4ba3d95ddf1030454e629","tarball":"https://registry.npmjs.org/@0xpass/key-signer/-/key-signer-1.0.0.tgz","fileCount":18,"integrity":"sha512-nROijorJlP8n7JUpWJByEGNSrssG4dwbmS6utd9dP1fLTp0zHS5NxIfHHj2YDzY5uJNzFxiDZcbSZkuXK228pg==","signatures":[{"sig":"MEUCIFlmoc9Y6AXuR56yqn5eQF23Qndg+KenSQ4Vcuz7CysZAiEAuxfycGkpQ8fy4RT/F0lyspkohr/wz8spQ/ZG5Ougte0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15247},"main":"dist/index.js","type":"module","_from":"file:0xpass-key-signer-1.0.0.tgz","types":"dist/index.d.ts","exports":{".":"./dist/index.js"},"scripts":{"dev":"rollup --config rollup.config.js --watch","lint":"eslint src/**/*.ts","test":"jest","build":"pnpm run clean && pnpm run compile","clean":"rimraf ./dist","compile":"rollup --config rollup.config.js","generate-keys":"passport-scope generate-keys --name passport"},"_npmUser":{"name":"kwk236","email":"kwk236@gmail.com"},"_resolved":"/tmp/b99945d5b5ff45a2c45a9249c1a3cecd/0xpass-key-signer-1.0.0.tgz","_integrity":"sha512-nROijorJlP8n7JUpWJByEGNSrssG4dwbmS6utd9dP1fLTp0zHS5NxIfHHj2YDzY5uJNzFxiDZcbSZkuXK228pg==","_npmVersion":"10.5.0","description":"The KeySigner library is designed to simplify cryptographic operations involving the generation of digital signatures and the verification of those signatures. Built on top of Node.js's native `crypto` module, it abstracts away some of the complexities in","directories":{},"_nodeVersion":"20.12.0","dependencies":{"@0xpass/models":"1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","tslib":"^2.3.0","rimraf":"~5.0.0","rollup":"^3.21.3","ts-jest":"^29.1.1","typescript":"^5.0.4","@types/jest":"^29.5.11","@types/node":"~18.16.0","@types/elliptic":"^6.4.18","@types/node-forge":"^1.3.5","@0xpass/eslint-config":"0.0.1","@0xpass/typescript-config":"0.0.1","rollup-plugin-typescript2":"^0.34.1","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/key-signer_1.0.0_1712068298805_0.23267063180896708","host":"s3://npm-registry-packages"}},"2.0.0":{"name":"@0xpass/key-signer","version":"2.0.0","_id":"@0xpass/key-signer@2.0.0","maintainers":[{"name":"k-xo","email":"alkassimk@gmail.com"},{"name":"whatmanathinks","email":"manasgoel@hotmail.com"},{"name":"kwk236","email":"kwk236@gmail.com"}],"dist":{"shasum":"3c6355a69f27ef336c6b8da755c760a89b73d113","tarball":"https://registry.npmjs.org/@0xpass/key-signer/-/key-signer-2.0.0.tgz","fileCount":18,"integrity":"sha512-Zwm8rnNbRjmmKnlB620TeIeZ0UqDcoUB4U6aAGhcY5VO98AbtFFanzeV4VGutWxj2hZtWhNUcMKP3zm9PizBRQ==","signatures":[{"sig":"MEYCIQDgBcSYvmdKs+23MJgn6/iDiB7Bh7qcp3PbWRvszuoelwIhAP31EMiyMz7OUbLTBZKfNwyvtC/McJK2c13u++v1eVLQ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15706},"main":"dist/index.js","type":"module","_from":"file:0xpass-key-signer-2.0.0.tgz","types":"dist/index.d.ts","exports":{".":"./dist/index.js"},"scripts":{"dev":"rollup --config rollup.config.js --watch","lint":"eslint src/**/*.ts","test":"jest","build":"pnpm run clean && pnpm run compile","clean":"rimraf ./dist","compile":"rollup --config rollup.config.js","generate-keys":"passport-scope generate-keys --name passport"},"_npmUser":{"name":"kwk236","email":"kwk236@gmail.com"},"_resolved":"/tmp/8a0ae33a87c6a0274912605d952653a5/0xpass-key-signer-2.0.0.tgz","_integrity":"sha512-Zwm8rnNbRjmmKnlB620TeIeZ0UqDcoUB4U6aAGhcY5VO98AbtFFanzeV4VGutWxj2hZtWhNUcMKP3zm9PizBRQ==","_npmVersion":"10.5.0","description":"The KeySigner library is designed to simplify cryptographic operations involving the generation of digital signatures and the verification of those signatures. Built on top of Node.js's native `crypto` module, it abstracts away some of the complexities in","directories":{},"_nodeVersion":"20.12.2","dependencies":{"@0xpass/models":"2.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","tslib":"^2.3.0","rimraf":"~5.0.0","rollup":"^3.21.3","ts-jest":"^29.1.1","typescript":"^5.0.4","@types/jest":"^29.5.11","@types/node":"~18.16.0","@types/elliptic":"^6.4.18","@types/node-forge":"^1.3.5","@0xpass/eslint-config":"0.0.1","@0xpass/typescript-config":"0.0.1","rollup-plugin-typescript2":"^0.34.1","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/key-signer_2.0.0_1714132701850_0.1438214353606977","host":"s3://npm-registry-packages"}},"2.0.1":{"name":"@0xpass/key-signer","version":"2.0.1","main":"dist/index.js","types":"dist/index.d.ts","type":"module","exports":{".":"./dist/index.js"},"dependencies":{"@0xpass/models":"2.0.1"},"devDependencies":{"@types/elliptic":"^6.4.18","@types/jest":"^29.5.11","@types/node":"~18.16.0","@types/node-forge":"^1.3.5","jest":"^29.7.0","rimraf":"~5.0.0","rollup":"^3.21.3","rollup-plugin-peer-deps-external":"^2.2.4","rollup-plugin-typescript2":"^0.34.1","typescript":"^5.0.4","ts-jest":"^29.1.1","tslib":"^2.3.0","@0xpass/eslint-config":"0.0.1","@0xpass/typescript-config":"0.0.1"},"publishConfig":{"access":"public"},"scripts":{"build":"pnpm run clean && pnpm run compile","dev":"rollup --config rollup.config.js --watch","clean":"rimraf ./dist","compile":"rollup --config rollup.config.js","test":"jest","lint":"eslint src/**/*.ts","generate-keys":"passport-scope generate-keys --name passport"},"_id":"@0xpass/key-signer@2.0.1","description":"The KeySigner library is designed to simplify cryptographic operations involving the generation of digital signatures and the verification of those signatures. Built on top of Node.js's native `crypto` module, it abstracts away some of the complexities in","_integrity":"sha512-xqlkiS3vJFdTVSV2LJsd2cqzp0mxX3bwKJUKmMWF4nf+fp5pmYk4vs8faZTjeFMLKYBEiPehS93I8ijA2oqKrw==","_resolved":"/tmp/fa9d67da3be3798cd95abfc34e37e9a5/0xpass-key-signer-2.0.1.tgz","_from":"file:0xpass-key-signer-2.0.1.tgz","_nodeVersion":"20.14.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-xqlkiS3vJFdTVSV2LJsd2cqzp0mxX3bwKJUKmMWF4nf+fp5pmYk4vs8faZTjeFMLKYBEiPehS93I8ijA2oqKrw==","shasum":"7626105f4065b053253ded2ccff0601a9d220f5d","tarball":"https://registry.npmjs.org/@0xpass/key-signer/-/key-signer-2.0.1.tgz","fileCount":18,"unpackedSize":15794,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCP9Xavpp4W/PGWJr+PT7nqfM/C7G9Cnbn793D9gQ0YDAIgO0qdcnSX/SgJvp+gj9K69nzgUn0HqcNUVlRBdnbs63o="}]},"_npmUser":{"name":"kwk236","email":"kwk236@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/key-signer_2.0.1_1718958140633_0.1440130824936645"},"_hasShrinkwrap":false}},"time":{"created":"2024-02-14T10:03:50.208Z","modified":"2024-06-21T08:22:21.046Z","0.0.2":"2024-02-14T10:03:50.564Z","0.0.3":"2024-02-25T12:26:24.803Z","1.0.0":"2024-04-02T14:31:38.954Z","2.0.0":"2024-04-26T11:58:21.990Z","2.0.1":"2024-06-21T08:22:20.780Z"},"maintainers":[{"name":"k-xo","email":"alkassimk@gmail.com"},{"name":"whatmanathinks","email":"manasgoel@hotmail.com"},{"name":"kwk236","email":"kwk236@gmail.com"}],"readme":"# KeySigner Library\n\nThe KeySigner library is designed to simplify cryptographic operations involving the generation of digital signatures and the verification of those signatures. Built on top of Node.js's native `crypto` module, it abstracts away some of the complexities involved in handling keys and performing cryptographic signing and verification.\n\n## Installation\n\n```sh\nnpm install @0xpass/key-signer\n```\n\nor\n\n```sh\npnpm install @0xpass/key-signer\n```\n\n## Usage\n\n### Initializing KeySigner\n\nTo create a new instance of `KeySigner`, you need to provide the private key. The private key can be supplied either as a path to a DER-encoded file in PKCS#8 format or as a base64-encoded string. This key can be generated using the `openssl` command-line tool, or the passport-scope cli [`passport-scope-cli`](https://www.npmjs.com/package/passport-scope-cli) package.\n\n```typescript\nimport { KeySigner } from \"./path/to/keysigner\";\n\n// Using a file path\nconst signer = new KeySigner(\"/path/to/private_key.der\");\n\n// Using a base64-encoded string\nconst signerBase64 = new KeySigner(\"base64PrivateKeyString\", true);\n```\n\n### Creating a Signature\n\nTo sign data, use the `createSignature` method with the data you wish to sign as a string. This method returns the signature in a base64-encoded format.\n\n```typescript\nconst signature = signer.createSignature(\"data to be signed\");\nconsole.log(signature);\n```\n\n### Creating a Signature Header\n\nTo create an HTTP header containing the signature, use the `createSignatureHeader `method. This can be useful for authenticated requests. This can be used for generating and formatting the correct headers for authentication requests to passport.\n\n```typescript\nconst { signatureHeaderName, signatureHeaderValue } =\n  await signer.createSignatureHeader(\"data to be signed\");\nconsole.log(signatureHeaderName, signatureHeaderValue);\n```\n\n### Verifying a Signature\n\nTo verify a signature, use the verifySignature static method, providing the original data, the signature to verify, and the public key. The public key can be supplied either as a path to a DER-encoded file in SPKI format or as a base64-encoded string.\n\n```typescript\nconst isVerified = KeySigner.verifySignature(\n  \"data to be signed\",\n  signature,\n  \"/path/to/public_key.der\"\n);\nconsole.log(isVerified); // true or false\n```\n","readmeFilename":"README.md"}