Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cards-utils

Shared Go library for logic common to the Issuer API and Merchant API.

Module: github.com/interledger/cards-utils

build

Run the below command to build the project.

go build ./...

test

Run the below command to run the unit tests.

go test ./...

Packages

redact

Produces loggable copies of API and domain values with sensitive fields masked or hidden, driven by sensitive:"<class>" struct tags. Classification follows the ILF EMV Field Data v1.0 sensitivity key.

Never log a request/response/domain struct directly — always go through redact.Redact or redact.Object:

log.Info().Object("merchant", redact.Object(m)).Msg("merchant created")

Highlights:

  • Tag-driven: pii/confidential are masked, crypto_key/crypto_data/credential/pci are hidden, dynamic maps are redacted by key rules.
  • ProfileApp (default) masks identifiers; ProfileAudit fails closed and hides everything classified.
  • redact.JSON redacts raw JSON bodies by key rules for byte-level logging.
  • redact.Object integrates with zerolog structured logging.

Each consuming service keeps its own coverage lint and sentinel/property tests (under internal/redact) that assert its own types are classified correctly; the reusable redaction engine lives here.

tlv

Validates the EMV authorized amount (9F02) in BER-TLV payloads and provides numeric BCD conversion:

err := tlv.ValidateAmount(payload, "100")

Validation errors can be classified with errors.Is using the exported sentinels such as tlv.ErrParsingTLV and tlv.ErrAmountMismatch.

Local development

Until this module is tagged and published, consuming services reference it with a replace directive pointing at a sibling checkout:

replace github.com/interledger/cards-utils => ../cards-utils

About

anything that merchant and issuer in common

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages