npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ut-emv

v7.0.5

Published

EMV tags handling functions

Downloads

84

Readme

EMV tags functions

Scope

Handle encoding and decoding of BER-TLV data to/from string.

Public API

tagsDecode

(emvString, result, dolIdx)

Decodes EMV tag string from BER-TVL format to EMV tag object

params

  • emvString (string) - EMV tags in BER-TLV format
  • result (object) - result to return
  • dolIdx (integer) - position of the current tag in a DOL

result (object); each key: value pair contains the following:

  • key - EMV tag key

  • value (object) - EMV tag object

    • tag (string) - EMV tag
    • val (string) - EMV tag value OR nested EMV tags object, in the case when tag is a DOL tag
    • len (integer) - length of val in bytes

    NOTE: if the current tag is a DOL tag, val will have the following key: value structure:

  • key - EMV tag key

  • value (object) - EMV tag object

    • tag (string) - EMV tag
    • val (string) - EMV tag value; NOTE: as the value of a DOL tag does not contain values for nested tags, this is usually ''
    • len (integer) - length of val in bytes
    • idx (integer) - position of the tag in the DOL

dolDecode

(emvTags)

Adds values for tags nested in DOLs

params

  • emvTags (object) - each key: value pair contains the following:
    • key - EMV tag key
    • value (object) - EMV tag object
      • tag (string) - EMV tag
      • val (string) - EMV tag value; NOTE: as the value of a DOL tag does not contain values for nested tags, this is usually ''
      • len (integer) - length of val in bytes NOTE: for each DOL tag, val will have the following key: value structure:
  • key - EMV tag key
  • value (object) - EMV tag object
    • tag (string) - EMV tag
    • val (string) - EMV tag value
    • len (integer) - length of val in bytes
    • idx (integer) - position of the tag in the DOL

result (object) - emvTags input object, with added values for tags nested in DOLs

tagsEncode

(emvTags)

Encodes EMV tag object to EMV tag string

params

  • emvTags (object) - each key: value pair contains the following:
    • key - EMV tag key
    • value (object) - EMV tag object
      • val (string) - EMV tag value
      • tag (string) - EMV tag
      • len (integer) - length of val in bytes
      • idx (integer) - indicates the position of the current tag; NOTE: present only in case the input tags have to be ordered before encoding

result

  • (string) - EMV tag string in BER-TLV format

flatten

(emv)

Reduces EMV tag object to key: value pairs

params (object); each key: value pair contains the following:

  • key - EMV tag key
  • value (object) - EMV tag object
    • tag (string) - EMV tag
    • val (string) - EMV tag value
    • len (integer) - length of val in bytes

result (object); each key: value pair contains the following:

  • key - EMV tag key
  • value (string) - EMV tag value val

unflatten

(emv)

Expands key: value pairs to EMV tags object

params (object); Default: {}; each key: value pair contains the following:

  • key - EMV tag key
  • value (string) - EMV tag

result (object); each key: value pair contains the following:

  • key - EMV tag key
  • value (object) - EMV tag object
    • tag (string) - EMV tag
    • val (string) - EMV tag value
    • len (integer) - length of val in bytes

Dictionaries

