@node-red/editor-client 2.0.4 → 2.1.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/locales/en-US/editor.json +37 -7
  2. package/locales/ko/editor.json +1 -1
  3. package/package.json +2 -2
  4. package/public/red/about +109 -0
  5. package/public/red/images/node-red-256.svg +1 -0
  6. package/public/red/keymap.json +13 -2
  7. package/public/red/red.js +6122 -3663
  8. package/public/red/red.min.js +1 -1
  9. package/public/red/style.min.css +2 -2
  10. package/public/red/tours/first-flow.js +80 -0
  11. package/public/red/tours/welcome.js +135 -0
  12. package/public/tours/first-flow.js +82 -0
  13. package/public/types/node/assert.d.ts +127 -0
  14. package/public/types/node/async_hooks.d.ts +229 -0
  15. package/public/types/node/buffer.d.ts +25 -1
  16. package/public/types/node/child_process.d.ts +514 -6
  17. package/public/types/node/cluster.d.ts +265 -0
  18. package/public/types/node/console.d.ts +136 -1
  19. package/public/types/node/crypto.d.ts +1189 -1
  20. package/public/types/node/dgram.d.ts +144 -1
  21. package/public/types/node/dns.d.ts +383 -10
  22. package/public/types/node/domain.d.ts +27 -1
  23. package/public/types/node/events.d.ts +81 -1
  24. package/public/types/node/fs.d.ts +2273 -1
  25. package/public/types/node/globals.d.ts +616 -1
  26. package/public/types/node/http.d.ts +489 -1
  27. package/public/types/node/http2.d.ts +961 -0
  28. package/public/types/node/https.d.ts +142 -0
  29. package/public/types/node/module.d.ts +55 -0
  30. package/public/types/node/net.d.ts +296 -1
  31. package/public/types/node/os.d.ts +242 -1
  32. package/public/types/node/path.d.ts +156 -1
  33. package/public/types/node/perf_hooks.d.ts +274 -0
  34. package/public/types/node/process.d.ts +412 -1
  35. package/public/types/node/querystring.d.ts +31 -1
  36. package/public/types/node/readline.d.ts +173 -0
  37. package/public/types/node/stream.d.ts +358 -0
  38. package/public/types/node/string_decoder.d.ts +10 -0
  39. package/public/types/node/timers.d.ts +19 -0
  40. package/public/types/node/tls.d.ts +783 -0
  41. package/public/types/node/trace_events.d.ts +64 -0
  42. package/public/types/node/tty.d.ts +69 -0
  43. package/public/types/node/url.d.ts +119 -1
  44. package/public/types/node/util.d.ts +210 -0
  45. package/public/types/node/v8.d.ts +190 -0
  46. package/public/types/node/vm.d.ts +155 -0
  47. package/public/types/node/wasi.d.ts +89 -0
  48. package/public/types/node/worker_threads.d.ts +241 -0
  49. package/public/types/node/zlib.d.ts +364 -0
  50. package/public/types/node-red/func.d.ts +1 -1
  51. package/public/types/node-red/util.d.ts +1 -1
  52. package/public/vendor/ace/worker-jsonata.js +1 -1
  53. package/public/vendor/monaco/dist/ThirdPartyNotices.txt +192 -192
  54. package/public/vendor/monaco/dist/css.worker.js +1 -1
  55. package/public/vendor/monaco/dist/editor.js +2 -2
  56. package/public/vendor/monaco/dist/editor.worker.js +1 -1
  57. package/public/vendor/monaco/dist/html.worker.js +1 -1
  58. package/public/vendor/monaco/dist/json.worker.js +1 -1
  59. package/public/vendor/monaco/dist/locale/cs.js +44 -10
  60. package/public/vendor/monaco/dist/locale/de.js +46 -12
  61. package/public/vendor/monaco/dist/locale/es.js +46 -12
  62. package/public/vendor/monaco/dist/locale/fr.js +43 -9
  63. package/public/vendor/monaco/dist/locale/it.js +45 -11
  64. package/public/vendor/monaco/dist/locale/ja.js +45 -11
  65. package/public/vendor/monaco/dist/locale/ko.js +44 -10
  66. package/public/vendor/monaco/dist/locale/pl.js +42 -8
  67. package/public/vendor/monaco/dist/locale/pt-br.js +49 -15
  68. package/public/vendor/monaco/dist/locale/qps-ploc.js +1445 -0
  69. package/public/vendor/monaco/dist/locale/ru.js +48 -14
  70. package/public/vendor/monaco/dist/locale/tr.js +49 -15
  71. package/public/vendor/monaco/dist/locale/zh-hans.js +48 -14
  72. package/public/vendor/monaco/dist/locale/zh-hant.js +45 -11
  73. package/public/vendor/monaco/dist/theme/monoindustrial.json +228 -0
  74. package/public/vendor/monaco/dist/theme/solarized-dark.json +1082 -0
  75. package/public/vendor/monaco/dist/ts.worker.js +2 -2
  76. package/public/vendor/vendor.js +4 -4
  77. package/templates/index.mst +5 -1
