Documentation
¶
Overview ¶
Package mock defines mocks for protocol testing
Index ¶
- Constants
- Variables
- func PrepareAuthInputs(hash []byte, _ *w3c.DID, _ circuits.CircuitID) ([]byte, error)
- func ResolveEncPrivateKey(keyID string) (interface{}, error)
- func ResolveKeyID(keyID string) (jwk.Key, error)
- func ToJWK(t *testing.T, key any) map[string]interface{}
- func VerifyState(_ circuits.CircuitID, _ []string) error
- type MockCommon
- type MockEC
- type MockRSA
- type ProvingMethodGroth16AuthV2
Constants ¶
View Source
const ( SenderKeyIdAuthCrypt = "sender-key-id" RecipientKeyIdAuthCrypt = "recipient-key-id" )
View Source
const MockRecipientKeyID = "123456789"
MockRecipientKeyID is mocked key id for recipient
Variables ¶
View Source
var ( AliceDigest = rand.New(rand.NewSource(1)) BobDigest = rand.New(rand.NewSource(2)) ViktorDigest = rand.New(rand.NewSource(3)) )
View Source
var ( PubResolverAuthCrypt = func(kid string) (interface{}, error) { if kid == SenderKeyIdAuthCrypt { return joseprimitives.Import(senderKey.PublicKey()) } if kid == RecipientKeyIdAuthCrypt { return joseprimitives.Import(recipientKey.PublicKey()) } return nil, errors.New("key not found") } PrivResolverAuthCrypt = func(kid string) (interface{}, error) { if kid == SenderKeyIdAuthCrypt { return senderKey, nil } if kid == RecipientKeyIdAuthCrypt { return recipientKey, nil } return nil, errors.New("key not found") } )
Functions ¶
func PrepareAuthInputs ¶
PrepareAuthInputs returns mocked inputs for auth circuit
func ResolveEncPrivateKey ¶
ResolveEncPrivateKey returns mocked private key
func ResolveKeyID ¶
ResolveKeyID returns mocked public key for any key ID
Types ¶
type MockCommon ¶ added in v2.11.9
func NewCommonMock ¶ added in v2.11.9
func NewCommonMock(r MockRSA, e MockEC) MockCommon
func (MockCommon) BuildDidDocWithAllKeys ¶ added in v2.11.9
func (m MockCommon) BuildDidDocWithAllKeys(t *testing.T, did string) *document.DidResolution
type MockEC ¶ added in v2.11.5
type MockEC struct {
PrivateKey *ecdh.PrivateKey
}
func (MockEC) BuildDidDocWithECKey ¶ added in v2.11.5
func (MockEC) GetJWKForPrivateKey ¶ added in v2.11.5
type MockRSA ¶ added in v2.11.5
type MockRSA struct {
PrivateKey *rsa.PrivateKey
}
func (MockRSA) BuildDidDocWithRSAKey ¶ added in v2.11.5
func (MockRSA) GetJWKForPrivateKey ¶ added in v2.11.5
type ProvingMethodGroth16AuthV2 ¶
type ProvingMethodGroth16AuthV2 struct {
jwz.ProvingMethodAlg
}
ProvingMethodGroth16AuthV2 proving method to avoid using of proving key and wasm files
func (*ProvingMethodGroth16AuthV2) Alg ¶
func (m *ProvingMethodGroth16AuthV2) Alg() string
Alg returns current zk alg
func (*ProvingMethodGroth16AuthV2) CircuitID ¶
func (m *ProvingMethodGroth16AuthV2) CircuitID() string
CircuitID returns name of circuit
Click to show internal directories.
Click to hide internal directories.