mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
node-forge: Add pkcs7.createEnvelopedData (#43393)
This patch adds typings for `createEnvelopedData` function of `pkcs7` module and tests that are lifted directly from the README. See: https://github.com/digitalbazaar/forge#pkcs7
This commit is contained in:
parent
de4580242d
commit
26be57aaba
10
types/node-forge/index.d.ts
vendored
10
types/node-forge/index.d.ts
vendored
@ -13,6 +13,7 @@
|
||||
// Sascha Zarhuber <https://github.com/saschazar21>
|
||||
// Rogier Schouten <https://github.com/rogierschouten>
|
||||
// Ivan Aseev <https://github.com/aseevia>
|
||||
// Wiktor Kwapisiewicz <https://github.com/wiktor-k>
|
||||
// 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 {
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user