Known EMV tags

  • Amount, Authorised (NUMERIC)

    • tag: 9F02
    • key: amountAuthorised
  • Amount, Other (NUMERIC)

    • tag: 9F03
    • key: amountOther,
  • Terminal Country Code

    • tag: 9F1A
    • key: terminalCountryCode,
  • Transaction Currency Code

    • tag: 5F2A
    • key: transactionCurrencyCode,
  • Transaction Date

    • tag: 9A
    • key: transactionDate,
  • Transaction Type

    • tag: 9C
    • key: transactionType,
  • Template, AEF Data

    • tag: 70
    • key: templateAEFData,
  • Issuer Public Key Certificate

    • tag: 90
    • key: issuerPublicKeyCertificate,
  • Issuer Public Key Remainder

    • tag: 92
    • key: issuerPublicKeyRemainder,
  • Certification Authority Public Key Index (PKI)

    • tag: 8F
    • key: certificationAuthorityPublicKeyIndex,
  • Unpredictable Number (UN)

    • tag: 9F37
    • key: unpredictableNumber,
  • Issuer Public Key Exponent

    • tag: 9F32
    • key: issuerPublicKeyExponent,
  • Card Risk Management Data Object List 1 (CDOL1)

    • tag: 8C
    • key: CDOL1,
  • Card Risk Management Data Object List 2 (CDOL2)

    • tag: 8D
    • key: CDOL2,
  • Transaction Certificate Data Object List (TDOL)

    • tag: 97
    • key: TDOL,
  • Processing Options Data Object List (PDOL)

    • tag: 9F38
    • key: PDOL,
  • Dynamic Data Authentication Data Object List (DDOL)

    • tag: 9F49
    • key: DDOL,
  • Track 2 Equivalent Data

    • tag: 57
    • key: track2EquivalentData,
  • Application Primary Account Number (PAN)

    • tag: 5A
    • key: pan,
  • Application Primary Account Number (PAN) Sequence Number (PSN)

    • tag: 5F34
    • key: panSeqNum,
  • Application Transaction Counter (ATC)

    • tag: 9F36
    • key: atc,
  • Application Cryptogram (AC)

    • tag: 9F26
    • key: applicationCryptogram,
  • Cryptogram Information Data (CID)

    • tag: 9F27
    • key: cryptogramInformationData,
  • Application Version Number, Terminal

    • tag: 9F09
    • key: terminalApplicationVersionNumber,
  • Terminal Capabilities

    • tag: 9F33
    • key: terminalCapabilities,
  • Terminal Type

    • tag: 9F35
    • key: terminalType,
  • Transaction Sequence Counter

    • tag: 9F41
    • key: transactionSequenceCounter,
  • Acquirer Identifier

    • tag: 9F01
    • key: acquirerIdentifier,
  • Additional Terminal Capabilities (ATC)

    • tag: 9F40
    • key: additionalTerminalCapabilities,
  • Amount, Authorised (Binary)

    • tag: 81
    • key: amountAuthorisedBinary,
  • Amount, Other (Binary)

    • tag: 9F04
    • key: amountOtherBinary,
  • Amount, Reference Currency (Binary)

    • tag: 9F3A
    • key: amountReferenceCurrency,
  • Currency Code, Application

    • tag: 9F42
    • key: applicationCurrencyCode,
  • Currency Exponent, Application

    • tag: 9F44
    • key: applicationCurrencyExponent,
  • Application Discretionary Data

    • tag: 9F05
    • key: applicationDiscretionaryData,
  • Application Effective Date

    • tag: 5F25
    • key: applicationEffectiveDate,
  • Application Expiration Date

    • tag: 5F24
    • key: applicationExpirationDate,
  • Application File Locator (AFL)

    • tag: 94
    • key: applicationFileLocatorAFL,
  • Application Identifier (ADF Name)

    • tag: 4F
    • key: applicationIdentifierAIDCard,
  • Application Identifier (AID), Terminal

    • tag: 9F06
    • key: applicationIdentifierAIDTerminal,
  • Application Interchange Profile (AIP)

    • tag: 82
    • key: applicationInterchangeProfile,
  • Application Label

    • tag: 50
    • key: applicationLabel,
  • Application Preferred Name

    • tag: 9F12
    • key: applicationPreferredName,
  • Application Priority Indicator

    • tag: 87
    • key: applicationPriorityIndicator,
  • Currency Code, Application Reference

    • tag: 9F3B
    • key: applicationReferenceCurrency,
  • Currency Exponent, Application Reference

    • tag: 9F43
    • key: applicationReferenceCurrencyExponent,
  • Application Template

    • tag: 61
    • key: applicationTemplate,
  • Application Usage Control (AUC)

    • tag: 9F07
    • key: applicationUsageControl,
  • Application Version Number, Card

    • tag: 9F08
    • key: applicationVersionNumber,
  • Authorisation Code

    • tag: 89
    • key: authorisationCode,
  • Authorisation Response Code (ARC)

    • tag: 8A
    • key: authorisationResponseCode,
  • Bank Identifier Code (BIC)

    • tag: 5F54
    • key: bankIdentifierCodeBIC,
  • Cardholder Name

    • tag: 5F20
    • key: cardholderName,
  • Cardholder Name - Extended

    • tag: 9F0B
    • key: cardholderNameExtended,
  • Cardholder Verification Method (CVM) List

    • tag: 8E
    • key: cvmList,
  • Cardholder Verification Method (CVM) Results

    • tag: 9F34
    • key: cvmResults,
  • Public Key Index, Certification Authority, Terminal

    • tag: 9F22
    • key: terminalCertificationAuthorityPublicKeyIndex,
  • Command Template

    • tag: 83
    • key: commandTemplate,
  • Data Authentication Code

    • tag: 9F45
    • key: dataAuthenticationCode,
  • Dedicated File (DF) Name

    • tag: 84
    • key: dedicatedFileDFName,
  • Directory Definition File (DDF) Name

    • tag: 9D
    • key: directoryDefinitionFileDDFName,
  • Directory Discretionary Template

    • tag: 73
    • key: directoryDiscretionaryTemplate,
  • File Control Information (FCI) Issuer Discretionary Data

    • tag: BF0C
    • key: fciIssuerDiscretionaryData,
  • File Control Information (FCI) Proprietary Template

    • tag: A5
    • key: fciProprietaryTemplate,
  • File Control Information (FCI) Template

    • tag: 6F
    • key: fciTemplate,
  • ICC Dynamic Number

    • tag: 9F4C
    • key: iccDynamicNumber,
  • Integrated Circuit Card (ICC) PIN Encipherment Public Key Certificate

    • tag: 9F2D
    • key: iccPINEnciphermentPublicKeyCertificate,
  • Integrated Circuit Card (ICC) PIN Encipherment Public Key Exponent

    • tag: 9F2E
    • key: iccPINEnciphermentPublicKeyExponent,
  • Integrated Circuit Card (ICC) PIN Encipherment Public Key Remainder

    • tag: 9F2F
    • key: iccPINEnciphermentPublicKeyRemainder,
  • Integrated Circuit Card (ICC) Public Key Certificate

    • tag: 9F46
    • key: iccPublicKeyCertificate,
  • Integrated Circuit Card (ICC) Public Key Exponent

    • tag: 9F47
    • key: iccPublicKeyExponent,
  • Integrated Circuit Card (ICC) Public Key Remainder

    • tag: 9F48
    • key: iccPublicKeyRemainder,
  • Interface Device (IFD) Serial Number

    • tag: 9F1E
    • key: interfaceDeviceIFDSerialNumber,
  • International Bank Account Number (IBAN)

    • tag: 5F53
    • key: internationalBankAccountNumberIBAN,
  • Issuer Action Code - Default

    • tag: 9F0D
    • key: issuerActionCodeDefault,
  • Issuer Action Code - Denial

    • tag: 9F0E
    • key: issuerActionCodeDenial,
  • Issuer Action Code - Online

    • tag: 9F0F
    • key: issuerActionCodeOnline,
  • Issuer Application Data (IAD)

    • tag: 9F10
    • key: issuerApplicationData,
  • Issuer Authentication Data

    • tag: 91
    • key: issuerAuthenticationData,
  • Issuer Code Table Index

    • tag: 9F11
    • key: issuerCodeTableIndex,
  • Issuer Country Code

    • tag: 5F28
    • key: issuerCountryCode,
  • Issuer Country Code (alpha2 format)

    • tag: 5F55
    • key: issuerCountryCodeAlpha2Format,
  • Issuer Country Code (alpha3 format)

    • tag: 5F56
    • key: issuerCountryCodeAlpha3Format,
  • Issuer Identification Number (IIN)

    • tag: 42
    • key: iin,
  • Issuer Script Command

    • tag: 86
    • key: issuerScriptCommand,
  • Issuer Script Identifier

    • tag: 9F18
    • key: issuerScriptIdentifier,
  • Issuer Script Template 1

    • tag: 71
    • key: issuerScriptTemplate1,
  • Issuer Script Template 2

    • tag: 72
    • key: issuerScriptTemplate2,
  • Issuer Uniform resource locator (URL)

    • tag: 5F50
    • key: issuerURL,
  • Language Preference

    • tag: 5F2D
    • key: languagePreference,
  • Last Online Application Transaction Counter (ATC) Register

    • tag: 9F13
    • key: lastOnlineATCRegister,
  • Log Entry

    • tag: 9F4D
    • key: logEntry,
  • Log Format

    • tag: 9F4F
    • key: logFormat,
  • Lower Consecutive Offline Limit (LCOL)

    • tag: 9F14
    • key: lowerConsecutiveOfflineLimit,
  • Merchant Category Code (MCC)

    • tag: 9F15
    • key: merchantCategoryCode,
  • Merchant Identifier

    • tag: 9F16
    • key: merchantIdentifier,
  • Merchant Name and Location

    • tag: 9F4E
    • key: merchantNameAndLocation,
  • Personal Identification Number (PIN) Try Counter

    • tag: 9F17
    • key: pinTryCounter,
  • Point-of-Service (POS) Entry Mode

    • tag: 9F39
    • key: pointOfServicePOSEntryMode,
  • Response Message Template Format 1

    • tag: 80
    • key: responseMessageTemplateFormat1,
  • Response Message Template Format 2

    • tag: 77
    • key: responseMessageTemplateFormat2,
  • Service Code

    • tag: 5F30
    • key: serviceCode,
  • Short File Identifier (SFI)

    • tag: 88
    • key: sfi,
  • Signed Dynamic Application Data (SDAD)

    • tag: 9F4B
    • key: signedDynamicApplicationData,
  • Signed Static Application Data (SAD)

    • tag: 93
    • key: signedStaticApplicationData,
  • Static Data Authentication Tag List (SDA)

    • tag: 9F4A
    • key: staticDataAuthenticationTagList,
  • Terminal Floor Limit

    • tag: 9F1B
    • key: terminalFloorLimit,
  • Terminal Identification

    • tag: 9F1C
    • key: terminalIdentification,
  • Terminal Risk Management Data

    • tag: 9F1D
    • key: terminalRiskManagementData,
  • Terminal Verification Results (TVR)

    • tag: 95
    • key: terminalVerificationResults,
  • Track 1 Discretionary Data

    • tag: 9F1F
    • key: track1DiscretionaryData,
  • Track 2 Discretionary Data

    • tag: 9F20
    • key: track2DiscretionaryData,
  • Transaction Certificate (TC) Hash Value

    • tag: 98
    • key: transactionCertificateTCHashValue,
  • Transaction Currency Exponent

    • tag: 5F36
    • key: transactionCurrencyExponent,
  • Transaction Personal Identification Number (PIN) Data

    • tag: 99
    • key: pinData,
  • Currency Code, Transaction Reference

    • tag: 9F3C
    • key: transactionReferenceCurrencyCode,
  • Currency Exponent, Transaction Reference

    • tag: 9F3D
    • key: transactionReferenceCurrencyExponent,
  • Transaction Status Information (TSI)

    • tag: 9B
    • key: transactionStatusInformation,
  • Transaction Time

    • tag: 9F21
    • key: transactionTime,
  • Upper Consecutive Offline Limit (UCOL)

    • tag: 9F23
    • key: upperConsecutiveOfflineLimit

Long tags

Indicates the value of the first byte for tags known to be two bytes long

  • 5f
  • 9f

DOL numeric types

Indicates the data type for tags in DOLs

  • 9F37 - non numeric
  • 9F02 - non numeric
  • 9F03 - non numeric
  • 9F1A - non numeric
  • 5F2A - non numeric
  • 9A - non numeric
  • 9C - non numeric