UNPKG

@peculiar/fortify-client-core

Version:

Fortify client core API for quickly connect to Fortify App

25 lines (24 loc) 756 B
/** * @license * Copyright (c) Peculiar Ventures, LLC. * * This source code is licensed under the BSD 3-Clause license found in the * LICENSE file in the root directory of this source tree. */ import { AsnConvert } from '@peculiar/asn1-schema'; import { BufferSourceConverter } from 'pvtsutils'; export class AsnData { constructor(...args) { if (args.length === 1) { // asn // eslint-disable-next-line prefer-destructuring this.asn = args[0]; this.rawData = AsnConvert.serialize(this.asn); } else { // raw, type this.asn = AsnConvert.parse(args[0], args[1]); this.rawData = BufferSourceConverter.toArrayBuffer(args[0]); } } }