@peculiar/fortify-client-core
Version:
Fortify client core API for quickly connect to Fortify App
27 lines (26 loc) • 778 B
JavaScript
/**
* @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 {
asn;
rawData;
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]);
}
}
}