aba

package
v0.804.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package aba decodes and validates an ABA routing transit number (RTN) — the 9-digit code that identifies a US bank or credit union in ACH and wire transfers. It is the US-domestic counterpart to internal/iban (the international account): a routing number turns up in ACH-fraud / business-email-compromise lures, leaked direct-deposit forms, and check images, so decoding one off a paste tells an operator whether the number is internally consistent and which Federal Reserve district issued it.

Wrap-vs-native judgement

Native. An RTN is a fixed digit-field layout — a 4-digit Federal
Reserve routing symbol, a 4-digit ABA institution identifier, and 1
check digit — guarded by a weighted modulus-10 checksum. Validating
it is integer arithmetic plus a small fixed range classification; no
runtime dependency or hand-transcribed lookup beyond the 12 statutory
Federal Reserve districts is justified. stdlib only, no new go.mod
dep.

Verifiable / no confidently-wrong output

The modulus-10 checksum is the verification anchor — it is recomputed
and compared, and a mismatch is reported as checksum_valid=false with
a note (a mistyped RTN), never asserted as a definitively fake bank.
The Federal Reserve district and the institution type are derived
from the leading two digits by the published numbering ranges (not a
guess); a prefix outside those ranges leaves the district undetermined
rather than inventing one. The institution identifier is surfaced raw
— it maps to a specific bank only via the proprietary American Bankers
Association registry, which is not embedded.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	RoutingNumber string   `json:"routing_number"`
	RoutingSymbol string   `json:"federal_reserve_routing_symbol"` // digits 1-4
	InstitutionID string   `json:"aba_institution_identifier"`     // digits 5-8
	CheckDigit    string   `json:"check_digit"`                    // digit 9
	Type          string   `json:"type"`                           // Government / Primary / Thrift / Electronic / Traveler's
	District      int      `json:"federal_reserve_district,omitempty"`
	DistrictName  string   `json:"federal_reserve_district_name,omitempty"`
	ChecksumValid bool     `json:"checksum_valid"` // ABA weighted modulus-10 (the verification anchor)
	Notes         []string `json:"notes,omitempty"`
}

Result is the decoded view of an ABA routing transit number.

func Decode

func Decode(raw string) (*Result, error)

Decode validates and breaks down an ABA routing number. Spaces, '-' and ':' separators are tolerated.

Jump to

Keyboard shortcuts

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