diff --git a/types/node-forge/index.d.ts b/types/node-forge/index.d.ts index 9162201fe1..2d41d55ccd 100644 --- a/types/node-forge/index.d.ts +++ b/types/node-forge/index.d.ts @@ -13,6 +13,7 @@ // Sascha Zarhuber // Rogier Schouten // Ivan Aseev +// Wiktor Kwapisiewicz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -678,6 +679,15 @@ declare module "node-forge" { } function createSignedData(): PkcsSignedData; + + interface PkcsEnvelopedData { + content?: string | util.ByteBuffer; + addRecipient(certificate: pki.Certificate): void; + encrypt(): void; + toAsn1(): asn1.Asn1; + } + + function createEnvelopedData(): PkcsEnvelopedData; } namespace pkcs5 { diff --git a/types/node-forge/node-forge-tests.ts b/types/node-forge/node-forge-tests.ts index fd5e6c2b30..b40d754e67 100644 --- a/types/node-forge/node-forge-tests.ts +++ b/types/node-forge/node-forge-tests.ts @@ -405,3 +405,12 @@ if (forge.util.fillString('1', 5) !== '11111') throw Error('forge.util.fillStrin encoding: 'binary' }); } + +{ + let p7 = forge.pkcs7.createEnvelopedData(); + let cert = forge.pki.certificateFromPem('PEM'); + p7.addRecipient(cert); + p7.content = forge.util.createBuffer('content'); + p7.encrypt(); + let asn1: forge.asn1.Asn1 = p7.toAsn1(); +}