uuid

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Example usage:

package main

import (
	"fmt"

)

func main() {
	UUID4 := uuid.UUID4()
	fmt.Println("UUID4 is", UUID4)

	UUID5 := uuid.UUID5(uuid.NamespaceDNS, "SomeName")
	fmt.Println("UUID5", UUID5)
}

Package uuidapikey contains generator, validator, and converter that transforms UUIDs into human-readable Base32-Crockford encoded API Keys

Index

Constants

This section is empty.

Variables

View Source
var (
	NamespaceDNS  = UUID{107, 167, 184, 16, 157, 173, 17, 209, 128, 180, 0, 192, 79, 212, 48, 200}
	NamespaceURL  = UUID{107, 167, 184, 17, 157, 173, 17, 209, 128, 180, 0, 192, 79, 212, 48, 200}
	NamespaceOID  = UUID{107, 167, 184, 18, 157, 173, 17, 209, 128, 180, 0, 192, 79, 212, 48, 200}
	NamespaceX500 = UUID{107, 167, 184, 20, 157, 173, 17, 209, 128, 180, 0, 192, 79, 212, 48, 200}
)

The following standard UUIDs are for use with UUID3() or UUID5().

Functions

func CheckAPIKey

func CheckAPIKey(uuid, apiKey string) bool

Check will verify both UUID and API Key, with either given

func CreateUUIDAPIKey

func CreateUUIDAPIKey() string

Create will create new UUID and API Key

func IsAPIKey

func IsAPIKey(apiKey string) bool

IsAPIKey will verify given API Key

func IsUUID

func IsUUID(uuid string) bool

IsUUID will verify given UUID

func ToAPIKey

func ToAPIKey(uuid string) string

ToAPIKey will convert given UUID to API Key

func ToUUID

func ToUUID(apiKey string) string

ToUUID will convert given API Key to UUID

Types

type UUID

type UUID [16]byte

UUID represents a UUID

func ParseUUIDFromString

func ParseUUIDFromString(str string) (uuid UUID, err error)

ParseUUIDFromString parses a RFC 4122 compliant string representation of a uuid into a UUID4

func UUID3

func UUID3(namespace UUID, name string) UUID

UUID3 generates a version 3 UUID

func UUID4

func UUID4() UUID

UUID4 generates a version 4 UUID

func UUID5

func UUID5(namespace UUID, name string) UUID

UUID5 generates a version 5 UUID

func (UUID) String

func (u UUID) String() string

String provides the uuid in a format compliant with RFC 4122

Jump to

Keyboard shortcuts

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