Skip to content

otplib API Documentation / @otplib/core / counterToBytes

Function: counterToBytes()

counterToBytes(value): Uint8Array

Defined in: packages/core/src/utils.ts:426

Convert counter to 8-byte big-endian array

Per RFC 4226 Section 5.1, the counter value is represented as an 8-byte big-endian (network byte order) unsigned integer.

Parameters

value

The counter value to convert

number | bigint

Returns

Uint8Array

8-byte big-endian array

See

RFC 4226 Section 5.1 - Symbol Descriptions

Released under the MIT License.