Skip to content

Latest commit

 

History

History
32 lines (20 loc) · 1.46 KB

README.md

File metadata and controls

32 lines (20 loc) · 1.46 KB

Turnkey Go SDK Encoding Module

GoDocs

The encoding module provides utilities for hexadecimal, Base58, and JSON encoding. It is primarily used as a shared dependency of the crypto module, but can also be imported independently in applications that need Turnkey-compatible encoding helpers.

Installation

go get github.com/tkhq/go-sdk/encoding

import "github.com/tkhq/go-sdk/encoding"

Key Types and Functions

HexBytes

HexBytes is a []byte type that marshals to/from a hex-encoded JSON string. Use it for fields that need to serialize as hex in JSON.

BytesToHex / HexToBytes

BytesToHex converts a byte slice to a lowercase hex string. HexToBytes converts a hex string back to a byte slice, with optional left-padding to a target length.

Bs58Encode / Bs58Decode

Bs58Encode encodes a byte slice into a Base58 string, and Bs58Decode decodes a Base58 string back into a byte slice.

HexToBase64URL

HexToBase64URL converts a hex string to a base64url-encoded string (no padding). Accepts an optional target byte length for left-padding.

Contributing + License

Contributions are welcome! Please open an issue or submit a pull request with any improvements or bug fixes.

This project is licensed under the Apache License 2.0. See the LICENSE file for details.