mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
This change makes the functions actually accept what they are documented to accept based on the error messages. Specifically this allows to pass node.js `Buffer`s to `sign` / `verify`, instead of needing to convert them to a `string`, just for forge to convert them back to a `NativeBuffer` internally. This also fixes the type for `ed25519.Key`. `ArrayBuffer` does not appear in forge's source code at all. Instead all functions accept something containing bytes (i.e. the new `BinaryBuffer` alias) and return a `NativeBuffer`. I opted to alias `Key` to `NativeBuffer`, because that's what is being returned by `publicKeyFromPrivateKey` and `generateKeyPair`, it's a subset of `BinaryBuffer` and does not cause `forge.pki.Key` (which is the union of RSA and ed25519 keys) to become a kitchen sink type. |
||
|---|---|---|
| .. | ||
| index.d.ts | ||
| node-forge-tests.ts | ||
| README.md | ||
| tsconfig.json | ||
| tslint.json | ||
DefinitelyTyped for node-forge
Current node-forge Version
v0.7.6
Usage
npm install --save-dev @types/node-forge
npm install --save node-forge
example:
import * as forge from "node-forge";
Buffer.isBuffer(forge.pki.ed25519.generateKeyPair().publicKey) // true
License
BSD-2-Clause
dependencies
@types/node
Author
Seth Westphal Kay Schecker Aakash Goenka Rafal2228 Beeno Tung Nikita Koryabkin