@hazae41/apdu
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

APDU

Rust-like APDU protocol for TypeScript

npm i @hazae41/apdu

Node Package 📦

Features

Current features

  • 100% TypeScript and ESM
  • No external dependencies
  • Rust-like patterns
  • Uses @hazae41/result

Usage

Request and response

import { ApduRequest, ApduResponse } from "@hazae41/apdu"
import { Readable, Writable, Empty } from "@hazae41/binary"

function send(bytes: Uint8Array): Promise<Uint8Array>;

const request = ApduRequest.fromOrThrow({ cla: 0xe0, ins: 0x06, p1: 0x00, p2: 0x00, fragment: new Empty() })
const output = Writable.writeToBytesOrThrow(request)
const input = await send(output)
const response = Readable.readFromBytesOrThrow(ApduResponse, input)

if (response.isOk())
  console.log(response.get())
else
  console.error(response.getErr())

Package Sidebar

Install

npm i @hazae41/apdu

Weekly Downloads

4

Version

1.0.0

License

MIT

Unpacked Size

23.2 kB

Total Files

17

Last publish

Collaborators

  • hazae41