package roottoken

import "github.com/hashicorp/vault/sdk/helper/roottoken"

Index

Functions

func DecodeToken

func DecodeToken(encoded, otp string, otpLength int) (string, error)

DecodeToken will decode the root token returned by the Vault API The algorithm was initially used in the generate root command

func EncodeToken

func EncodeToken(token, otp string) (string, error)

EncodeToken gets a token and an OTP and encodes the token. The OTP must have the same length as the token.

func GenerateOTP

func GenerateOTP(otpLength int) (string, error)

GenerateOTP generates a random token and encodes it as a Base64 or as a Base62 encoded string. Returns 0 if the generation completed without any error, 2 otherwise, along with the error.

Source Files

decode.go encode.go otp.go

Version
v0.18.0 (latest)
Published
Jun 5, 2025
Platform
linux/amd64
Imports
7 packages
Last checked
1 month ago

Tools for package owners.