mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-18 01:49:01 +00:00
🤖 Merge PR #65743 Correct Node@14 Signer type to be Sign by @cjbarth
This commit is contained in:
8
types/node/v14/crypto.d.ts
vendored
8
types/node/v14/crypto.d.ts
vendored
@@ -334,7 +334,7 @@ declare module 'crypto' {
|
||||
function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject): KeyObject;
|
||||
function createSecretKey(key: NodeJS.ArrayBufferView): KeyObject;
|
||||
|
||||
function createSign(algorithm: string, options?: stream.WritableOptions): Signer;
|
||||
function createSign(algorithm: string, options?: stream.WritableOptions): Sign;
|
||||
|
||||
type DSAEncoding = 'der' | 'ieee-p1363';
|
||||
|
||||
@@ -358,11 +358,11 @@ declare module 'crypto' {
|
||||
|
||||
type KeyLike = string | Buffer | KeyObject;
|
||||
|
||||
class Signer extends stream.Writable {
|
||||
class Sign extends stream.Writable {
|
||||
private constructor();
|
||||
|
||||
update(data: BinaryLike): Signer;
|
||||
update(data: string, input_encoding: Encoding): Signer;
|
||||
update(data: BinaryLike): Sign;
|
||||
update(data: string, input_encoding: Encoding): Sign;
|
||||
sign(private_key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer;
|
||||
sign(
|
||||
private_key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput,
|
||||
|
||||
@@ -731,7 +731,7 @@ import { promisify } from 'node:util';
|
||||
namedCurve: 'sect239k1',
|
||||
});
|
||||
|
||||
const sign: crypto.Signer = crypto.createSign('SHA256');
|
||||
const sign: crypto.Sign = crypto.createSign('SHA256');
|
||||
sign.write('some data to sign');
|
||||
sign.end();
|
||||
const signature: string = sign.sign(privateKey, 'hex');
|
||||
@@ -743,7 +743,7 @@ import { promisify } from 'node:util';
|
||||
|
||||
// ensure that instanceof works
|
||||
verify instanceof crypto.Verify;
|
||||
sign instanceof crypto.Signer;
|
||||
sign instanceof crypto.Sign;
|
||||
}
|
||||
|
||||
{
|
||||
@@ -751,7 +751,7 @@ import { promisify } from 'node:util';
|
||||
modulusLength: 2048,
|
||||
});
|
||||
|
||||
const sign: crypto.Signer = crypto.createSign('SHA256');
|
||||
const sign: crypto.Sign = crypto.createSign('SHA256');
|
||||
sign.update('some data to sign');
|
||||
sign.end();
|
||||
const signature: Buffer = sign.sign(privateKey);
|
||||
|
||||
Reference in New Issue
Block a user