types

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HighwayServiceName is the name of the highway service
	HighwayServiceName = "Highway Protocol Service"

	// HighwayServiceDisplayName is the display name of the highway service
	HighwayServiceDisplayName = "highway"

	// HighwayServiceDescription is the description of the highway service
	HighwayServiceDescription = "Proxy for underlying blockchain protocol"

	// IceFireKVServiceName is the name of the IceFire KV service
	IceFireKVServiceName = "IceFire KV Service"

	// IceFireKVServiceDisplayName is the display name of the IceFire KV service
	IceFireKVServiceDisplayName = "icefirekv"

	// IceFireKVServiceDescription is the description of the IceFire KV service
	IceFireKVServiceDescription = "Key-value store for the Highway Protocol"

	// IceFireSQLServiceName is the name of the IceFire SQL service
	IceFireSQLServiceName = "IceFire SQL Service"

	// IceFireSQLServiceDisplayName is the display name of the IceFire SQL service
	IceFireSQLServiceDisplayName = "icefiresql"

	// IceFireSQLServiceDescription is the description of the IceFire SQL service
	IceFireSQLServiceDescription = "SQL database for the Highway Protocol"
)

Variables

View Source
var (
	// ErrNullWebauthnCredential is returned when a null credential is provided
	ErrNullWebauthnCredential = fmt.Errorf("provided webauthn credential is null")

	// ErrNullVaultKeyshare is returned when a null keyshare is provided
	ErrNullVaultKeyshare = fmt.Errorf("provided vault keyshare is null")

	// ErrInvalidCredentailCount is returned when the credential count is not 1
	ErrInvalidCredentailCount = fmt.Errorf("expected 1 credential formatted as json")

	// ErrJWTExpired is returned when the jwt has expired
	ErrJWTExpired = fmt.Errorf("jwt has expired")

	// ErrInvalidEmailController is returned when the controller is not a valid email controller
	ErrInvalidEmailController = fmt.Errorf("controller is not a valid email controller containing 'did:email:'")

	// ErrInvalidEmailAddress is returned when the email address is not properly formatted
	ErrInvalidEmailAddress = fmt.Errorf("email address is not properly formatted")

	// ErrFailedToRenameKeyshare is returned when the keyshare could not be renamed
	ErrFailedToRenameKeyshare = fmt.Errorf("failed to rename keyshare")

	// ErrNotFoundInPendingSet is returned when the did is not in the pending set for this vault
	ErrNotFoundInPendingSet = fmt.Errorf("this did is not in the pending set for this vault")

	// ErrNotFoundInControlledSet is returned when the did is not in the controlled set for this vault
	ErrNotFoundInControlledSet = fmt.Errorf("this did is not in the controlled set for this vault")

	// ErrInvalidKeyshareIndex is returned when the keyshare index is not valid
	ErrInvalidKeyshareIndex = fmt.Errorf("keyshare index is not valid")
)

Functions

func IsValidEmailAddress

func IsValidEmailAddress(email string) bool

IsValidEmailAddress returns true if the email is valid

func IsValidEmailController

func IsValidEmailController(emailDid string) bool

IsValidEmailController returns true if the email did format is valid

func IsValidUnclaimedKeyshare

func IsValidUnclaimedKeyshare(keyshare string) bool

IsValidUnclaimedKeyshare returns true if the keyshare is valid for its DID format

func NewSessionJWTClaims

func NewSessionJWTClaims(email string, acc *identitytypes.ControllerAccount) (string, error)

NewSessionJWTClaims takes a did string and returns a JWTClaims struct.

Types

type AuthenticationResult

type AuthenticationResult struct {
	Account     *crypto.AccountData        `json:"account"`
	Address     string                     `json:"address"`
	Alias       string                     `json:"alias"`
	DID         string                     `json:"did"`
	DIDDocument *identitytypes.DIDDocument `json:"did_document"`
	JWT         string                     `json:"jwt"`
}

AuthenticationResult struct is defining a data structure that represents the response returned after a successful authentication process. It contains various fields such as `Account`, `Address`, `Alias`, `DID`, `DIDDocument`, and `JWT`, which hold information related to the authenticated user.

type ClaimsResult

type ClaimsResult struct {
	Challenge  string `json:"challenge"`
	UCWAddress string `json:"ucw_address"`
}

ClaimsResult struct is defining a data structure used to allocate a challenge and random wallet address to a user.

type CredentialJWTClaims

type CredentialJWTClaims struct {
	AccountDid string `json:"did"`
	ExpiresAt  int64  `json:"expires_at"`
	UUID       string `json:"uuid"`
}

CredentialJWTClaims struct is defining a data structure that represents the claims (or payload) of a JSON Web Token (JWT). It contains fields such as `Did`, `ExpiresAt`, and `UUID`, which hold information related to the JWT. These fields can be used to store additional data that needs to be included in the JWT for authentication or authorization purposes.

func NewCredentialJWTClaims

func NewCredentialJWTClaims(did string) (CredentialJWTClaims, string, error)

NewCredentialJWTClaims takes a did string and returns a JWTClaims struct.

func VerifyCredentialJWTClaims

func VerifyCredentialJWTClaims(token string) (CredentialJWTClaims, error)

VerifyCredentialJWTClaims takes a token string as input and returns the JWTClaims and an error.

func (CredentialJWTClaims) IsValid

func (c CredentialJWTClaims) IsValid() error

IsValid returns true if the credential is valid

type EmailEncryptedData

type EmailEncryptedData struct {
	Did    string `json:"did"`
	Base64 string `json:"base64"`
}

