testing

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const SecondsInYear = int32(3600 * 24 * 365)

Variables

This section is empty.

Functions

func CreateCompressedVerificationMethod

func CreateCompressedVerificationMethod(id string, keyIndex int, pubKey *ecdsa.PublicKey) (*types.DidVerificationMethod, error)

CreateCompressedVerificationMethod converts an ECDSA public key to a JsonWebKey structure using compressed format.

func CreateTestDidDocument

func CreateTestDidDocument(options DidDocumentTestOptions) (
	types.DidDocument,
	*ecdsa.PrivateKey,
	*ecdsa.PrivateKey,
)

CreateTestDidDocument creates a DID document for testing, applying any specified overrides.

func CreateVerificationMethod

func CreateVerificationMethod(id string, keyIndex int, pubKey *ecdsa.PublicKey) (*types.DidVerificationMethod, error)

CreateVerificationMethod converts an ECDSA public key to a JsonWebKey structure.

func GenerateCompressedTestingVerificationMethod

func GenerateCompressedTestingVerificationMethod(id string, idx int) (*ecdsa.PrivateKey, *types.DidVerificationMethod, error)

func GenerateDidFromKeyPair

func GenerateDidFromKeyPair(publicKey *ecdsa.PublicKey) (string, *types.DidVerificationMethod)

func GenerateGenesisState

func GenerateGenesisState(simState *module.SimulationState)

GenerateGenesisState creates a randomized GenState of the module

func GenerateRandomDIDDocument

func GenerateRandomDIDDocument() *types.DidDocument

GenerateRandomDIDDocument generates a random DIDDocument for simulation.

func GenerateTestKeyPair

func GenerateTestKeyPair() (*ecdsa.PrivateKey, *ecdsa.PublicKey)

func GenerateTestingVerificationMethod

func GenerateTestingVerificationMethod(id string, idx int) (*ecdsa.PrivateKey, *types.DidVerificationMethod, error)

func PublicKeyToEthAddress

func PublicKeyToEthAddress(pubKey *ecdsa.PublicKey) string

func SetupMsgServer

func SetupMsgServer(t testing.TB) (keeper.Keeper, types.MsgServer, sdk.Context)

func SignMessage

func SignMessage(
	cdc *codec.ProtoCodec,
	privKey *ecdsa.PrivateKey,
	methodId string,
	msg codec.ProtoMarshaler,
) types.Signature

func TestMsgServer

func TestMsgServer(t *testing.T)

Types

type DidDocumentTestOptions

type DidDocumentTestOptions struct {
	Id                           string
	ContextOverride              []string
	ControllerOverride           []string
	AlsoKnownAsOverride          []string
	VerificationMethodOverride   []*types.DidVerificationMethod
	AuthenticationOverride       []*types.DidVerificationRelationship
	AssertionMethodOverride      []*types.DidVerificationRelationship
	KeyAgreementOverride         []*types.DidVerificationRelationship
	CapabilityInvocationOverride []*types.DidVerificationRelationship
	CapabilityDelegationOverride []*types.DidVerificationRelationship
	ServiceOverride              []*types.DidDocumentService
}

DidDocumentTestOptions defines options for customizing the creation of DID documents in tests.

Jump to

Keyboard shortcuts

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