tmobilepoptokenbuilder

package
v0.0.0-...-f1548b2 Latest Latest
Warning

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

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

README

Golang - PoP Token Builder Library

Golang library to build PoP tokens to the T-Mobile specification.

See poptokenbuilder_test.go for example usage

Basic overview:

This library works by taking in a standard Go libray http.Request struct, using it's in formation to generate the PoP token, then writing the token back to the Request (optionally this part can be done manually by using Build() instead of Sign()).

Both unencrypted and encrypted (pass-phrase protected) RSA keys are supported, either hard-coded or loaded from the filesystem.

Generated tokens have been tested and validated against the production API calls.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PoPTokenBuilder

type PoPTokenBuilder struct {
	// contains filtered or unexported fields
}

PoPTokenBuilder - generates and signs a T-Mobile PoP token for API requests

func NewFromBytes

func NewFromBytes(key []byte, passphrase string) (*PoPTokenBuilder, error)

NewFromBytes - returns a PoPTokenBuilder using a PEM formatted RSA private key byte array

func NewFromFile

func NewFromFile(path string, passphrase string) (*PoPTokenBuilder, error)

NewFromFile - returns a PoPTokenBuilder using a PEM formatted RSA private key loaded from a file

func NewFromString

func NewFromString(key string, passphrase string) (*PoPTokenBuilder, error)

NewFromString - returns a PoPTokenBuilder using a PEM formatted RSA private key string

func (PoPTokenBuilder) Build

func (pts PoPTokenBuilder) Build(r *http.Request) (string, error)

Build - creates a T-Mobile JWT PoP token and returns it

func (PoPTokenBuilder) Sign

func (pts PoPTokenBuilder) Sign(r *http.Request) error

Sign - creates and signs a T-Mobile JWT PoP token and adds it to the request

Jump to

Keyboard shortcuts

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