mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Merge pull request #28211 from beenotung/node-forge-patch-1
update [@types/node-forge] added ed25519 in pki
This commit is contained in:
29
types/node-forge/README.md
Normal file
29
types/node-forge/README.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# DefinitelyTyped for node-forge
|
||||
|
||||
## Current node-forge Version
|
||||
`v0.7.6`
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
npm install --save-dev @types/node-forge
|
||||
npm install --save node-forge
|
||||
```
|
||||
|
||||
example:
|
||||
```ts
|
||||
import * as forge from "node-forge";
|
||||
|
||||
Buffer.isBuffer(forge.pki.ed25519.generateKeyPair().publicKey) // true
|
||||
```
|
||||
## License
|
||||
BSD-2-Clause
|
||||
|
||||
## dependencies
|
||||
`@types/node`
|
||||
|
||||
## Author
|
||||
[Seth Westphal](https://github.com/westy92)
|
||||
[Kay Schecker](https://github.com/flynetworks)
|
||||
[Aakash Goenka](https://github.com/a-k-g)
|
||||
[Rafal2228](https://github.com/rafal2228)
|
||||
[Beeno Tung](https://github.com/beenotung)
|
||||
33
types/node-forge/index.d.ts
vendored
33
types/node-forge/index.d.ts
vendored
@@ -1,10 +1,14 @@
|
||||
// Type definitions for node-forge 0.7.5
|
||||
// Type definitions for node-forge 0.7.6
|
||||
// Project: https://github.com/digitalbazaar/forge
|
||||
// Definitions by: Seth Westphal <https://github.com/westy92>
|
||||
// Kay Schecker <https://github.com/flynetworks>
|
||||
// Aakash Goenka <https://github.com/a-k-g>
|
||||
// Rafal2228 <https://github.com/rafal2228>
|
||||
// Beeno Tung <https://github.com/beenotung>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
declare module "node-forge" {
|
||||
type Byte = string;
|
||||
@@ -73,6 +77,33 @@ declare module "node-forge" {
|
||||
function generateKeyPair(options?: GenerateKeyPairOptions, callback?: (err: Error, keypair: KeyPair) => void): KeyPair;
|
||||
}
|
||||
|
||||
namespace ed25519 {
|
||||
|
||||
type NativeBuffer = Buffer | Uint8Array;
|
||||
|
||||
namespace constants {
|
||||
const PUBLIC_KEY_BYTE_LENGTH = 32;
|
||||
const PRIVATE_KEY_BYTE_LENGTH = 64;
|
||||
const SEED_BYTE_LENGTH = 32;
|
||||
const SIGN_BYTE_LENGTH = 64;
|
||||
const HASH_BYTE_LENGTH = 64;
|
||||
}
|
||||
|
||||
function generateKeyPair(options?: { seed?: Buffer | Uint8Array | string }): {
|
||||
publicKey: NativeBuffer;
|
||||
privateKey: NativeBuffer;
|
||||
};
|
||||
|
||||
function publicKeyFromPrivateKey(options: { privateKey: NativeBuffer }): NativeBuffer;
|
||||
|
||||
function sign(options: { privateKey: NativeBuffer }): NativeBuffer;
|
||||
|
||||
function verify(options: {
|
||||
signature: Buffer | Uint8Array | util.ByteBuffer | string,
|
||||
publicKey: NativeBuffer
|
||||
}): boolean;
|
||||
}
|
||||
|
||||
interface CertificateFieldOptions {
|
||||
name?: string;
|
||||
type?: string;
|
||||
|
||||
Reference in New Issue
Block a user