@@ -1 +1,1189 @@
1
- declare module'node:crypto'{export*from'crypto';}declare module'crypto'{import*as stream from'node:stream';interface Certificate{exportChallenge(spkac:BinaryLike):Buffer;exportPublicKey(spkac:BinaryLike,encoding?:string):Buffer;verifySpkac(spkac:NodeJS.ArrayBufferView):boolean;}const Certificate:Certificate&{new():Certificate;():Certificate;};namespace constants{const OPENSSL_VERSION_NUMBER:number;const SSL_OP_ALL:number;const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION:number;const SSL_OP_CIPHER_SERVER_PREFERENCE:number;const SSL_OP_CISCO_ANYCONNECT:number;const SSL_OP_COOKIE_EXCHANGE:number;const SSL_OP_CRYPTOPRO_TLSEXT_BUG:number;const SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS:number;const SSL_OP_EPHEMERAL_RSA:number;const SSL_OP_LEGACY_SERVER_CONNECT:number;const SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER:number;const SSL_OP_MICROSOFT_SESS_ID_BUG:number;const SSL_OP_MSIE_SSLV2_RSA_PADDING:number;const SSL_OP_NETSCAPE_CA_DN_BUG:number;const SSL_OP_NETSCAPE_CHALLENGE_BUG:number;const SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG:number;const SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG:number;const SSL_OP_NO_COMPRESSION:number;const SSL_OP_NO_QUERY_MTU:number;const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION:number;const SSL_OP_NO_SSLv2:number;const SSL_OP_NO_SSLv3:number;const SSL_OP_NO_TICKET:number;const SSL_OP_NO_TLSv1:number;const SSL_OP_NO_TLSv1_1:number;const SSL_OP_NO_TLSv1_2:number;const SSL_OP_PKCS1_CHECK_1:number;const SSL_OP_PKCS1_CHECK_2:number;const SSL_OP_SINGLE_DH_USE:number;const SSL_OP_SINGLE_ECDH_USE:number;const SSL_OP_SSLEAY_080_CLIENT_DH_BUG:number;const SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG:number;const SSL_OP_TLS_BLOCK_PADDING_BUG:number;const SSL_OP_TLS_D5_BUG:number;const SSL_OP_TLS_ROLLBACK_BUG:number;const ENGINE_METHOD_RSA:number;const ENGINE_METHOD_DSA:number;const ENGINE_METHOD_DH:number;const ENGINE_METHOD_RAND:number;const ENGINE_METHOD_EC:number;const ENGINE_METHOD_CIPHERS:number;const ENGINE_METHOD_DIGESTS:number;const ENGINE_METHOD_PKEY_METHS:number;const ENGINE_METHOD_PKEY_ASN1_METHS:number;const ENGINE_METHOD_ALL:number;const ENGINE_METHOD_NONE:number;const DH_CHECK_P_NOT_SAFE_PRIME:number;const DH_CHECK_P_NOT_PRIME:number;const DH_UNABLE_TO_CHECK_GENERATOR:number;const DH_NOT_SUITABLE_GENERATOR:number;const ALPN_ENABLED:number;const RSA_PKCS1_PADDING:number;const RSA_SSLV23_PADDING:number;const RSA_NO_PADDING:number;const RSA_PKCS1_OAEP_PADDING:number;const RSA_X931_PADDING:number;const RSA_PKCS1_PSS_PADDING:number;const RSA_PSS_SALTLEN_DIGEST:number;const RSA_PSS_SALTLEN_MAX_SIGN:number;const RSA_PSS_SALTLEN_AUTO:number;const POINT_CONVERSION_COMPRESSED:number;const POINT_CONVERSION_UNCOMPRESSED:number;const POINT_CONVERSION_HYBRID:number;const defaultCoreCipherList:string;const defaultCipherList:string;}interface HashOptions extends stream.TransformOptions{outputLength?:number;}const fips:boolean;function createHash(algorithm:string,options?:HashOptions):Hash;function createHmac(algorithm:string,key:BinaryLike|KeyObject,options?:stream.TransformOptions):Hmac;type BinaryToTextEncoding='base64'|'hex';type CharacterEncoding='utf8'|'utf-8'|'utf16le'|'latin1';type LegacyCharacterEncoding='ascii'|'binary'|'ucs2'|'ucs-2';type Encoding=BinaryToTextEncoding|CharacterEncoding|LegacyCharacterEncoding;type ECDHKeyFormat='compressed'|'uncompressed'|'hybrid';class Hash extends stream.Transform{private constructor();copy():Hash;update(data:BinaryLike):Hash;update(data:string,input_encoding:Encoding):Hash;digest():Buffer;digest(encoding:BinaryToTextEncoding):string;}class Hmac extends stream.Transform{private constructor();update(data:BinaryLike):Hmac;update(data:string,input_encoding:Encoding):Hmac;digest():Buffer;digest(encoding:BinaryToTextEncoding):string;}type KeyObjectType='secret'|'public'|'private';interface KeyExportOptions<T extends KeyFormat>{type:'pkcs1'|'spki'|'pkcs8'|'sec1';format:T;cipher?:string;passphrase?:string|Buffer;}class KeyObject{private constructor();asymmetricKeyType?:KeyType;asymmetricKeySize?:number;export(options:KeyExportOptions<'pem'>):string|Buffer;export(options?:KeyExportOptions<'der'>):Buffer;symmetricKeySize?:number;type:KeyObjectType;}type CipherCCMTypes='aes-128-ccm'|'aes-192-ccm'|'aes-256-ccm'|'chacha20-poly1305';type CipherGCMTypes='aes-128-gcm'|'aes-192-gcm'|'aes-256-gcm';type BinaryLike=string|NodeJS.ArrayBufferView;type CipherKey=BinaryLike|KeyObject;interface CipherCCMOptions extends stream.TransformOptions{authTagLength:number;}interface CipherGCMOptions extends stream.TransformOptions{authTagLength?:number;}function createCipher(algorithm:CipherCCMTypes,password:BinaryLike,options:CipherCCMOptions):CipherCCM;function createCipher(algorithm:CipherGCMTypes,password:BinaryLike,options?:CipherGCMOptions):CipherGCM;function createCipher(algorithm:string,password:BinaryLike,options?:stream.TransformOptions):Cipher;function createCipheriv(algorithm:CipherCCMTypes,key:CipherKey,iv:BinaryLike|null,options:CipherCCMOptions,):CipherCCM;function createCipheriv(algorithm:CipherGCMTypes,key:CipherKey,iv:BinaryLike|null,options?:CipherGCMOptions,):CipherGCM;function createCipheriv(algorithm:string,key:CipherKey,iv:BinaryLike|null,options?:stream.TransformOptions,):Cipher;class Cipher extends stream.Transform{private constructor();update(data:BinaryLike):Buffer;update(data:string,input_encoding:Encoding):Buffer;update(data:NodeJS.ArrayBufferView,input_encoding:undefined,output_encoding:Encoding):string;update(data:string,input_encoding:Encoding|undefined,output_encoding:Encoding):string;final():Buffer;final(output_encoding:BufferEncoding):string;setAutoPadding(auto_padding?:boolean):this;}interface CipherCCM extends Cipher{setAAD(buffer:NodeJS.ArrayBufferView,options:{plaintextLength:number}):this;getAuthTag():Buffer;}interface CipherGCM extends Cipher{setAAD(buffer:NodeJS.ArrayBufferView,options?:{plaintextLength:number}):this;getAuthTag():Buffer;}function createDecipher(algorithm:CipherCCMTypes,password:BinaryLike,options:CipherCCMOptions):DecipherCCM;function createDecipher(algorithm:CipherGCMTypes,password:BinaryLike,options?:CipherGCMOptions):DecipherGCM;function createDecipher(algorithm:string,password:BinaryLike,options?:stream.TransformOptions):Decipher;function createDecipheriv(algorithm:CipherCCMTypes,key:CipherKey,iv:BinaryLike|null,options:CipherCCMOptions,):DecipherCCM;function createDecipheriv(algorithm:CipherGCMTypes,key:CipherKey,iv:BinaryLike|null,options?:CipherGCMOptions,):DecipherGCM;function createDecipheriv(algorithm:string,key:CipherKey,iv:BinaryLike|null,options?:stream.TransformOptions,):Decipher;class Decipher extends stream.Transform{private constructor();update(data:NodeJS.ArrayBufferView):Buffer;update(data:string,input_encoding:Encoding):Buffer;update(data:NodeJS.ArrayBufferView,input_encoding:undefined,output_encoding:Encoding):string;update(data:string,input_encoding:Encoding|undefined,output_encoding:Encoding):string;final():Buffer;final(output_encoding:BufferEncoding):string;setAutoPadding(auto_padding?:boolean):this;}interface DecipherCCM extends Decipher{setAuthTag(buffer:NodeJS.ArrayBufferView):this;setAAD(buffer:NodeJS.ArrayBufferView,options:{plaintextLength:number}):this;}interface DecipherGCM extends Decipher{setAuthTag(buffer:NodeJS.ArrayBufferView):this;setAAD(buffer:NodeJS.ArrayBufferView,options?:{plaintextLength:number}):this;}interface PrivateKeyInput{key:string|Buffer;format?:KeyFormat;type?:'pkcs1'|'pkcs8'|'sec1';passphrase?:string|Buffer;}interface PublicKeyInput{key:string|Buffer;format?:KeyFormat;type?:'pkcs1'|'spki';}function createPrivateKey(key:PrivateKeyInput|string|Buffer):KeyObject;function createPublicKey(key:PublicKeyInput|string|Buffer|KeyObject):KeyObject;function createSecretKey(key:NodeJS.ArrayBufferView):KeyObject;function createSign(algorithm:string,options?:stream.WritableOptions):Signer;type DSAEncoding='der'|'ieee-p1363';interface SigningOptions{padding?:number;saltLength?:number;dsaEncoding?:DSAEncoding;}interface SignPrivateKeyInput extends PrivateKeyInput,SigningOptions{}interface SignKeyObjectInput extends SigningOptions{key:KeyObject;}interface VerifyPublicKeyInput extends PublicKeyInput,SigningOptions{}interface VerifyKeyObjectInput extends SigningOptions{key:KeyObject;}type KeyLike=string|Buffer|KeyObject;class Signer extends stream.Writable{private constructor();update(data:BinaryLike):Signer;update(data:string,input_encoding:Encoding):Signer;sign(private_key:KeyLike|SignKeyObjectInput|SignPrivateKeyInput):Buffer;sign(private_key:KeyLike|SignKeyObjectInput|SignPrivateKeyInput,output_format:BinaryToTextEncoding,):string;}function createVerify(algorithm:string,options?:stream.WritableOptions):Verify;class Verify extends stream.Writable{private constructor();update(data:BinaryLike):Verify;update(data:string,input_encoding:Encoding):Verify;verify(object:KeyLike|VerifyKeyObjectInput|VerifyPublicKeyInput,signature:NodeJS.ArrayBufferView,):boolean;verify(object:KeyLike|VerifyKeyObjectInput|VerifyPublicKeyInput,signature:string,signature_format?:BinaryToTextEncoding,):boolean;}function createDiffieHellman(prime_length:number,generator?:number|NodeJS.ArrayBufferView):DiffieHellman;function createDiffieHellman(prime:NodeJS.ArrayBufferView):DiffieHellman;function createDiffieHellman(prime:string,prime_encoding:BinaryToTextEncoding):DiffieHellman;function createDiffieHellman(prime:string,prime_encoding:BinaryToTextEncoding,generator:number|NodeJS.ArrayBufferView,):DiffieHellman;function createDiffieHellman(prime:string,prime_encoding:BinaryToTextEncoding,generator:string,generator_encoding:BinaryToTextEncoding,):DiffieHellman;class DiffieHellman{private constructor();generateKeys():Buffer;generateKeys(encoding:BinaryToTextEncoding):string;computeSecret(other_public_key:NodeJS.ArrayBufferView):Buffer;computeSecret(other_public_key:string,input_encoding:BinaryToTextEncoding):Buffer;computeSecret(other_public_key:NodeJS.ArrayBufferView,output_encoding:BinaryToTextEncoding):string;computeSecret(other_public_key:string,input_encoding:BinaryToTextEncoding,output_encoding:BinaryToTextEncoding,):string;getPrime():Buffer;getPrime(encoding:BinaryToTextEncoding):string;getGenerator():Buffer;getGenerator(encoding:BinaryToTextEncoding):string;getPublicKey():Buffer;getPublicKey(encoding:BinaryToTextEncoding):string;getPrivateKey():Buffer;getPrivateKey(encoding:BinaryToTextEncoding):string;setPublicKey(public_key:NodeJS.ArrayBufferView):void;setPublicKey(public_key:string,encoding:BufferEncoding):void;setPrivateKey(private_key:NodeJS.ArrayBufferView):void;setPrivateKey(private_key:string,encoding:BufferEncoding):void;verifyError:number;}function getDiffieHellman(group_name:string):DiffieHellman;function pbkdf2(password:BinaryLike,salt:BinaryLike,iterations:number,keylen:number,digest:string,callback:(err:Error|null,derivedKey:Buffer)=>any,):void;function pbkdf2Sync(password:BinaryLike,salt:BinaryLike,iterations:number,keylen:number,digest:string,):Buffer;function randomBytes(size:number):Buffer;function randomBytes(size:number,callback:(err:Error|null,buf:Buffer)=>void):void;function pseudoRandomBytes(size:number):Buffer;function pseudoRandomBytes(size:number,callback:(err:Error|null,buf:Buffer)=>void):void;function randomInt(max:number):number;function randomInt(min:number,max:number):number;function randomInt(max:number,callback:(err:Error|null,value:number)=>void):void;function randomInt(min:number,max:number,callback:(err:Error|null,value:number)=>void):void;function randomFillSync<T extends NodeJS.ArrayBufferView>(buffer:T,offset?:number,size?:number):T;function randomFill<T extends NodeJS.ArrayBufferView>(buffer:T,callback:(err:Error|null,buf:T)=>void,):void;function randomFill<T extends NodeJS.ArrayBufferView>(buffer:T,offset:number,callback:(err:Error|null,buf:T)=>void,):void;function randomFill<T extends NodeJS.ArrayBufferView>(buffer:T,offset:number,size:number,callback:(err:Error|null,buf:T)=>void,):void;interface ScryptOptions{cost?:number;blockSize?:number;parallelization?:number;N?:number;r?:number;p?:number;maxmem?:number;}function scrypt(password:BinaryLike,salt:BinaryLike,keylen:number,callback:(err:Error|null,derivedKey:Buffer)=>void,):void;function scrypt(password:BinaryLike,salt:BinaryLike,keylen:number,options:ScryptOptions,callback:(err:Error|null,derivedKey:Buffer)=>void,):void;function scryptSync(password:BinaryLike,salt:BinaryLike,keylen:number,options?:ScryptOptions):Buffer;interface RsaPublicKey{key:KeyLike;padding?:number;}interface RsaPrivateKey{key:KeyLike;passphrase?:string;oaepHash?:string;oaepLabel?:NodeJS.TypedArray;padding?:number;}function publicEncrypt(key:RsaPublicKey|RsaPrivateKey|KeyLike,buffer:NodeJS.ArrayBufferView):Buffer;function publicDecrypt(key:RsaPublicKey|RsaPrivateKey|KeyLike,buffer:NodeJS.ArrayBufferView):Buffer;function privateDecrypt(private_key:RsaPrivateKey|KeyLike,buffer:NodeJS.ArrayBufferView):Buffer;function privateEncrypt(private_key:RsaPrivateKey|KeyLike,buffer:NodeJS.ArrayBufferView):Buffer;function getCiphers():string[];function getCurves():string[];function getFips():1|0;function getHashes():string[];class ECDH{private constructor();static convertKey(key:BinaryLike,curve:string,inputEncoding?:BinaryToTextEncoding,outputEncoding?:'latin1'|'hex'|'base64',format?:'uncompressed'|'compressed'|'hybrid',):Buffer|string;generateKeys():Buffer;generateKeys(encoding:BinaryToTextEncoding,format?:ECDHKeyFormat):string;computeSecret(other_public_key:NodeJS.ArrayBufferView):Buffer;computeSecret(other_public_key:string,input_encoding:BinaryToTextEncoding):Buffer;computeSecret(other_public_key:NodeJS.ArrayBufferView,output_encoding:BinaryToTextEncoding):string;computeSecret(other_public_key:string,input_encoding:BinaryToTextEncoding,output_encoding:BinaryToTextEncoding,):string;getPrivateKey():Buffer;getPrivateKey(encoding:BinaryToTextEncoding):string;getPublicKey():Buffer;getPublicKey(encoding:BinaryToTextEncoding,format?:ECDHKeyFormat):string;setPrivateKey(private_key:NodeJS.ArrayBufferView):void;setPrivateKey(private_key:string,encoding:BinaryToTextEncoding):void;}function createECDH(curve_name:string):ECDH;function timingSafeEqual(a:NodeJS.ArrayBufferView,b:NodeJS.ArrayBufferView):boolean;const DEFAULT_ENCODING:BufferEncoding;type KeyType='rsa'|'dsa'|'ec'|'ed25519'|'ed448'|'x25519'|'x448';type KeyFormat='pem'|'der';interface BasePrivateKeyEncodingOptions<T extends KeyFormat>{format:T;cipher?:string;passphrase?:string;}interface KeyPairKeyObjectResult{publicKey:KeyObject;privateKey:KeyObject;}interface ED25519KeyPairKeyObjectOptions{}interface ED448KeyPairKeyObjectOptions{}interface X25519KeyPairKeyObjectOptions{}interface X448KeyPairKeyObjectOptions{}interface ECKeyPairKeyObjectOptions{namedCurve:string;}interface RSAKeyPairKeyObjectOptions{modulusLength:number;publicExponent?:number;}interface DSAKeyPairKeyObjectOptions{modulusLength:number;divisorLength:number;}interface RSAKeyPairOptions<PubF extends KeyFormat,PrivF extends KeyFormat>{modulusLength:number;publicExponent?:number;publicKeyEncoding:{type:'pkcs1'|'spki';format:PubF;};privateKeyEncoding:BasePrivateKeyEncodingOptions<PrivF>&{type:'pkcs1'|'pkcs8';};}interface DSAKeyPairOptions<PubF extends KeyFormat,PrivF extends KeyFormat>{modulusLength:number;divisorLength:number;publicKeyEncoding:{type:'spki';format:PubF;};privateKeyEncoding:BasePrivateKeyEncodingOptions<PrivF>&{type:'pkcs8';};}interface ECKeyPairOptions<PubF extends KeyFormat,PrivF extends KeyFormat>{namedCurve:string;publicKeyEncoding:{type:'pkcs1'|'spki';format:PubF;};privateKeyEncoding:BasePrivateKeyEncodingOptions<PrivF>&{type:'sec1'|'pkcs8';};}interface ED25519KeyPairOptions<PubF extends KeyFormat,PrivF extends KeyFormat>{publicKeyEncoding:{type:'spki';format:PubF;};privateKeyEncoding:BasePrivateKeyEncodingOptions<PrivF>&{type:'pkcs8';};}interface ED448KeyPairOptions<PubF extends KeyFormat,PrivF extends KeyFormat>{publicKeyEncoding:{type:'spki';format:PubF;};privateKeyEncoding:BasePrivateKeyEncodingOptions<PrivF>&{type:'pkcs8';};}interface X25519KeyPairOptions<PubF extends KeyFormat,PrivF extends KeyFormat>{publicKeyEncoding:{type:'spki';format:PubF;};privateKeyEncoding:BasePrivateKeyEncodingOptions<PrivF>&{type:'pkcs8';};}interface X448KeyPairOptions<PubF extends KeyFormat,PrivF extends KeyFormat>{publicKeyEncoding:{type:'spki';format:PubF;};privateKeyEncoding:BasePrivateKeyEncodingOptions<PrivF>&{type:'pkcs8';};}interface KeyPairSyncResult<T1 extends string|Buffer,T2 extends string|Buffer>{publicKey:T1;privateKey:T2;}function generateKeyPairSync(type:'rsa',options:RSAKeyPairOptions<'pem','pem'>,):KeyPairSyncResult<string,string>;function generateKeyPairSync(type:'rsa',options:RSAKeyPairOptions<'pem','der'>,):KeyPairSyncResult<string,Buffer>;function generateKeyPairSync(type:'rsa',options:RSAKeyPairOptions<'der','pem'>,):KeyPairSyncResult<Buffer,string>;function generateKeyPairSync(type:'rsa',options:RSAKeyPairOptions<'der','der'>,):KeyPairSyncResult<Buffer,Buffer>;function generateKeyPairSync(type:'rsa',options:RSAKeyPairKeyObjectOptions):KeyPairKeyObjectResult;function generateKeyPairSync(type:'dsa',options:DSAKeyPairOptions<'pem','pem'>,):KeyPairSyncResult<string,string>;function generateKeyPairSync(type:'dsa',options:DSAKeyPairOptions<'pem','der'>,):KeyPairSyncResult<string,Buffer>;function generateKeyPairSync(type:'dsa',options:DSAKeyPairOptions<'der','pem'>,):KeyPairSyncResult<Buffer,string>;function generateKeyPairSync(type:'dsa',options:DSAKeyPairOptions<'der','der'>,):KeyPairSyncResult<Buffer,Buffer>;function generateKeyPairSync(type:'dsa',options:DSAKeyPairKeyObjectOptions):KeyPairKeyObjectResult;function generateKeyPairSync(type:'ec',options:ECKeyPairOptions<'pem','pem'>,):KeyPairSyncResult<string,string>;function generateKeyPairSync(type:'ec',options:ECKeyPairOptions<'pem','der'>,):KeyPairSyncResult<string,Buffer>;function generateKeyPairSync(type:'ec',options:ECKeyPairOptions<'der','pem'>,):KeyPairSyncResult<Buffer,string>;function generateKeyPairSync(type:'ec',options:ECKeyPairOptions<'der','der'>,):KeyPairSyncResult<Buffer,Buffer>;function generateKeyPairSync(type:'ec',options:ECKeyPairKeyObjectOptions):KeyPairKeyObjectResult;function generateKeyPairSync(type:'ed25519',options:ED25519KeyPairOptions<'pem','pem'>,):KeyPairSyncResult<string,string>;function generateKeyPairSync(type:'ed25519',options:ED25519KeyPairOptions<'pem','der'>,):KeyPairSyncResult<string,Buffer>;function generateKeyPairSync(type:'ed25519',options:ED25519KeyPairOptions<'der','pem'>,):KeyPairSyncResult<Buffer,string>;function generateKeyPairSync(type:'ed25519',options:ED25519KeyPairOptions<'der','der'>,):KeyPairSyncResult<Buffer,Buffer>;function generateKeyPairSync(type:'ed25519',options?:ED25519KeyPairKeyObjectOptions):KeyPairKeyObjectResult;function generateKeyPairSync(type:'ed448',options:ED448KeyPairOptions<'pem','pem'>,):KeyPairSyncResult<string,string>;function generateKeyPairSync(type:'ed448',options:ED448KeyPairOptions<'pem','der'>,):KeyPairSyncResult<string,Buffer>;function generateKeyPairSync(type:'ed448',options:ED448KeyPairOptions<'der','pem'>,):KeyPairSyncResult<Buffer,string>;function generateKeyPairSync(type:'ed448',options:ED448KeyPairOptions<'der','der'>,):KeyPairSyncResult<Buffer,Buffer>;function generateKeyPairSync(type:'ed448',options?:ED448KeyPairKeyObjectOptions):KeyPairKeyObjectResult;function generateKeyPairSync(type:'x25519',options:X25519KeyPairOptions<'pem','pem'>,):KeyPairSyncResult<string,string>;function generateKeyPairSync(type:'x25519',options:X25519KeyPairOptions<'pem','der'>,):KeyPairSyncResult<string,Buffer>;function generateKeyPairSync(type:'x25519',options:X25519KeyPairOptions<'der','pem'>,):KeyPairSyncResult<Buffer,string>;function generateKeyPairSync(type:'x25519',options:X25519KeyPairOptions<'der','der'>,):KeyPairSyncResult<Buffer,Buffer>;function generateKeyPairSync(type:'x25519',options?:X25519KeyPairKeyObjectOptions):KeyPairKeyObjectResult;function generateKeyPairSync(type:'x448',options:X448KeyPairOptions<'pem','pem'>,):KeyPairSyncResult<string,string>;function generateKeyPairSync(type:'x448',options:X448KeyPairOptions<'pem','der'>,):KeyPairSyncResult<string,Buffer>;function generateKeyPairSync(type:'x448',options:X448KeyPairOptions<'der','pem'>,):KeyPairSyncResult<Buffer,string>;function generateKeyPairSync(type:'x448',options:X448KeyPairOptions<'der','der'>,):KeyPairSyncResult<Buffer,Buffer>;function generateKeyPairSync(type:'x448',options?:X448KeyPairKeyObjectOptions):KeyPairKeyObjectResult;function generateKeyPair(type:'rsa',options:RSAKeyPairOptions<'pem','pem'>,callback:(err:Error|null,publicKey:string,privateKey:string)=>void,):void;function generateKeyPair(type:'rsa',options:RSAKeyPairOptions<'pem','der'>,callback:(err:Error|null,publicKey:string,privateKey:Buffer)=>void,):void;function generateKeyPair(type:'rsa',options:RSAKeyPairOptions<'der','pem'>,callback:(err:Error|null,publicKey:Buffer,privateKey:string)=>void,):void;function generateKeyPair(type:'rsa',options:RSAKeyPairOptions<'der','der'>,callback:(err:Error|null,publicKey:Buffer,privateKey:Buffer)=>void,):void;function generateKeyPair(type:'rsa',options:RSAKeyPairKeyObjectOptions,callback:(err:Error|null,publicKey:KeyObject,privateKey:KeyObject)=>void,):void;function generateKeyPair(type:'dsa',options:DSAKeyPairOptions<'pem','pem'>,callback:(err:Error|null,publicKey:string,privateKey:string)=>void,):void;function generateKeyPair(type:'dsa',options:DSAKeyPairOptions<'pem','der'>,callback:(err:Error|null,publicKey:string,privateKey:Buffer)=>void,):void;function generateKeyPair(type:'dsa',options:DSAKeyPairOptions<'der','pem'>,callback:(err:Error|null,publicKey:Buffer,privateKey:string)=>void,):void;function generateKeyPair(type:'dsa',options:DSAKeyPairOptions<'der','der'>,callback:(err:Error|null,publicKey:Buffer,privateKey:Buffer)=>void,):void;function generateKeyPair(type:'dsa',options:DSAKeyPairKeyObjectOptions,callback:(err:Error|null,publicKey:KeyObject,privateKey:KeyObject)=>void,):void;function generateKeyPair(type:'ec',options:ECKeyPairOptions<'pem','pem'>,callback:(err:Error|null,publicKey:string,privateKey:string)=>void,):void;function generateKeyPair(type:'ec',options:ECKeyPairOptions<'pem','der'>,callback:(err:Error|null,publicKey:string,privateKey:Buffer)=>void,):void;function generateKeyPair(type:'ec',options:ECKeyPairOptions<'der','pem'>,callback:(err:Error|null,publicKey:Buffer,privateKey:string)=>void,):void;function generateKeyPair(type:'ec',options:ECKeyPairOptions<'der','der'>,callback:(err:Error|null,publicKey:Buffer,privateKey:Buffer)=>void,):void;function generateKeyPair(type:'ec',options:ECKeyPairKeyObjectOptions,callback:(err:Error|null,publicKey:KeyObject,privateKey:KeyObject)=>void,):void;function generateKeyPair(type:'ed25519',options:ED25519KeyPairOptions<'pem','pem'>,callback:(err:Error|null,publicKey:string,privateKey:string)=>void,):void;function generateKeyPair(type:'ed25519',options:ED25519KeyPairOptions<'pem','der'>,callback:(err:Error|null,publicKey:string,privateKey:Buffer)=>void,):void;function generateKeyPair(type:'ed25519',options:ED25519KeyPairOptions<'der','pem'>,callback:(err:Error|null,publicKey:Buffer,privateKey:string)=>void,):void;function generateKeyPair(type:'ed25519',options:ED25519KeyPairOptions<'der','der'>,callback:(err:Error|null,publicKey:Buffer,privateKey:Buffer)=>void,):void;function generateKeyPair(type:'ed25519',options:ED25519KeyPairKeyObjectOptions|undefined,callback:(err:Error|null,publicKey:KeyObject,privateKey:KeyObject)=>void,):void;function generateKeyPair(type:'ed448',options:ED448KeyPairOptions<'pem','pem'>,callback:(err:Error|null,publicKey:string,privateKey:string)=>void,):void;function generateKeyPair(type:'ed448',options:ED448KeyPairOptions<'pem','der'>,callback:(err:Error|null,publicKey:string,privateKey:Buffer)=>void,):void;function generateKeyPair(type:'ed448',options:ED448KeyPairOptions<'der','pem'>,callback:(err:Error|null,publicKey:Buffer,privateKey:string)=>void,):void;function generateKeyPair(type:'ed448',options:ED448KeyPairOptions<'der','der'>,callback:(err:Error|null,publicKey:Buffer,privateKey:Buffer)=>void,):void;function generateKeyPair(type:'ed448',options:ED448KeyPairKeyObjectOptions|undefined,callback:(err:Error|null,publicKey:KeyObject,privateKey:KeyObject)=>void,):void;function generateKeyPair(type:'x25519',options:X25519KeyPairOptions<'pem','pem'>,callback:(err:Error|null,publicKey:string,privateKey:string)=>void,):void;function generateKeyPair(type:'x25519',options:X25519KeyPairOptions<'pem','der'>,callback:(err:Error|null,publicKey:string,privateKey:Buffer)=>void,):void;function generateKeyPair(type:'x25519',options:X25519KeyPairOptions<'der','pem'>,callback:(err:Error|null,publicKey:Buffer,privateKey:string)=>void,):void;function generateKeyPair(type:'x25519',options:X25519KeyPairOptions<'der','der'>,callback:(err:Error|null,publicKey:Buffer,privateKey:Buffer)=>void,):void;function generateKeyPair(type:'x25519',options:X25519KeyPairKeyObjectOptions|undefined,callback:(err:Error|null,publicKey:KeyObject,privateKey:KeyObject)=>void,):void;function generateKeyPair(type:'x448',options:X448KeyPairOptions<'pem','pem'>,callback:(err:Error|null,publicKey:string,privateKey:string)=>void,):void;function generateKeyPair(type:'x448',options:X448KeyPairOptions<'pem','der'>,callback:(err:Error|null,publicKey:string,privateKey:Buffer)=>void,):void;function generateKeyPair(type:'x448',options:X448KeyPairOptions<'der','pem'>,callback:(err:Error|null,publicKey:Buffer,privateKey:string)=>void,):void;function generateKeyPair(type:'x448',options:X448KeyPairOptions<'der','der'>,callback:(err:Error|null,publicKey:Buffer,privateKey:Buffer)=>void,):void;function generateKeyPair(type:'x448',options:X448KeyPairKeyObjectOptions|undefined,callback:(err:Error|null,publicKey:KeyObject,privateKey:KeyObject)=>void,):void;namespace generateKeyPair{function __promisify__(type:'rsa',options:RSAKeyPairOptions<'pem','pem'>,):Promise<{publicKey:string;privateKey:string}>;function __promisify__(type:'rsa',options:RSAKeyPairOptions<'pem','der'>,):Promise<{publicKey:string;privateKey:Buffer}>;function __promisify__(type:'rsa',options:RSAKeyPairOptions<'der','pem'>,):Promise<{publicKey:Buffer;privateKey:string}>;function __promisify__(type:'rsa',options:RSAKeyPairOptions<'der','der'>,):Promise<{publicKey:Buffer;privateKey:Buffer}>;function __promisify__(type:'rsa',options:RSAKeyPairKeyObjectOptions):Promise<KeyPairKeyObjectResult>;function __promisify__(type:'dsa',options:DSAKeyPairOptions<'pem','pem'>,):Promise<{publicKey:string;privateKey:string}>;function __promisify__(type:'dsa',options:DSAKeyPairOptions<'pem','der'>,):Promise<{publicKey:string;privateKey:Buffer}>;function __promisify__(type:'dsa',options:DSAKeyPairOptions<'der','pem'>,):Promise<{publicKey:Buffer;privateKey:string}>;function __promisify__(type:'dsa',options:DSAKeyPairOptions<'der','der'>,):Promise<{publicKey:Buffer;privateKey:Buffer}>;function __promisify__(type:'dsa',options:DSAKeyPairKeyObjectOptions):Promise<KeyPairKeyObjectResult>;function __promisify__(type:'ec',options:ECKeyPairOptions<'pem','pem'>,):Promise<{publicKey:string;privateKey:string}>;function __promisify__(type:'ec',options:ECKeyPairOptions<'pem','der'>,):Promise<{publicKey:string;privateKey:Buffer}>;function __promisify__(type:'ec',options:ECKeyPairOptions<'der','pem'>,):Promise<{publicKey:Buffer;privateKey:string}>;function __promisify__(type:'ec',options:ECKeyPairOptions<'der','der'>,):Promise<{publicKey:Buffer;privateKey:Buffer}>;function __promisify__(type:'ec',options:ECKeyPairKeyObjectOptions):Promise<KeyPairKeyObjectResult>;function __promisify__(type:'ed25519',options:ED25519KeyPairOptions<'pem','pem'>,):Promise<{publicKey:string;privateKey:string}>;function __promisify__(type:'ed25519',options:ED25519KeyPairOptions<'pem','der'>,):Promise<{publicKey:string;privateKey:Buffer}>;function __promisify__(type:'ed25519',options:ED25519KeyPairOptions<'der','pem'>,):Promise<{publicKey:Buffer;privateKey:string}>;function __promisify__(type:'ed25519',options:ED25519KeyPairOptions<'der','der'>,):Promise<{publicKey:Buffer;privateKey:Buffer}>;function __promisify__(type:'ed25519',options?:ED25519KeyPairKeyObjectOptions,):Promise<KeyPairKeyObjectResult>;function __promisify__(type:'ed448',options:ED448KeyPairOptions<'pem','pem'>,):Promise<{publicKey:string;privateKey:string}>;function __promisify__(type:'ed448',options:ED448KeyPairOptions<'pem','der'>,):Promise<{publicKey:string;privateKey:Buffer}>;function __promisify__(type:'ed448',options:ED448KeyPairOptions<'der','pem'>,):Promise<{publicKey:Buffer;privateKey:string}>;function __promisify__(type:'ed448',options:ED448KeyPairOptions<'der','der'>,):Promise<{publicKey:Buffer;privateKey:Buffer}>;function __promisify__(type:'ed448',options?:ED448KeyPairKeyObjectOptions):Promise<KeyPairKeyObjectResult>;function __promisify__(type:'x25519',options:X25519KeyPairOptions<'pem','pem'>,):Promise<{publicKey:string;privateKey:string}>;function __promisify__(type:'x25519',options:X25519KeyPairOptions<'pem','der'>,):Promise<{publicKey:string;privateKey:Buffer}>;function __promisify__(type:'x25519',options:X25519KeyPairOptions<'der','pem'>,):Promise<{publicKey:Buffer;privateKey:string}>;function __promisify__(type:'x25519',options:X25519KeyPairOptions<'der','der'>,):Promise<{publicKey:Buffer;privateKey:Buffer}>;function __promisify__(type:'x25519',options?:X25519KeyPairKeyObjectOptions,):Promise<KeyPairKeyObjectResult>;function __promisify__(type:'x448',options:X448KeyPairOptions<'pem','pem'>,):Promise<{publicKey:string;privateKey:string}>;function __promisify__(type:'x448',options:X448KeyPairOptions<'pem','der'>,):Promise<{publicKey:string;privateKey:Buffer}>;function __promisify__(type:'x448',options:X448KeyPairOptions<'der','pem'>,):Promise<{publicKey:Buffer;privateKey:string}>;function __promisify__(type:'x448',options:X448KeyPairOptions<'der','der'>,):Promise<{publicKey:Buffer;privateKey:Buffer}>;function __promisify__(type:'x448',options?:X448KeyPairKeyObjectOptions):Promise<KeyPairKeyObjectResult>;}function sign(algorithm:string|null|undefined,data:NodeJS.ArrayBufferView,key:KeyLike|SignKeyObjectInput|SignPrivateKeyInput,):Buffer;function verify(algorithm:string|null|undefined,data:NodeJS.ArrayBufferView,key:KeyLike|VerifyKeyObjectInput|VerifyPublicKeyInput,signature:NodeJS.ArrayBufferView,):boolean;function diffieHellman(options:{privateKey:KeyObject;publicKey:KeyObject}):Buffer;}
1
+
2
+ /* NOTE: Do not edit directly! This file is generated using `npm run update-types` in https://github.com/node-red/nr-monaco-build */
3
+
4
+ declare module 'crypto' {
5
+ import * as stream from 'stream';
6
+
7
+ interface Certificate {
8
+ /**
9
+ * @param spkac
10
+ * @returns The challenge component of the `spkac` data structure,
11
+ * which includes a public key and a challenge.
12
+ */
13
+ exportChallenge(spkac: BinaryLike): Buffer;
14
+ /**
15
+ * @param spkac
16
+ * @param encoding The encoding of the spkac string.
17
+ * @returns The public key component of the `spkac` data structure,
18
+ * which includes a public key and a challenge.
19
+ */
20
+ exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer;
21
+ /**
22
+ * @param spkac
23
+ * @returns `true` if the given `spkac` data structure is valid,
24
+ * `false` otherwise.
25
+ */
26
+ verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
27
+ }
28
+ const Certificate: Certificate & {
29
+ /** @deprecated since v14.9.0 - Use static methods of `crypto.Certificate` instead. */
30
+ new (): Certificate;
31
+ /** @deprecated since v14.9.0 - Use static methods of `crypto.Certificate` instead. */
32
+ (): Certificate;
33
+ };
34
+
35
+ namespace constants {
36
+ // https://nodejs.org/dist/latest-v10.x/docs/api/crypto.html#crypto_crypto_constants
37
+ const OPENSSL_VERSION_NUMBER: number;
38
+
39
+ /** Applies multiple bug workarounds within OpenSSL. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for detail. */
40
+ const SSL_OP_ALL: number;
41
+ /** Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */
42
+ const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number;
43
+ /** Attempts to use the server's preferences instead of the client's when selecting a cipher. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */
44
+ const SSL_OP_CIPHER_SERVER_PREFERENCE: number;
45
+ /** Instructs OpenSSL to use Cisco's "speshul" version of DTLS_BAD_VER. */
46
+ const SSL_OP_CISCO_ANYCONNECT: number;
47
+ /** Instructs OpenSSL to turn on cookie exchange. */
48
+ const SSL_OP_COOKIE_EXCHANGE: number;
49
+ /** Instructs OpenSSL to add server-hello extension from an early version of the cryptopro draft. */
50
+ const SSL_OP_CRYPTOPRO_TLSEXT_BUG: number;
51
+ /** Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. */
52
+ const SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number;
53
+ /** Instructs OpenSSL to always use the tmp_rsa key when performing RSA operations. */
54
+ const SSL_OP_EPHEMERAL_RSA: number;
55
+ /** Allows initial connection to servers that do not support RI. */
56
+ const SSL_OP_LEGACY_SERVER_CONNECT: number;
57
+ const SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: number;
58
+ const SSL_OP_MICROSOFT_SESS_ID_BUG: number;
59
+ /** Instructs OpenSSL to disable the workaround for a man-in-the-middle protocol-version vulnerability in the SSL 2.0 server implementation. */
60
+ const SSL_OP_MSIE_SSLV2_RSA_PADDING: number;
61
+ const SSL_OP_NETSCAPE_CA_DN_BUG: number;
62
+ const SSL_OP_NETSCAPE_CHALLENGE_BUG: number;
63
+ const SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG: number;
64
+ const SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: number;
65
+ /** Instructs OpenSSL to disable support for SSL/TLS compression. */
66
+ const SSL_OP_NO_COMPRESSION: number;
67
+ const SSL_OP_NO_QUERY_MTU: number;
68
+ /** Instructs OpenSSL to always start a new session when performing renegotiation. */
69
+ const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number;
70
+ const SSL_OP_NO_SSLv2: number;
71
+ const SSL_OP_NO_SSLv3: number;
72
+ const SSL_OP_NO_TICKET: number;
73
+ const SSL_OP_NO_TLSv1: number;
74
+ const SSL_OP_NO_TLSv1_1: number;
75
+ const SSL_OP_NO_TLSv1_2: number;
76
+ const SSL_OP_PKCS1_CHECK_1: number;
77
+ const SSL_OP_PKCS1_CHECK_2: number;
78
+ /** Instructs OpenSSL to always create a new key when using temporary/ephemeral DH parameters. */
79
+ const SSL_OP_SINGLE_DH_USE: number;
80
+ /** Instructs OpenSSL to always create a new key when using temporary/ephemeral ECDH parameters. */
81
+ const SSL_OP_SINGLE_ECDH_USE: number;
82
+ const SSL_OP_SSLEAY_080_CLIENT_DH_BUG: number;
83
+ const SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG: number;
84
+ const SSL_OP_TLS_BLOCK_PADDING_BUG: number;
85
+ const SSL_OP_TLS_D5_BUG: number;
86
+ /** Instructs OpenSSL to disable version rollback attack detection. */
87
+ const SSL_OP_TLS_ROLLBACK_BUG: number;
88
+
89
+ const ENGINE_METHOD_RSA: number;
90
+ const ENGINE_METHOD_DSA: number;
91
+ const ENGINE_METHOD_DH: number;
92
+ const ENGINE_METHOD_RAND: number;
93
+ const ENGINE_METHOD_EC: number;
94
+ const ENGINE_METHOD_CIPHERS: number;
95
+ const ENGINE_METHOD_DIGESTS: number;
96
+ const ENGINE_METHOD_PKEY_METHS: number;
97
+ const ENGINE_METHOD_PKEY_ASN1_METHS: number;
98
+ const ENGINE_METHOD_ALL: number;
99
+ const ENGINE_METHOD_NONE: number;
100
+
101
+ const DH_CHECK_P_NOT_SAFE_PRIME: number;
102
+ const DH_CHECK_P_NOT_PRIME: number;
103
+ const DH_UNABLE_TO_CHECK_GENERATOR: number;
104
+ const DH_NOT_SUITABLE_GENERATOR: number;
105
+
106
+ const ALPN_ENABLED: number;
107
+
108
+ const RSA_PKCS1_PADDING: number;
109
+ const RSA_SSLV23_PADDING: number;
110
+ const RSA_NO_PADDING: number;
111
+ const RSA_PKCS1_OAEP_PADDING: number;
112
+ const RSA_X931_PADDING: number;
113
+ const RSA_PKCS1_PSS_PADDING: number;
114
+ /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the digest size when signing or verifying. */
115
+ const RSA_PSS_SALTLEN_DIGEST: number;
116
+ /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the maximum permissible value when signing data. */
117
+ const RSA_PSS_SALTLEN_MAX_SIGN: number;
118
+ /** Causes the salt length for RSA_PKCS1_PSS_PADDING to be determined automatically when verifying a signature. */
119
+ const RSA_PSS_SALTLEN_AUTO: number;
120
+
121
+ const POINT_CONVERSION_COMPRESSED: number;
122
+ const POINT_CONVERSION_UNCOMPRESSED: number;
123
+ const POINT_CONVERSION_HYBRID: number;
124
+
125
+ /** Specifies the built-in default cipher list used by Node.js (colon-separated values). */
126
+ const defaultCoreCipherList: string;
127
+ /** Specifies the active default cipher list used by the current Node.js process (colon-separated values). */
128
+ const defaultCipherList: string;
129
+ }
130
+
131
+ interface HashOptions extends stream.TransformOptions {
132
+ /**
133
+ * For XOF hash functions such as `shake256`, the
134
+ * outputLength option can be used to specify the desired output length in bytes.
135
+ */
136
+ outputLength?: number | undefined;
137
+ }
138
+
139
+ /** @deprecated since v10.0.0 */
140
+ const fips: boolean;
141
+
142
+ function createHash(algorithm: string, options?: HashOptions): Hash;
143
+ function createHmac(algorithm: string, key: BinaryLike | KeyObject, options?: stream.TransformOptions): Hmac;
144
+
145
+ // https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings
146
+ type BinaryToTextEncoding = 'base64' | 'hex';
147
+ type CharacterEncoding = 'utf8' | 'utf-8' | 'utf16le' | 'latin1';
148
+ type LegacyCharacterEncoding = 'ascii' | 'binary' | 'ucs2' | 'ucs-2';
149
+
150
+ type Encoding = BinaryToTextEncoding | CharacterEncoding | LegacyCharacterEncoding;
151
+
152
+ type ECDHKeyFormat = 'compressed' | 'uncompressed' | 'hybrid';
153
+
154
+ class Hash extends stream.Transform {
155
+ private constructor();
156
+ copy(): Hash;
157
+ update(data: BinaryLike): Hash;
158
+ update(data: string, input_encoding: Encoding): Hash;
159
+ digest(): Buffer;
160
+ digest(encoding: BinaryToTextEncoding): string;
161
+ }
162
+ class Hmac extends stream.Transform {
163
+ private constructor();
164
+ update(data: BinaryLike): Hmac;
165
+ update(data: string, input_encoding: Encoding): Hmac;
166
+ digest(): Buffer;
167
+ digest(encoding: BinaryToTextEncoding): string;
168
+ }
169
+
170
+ type KeyObjectType = 'secret' | 'public' | 'private';
171
+
172
+ interface KeyExportOptions<T extends KeyFormat> {
173
+ type: 'pkcs1' | 'spki' | 'pkcs8' | 'sec1';
174
+ format: T;
175
+ cipher?: string | undefined;
176
+ passphrase?: string | Buffer | undefined;
177
+ }
178
+
179
+ class KeyObject {
180
+ private constructor();
181
+ asymmetricKeyType?: KeyType | undefined;
182
+ /**
183
+ * For asymmetric keys, this property represents the size of the embedded key in
184
+ * bytes. This property is `undefined` for symmetric keys.
185
+ */
186
+ asymmetricKeySize?: number | undefined;
187
+ export(options: KeyExportOptions<'pem'>): string | Buffer;
188
+ export(options?: KeyExportOptions<'der'>): Buffer;
189
+ symmetricKeySize?: number | undefined;
190
+ type: KeyObjectType;
191
+ }
192
+
193
+ type CipherCCMTypes = 'aes-128-ccm' | 'aes-192-ccm' | 'aes-256-ccm' | 'chacha20-poly1305';
194
+ type CipherGCMTypes = 'aes-128-gcm' | 'aes-192-gcm' | 'aes-256-gcm';
195
+
196
+ type BinaryLike = string | NodeJS.ArrayBufferView;
197
+
198
+ type CipherKey = BinaryLike | KeyObject;
199
+
200
+ interface CipherCCMOptions extends stream.TransformOptions {
201
+ authTagLength: number;
202
+ }
203
+ interface CipherGCMOptions extends stream.TransformOptions {
204
+ authTagLength?: number | undefined;
205
+ }
206
+ /** @deprecated since v10.0.0 use `createCipheriv()` */
207
+ function createCipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): CipherCCM;
208
+ /** @deprecated since v10.0.0 use `createCipheriv()` */
209
+ function createCipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): CipherGCM;
210
+ /** @deprecated since v10.0.0 use `createCipheriv()` */
211
+ function createCipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Cipher;
212
+
213
+ function createCipheriv(
214
+ algorithm: CipherCCMTypes,
215
+ key: CipherKey,
216
+ iv: BinaryLike | null,
217
+ options: CipherCCMOptions,
218
+ ): CipherCCM;
219
+ function createCipheriv(
220
+ algorithm: CipherGCMTypes,
221
+ key: CipherKey,
222
+ iv: BinaryLike | null,
223
+ options?: CipherGCMOptions,
224
+ ): CipherGCM;
225
+ function createCipheriv(
226
+ algorithm: string,
227
+ key: CipherKey,
228
+ iv: BinaryLike | null,
229
+ options?: stream.TransformOptions,
230
+ ): Cipher;
231
+
232
+ class Cipher extends stream.Transform {
233
+ private constructor();
234
+ update(data: BinaryLike): Buffer;
235
+ update(data: string, input_encoding: Encoding): Buffer;
236
+ update(data: NodeJS.ArrayBufferView, input_encoding: undefined, output_encoding: Encoding): string;
237
+ update(data: string, input_encoding: Encoding | undefined, output_encoding: Encoding): string;
238
+ final(): Buffer;
239
+ final(output_encoding: BufferEncoding): string;
240
+ setAutoPadding(auto_padding?: boolean): this;
241
+ // getAuthTag(): Buffer;
242
+ // setAAD(buffer: NodeJS.ArrayBufferView): this;
243
+ }
244
+ interface CipherCCM extends Cipher {
245
+ setAAD(buffer: NodeJS.ArrayBufferView, options: { plaintextLength: number }): this;
246
+ getAuthTag(): Buffer;
247
+ }
248
+ interface CipherGCM extends Cipher {
249
+ setAAD(buffer: NodeJS.ArrayBufferView, options?: { plaintextLength: number }): this;
250
+ getAuthTag(): Buffer;
251
+ }
252
+ /** @deprecated since v10.0.0 use `createDecipheriv()` */
253
+ function createDecipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): DecipherCCM;
254
+ /** @deprecated since v10.0.0 use `createDecipheriv()` */
255
+ function createDecipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): DecipherGCM;
256
+ /** @deprecated since v10.0.0 use `createDecipheriv()` */
257
+ function createDecipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Decipher;
258
+
259
+ function createDecipheriv(
260
+ algorithm: CipherCCMTypes,
261
+ key: CipherKey,
262
+ iv: BinaryLike | null,
263
+ options: CipherCCMOptions,
264
+ ): DecipherCCM;
265
+ function createDecipheriv(
266
+ algorithm: CipherGCMTypes,
267
+ key: CipherKey,
268
+ iv: BinaryLike | null,
269
+ options?: CipherGCMOptions,
270
+ ): DecipherGCM;
271
+ function createDecipheriv(
272
+ algorithm: string,
273
+ key: CipherKey,
274
+ iv: BinaryLike | null,
275
+ options?: stream.TransformOptions,
276
+ ): Decipher;
277
+
278
+ class Decipher extends stream.Transform {
279
+ private constructor();
280
+ update(data: NodeJS.ArrayBufferView): Buffer;
281
+ update(data: string, input_encoding: Encoding): Buffer;
282
+ update(data: NodeJS.ArrayBufferView, input_encoding: undefined, output_encoding: Encoding): string;
283
+ update(data: string, input_encoding: Encoding | undefined, output_encoding: Encoding): string;
284
+ final(): Buffer;
285
+ final(output_encoding: BufferEncoding): string;
286
+ setAutoPadding(auto_padding?: boolean): this;
287
+ // setAuthTag(tag: NodeJS.ArrayBufferView): this;
288
+ // setAAD(buffer: NodeJS.ArrayBufferView): this;
289
+ }
290
+ interface DecipherCCM extends Decipher {
291
+ setAuthTag(buffer: NodeJS.ArrayBufferView): this;
292
+ setAAD(buffer: NodeJS.ArrayBufferView, options: { plaintextLength: number }): this;
293
+ }
294
+ interface DecipherGCM extends Decipher {
295
+ setAuthTag(buffer: NodeJS.ArrayBufferView): this;
296
+ setAAD(buffer: NodeJS.ArrayBufferView, options?: { plaintextLength: number }): this;
297
+ }
298
+
299
+ interface PrivateKeyInput {
300
+ key: string | Buffer;
301
+ format?: KeyFormat | undefined;
302
+ type?: 'pkcs1' | 'pkcs8' | 'sec1' | undefined;
303
+ passphrase?: string | Buffer | undefined;
304
+ }
305
+
306
+ interface PublicKeyInput {
307
+ key: string | Buffer;
308
+ format?: KeyFormat | undefined;
309
+ type?: 'pkcs1' | 'spki' | undefined;
310
+ }
311
+
312
+ function createPrivateKey(key: PrivateKeyInput | string | Buffer): KeyObject;
313
+ function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject): KeyObject;
314
+ function createSecretKey(key: NodeJS.ArrayBufferView): KeyObject;
315
+
316
+ function createSign(algorithm: string, options?: stream.WritableOptions): Signer;
317
+
318
+ type DSAEncoding = 'der' | 'ieee-p1363';
319
+
320
+ interface SigningOptions {
321
+ /**
322
+ * @See crypto.constants.RSA_PKCS1_PADDING
323
+ */
324
+ padding?: number | undefined;
325
+ saltLength?: number | undefined;
326
+ dsaEncoding?: DSAEncoding | undefined;
327
+ }
328
+
329
+ interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions {}
330
+ interface SignKeyObjectInput extends SigningOptions {
331
+ key: KeyObject;
332
+ }
333
+ interface VerifyPublicKeyInput extends PublicKeyInput, SigningOptions {}
334
+ interface VerifyKeyObjectInput extends SigningOptions {
335
+ key: KeyObject;
336
+ }
337
+
338
+ type KeyLike = string | Buffer | KeyObject;
339
+
340
+ class Signer extends stream.Writable {
341
+ private constructor();
342
+
343
+ update(data: BinaryLike): Signer;
344
+ update(data: string, input_encoding: Encoding): Signer;
345
+ sign(private_key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer;
346
+ sign(
347
+ private_key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput,
348
+ output_format: BinaryToTextEncoding,
349
+ ): string;
350
+ }
351
+
352
+ function createVerify(algorithm: string, options?: stream.WritableOptions): Verify;
353
+ class Verify extends stream.Writable {
354
+ private constructor();
355
+
356
+ update(data: BinaryLike): Verify;
357
+ update(data: string, input_encoding: Encoding): Verify;
358
+ verify(
359
+ object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput,
360
+ signature: NodeJS.ArrayBufferView,
361
+ ): boolean;
362
+ verify(
363
+ object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput,
364
+ signature: string,
365
+ signature_format?: BinaryToTextEncoding,
366
+ ): boolean;
367
+ // https://nodejs.org/api/crypto.html#crypto_verifier_verify_object_signature_signature_format
368
+ // The signature field accepts a TypedArray type, but it is only available starting ES2017
369
+ }
370
+ function createDiffieHellman(prime_length: number, generator?: number | NodeJS.ArrayBufferView): DiffieHellman;
371
+ function createDiffieHellman(prime: NodeJS.ArrayBufferView): DiffieHellman;
372
+ function createDiffieHellman(prime: string, prime_encoding: BinaryToTextEncoding): DiffieHellman;
373
+ function createDiffieHellman(
374
+ prime: string,
375
+ prime_encoding: BinaryToTextEncoding,
376
+ generator: number | NodeJS.ArrayBufferView,
377
+ ): DiffieHellman;
378
+ function createDiffieHellman(
379
+ prime: string,
380
+ prime_encoding: BinaryToTextEncoding,
381
+ generator: string,
382
+ generator_encoding: BinaryToTextEncoding,
383
+ ): DiffieHellman;
384
+ class DiffieHellman {
385
+ private constructor();
386
+ generateKeys(): Buffer;
387
+ generateKeys(encoding: BinaryToTextEncoding): string;
388
+ computeSecret(other_public_key: NodeJS.ArrayBufferView): Buffer;
389
+ computeSecret(other_public_key: string, input_encoding: BinaryToTextEncoding): Buffer;
390
+ computeSecret(other_public_key: NodeJS.ArrayBufferView, output_encoding: BinaryToTextEncoding): string;
391
+ computeSecret(
392
+ other_public_key: string,
393
+ input_encoding: BinaryToTextEncoding,
394
+ output_encoding: BinaryToTextEncoding,
395
+ ): string;
396
+ getPrime(): Buffer;
397
+ getPrime(encoding: BinaryToTextEncoding): string;
398
+ getGenerator(): Buffer;
399
+ getGenerator(encoding: BinaryToTextEncoding): string;
400
+ getPublicKey(): Buffer;
401
+ getPublicKey(encoding: BinaryToTextEncoding): string;
402
+ getPrivateKey(): Buffer;
403
+ getPrivateKey(encoding: BinaryToTextEncoding): string;
404
+ setPublicKey(public_key: NodeJS.ArrayBufferView): void;
405
+ setPublicKey(public_key: string, encoding: BufferEncoding): void;
406
+ setPrivateKey(private_key: NodeJS.ArrayBufferView): void;
407
+ setPrivateKey(private_key: string, encoding: BufferEncoding): void;
408
+ verifyError: number;
409
+ }
410
+ function getDiffieHellman(group_name: string): DiffieHellman;
411
+ function pbkdf2(
412
+ password: BinaryLike,
413
+ salt: BinaryLike,
414
+ iterations: number,
415
+ keylen: number,
416
+ digest: string,
417
+ callback: (err: Error | null, derivedKey: Buffer) => any,
418
+ ): void;
419
+ function pbkdf2Sync(
420
+ password: BinaryLike,
421
+ salt: BinaryLike,
422
+ iterations: number,
423
+ keylen: number,
424
+ digest: string,
425
+ ): Buffer;
426
+
427
+ function randomBytes(size: number): Buffer;
428
+ function randomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void;
429
+ function pseudoRandomBytes(size: number): Buffer;
430
+ function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void;
431
+
432
+ function randomInt(max: number): number;
433
+ function randomInt(min: number, max: number): number;
434
+ function randomInt(max: number, callback: (err: Error | null, value: number) => void): void;
435
+ function randomInt(min: number, max: number, callback: (err: Error | null, value: number) => void): void;
436
+
437
+ function randomFillSync<T extends NodeJS.ArrayBufferView>(buffer: T, offset?: number, size?: number): T;
438
+ function randomFill<T extends NodeJS.ArrayBufferView>(
439
+ buffer: T,
440
+ callback: (err: Error | null, buf: T) => void,
441
+ ): void;
442
+ function randomFill<T extends NodeJS.ArrayBufferView>(
443
+ buffer: T,
444
+ offset: number,
445
+ callback: (err: Error | null, buf: T) => void,
446
+ ): void;
447
+ function randomFill<T extends NodeJS.ArrayBufferView>(
448
+ buffer: T,
449
+ offset: number,
450
+ size: number,
451
+ callback: (err: Error | null, buf: T) => void,
452
+ ): void;
453
+
454
+ interface RandomUUIDOptions {
455
+ /**
456
+ * By default, to improve performance,
457
+ * Node.js will pre-emptively generate and persistently cache enough
458
+ * random data to generate up to 128 random UUIDs. To generate a UUID
459
+ * without using the cache, set `disableEntropyCache` to `true`.
460
+ *
461
+ * @default `false`
462
+ */
463
+ disableEntropyCache?: boolean | undefined;
464
+ }
465
+
466
+ function randomUUID(options?: RandomUUIDOptions): string;
467
+
468
+ interface ScryptOptions {
469
+ cost?: number | undefined;
470
+ blockSize?: number | undefined;
471
+ parallelization?: number | undefined;
472
+ N?: number | undefined;
473
+ r?: number | undefined;
474
+ p?: number | undefined;
475
+ maxmem?: number | undefined;
476
+ }
477
+ function scrypt(
478
+ password: BinaryLike,
479
+ salt: BinaryLike,
480
+ keylen: number,
481
+ callback: (err: Error | null, derivedKey: Buffer) => void,
482
+ ): void;
483
+ function scrypt(
484
+ password: BinaryLike,
485
+ salt: BinaryLike,
486
+ keylen: number,
487
+ options: ScryptOptions,
488
+ callback: (err: Error | null, derivedKey: Buffer) => void,
489
+ ): void;
490
+ function scryptSync(password: BinaryLike, salt: BinaryLike, keylen: number, options?: ScryptOptions): Buffer;
491
+
492
+ interface RsaPublicKey {
493
+ key: KeyLike;
494
+ padding?: number | undefined;
495
+ }
496
+ interface RsaPrivateKey {
497
+ key: KeyLike;
498
+ passphrase?: string | undefined;
499
+ /**
500
+ * @default 'sha1'
501
+ */
502
+ oaepHash?: string | undefined;
503
+ oaepLabel?: NodeJS.TypedArray | undefined;
504
+ padding?: number | undefined;
505
+ }
506
+ function publicEncrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
507
+ function publicDecrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
508
+ function privateDecrypt(private_key: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
509
+ function privateEncrypt(private_key: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
510
+ function getCiphers(): string[];
511
+ function getCurves(): string[];
512
+ function getFips(): 1 | 0;
513
+ function getHashes(): string[];
514
+ class ECDH {
515
+ private constructor();
516
+ static convertKey(
517
+ key: BinaryLike,
518
+ curve: string,
519
+ inputEncoding?: BinaryToTextEncoding,
520
+ outputEncoding?: 'latin1' | 'hex' | 'base64',
521
+ format?: 'uncompressed' | 'compressed' | 'hybrid',
522
+ ): Buffer | string;
523
+ generateKeys(): Buffer;
524
+ generateKeys(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string;
525
+ computeSecret(other_public_key: NodeJS.ArrayBufferView): Buffer;
526
+ computeSecret(other_public_key: string, input_encoding: BinaryToTextEncoding): Buffer;
527
+ computeSecret(other_public_key: NodeJS.ArrayBufferView, output_encoding: BinaryToTextEncoding): string;
528
+ computeSecret(
529
+ other_public_key: string,
530
+ input_encoding: BinaryToTextEncoding,
531
+ output_encoding: BinaryToTextEncoding,
532
+ ): string;
533
+ getPrivateKey(): Buffer;
534
+ getPrivateKey(encoding: BinaryToTextEncoding): string;
535
+ getPublicKey(): Buffer;
536
+ getPublicKey(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string;
537
+ setPrivateKey(private_key: NodeJS.ArrayBufferView): void;
538
+ setPrivateKey(private_key: string, encoding: BinaryToTextEncoding): void;
539
+ }
540
+ function createECDH(curve_name: string): ECDH;
541
+ function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean;
542
+ /** @deprecated since v10.0.0 */
543
+ const DEFAULT_ENCODING: BufferEncoding;
544
+
545
+ type KeyType = 'rsa' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448';
546
+ type KeyFormat = 'pem' | 'der';
547
+
548
+ interface BasePrivateKeyEncodingOptions<T extends KeyFormat> {
549
+ format: T;
550
+ cipher?: string | undefined;
551
+ passphrase?: string | undefined;
552
+ }
553
+
554
+ interface KeyPairKeyObjectResult {
555
+ publicKey: KeyObject;
556
+ privateKey: KeyObject;
557
+ }
558
+
559
+ interface ED25519KeyPairKeyObjectOptions {
560
+ /**
561
+ * No options.
562
+ */
563
+ }
564
+
565
+ interface ED448KeyPairKeyObjectOptions {
566
+ /**
567
+ * No options.
568
+ */
569
+ }
570
+
571
+ interface X25519KeyPairKeyObjectOptions {
572
+ /**
573
+ * No options.
574
+ */
575
+ }
576
+
577
+ interface X448KeyPairKeyObjectOptions {
578
+ /**
579
+ * No options.
580
+ */
581
+ }
582
+
583
+ interface ECKeyPairKeyObjectOptions {
584
+ /**
585
+ * Name of the curve to use.
586
+ */
587
+ namedCurve: string;
588
+ }
589
+
590
+ interface RSAKeyPairKeyObjectOptions {
591
+ /**
592
+ * Key size in bits
593
+ */
594
+ modulusLength: number;
595
+
596
+ /**
597
+ * @default 0x10001
598
+ */
599
+ publicExponent?: number | undefined;
600
+ }
601
+
602
+ interface DSAKeyPairKeyObjectOptions {
603
+ /**
604
+ * Key size in bits
605
+ */
606
+ modulusLength: number;
607
+
608
+ /**
609
+ * Size of q in bits
610
+ */
611
+ divisorLength: number;
612
+ }
613
+
614
+ interface RSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
615
+ /**
616
+ * Key size in bits
617
+ */
618
+ modulusLength: number;
619
+ /**
620
+ * @default 0x10001
621
+ */
622
+ publicExponent?: number | undefined;
623
+
624
+ publicKeyEncoding: {
625
+ type: 'pkcs1' | 'spki';
626
+ format: PubF;
627
+ };
628
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
629
+ type: 'pkcs1' | 'pkcs8';
630
+ };
631
+ }
632
+
633
+ interface DSAKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
634
+ /**
635
+ * Key size in bits
636
+ */
637
+ modulusLength: number;
638
+ /**
639
+ * Size of q in bits
640
+ */
641
+ divisorLength: number;
642
+
643
+ publicKeyEncoding: {
644
+ type: 'spki';
645
+ format: PubF;
646
+ };
647
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
648
+ type: 'pkcs8';
649
+ };
650
+ }
651
+
652
+ interface ECKeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
653
+ /**
654
+ * Name of the curve to use.
655
+ */
656
+ namedCurve: string;
657
+
658
+ publicKeyEncoding: {
659
+ type: 'pkcs1' | 'spki';
660
+ format: PubF;
661
+ };
662
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
663
+ type: 'sec1' | 'pkcs8';
664
+ };
665
+ }
666
+
667
+ interface ED25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
668
+ publicKeyEncoding: {
669
+ type: 'spki';
670
+ format: PubF;
671
+ };
672
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
673
+ type: 'pkcs8';
674
+ };
675
+ }
676
+
677
+ interface ED448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
678
+ publicKeyEncoding: {
679
+ type: 'spki';
680
+ format: PubF;
681
+ };
682
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
683
+ type: 'pkcs8';
684
+ };
685
+ }
686
+
687
+ interface X25519KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
688
+ publicKeyEncoding: {
689
+ type: 'spki';
690
+ format: PubF;
691
+ };
692
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
693
+ type: 'pkcs8';
694
+ };
695
+ }
696
+
697
+ interface X448KeyPairOptions<PubF extends KeyFormat, PrivF extends KeyFormat> {
698
+ publicKeyEncoding: {
699
+ type: 'spki';
700
+ format: PubF;
701
+ };
702
+ privateKeyEncoding: BasePrivateKeyEncodingOptions<PrivF> & {
703
+ type: 'pkcs8';
704
+ };
705
+ }
706
+
707
+ interface KeyPairSyncResult<T1 extends string | Buffer, T2 extends string | Buffer> {
708
+ publicKey: T1;
709
+ privateKey: T2;
710
+ }
711
+
712
+ function generateKeyPairSync(
713
+ type: 'rsa',
714
+ options: RSAKeyPairOptions<'pem', 'pem'>,
715
+ ): KeyPairSyncResult<string, string>;
716
+ function generateKeyPairSync(
717
+ type: 'rsa',
718
+ options: RSAKeyPairOptions<'pem', 'der'>,
719
+ ): KeyPairSyncResult<string, Buffer>;
720
+ function generateKeyPairSync(
721
+ type: 'rsa',
722
+ options: RSAKeyPairOptions<'der', 'pem'>,
723
+ ): KeyPairSyncResult<Buffer, string>;
724
+ function generateKeyPairSync(
725
+ type: 'rsa',
726
+ options: RSAKeyPairOptions<'der', 'der'>,
727
+ ): KeyPairSyncResult<Buffer, Buffer>;
728
+ function generateKeyPairSync(type: 'rsa', options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
729
+
730
+ function generateKeyPairSync(
731
+ type: 'dsa',
732
+ options: DSAKeyPairOptions<'pem', 'pem'>,
733
+ ): KeyPairSyncResult<string, string>;
734
+ function generateKeyPairSync(
735
+ type: 'dsa',
736
+ options: DSAKeyPairOptions<'pem', 'der'>,
737
+ ): KeyPairSyncResult<string, Buffer>;
738
+ function generateKeyPairSync(
739
+ type: 'dsa',
740
+ options: DSAKeyPairOptions<'der', 'pem'>,
741
+ ): KeyPairSyncResult<Buffer, string>;
742
+ function generateKeyPairSync(
743
+ type: 'dsa',
744
+ options: DSAKeyPairOptions<'der', 'der'>,
745
+ ): KeyPairSyncResult<Buffer, Buffer>;
746
+ function generateKeyPairSync(type: 'dsa', options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
747
+
748
+ function generateKeyPairSync(
749
+ type: 'ec',
750
+ options: ECKeyPairOptions<'pem', 'pem'>,
751
+ ): KeyPairSyncResult<string, string>;
752
+ function generateKeyPairSync(
753
+ type: 'ec',
754
+ options: ECKeyPairOptions<'pem', 'der'>,
755
+ ): KeyPairSyncResult<string, Buffer>;
756
+ function generateKeyPairSync(
757
+ type: 'ec',
758
+ options: ECKeyPairOptions<'der', 'pem'>,
759
+ ): KeyPairSyncResult<Buffer, string>;
760
+ function generateKeyPairSync(
761
+ type: 'ec',
762
+ options: ECKeyPairOptions<'der', 'der'>,
763
+ ): KeyPairSyncResult<Buffer, Buffer>;
764
+ function generateKeyPairSync(type: 'ec', options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
765
+
766
+ function generateKeyPairSync(
767
+ type: 'ed25519',
768
+ options: ED25519KeyPairOptions<'pem', 'pem'>,
769
+ ): KeyPairSyncResult<string, string>;
770
+ function generateKeyPairSync(
771
+ type: 'ed25519',
772
+ options: ED25519KeyPairOptions<'pem', 'der'>,
773
+ ): KeyPairSyncResult<string, Buffer>;
774
+ function generateKeyPairSync(
775
+ type: 'ed25519',
776
+ options: ED25519KeyPairOptions<'der', 'pem'>,
777
+ ): KeyPairSyncResult<Buffer, string>;
778
+ function generateKeyPairSync(
779
+ type: 'ed25519',
780
+ options: ED25519KeyPairOptions<'der', 'der'>,
781
+ ): KeyPairSyncResult<Buffer, Buffer>;
782
+ function generateKeyPairSync(type: 'ed25519', options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
783
+
784
+ function generateKeyPairSync(
785
+ type: 'ed448',
786
+ options: ED448KeyPairOptions<'pem', 'pem'>,
787
+ ): KeyPairSyncResult<string, string>;
788
+ function generateKeyPairSync(
789
+ type: 'ed448',
790
+ options: ED448KeyPairOptions<'pem', 'der'>,
791
+ ): KeyPairSyncResult<string, Buffer>;
792
+ function generateKeyPairSync(
793
+ type: 'ed448',
794
+ options: ED448KeyPairOptions<'der', 'pem'>,
795
+ ): KeyPairSyncResult<Buffer, string>;
796
+ function generateKeyPairSync(
797
+ type: 'ed448',
798
+ options: ED448KeyPairOptions<'der', 'der'>,
799
+ ): KeyPairSyncResult<Buffer, Buffer>;
800
+ function generateKeyPairSync(type: 'ed448', options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
801
+
802
+ function generateKeyPairSync(
803
+ type: 'x25519',
804
+ options: X25519KeyPairOptions<'pem', 'pem'>,
805
+ ): KeyPairSyncResult<string, string>;
806
+ function generateKeyPairSync(
807
+ type: 'x25519',
808
+ options: X25519KeyPairOptions<'pem', 'der'>,
809
+ ): KeyPairSyncResult<string, Buffer>;
810
+ function generateKeyPairSync(
811
+ type: 'x25519',
812
+ options: X25519KeyPairOptions<'der', 'pem'>,
813
+ ): KeyPairSyncResult<Buffer, string>;
814
+ function generateKeyPairSync(
815
+ type: 'x25519',
816
+ options: X25519KeyPairOptions<'der', 'der'>,
817
+ ): KeyPairSyncResult<Buffer, Buffer>;
818
+ function generateKeyPairSync(type: 'x25519', options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
819
+
820
+ function generateKeyPairSync(
821
+ type: 'x448',
822
+ options: X448KeyPairOptions<'pem', 'pem'>,
823
+ ): KeyPairSyncResult<string, string>;
824
+ function generateKeyPairSync(
825
+ type: 'x448',
826
+ options: X448KeyPairOptions<'pem', 'der'>,
827
+ ): KeyPairSyncResult<string, Buffer>;
828
+ function generateKeyPairSync(
829
+ type: 'x448',
830
+ options: X448KeyPairOptions<'der', 'pem'>,
831
+ ): KeyPairSyncResult<Buffer, string>;
832
+ function generateKeyPairSync(
833
+ type: 'x448',
834
+ options: X448KeyPairOptions<'der', 'der'>,
835
+ ): KeyPairSyncResult<Buffer, Buffer>;
836
+ function generateKeyPairSync(type: 'x448', options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
837
+
838
+ function generateKeyPair(
839
+ type: 'rsa',
840
+ options: RSAKeyPairOptions<'pem', 'pem'>,
841
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
842
+ ): void;
843
+ function generateKeyPair(
844
+ type: 'rsa',
845
+ options: RSAKeyPairOptions<'pem', 'der'>,
846
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
847
+ ): void;
848
+ function generateKeyPair(
849
+ type: 'rsa',
850
+ options: RSAKeyPairOptions<'der', 'pem'>,
851
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
852
+ ): void;
853
+ function generateKeyPair(
854
+ type: 'rsa',
855
+ options: RSAKeyPairOptions<'der', 'der'>,
856
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
857
+ ): void;
858
+ function generateKeyPair(
859
+ type: 'rsa',
860
+ options: RSAKeyPairKeyObjectOptions,
861
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
862
+ ): void;
863
+
864
+ function generateKeyPair(
865
+ type: 'dsa',
866
+ options: DSAKeyPairOptions<'pem', 'pem'>,
867
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
868
+ ): void;
869
+ function generateKeyPair(
870
+ type: 'dsa',
871
+ options: DSAKeyPairOptions<'pem', 'der'>,
872
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
873
+ ): void;
874
+ function generateKeyPair(
875
+ type: 'dsa',
876
+ options: DSAKeyPairOptions<'der', 'pem'>,
877
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
878
+ ): void;
879
+ function generateKeyPair(
880
+ type: 'dsa',
881
+ options: DSAKeyPairOptions<'der', 'der'>,
882
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
883
+ ): void;
884
+ function generateKeyPair(
885
+ type: 'dsa',
886
+ options: DSAKeyPairKeyObjectOptions,
887
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
888
+ ): void;
889
+
890
+ function generateKeyPair(
891
+ type: 'ec',
892
+ options: ECKeyPairOptions<'pem', 'pem'>,
893
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
894
+ ): void;
895
+ function generateKeyPair(
896
+ type: 'ec',
897
+ options: ECKeyPairOptions<'pem', 'der'>,
898
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
899
+ ): void;
900
+ function generateKeyPair(
901
+ type: 'ec',
902
+ options: ECKeyPairOptions<'der', 'pem'>,
903
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
904
+ ): void;
905
+ function generateKeyPair(
906
+ type: 'ec',
907
+ options: ECKeyPairOptions<'der', 'der'>,
908
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
909
+ ): void;
910
+ function generateKeyPair(
911
+ type: 'ec',
912
+ options: ECKeyPairKeyObjectOptions,
913
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
914
+ ): void;
915
+
916
+ function generateKeyPair(
917
+ type: 'ed25519',
918
+ options: ED25519KeyPairOptions<'pem', 'pem'>,
919
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
920
+ ): void;
921
+ function generateKeyPair(
922
+ type: 'ed25519',
923
+ options: ED25519KeyPairOptions<'pem', 'der'>,
924
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
925
+ ): void;
926
+ function generateKeyPair(
927
+ type: 'ed25519',
928
+ options: ED25519KeyPairOptions<'der', 'pem'>,
929
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
930
+ ): void;
931
+ function generateKeyPair(
932
+ type: 'ed25519',
933
+ options: ED25519KeyPairOptions<'der', 'der'>,
934
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
935
+ ): void;
936
+ function generateKeyPair(
937
+ type: 'ed25519',
938
+ options: ED25519KeyPairKeyObjectOptions | undefined,
939
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
940
+ ): void;
941
+
942
+ function generateKeyPair(
943
+ type: 'ed448',
944
+ options: ED448KeyPairOptions<'pem', 'pem'>,
945
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
946
+ ): void;
947
+ function generateKeyPair(
948
+ type: 'ed448',
949
+ options: ED448KeyPairOptions<'pem', 'der'>,
950
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
951
+ ): void;
952
+ function generateKeyPair(
953
+ type: 'ed448',
954
+ options: ED448KeyPairOptions<'der', 'pem'>,
955
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
956
+ ): void;
957
+ function generateKeyPair(
958
+ type: 'ed448',
959
+ options: ED448KeyPairOptions<'der', 'der'>,
960
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
961
+ ): void;
962
+ function generateKeyPair(
963
+ type: 'ed448',
964
+ options: ED448KeyPairKeyObjectOptions | undefined,
965
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
966
+ ): void;
967
+
968
+ function generateKeyPair(
969
+ type: 'x25519',
970
+ options: X25519KeyPairOptions<'pem', 'pem'>,
971
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
972
+ ): void;
973
+ function generateKeyPair(
974
+ type: 'x25519',
975
+ options: X25519KeyPairOptions<'pem', 'der'>,
976
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
977
+ ): void;
978
+ function generateKeyPair(
979
+ type: 'x25519',
980
+ options: X25519KeyPairOptions<'der', 'pem'>,
981
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
982
+ ): void;
983
+ function generateKeyPair(
984
+ type: 'x25519',
985
+ options: X25519KeyPairOptions<'der', 'der'>,
986
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
987
+ ): void;
988
+ function generateKeyPair(
989
+ type: 'x25519',
990
+ options: X25519KeyPairKeyObjectOptions | undefined,
991
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
992
+ ): void;
993
+
994
+ function generateKeyPair(
995
+ type: 'x448',
996
+ options: X448KeyPairOptions<'pem', 'pem'>,
997
+ callback: (err: Error | null, publicKey: string, privateKey: string) => void,
998
+ ): void;
999
+ function generateKeyPair(
1000
+ type: 'x448',
1001
+ options: X448KeyPairOptions<'pem', 'der'>,
1002
+ callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void,
1003
+ ): void;
1004
+ function generateKeyPair(
1005
+ type: 'x448',
1006
+ options: X448KeyPairOptions<'der', 'pem'>,
1007
+ callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void,
1008
+ ): void;
1009
+ function generateKeyPair(
1010
+ type: 'x448',
1011
+ options: X448KeyPairOptions<'der', 'der'>,
1012
+ callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void,
1013
+ ): void;
1014
+ function generateKeyPair(
1015
+ type: 'x448',
1016
+ options: X448KeyPairKeyObjectOptions | undefined,
1017
+ callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void,
1018
+ ): void;
1019
+
1020
+ namespace generateKeyPair {
1021
+ function __promisify__(
1022
+ type: 'rsa',
1023
+ options: RSAKeyPairOptions<'pem', 'pem'>,
1024
+ ): Promise<{ publicKey: string; privateKey: string }>;
1025
+ function __promisify__(
1026
+ type: 'rsa',
1027
+ options: RSAKeyPairOptions<'pem', 'der'>,
1028
+ ): Promise<{ publicKey: string; privateKey: Buffer }>;
1029
+ function __promisify__(
1030
+ type: 'rsa',
1031
+ options: RSAKeyPairOptions<'der', 'pem'>,
1032
+ ): Promise<{ publicKey: Buffer; privateKey: string }>;
1033
+ function __promisify__(
1034
+ type: 'rsa',
1035
+ options: RSAKeyPairOptions<'der', 'der'>,
1036
+ ): Promise<{ publicKey: Buffer; privateKey: Buffer }>;
1037
+ function __promisify__(type: 'rsa', options: RSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
1038
+
1039
+ function __promisify__(
1040
+ type: 'dsa',
1041
+ options: DSAKeyPairOptions<'pem', 'pem'>,
1042
+ ): Promise<{ publicKey: string; privateKey: string }>;
1043
+ function __promisify__(
1044
+ type: 'dsa',
1045
+ options: DSAKeyPairOptions<'pem', 'der'>,
1046
+ ): Promise<{ publicKey: string; privateKey: Buffer }>;
1047
+ function __promisify__(
1048
+ type: 'dsa',
1049
+ options: DSAKeyPairOptions<'der', 'pem'>,
1050
+ ): Promise<{ publicKey: Buffer; privateKey: string }>;
1051
+ function __promisify__(
1052
+ type: 'dsa',
1053
+ options: DSAKeyPairOptions<'der', 'der'>,
1054
+ ): Promise<{ publicKey: Buffer; privateKey: Buffer }>;
1055
+ function __promisify__(type: 'dsa', options: DSAKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
1056
+
1057
+ function __promisify__(
1058
+ type: 'ec',
1059
+ options: ECKeyPairOptions<'pem', 'pem'>,
1060
+ ): Promise<{ publicKey: string; privateKey: string }>;
1061
+ function __promisify__(
1062
+ type: 'ec',
1063
+ options: ECKeyPairOptions<'pem', 'der'>,
1064
+ ): Promise<{ publicKey: string; privateKey: Buffer }>;
1065
+ function __promisify__(
1066
+ type: 'ec',
1067
+ options: ECKeyPairOptions<'der', 'pem'>,
1068
+ ): Promise<{ publicKey: Buffer; privateKey: string }>;
1069
+ function __promisify__(
1070
+ type: 'ec',
1071
+ options: ECKeyPairOptions<'der', 'der'>,
1072
+ ): Promise<{ publicKey: Buffer; privateKey: Buffer }>;
1073
+ function __promisify__(type: 'ec', options: ECKeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
1074
+
1075
+ function __promisify__(
1076
+ type: 'ed25519',
1077
+ options: ED25519KeyPairOptions<'pem', 'pem'>,
1078
+ ): Promise<{ publicKey: string; privateKey: string }>;
1079
+ function __promisify__(
1080
+ type: 'ed25519',
1081
+ options: ED25519KeyPairOptions<'pem', 'der'>,
1082
+ ): Promise<{ publicKey: string; privateKey: Buffer }>;
1083
+ function __promisify__(
1084
+ type: 'ed25519',
1085
+ options: ED25519KeyPairOptions<'der', 'pem'>,
1086
+ ): Promise<{ publicKey: Buffer; privateKey: string }>;
1087
+ function __promisify__(
1088
+ type: 'ed25519',
1089
+ options: ED25519KeyPairOptions<'der', 'der'>,
1090
+ ): Promise<{ publicKey: Buffer; privateKey: Buffer }>;
1091
+ function __promisify__(
1092
+ type: 'ed25519',
1093
+ options?: ED25519KeyPairKeyObjectOptions,
1094
+ ): Promise<KeyPairKeyObjectResult>;
1095
+
1096
+ function __promisify__(
1097
+ type: 'ed448',
1098
+ options: ED448KeyPairOptions<'pem', 'pem'>,
1099
+ ): Promise<{ publicKey: string; privateKey: string }>;
1100
+ function __promisify__(
1101
+ type: 'ed448',
1102
+ options: ED448KeyPairOptions<'pem', 'der'>,
1103
+ ): Promise<{ publicKey: string; privateKey: Buffer }>;
1104
+ function __promisify__(
1105
+ type: 'ed448',
1106
+ options: ED448KeyPairOptions<'der', 'pem'>,
1107
+ ): Promise<{ publicKey: Buffer; privateKey: string }>;
1108
+ function __promisify__(
1109
+ type: 'ed448',
1110
+ options: ED448KeyPairOptions<'der', 'der'>,
1111
+ ): Promise<{ publicKey: Buffer; privateKey: Buffer }>;
1112
+ function __promisify__(type: 'ed448', options?: ED448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
1113
+
1114
+ function __promisify__(
1115
+ type: 'x25519',
1116
+ options: X25519KeyPairOptions<'pem', 'pem'>,
1117
+ ): Promise<{ publicKey: string; privateKey: string }>;
1118
+ function __promisify__(
1119
+ type: 'x25519',
1120
+ options: X25519KeyPairOptions<'pem', 'der'>,
1121
+ ): Promise<{ publicKey: string; privateKey: Buffer }>;
1122
+ function __promisify__(
1123
+ type: 'x25519',
1124
+ options: X25519KeyPairOptions<'der', 'pem'>,
1125
+ ): Promise<{ publicKey: Buffer; privateKey: string }>;
1126
+ function __promisify__(
1127
+ type: 'x25519',
1128
+ options: X25519KeyPairOptions<'der', 'der'>,
1129
+ ): Promise<{ publicKey: Buffer; privateKey: Buffer }>;
1130
+ function __promisify__(
1131
+ type: 'x25519',
1132
+ options?: X25519KeyPairKeyObjectOptions,
1133
+ ): Promise<KeyPairKeyObjectResult>;
1134
+
1135
+ function __promisify__(
1136
+ type: 'x448',
1137
+ options: X448KeyPairOptions<'pem', 'pem'>,
1138
+ ): Promise<{ publicKey: string; privateKey: string }>;
1139
+ function __promisify__(
1140
+ type: 'x448',
1141
+ options: X448KeyPairOptions<'pem', 'der'>,
1142
+ ): Promise<{ publicKey: string; privateKey: Buffer }>;
1143
+ function __promisify__(
1144
+ type: 'x448',
1145
+ options: X448KeyPairOptions<'der', 'pem'>,
1146
+ ): Promise<{ publicKey: Buffer; privateKey: string }>;
1147
+ function __promisify__(
1148
+ type: 'x448',
1149
+ options: X448KeyPairOptions<'der', 'der'>,
1150
+ ): Promise<{ publicKey: Buffer; privateKey: Buffer }>;
1151
+ function __promisify__(type: 'x448', options?: X448KeyPairKeyObjectOptions): Promise<KeyPairKeyObjectResult>;
1152
+ }
1153
+
1154
+ /**
1155
+ * Calculates and returns the signature for `data` using the given private key and
1156
+ * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is
1157
+ * dependent upon the key type (especially Ed25519 and Ed448).
1158
+ *
1159
+ * If `key` is not a [`KeyObject`][], this function behaves as if `key` had been
1160
+ * passed to [`crypto.createPrivateKey()`][].
1161
+ */
1162
+ function sign(
1163
+ algorithm: string | null | undefined,
1164
+ data: NodeJS.ArrayBufferView,
1165
+ key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput,
1166
+ ): Buffer;
1167
+
1168
+ /**
1169
+ * Calculates and returns the signature for `data` using the given private key and
1170
+ * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is
1171
+ * dependent upon the key type (especially Ed25519 and Ed448).
1172
+ *
1173
+ * If `key` is not a [`KeyObject`][], this function behaves as if `key` had been
1174
+ * passed to [`crypto.createPublicKey()`][].
1175
+ */
1176
+ function verify(
1177
+ algorithm: string | null | undefined,
1178
+ data: NodeJS.ArrayBufferView,
1179
+ key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput,
1180
+ signature: NodeJS.ArrayBufferView,
1181
+ ): boolean;
1182
+
1183
+ /**
1184
+ * Computes the Diffie-Hellman secret based on a privateKey and a publicKey.
1185
+ * Both keys must have the same asymmetricKeyType, which must be one of
1186
+ * 'dh' (for Diffie-Hellman), 'ec' (for ECDH), 'x448', or 'x25519' (for ECDH-ES).
1187
+ */
1188
+ function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): Buffer;
1189
+ }