DefinitelyTyped/types/node-forge
Tim Düsterhus f3eb9ef31f node-forge: Fix typings of ed25519 module (#37080)
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.
2019-07-30 10:14:31 -07:00
..
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