tapcards

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 19 Imported by: 2

README

Coinkite Tap Cards Protocol Implementation in Go

Gopher Logo

This project is a Go language implementation of the Tap Cards protocol, specifically focusing on the Satscard functionality. It does not cover Tapsigner or Satschip functionalities at this time.

Available Satscard Commands

Implemented commands for Satscard include:

Usage Guide

Initial Steps

The first action with a card is an ISOAppletSelectRequest. The library manages APDU complexities, allowing direct sending of raw bytes. The card’s response should be processed through ParseResponse. This step is not necessary to repeat as long as the card remains powered in the RF field.

Subsequently, run a Request command to generate a byte array for the card. Multiple interactions may be necessary for some commands, with byte arrays from ParseResponse being resent to the card as needed. Once ParseResponse yields no further data, use Satscard to access card information, private keys, etc.

Always verify the factory certificate of the card before trusting any data from it. To do this, run CertsRequest which check the authenticity of the card. This command will also run the read command, which will expose the current receiving address.

Building Mobile Libraries

The Go library can be compiled for mobile platforms, supporting Objective-C on iOS and Java on Android.

Setup Requirements
For iOS

Requires macOS with Command Line Tools or Xcode.

For Android

Requires Android Studio or Command Line Tools, and the installation of Android NDK.

Mobile Compilation Steps
go install golang.org/x/mobile/cmd/gomobile@latest
go install golang.org/x/mobile/bind
gomobile init
gomobile bind -target=ios
gomobile bind -target=android

Examples

In the examples folder, there are two projects using this module. One using the emulator, and the other using physical Satscards.

Development and debug

For the ongoing development and upkeep of this library, it is beneficial to utilise the Python emulator provided by Coinkite. You can integrate the emulator with the library by executing UseEmulator(). Additionally, invoking EnableDebugLogging() will provide valuable information for debugging.

Documentation

Overview

package tapcards provides a simple queue implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnableDebugLogging

func EnableDebugLogging()

func UseEmulator

func UseEmulator()

Types

type Satscard

type Satscard struct {

	//TODO: Make private and use getters so these cannot be changed
	ActiveSlot           int
	NumberOfSlots        int
	Identity             string
	PaymentAddress       string
	Proto                int
	Birth                int
	Version              string
	ActiveSlotPrivateKey string
	AuthDelay            int
	// contains filtered or unexported fields
}

func (*Satscard) CertsRequest

func (satscard *Satscard) CertsRequest() ([]byte, error)

func (*Satscard) ISOAppletSelectRequest

func (satscard *Satscard) ISOAppletSelectRequest() ([]byte, error)

ISO Applet Select

func (*Satscard) NewRequest

func (satscard *Satscard) NewRequest(cvc string) ([]byte, error)

func (*Satscard) ParseResponse

func (satscard *Satscard) ParseResponse(response []byte) ([]byte, error)

func (*Satscard) ReadRequest

func (satscard *Satscard) ReadRequest() ([]byte, error)

func (*Satscard) StatusRequest

func (satscard *Satscard) StatusRequest() ([]byte, error)

func (*Satscard) UnsealRequest

func (satscard *Satscard) UnsealRequest(cvc string) ([]byte, error)

func (*Satscard) WaitRequest

func (satscard *Satscard) WaitRequest() ([]byte, error)

Directories

Path Synopsis
examples
card Module
emulator Module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL