smartid

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2022 License: MIT Imports: 3 Imported by: 0

README

smartid CI

The smartid package generates URL-friendly 160 bit (20 byte) random identifiers, base64 encoded.

160 bit is better than uid v4 (122 bit) and is OWASP-compatible (>= 128 bit)

install
go get github.com/dmasior/smartid
usage
id := smartid.MustNew()

fmt.Println(id.String())

// Prints: 9z4Q7WaUmzQetcj8CCWcKITTg3w
Documentation

GoDoc

View GoDocs: https://pkg.go.dev/github.com/dmasior/smartid

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustNewString

func MustNewString() string

MustNewString creates new SmartID and returns it as string or panics.

Types

type SmartID

type SmartID [27]byte

A SmartID has size of 27 bytes which is encoded size of a 160 bit (20 byte) random identifier.

func Must

func Must(ID SmartID, err error) SmartID

Must returns SmartID if err is nil and panics otherwise.

func MustNew

func MustNew() SmartID

MustNew creates new SmartID or panics.

Example
id := MustNew()

fmt.Println(id.String())

func New

func New() (SmartID, error)

New creates new SmartID.

func (SmartID) String

func (s SmartID) String() string

String returns string from SmartID

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL