Categorygithub.com/Miguelo981/web3-token
modulepackage
0.0.3
Repository: https://github.com/miguelo981/web3-token.git
Documentation: pkg.go.dev

# README

Web3 Token

Web3 Token is a new way to authenticate users inspired in web3-token for Golang and use it as a middleware in your backends.


Install

$ go get github.com/Miguelo981/web3-token

Example usage (Server side)


import (
	web3Token "github.com/Miguelo981/web3-token"
)

decoded, err := web3Token.Verify(token, "")

if err != nil {
	//Token is invalid
	return
}

// Now you can find that user by his address or use the signed attributes in the token
req.user = await User.findOne({ decoded.Address });

API

Descrypt(signer, options)

NameDescriptionRequiredExample
tokenA function that returns a the decrypted body of the signed tokenrequiredweb3Token.Descrypt(eyJzaWduYXR1cmUiOi)

Verify(token, options)

NameDescriptionRequiredExample
tokenA token string that is generated from sign()required...
optionsAn options objectrequired{ domain: 'example.com' }
options.domainThe domain you want to acceptrequired'example.com'

License

Web3 Token is released under the MIT license. © 2022 Miguelo

# Packages

No description provided by the author

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author