diff --git a/Makefile.flatbuffers b/Makefile.flatbuffers index b4c0699..d3df8ee 100644 --- a/Makefile.flatbuffers +++ b/Makefile.flatbuffers @@ -1,5 +1,5 @@ .PHONY: flatbuffers -flatbuffers: flatbuffers_dart flatbuffers_go flatbuffers_js +flatbuffers: flatbuffers_dart flatbuffers_go flatbuffers_ts flatbuffers_deps: cd /tmp && \ diff --git a/wasm/example/libs/model/armor-decode-request.ts b/wasm/example/libs/model/armor-decode-request.ts new file mode 100644 index 0000000..015e3bb --- /dev/null +++ b/wasm/example/libs/model/armor-decode-request.ts @@ -0,0 +1,48 @@ +// automatically generated by the FlatBuffers compiler, do not modify + +import * as flatbuffers from 'flatbuffers'; + +export class ArmorDecodeRequest { + bb: flatbuffers.ByteBuffer|null = null; + bb_pos = 0; +__init(i:number, bb:flatbuffers.ByteBuffer):ArmorDecodeRequest { + this.bb_pos = i; + this.bb = bb; + return this; +} + +static getRootAsArmorDecodeRequest(bb:flatbuffers.ByteBuffer, obj?:ArmorDecodeRequest):ArmorDecodeRequest { + return (obj || new ArmorDecodeRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb); +} + +static getSizePrefixedRootAsArmorDecodeRequest(bb:flatbuffers.ByteBuffer, obj?:ArmorDecodeRequest):ArmorDecodeRequest { + bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); + return (obj || new ArmorDecodeRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb); +} + +packet():string|null +packet(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null +packet(optionalEncoding?:any):string|Uint8Array|null { + const offset = this.bb!.__offset(this.bb_pos, 4); + return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; +} + +static startArmorDecodeRequest(builder:flatbuffers.Builder) { + builder.startObject(1); +} + +static addPacket(builder:flatbuffers.Builder, packetOffset:flatbuffers.Offset) { + builder.addFieldOffset(0, packetOffset, 0); +} + +static endArmorDecodeRequest(builder:flatbuffers.Builder):flatbuffers.Offset { + const offset = builder.endObject(); + return offset; +} + +static createArmorDecodeRequest(builder:flatbuffers.Builder, packetOffset:flatbuffers.Offset):flatbuffers.Offset { + ArmorDecodeRequest.startArmorDecodeRequest(builder); + ArmorDecodeRequest.addPacket(builder, packetOffset); + return ArmorDecodeRequest.endArmorDecodeRequest(builder); +} +} diff --git a/wasm/example/libs/model/armor-encode-request.ts b/wasm/example/libs/model/armor-encode-request.ts new file mode 100644 index 0000000..df458b2 --- /dev/null +++ b/wasm/example/libs/model/armor-encode-request.ts @@ -0,0 +1,68 @@ +// automatically generated by the FlatBuffers compiler, do not modify + +import * as flatbuffers from 'flatbuffers'; + +export class ArmorEncodeRequest { + bb: flatbuffers.ByteBuffer|null = null; + bb_pos = 0; +__init(i:number, bb:flatbuffers.ByteBuffer):ArmorEncodeRequest { + this.bb_pos = i; + this.bb = bb; + return this; +} + +static getRootAsArmorEncodeRequest(bb:flatbuffers.ByteBuffer, obj?:ArmorEncodeRequest):ArmorEncodeRequest { + return (obj || new ArmorEncodeRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb); +} + +static getSizePrefixedRootAsArmorEncodeRequest(bb:flatbuffers.ByteBuffer, obj?:ArmorEncodeRequest):ArmorEncodeRequest { + bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH); + return (obj || new ArmorEncodeRequest()).__init(bb.readInt32(bb.position()) + bb.position(), bb); +} + +packet(index: number):number|null { + const offset = this.bb!.__offset(this.bb_pos, 4); + return offset ? this.bb!.readUint8(this.bb!.__vector(this.bb_pos + offset) + index) : 0; +} + +packetLength():number { + const offset = this.bb!.__offset(this.bb_pos, 4); + return offset ? this.bb!.__vector_len(this.bb_pos + offset) : 0; +} + +packetArray():Uint8Array|null { + const offset = this.bb!.__offset(this.bb_pos, 4); + return offset ? new Uint8Array(this.bb!.bytes().buffer, this.bb!.bytes().byteOffset + this.bb!.__vector(this.bb_pos + offset), this.bb!.__vector_len(this.bb_pos + offset)) : null; +} + +static startArmorEncodeRequest(builder:flatbuffers.Builder) { + builder.startObject(1); +} + +static addPacket(builder:flatbuffers.Builder, packetOffset:flatbuffers.Offset) { + builder.addFieldOffset(0, packetOffset, 0); +} + +static createPacketVector(builder:flatbuffers.Builder, data:number[]|Uint8Array):flatbuffers.Offset { + builder.startVector(1, data.length, 1); + for (let i = data.length - 1; i >= 0; i--) { + builder.addInt8(data[i]!); + } + return builder.endVector(); +} + +static startPacketVector(builder:flatbuffers.Builder, numElems:number) { + builder.startVector(1, numElems, 1); +} + +static endArmorEncodeRequest(builder:flatbuffers.Builder):flatbuffers.Offset { + const offset = builder.endObject(); + return offset; +} + +static createArmorEncodeRequest(builder:flatbuffers.Builder, packetOffset:flatbuffers.Offset):flatbuffers.Offset { + ArmorEncodeRequest.startArmorEncodeRequest(builder); + ArmorEncodeRequest.addPacket(builder, packetOffset); + return ArmorEncodeRequest.endArmorEncodeRequest(builder); +} +} diff --git a/wasm/example/libs/model/file-hints.ts b/wasm/example/libs/model/file-hints.ts index 39b40b4..32ee72f 100644 --- a/wasm/example/libs/model/file-hints.ts +++ b/wasm/example/libs/model/file-hints.ts @@ -28,7 +28,7 @@ isBinary():boolean { return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; } -mutate_isBinary(value:boolean):boolean { +mutate_is_binary(value:boolean):boolean { const offset = this.bb!.__offset(this.bb_pos, 4); if (offset === 0) { diff --git a/wasm/example/libs/model/int-response.ts b/wasm/example/libs/model/int-response.ts index 8f8c770..8371b3d 100644 --- a/wasm/example/libs/model/int-response.ts +++ b/wasm/example/libs/model/int-response.ts @@ -20,12 +20,12 @@ static getSizePrefixedRootAsIntResponse(bb:flatbuffers.ByteBuffer, obj?:IntRespo return (obj || new IntResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } -output():flatbuffers.Long { +output():bigint { const offset = this.bb!.__offset(this.bb_pos, 4); - return offset ? this.bb!.readInt64(this.bb_pos + offset) : this.bb!.createLong(0, 0); + return offset ? this.bb!.readInt64(this.bb_pos + offset) : BigInt('0'); } -mutate_output(value:flatbuffers.Long):boolean { +mutate_output(value:bigint):boolean { const offset = this.bb!.__offset(this.bb_pos, 4); if (offset === 0) { @@ -47,8 +47,8 @@ static startIntResponse(builder:flatbuffers.Builder) { builder.startObject(2); } -static addOutput(builder:flatbuffers.Builder, output:flatbuffers.Long) { - builder.addFieldInt64(0, output, builder.createLong(0, 0)); +static addOutput(builder:flatbuffers.Builder, output:bigint) { + builder.addFieldInt64(0, output, BigInt('0')); } static addError(builder:flatbuffers.Builder, errorOffset:flatbuffers.Offset) { @@ -60,7 +60,7 @@ static endIntResponse(builder:flatbuffers.Builder):flatbuffers.Offset { return offset; } -static createIntResponse(builder:flatbuffers.Builder, output:flatbuffers.Long, errorOffset:flatbuffers.Offset):flatbuffers.Offset { +static createIntResponse(builder:flatbuffers.Builder, output:bigint, errorOffset:flatbuffers.Offset):flatbuffers.Offset { IntResponse.startIntResponse(builder); IntResponse.addOutput(builder, output); IntResponse.addError(builder, errorOffset); diff --git a/wasm/example/libs/model/key-options.ts b/wasm/example/libs/model/key-options.ts index 899c53e..4bc708e 100644 --- a/wasm/example/libs/model/key-options.ts +++ b/wasm/example/libs/model/key-options.ts @@ -104,7 +104,7 @@ compressionLevel():number { return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; } -mutate_compressionLevel(value:number):boolean { +mutate_compression_level(value:number):boolean { const offset = this.bb!.__offset(this.bb_pos, 10); if (offset === 0) { @@ -124,7 +124,7 @@ rsaBits():number { return offset ? this.bb!.readInt32(this.bb_pos + offset) : 0; } -mutate_rsaBits(value:number):boolean { +mutate_rsa_bits(value:number):boolean { const offset = this.bb!.__offset(this.bb_pos, 12); if (offset === 0) { diff --git a/wasm/example/libs/model/private-key-metadata.ts b/wasm/example/libs/model/private-key-metadata.ts index 491047e..68137b4 100644 --- a/wasm/example/libs/model/private-key-metadata.ts +++ b/wasm/example/libs/model/private-key-metadata.ts @@ -20,16 +20,16 @@ static getSizePrefixedRootAsPrivateKeyMetadata(bb:flatbuffers.ByteBuffer, obj?:P return (obj || new PrivateKeyMetadata()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } -keyID():string|null -keyID(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -keyID(optionalEncoding?:any):string|Uint8Array|null { +keyId():string|null +keyId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null +keyId(optionalEncoding?:any):string|Uint8Array|null { const offset = this.bb!.__offset(this.bb_pos, 4); return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; } -keyIDShort():string|null -keyIDShort(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -keyIDShort(optionalEncoding?:any):string|Uint8Array|null { +keyIdShort():string|null +keyIdShort(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null +keyIdShort(optionalEncoding?:any):string|Uint8Array|null { const offset = this.bb!.__offset(this.bb_pos, 6); return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; } @@ -48,9 +48,9 @@ fingerprint(optionalEncoding?:any):string|Uint8Array|null { return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; } -keyIDNumeric():string|null -keyIDNumeric(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -keyIDNumeric(optionalEncoding?:any):string|Uint8Array|null { +keyIdNumeric():string|null +keyIdNumeric(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null +keyIdNumeric(optionalEncoding?:any):string|Uint8Array|null { const offset = this.bb!.__offset(this.bb_pos, 12); return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; } @@ -60,7 +60,7 @@ isSubKey():boolean { return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; } -mutate_isSubKey(value:boolean):boolean { +mutate_is_sub_key(value:boolean):boolean { const offset = this.bb!.__offset(this.bb_pos, 14); if (offset === 0) { @@ -91,12 +91,12 @@ static startPrivateKeyMetadata(builder:flatbuffers.Builder) { builder.startObject(7); } -static addKeyID(builder:flatbuffers.Builder, keyIDOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, keyIDOffset, 0); +static addKeyId(builder:flatbuffers.Builder, keyIdOffset:flatbuffers.Offset) { + builder.addFieldOffset(0, keyIdOffset, 0); } -static addKeyIDShort(builder:flatbuffers.Builder, keyIDShortOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, keyIDShortOffset, 0); +static addKeyIdShort(builder:flatbuffers.Builder, keyIdShortOffset:flatbuffers.Offset) { + builder.addFieldOffset(1, keyIdShortOffset, 0); } static addCreationTime(builder:flatbuffers.Builder, creationTimeOffset:flatbuffers.Offset) { @@ -107,8 +107,8 @@ static addFingerprint(builder:flatbuffers.Builder, fingerprintOffset:flatbuffers builder.addFieldOffset(3, fingerprintOffset, 0); } -static addKeyIDNumeric(builder:flatbuffers.Builder, keyIDNumericOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, keyIDNumericOffset, 0); +static addKeyIdNumeric(builder:flatbuffers.Builder, keyIdNumericOffset:flatbuffers.Offset) { + builder.addFieldOffset(4, keyIdNumericOffset, 0); } static addIsSubKey(builder:flatbuffers.Builder, isSubKey:boolean) { @@ -124,13 +124,13 @@ static endPrivateKeyMetadata(builder:flatbuffers.Builder):flatbuffers.Offset { return offset; } -static createPrivateKeyMetadata(builder:flatbuffers.Builder, keyIDOffset:flatbuffers.Offset, keyIDShortOffset:flatbuffers.Offset, creationTimeOffset:flatbuffers.Offset, fingerprintOffset:flatbuffers.Offset, keyIDNumericOffset:flatbuffers.Offset, isSubKey:boolean, encrypted:boolean):flatbuffers.Offset { +static createPrivateKeyMetadata(builder:flatbuffers.Builder, keyIdOffset:flatbuffers.Offset, keyIdShortOffset:flatbuffers.Offset, creationTimeOffset:flatbuffers.Offset, fingerprintOffset:flatbuffers.Offset, keyIdNumericOffset:flatbuffers.Offset, isSubKey:boolean, encrypted:boolean):flatbuffers.Offset { PrivateKeyMetadata.startPrivateKeyMetadata(builder); - PrivateKeyMetadata.addKeyID(builder, keyIDOffset); - PrivateKeyMetadata.addKeyIDShort(builder, keyIDShortOffset); + PrivateKeyMetadata.addKeyId(builder, keyIdOffset); + PrivateKeyMetadata.addKeyIdShort(builder, keyIdShortOffset); PrivateKeyMetadata.addCreationTime(builder, creationTimeOffset); PrivateKeyMetadata.addFingerprint(builder, fingerprintOffset); - PrivateKeyMetadata.addKeyIDNumeric(builder, keyIDNumericOffset); + PrivateKeyMetadata.addKeyIdNumeric(builder, keyIdNumericOffset); PrivateKeyMetadata.addIsSubKey(builder, isSubKey); PrivateKeyMetadata.addEncrypted(builder, encrypted); return PrivateKeyMetadata.endPrivateKeyMetadata(builder); diff --git a/wasm/example/libs/model/public-key-metadata.ts b/wasm/example/libs/model/public-key-metadata.ts index ddb1feb..de86f1c 100644 --- a/wasm/example/libs/model/public-key-metadata.ts +++ b/wasm/example/libs/model/public-key-metadata.ts @@ -20,16 +20,16 @@ static getSizePrefixedRootAsPublicKeyMetadata(bb:flatbuffers.ByteBuffer, obj?:Pu return (obj || new PublicKeyMetadata()).__init(bb.readInt32(bb.position()) + bb.position(), bb); } -keyID():string|null -keyID(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -keyID(optionalEncoding?:any):string|Uint8Array|null { +keyId():string|null +keyId(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null +keyId(optionalEncoding?:any):string|Uint8Array|null { const offset = this.bb!.__offset(this.bb_pos, 4); return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; } -keyIDShort():string|null -keyIDShort(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -keyIDShort(optionalEncoding?:any):string|Uint8Array|null { +keyIdShort():string|null +keyIdShort(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null +keyIdShort(optionalEncoding?:any):string|Uint8Array|null { const offset = this.bb!.__offset(this.bb_pos, 6); return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; } @@ -48,9 +48,9 @@ fingerprint(optionalEncoding?:any):string|Uint8Array|null { return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; } -keyIDNumeric():string|null -keyIDNumeric(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null -keyIDNumeric(optionalEncoding?:any):string|Uint8Array|null { +keyIdNumeric():string|null +keyIdNumeric(optionalEncoding:flatbuffers.Encoding):string|Uint8Array|null +keyIdNumeric(optionalEncoding?:any):string|Uint8Array|null { const offset = this.bb!.__offset(this.bb_pos, 12); return offset ? this.bb!.__string(this.bb_pos + offset, optionalEncoding) : null; } @@ -60,7 +60,7 @@ isSubKey():boolean { return offset ? !!this.bb!.readInt8(this.bb_pos + offset) : false; } -mutate_isSubKey(value:boolean):boolean { +mutate_is_sub_key(value:boolean):boolean { const offset = this.bb!.__offset(this.bb_pos, 14); if (offset === 0) { @@ -75,12 +75,12 @@ static startPublicKeyMetadata(builder:flatbuffers.Builder) { builder.startObject(6); } -static addKeyID(builder:flatbuffers.Builder, keyIDOffset:flatbuffers.Offset) { - builder.addFieldOffset(0, keyIDOffset, 0); +static addKeyId(builder:flatbuffers.Builder, keyIdOffset:flatbuffers.Offset) { + builder.addFieldOffset(0, keyIdOffset, 0); } -static addKeyIDShort(builder:flatbuffers.Builder, keyIDShortOffset:flatbuffers.Offset) { - builder.addFieldOffset(1, keyIDShortOffset, 0); +static addKeyIdShort(builder:flatbuffers.Builder, keyIdShortOffset:flatbuffers.Offset) { + builder.addFieldOffset(1, keyIdShortOffset, 0); } static addCreationTime(builder:flatbuffers.Builder, creationTimeOffset:flatbuffers.Offset) { @@ -91,8 +91,8 @@ static addFingerprint(builder:flatbuffers.Builder, fingerprintOffset:flatbuffers builder.addFieldOffset(3, fingerprintOffset, 0); } -static addKeyIDNumeric(builder:flatbuffers.Builder, keyIDNumericOffset:flatbuffers.Offset) { - builder.addFieldOffset(4, keyIDNumericOffset, 0); +static addKeyIdNumeric(builder:flatbuffers.Builder, keyIdNumericOffset:flatbuffers.Offset) { + builder.addFieldOffset(4, keyIdNumericOffset, 0); } static addIsSubKey(builder:flatbuffers.Builder, isSubKey:boolean) { @@ -104,13 +104,13 @@ static endPublicKeyMetadata(builder:flatbuffers.Builder):flatbuffers.Offset { return offset; } -static createPublicKeyMetadata(builder:flatbuffers.Builder, keyIDOffset:flatbuffers.Offset, keyIDShortOffset:flatbuffers.Offset, creationTimeOffset:flatbuffers.Offset, fingerprintOffset:flatbuffers.Offset, keyIDNumericOffset:flatbuffers.Offset, isSubKey:boolean):flatbuffers.Offset { +static createPublicKeyMetadata(builder:flatbuffers.Builder, keyIdOffset:flatbuffers.Offset, keyIdShortOffset:flatbuffers.Offset, creationTimeOffset:flatbuffers.Offset, fingerprintOffset:flatbuffers.Offset, keyIdNumericOffset:flatbuffers.Offset, isSubKey:boolean):flatbuffers.Offset { PublicKeyMetadata.startPublicKeyMetadata(builder); - PublicKeyMetadata.addKeyID(builder, keyIDOffset); - PublicKeyMetadata.addKeyIDShort(builder, keyIDShortOffset); + PublicKeyMetadata.addKeyId(builder, keyIdOffset); + PublicKeyMetadata.addKeyIdShort(builder, keyIdShortOffset); PublicKeyMetadata.addCreationTime(builder, creationTimeOffset); PublicKeyMetadata.addFingerprint(builder, fingerprintOffset); - PublicKeyMetadata.addKeyIDNumeric(builder, keyIDNumericOffset); + PublicKeyMetadata.addKeyIdNumeric(builder, keyIdNumericOffset); PublicKeyMetadata.addIsSubKey(builder, isSubKey); return PublicKeyMetadata.endPublicKeyMetadata(builder); }