EmailEncryptedData struct is defining a data structure that represents the encrypted data to be stored in the JWT. It contains fields such as `Did` and `Base64`, which hold information related to the encrypted data. The `Did` field represents the decentralized identifier associated with the data, and the `Base64` field stores the encrypted data in base64 format. This struct is used in the `Encrypt` and `Decrypt` methods of the `EmailJWTClaims` struct to encrypt and decrypt data using the JWT signing key.

type EmailJWTClaims

type EmailJWTClaims struct {
	AccountDid    string `json:"did"`
	ControllerDid string `json:"controller_did"`
	ExpiresAt     int64  `json:"expires_at"`
	Email         string `json:"email"`
}

EmailJWTClaims struct is defining a data structure that represents the claims (or payload) of a JSON Web Token (JWT). It contains fields such as `Did`, `ExpiresAt`, and `UUID`, which hold information related to the JWT. These fields can be used to store additional data that needs to be included in the JWT for authentication or authorization purposes.

func NewEmailJWTClaims

func NewEmailJWTClaims(did string, email string) (EmailJWTClaims, string, error)

NewEmailJWTClaims takes a did string and returns a JWTClaims struct.

func VerifyEmailJWTClaims

func VerifyEmailJWTClaims(token string) (EmailJWTClaims, error)

VerifyEmailJWTClaims takes a token string as input and returns the JWTClaims and an error.

func (EmailJWTClaims) ControllerIdentifier

func (c EmailJWTClaims) ControllerIdentifier() string

ControllerIdentifier returns the last part of the DID used to anonymize email addresses

func (EmailJWTClaims) Decrypt

func (c EmailJWTClaims) Decrypt(data []byte) ([]byte, error)

Decrypt method of the `EmailJWTClaims` struct is used to decrypt data that has been encrypted using the JWT signing key. It takes a byte slice `data` as input, which represents the encrypted data, and returns a byte slice representing the decrypted data and an error.

func (EmailJWTClaims) Encrypt

func (c EmailJWTClaims) Encrypt(data []byte) ([]byte, error)

Encrypt method of the `EmailJWTClaims` struct is used to encrypt data using the JWT signing key. It takes a byte slice `data` as input and returns a byte slice representing the encrypted data and an error.

func (EmailJWTClaims) IsValid

func (c EmailJWTClaims) IsValid() error

IsValid returns true if the credential is valid

func (EmailJWTClaims) SigningKey

func (c EmailJWTClaims) SigningKey() []byte

SigningKey returns the JWT signing key

type SessionJWTClaims

type SessionJWTClaims struct {
	Address       string `json:"address"`
	Authenticator string `json:"authenticator"`
	Email         string `json:"email"`
	ExpiresAt     int64  `json:"expires_at"`
}

SessionJWTClaims struct is defining a data structure that represents the claims (or payload) of a JSON Web Token (JWT). It contains fields such as `Did`, `ExpiresAt`, and `UUID`, which hold information related to the JWT. These fields can be used to store additional data that needs to be included in the JWT for authentication or authorization purposes.

func VerifySessionJWTClaims

func VerifySessionJWTClaims(token string) (SessionJWTClaims, error)

VerifySessionJWTClaims takes a token string as input and returns the JWTClaims and an error.

func (SessionJWTClaims) IsValid

func (c SessionJWTClaims) IsValid() error

IsValid returns true if the credential is valid

type SignAndSendTxRequest

type SignAndSendTxRequest struct {
	Messages []*tx.SignDoc `json:"messages"`
	DID      string        `json:"did"`
}

SignAndSendTxRequest struct is used to represent a request object for signing and sending a transaction. the messages to be included in the transaction, and `DID`, which is a string representing the decentralized identifier associated with the transaction.

func (*SignAndSendTxRequest) Marshal

func (r *SignAndSendTxRequest) Marshal() ([]byte, error)

Marshal returns the JSON encoding of the SignAndSendTxRequest object.

func (*SignAndSendTxRequest) Unmarshal

func (r *SignAndSendTxRequest) Unmarshal(data []byte) error

Unmarshal parses the JSON-encoded data and stores the result in the SignAndSendTxRequest object.

type SignWithAccountRequest

type SignWithAccountRequest struct {
	Message string `json:"message"`
	DID     string `json:"did"`
}

SignWithAccountRequest struct is defining the structure of a request object for signing a message with an account. It has two fields: `Message`, which is a string representing the message to be signed, and `DID`, which is a string representing the decentralized identifier associated with the account.

func (*SignWithAccountRequest) Marshal

func (r *SignWithAccountRequest) Marshal() ([]byte, error)

Marshal returns the JSON encoding of the SignWithAccountRequest object.

func (*SignWithAccountRequest) Unmarshal

func (r *SignWithAccountRequest) Unmarshal(data []byte) error

Unmarshal parses the JSON-encoded data and stores the result in the SignWithAccountRequest object.

type TxResponse

type TxResponse = sdk.TxResponse

TxResponse is a wrapper struct for the response returned after a transaction is broadcasted to the blockchain.

type VerifyWithAccountRequest

type VerifyWithAccountRequest struct {
	Message   string `json:"message"`
	Signature string `json:"signature"`
	DID       string `json:"did"`
}

VerifyWithAccountRequest struct is defining the structure of a request object for verifying a message with an account. It has three fields: message, and `DID`, which is a string representing the decentralized identifier associated with the account.

func (*VerifyWithAccountRequest) Marshal

func (r *VerifyWithAccountRequest) Marshal() ([]byte, error)

Marshal returns the JSON encoding of the VerifyWithAccountRequest object.

func (*VerifyWithAccountRequest) Unmarshal

func (r *VerifyWithAccountRequest) Unmarshal(data []byte) error

Unmarshal parses the JSON-encoded data and stores the result in the VerifyWithAccountRequest object.

Jump to

Keyboard shortcuts

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