Files
NapCatQQ/.pnpm-store/v3/files/03/03535e45a2ebaac3f4db43c5d8e2469c7231ec8409860b56265547cb3b7ea085647d62f24e60c63942976e7696e53c9dc3f9946de792dbdd7f294d43f21952
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

40 lines
1.1 KiB
Plaintext

import * as asn1js from "asn1js";
import { BufferSourceConverter } from "pvtsutils";
export class OctetString {
get byteLength() {
return this.buffer.byteLength;
}
get byteOffset() {
return 0;
}
constructor(param) {
if (typeof param === "number") {
this.buffer = new ArrayBuffer(param);
}
else {
if (BufferSourceConverter.isBufferSource(param)) {
this.buffer = BufferSourceConverter.toArrayBuffer(param);
}
else if (Array.isArray(param)) {
this.buffer = new Uint8Array(param);
}
else {
this.buffer = new ArrayBuffer(0);
}
}
}
fromASN(asn) {
if (!(asn instanceof asn1js.OctetString)) {
throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");
}
this.buffer = asn.valueBlock.valueHex;
return this;
}
toASN() {
return new asn1js.OctetString({ valueHex: this.buffer });
}
toSchema(name) {
return new asn1js.OctetString({ name });
}
}