Skip to content

Commit

Permalink
Merge pull request #95 from bitcoin-sv/shameful-removal
Browse files Browse the repository at this point in the history
[chore] remove debugging console log
  • Loading branch information
sirdeggen committed Jun 19, 2024
2 parents b87d106 + fa2a3f6 commit 6dc80a7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. The format
## Table of Contents

- [Unreleased](#unreleased)
- [1.1.8 - 2024-06-12](#118---2024-06-19)
- [1.1.6 - 2024-06-12](#116---2024-06-12)
- [1.1.5 - 2024-06-11](#115---2024-06-11)
- [1.1.4 - 2024-05-10](#114---2024-05-10)
Expand All @@ -27,6 +28,12 @@ All notable changes to this project will be documented in this file. The format

---


## [1.1.8] - 2024-06-19

### Added
TOTP class which allows the generation of time based pass codes. Use varies but originally included for validating shared secrets between remote counterparties over a secure channel.

## [1.1.6] - 2024-06-12
### Added
- Allow Fees in historic transaction to be validated against a FeeModel.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bsv/sdk",
"version": "1.1.7",
"version": "1.1.8",
"type": "module",
"description": "BSV Blockchain Software Development Kit",
"main": "dist/cjs/mod.js",
Expand Down
4 changes: 0 additions & 4 deletions src/totp/totp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,14 @@ function generateHOTP (
const timePad = new BigNumber(counter).toArray('be', 8)
console.log({ timePad })
const hmac = calcHMAC(secret, timePad, options.algorithm)

const signature = hmac.digest()
const signatureHex = hmac.digestHex()

// RFC 4226 https://datatracker.ietf.org/doc/html/rfc4226#section-5.4
const offset = signature[signature.length - 1] & 0x0f // offset is the last byte in the hmac
const fourBytesRange = signature.slice(offset, offset + 4) // starting from offset, get 4 bytes
const mask = 0x7fffffff // 32-bit number with a leading 0 followed by 31 ones [0111 (...) 1111]
const masked = new BigNumber(fourBytesRange).toNumber() & mask

console.log({ signatureHex, signature, offset, fourBytesRange, mask, masked })

const otp = masked.toString().slice(-options.digits)
return otp
}
Expand Down

0 comments on commit 6dc80a7

Please sign in to comment.