Closed kazuemon closed 9 months ago
const schema = sequence({ fields: [ { name: "id", schema: integer(), }, { name: "message", schema: octetString(), // ✨ New option! optional: true, }, ] as const, }); const asn1Buf = schema.encode({ // id: number id: 50, // message?: string | undefined message: "hello", }); const result = schema.decode( /* Asn1Data */ ); const id = result.id; // number const message = result.message; // string | undefined