mirror of
https://github.com/gchq/CyberChef.git
synced 2024-11-16 08:58:30 +01:00
41 lines
805 B
JavaScript
41 lines
805 B
JavaScript
/**
|
|
* @author Danh4 [dan.h4@ncsc.gov.uk]
|
|
* @copyright Crown Copyright 2020
|
|
* @license Apache-2.0
|
|
*/
|
|
|
|
import Operation from "../Operation.mjs";
|
|
import Cbor from "cbor";
|
|
|
|
/**
|
|
* CBOR Encode operation
|
|
*/
|
|
class CBOREncode extends Operation {
|
|
|
|
/**
|
|
* CBOREncode constructor
|
|
*/
|
|
constructor() {
|
|
super();
|
|
|
|
this.name = "CBOR Encode";
|
|
this.module = "Default";
|
|
this.description = "2";
|
|
this.infoURL = "https://cbor.io";
|
|
this.inputType = "JSON";
|
|
this.outputType = "ArrayBuffer";
|
|
this.args = [];
|
|
}
|
|
|
|
/**
|
|
* @param {JSON} input
|
|
* @param {Object[]} args
|
|
* @returns {ArrayBuffer}
|
|
*/
|
|
run(input, args) {
|
|
return new Uint8Array(Cbor.encodeCanonical(input)).buffer;
|
|
}
|
|
|
|
}
|
|
|
|
export default CBOREncode;
|