UNPKG

@indrajala/asn1der

Version:

parse ASN.1 DER structures

69 lines 2.6 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const x509FM4DD_1 = require("./data/pem/x509FM4DD"); const chai_1 = require("chai"); require("mocha"); const asn1der_1 = require("../asn1der"); describe('pemToDER', () => { it('it should be able to parse ascii armour of certs', () => __awaiter(void 0, void 0, void 0, function* () { const parsedCount = x509FM4DD_1.certs .map(cert => { try { asn1der_1.pemToDER(cert); return true; } catch (e) { return false; } }) .filter(parsed => parsed) .length; chai_1.expect(x509FM4DD_1.certs.length) .to .equal(parsedCount); })); it('it should be able to parse ascii armour of csrs', () => __awaiter(void 0, void 0, void 0, function* () { const parsedCount = x509FM4DD_1.csrs .map(csr => { try { asn1der_1.pemToDER(csr); return true; } catch (e) { return false; } }) .filter(parsed => parsed) .length; chai_1.expect(x509FM4DD_1.csrs.length) .to .equal(parsedCount); })); it('it should be able to parse ascii armour of private keys', () => __awaiter(void 0, void 0, void 0, function* () { const parsedCount = x509FM4DD_1.privateKeys .map(pvtKey => { try { asn1der_1.pemToDER(pvtKey); return true; } catch (e) { return false; } }) .filter(parsed => parsed) .length; chai_1.expect(x509FM4DD_1.privateKeys.length) .to .equal(parsedCount); })); }); //# sourceMappingURL=pemToDER.spec.js.map