common

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExtensionAppID        = "appid"
	ExtensionAppIDExclude = "appidExclude"
)

Variables

View Source
var (
	ErrInvalidLengthData        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowData          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupData = fmt.Errorf("proto: unexpected end of group")
)
View Source
var PeerType_name = map[int32]string{
	0: "UNKNOWN",
	1: "HIGHWAY",
	2: "MOTOR",
	3: "VALIDATOR",
	4: "THIRD_PARTY",
}
View Source
var PeerType_value = map[string]int32{
	"UNKNOWN":     0,
	"HIGHWAY":     1,
	"MOTOR":       2,
	"VALIDATOR":   3,
	"THIRD_PARTY": 4,
}

Functions

func ConvertBoolToString

func ConvertBoolToString(v bool) string

func ConvertStringToBool

func ConvertStringToBool(v string) bool

Types

type AuthenticationExtensionsClientOutputs

type AuthenticationExtensionsClientOutputs map[string]interface{}

type KeyPrint

type KeyPrint struct {
	Address          string              `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	BiometricKey     []byte              `protobuf:"bytes,2,opt,name=biometric_key,json=biometricKey,proto3" json:"biometric_key,omitempty"`
	BiometricKeyType string              `protobuf:"bytes,3,opt,name=biometric_key_type,json=biometricKeyType,proto3" json:"biometric_key_type,omitempty"`
	WebauthnKey      *WebauthnCredential `protobuf:"bytes,4,opt,name=webauthn_key,json=webauthnKey,proto3" json:"webauthn_key,omitempty"`
	DeviceLabel      string              `protobuf:"bytes,5,opt,name=device_label,json=deviceLabel,proto3" json:"device_label,omitempty"`
}

KeyPrint is a object used by Motor clients to store key print information in Biometric storage or Webauthn

func (*KeyPrint) Descriptor

func (*KeyPrint) Descriptor() ([]byte, []int)

func (*KeyPrint) GetAddress

func (m *KeyPrint) GetAddress() string

func (*KeyPrint) GetBiometricKey

func (m *KeyPrint) GetBiometricKey() []byte

func (*KeyPrint) GetBiometricKeyType

func (m *KeyPrint) GetBiometricKeyType() string

func (*KeyPrint) GetDeviceLabel

func (m *KeyPrint) GetDeviceLabel() string

func (*KeyPrint) GetWebauthnKey

func (m *KeyPrint) GetWebauthnKey() *WebauthnCredential

func (*KeyPrint) Marshal

func (m *KeyPrint) Marshal() (dAtA []byte, err error)

func (*KeyPrint) MarshalTo

func (m *KeyPrint) MarshalTo(dAtA []byte) (int, error)

func (*KeyPrint) MarshalToSizedBuffer

func (m *KeyPrint) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*KeyPrint) ProtoMessage

func (*KeyPrint) ProtoMessage()

func (*KeyPrint) Reset

func (m *KeyPrint) Reset()

func (*KeyPrint) Size

func (m *KeyPrint) Size() (n int)

func (*KeyPrint) String

func (m *KeyPrint) String() string

func (*KeyPrint) Unmarshal

func (m *KeyPrint) Unmarshal(dAtA []byte) error

func (*KeyPrint) XXX_DiscardUnknown

func (m *KeyPrint) XXX_DiscardUnknown()

func (*KeyPrint) XXX_Marshal

func (m *KeyPrint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*KeyPrint) XXX_Merge

func (m *KeyPrint) XXX_Merge(src proto.Message)

func (*KeyPrint) XXX_Size

func (m *KeyPrint) XXX_Size() int

func (*KeyPrint) XXX_Unmarshal

func (m *KeyPrint) XXX_Unmarshal(b []byte) error

type NodeCallback

type NodeCallback interface {
	OnDiscover(data []byte)
	OnLinking(data []byte)
}

NodeCallback is an interface with three methods: OnDiscover, OnLinking, and OnTopicMessage. @property OnDiscover - This is called when a node is discovered. The data is the data that was sent by the node. @property OnLinking - This is called when a node is linking to the gateway. @property OnTopicMessage - This is the callback that will be called when a message is received on a topic.

func DefaultCallback

func DefaultCallback() NodeCallback

It returns a pointer to a defaultCallback struct

type PeerInfo

type PeerInfo struct {
	Id        string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Name      string   `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	PeerId    string   `protobuf:"bytes,3,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"`
	Multiaddr string   `protobuf:"bytes,4,opt,name=multiaddr,proto3" json:"multiaddr,omitempty"`
	Type      PeerType `protobuf:"varint,5,opt,name=type,proto3,enum=sonrhq.common.v1.PeerType" json:"type,omitempty"`
}

Basic Info Sent to Peers to Establish Connections

func (*PeerInfo) Descriptor

func (*PeerInfo) Descriptor() ([]byte, []int)

func (*PeerInfo) GetId

func (m *PeerInfo) GetId() string

func (*PeerInfo) GetMultiaddr

func (m *PeerInfo) GetMultiaddr() string

func (*PeerInfo) GetName

func (m *PeerInfo) GetName() string

func (*PeerInfo) GetPeerId

func (m *PeerInfo) GetPeerId() string

func (*PeerInfo) GetType

func (m *PeerInfo) GetType() PeerType

func (*PeerInfo) Marshal

func (m *PeerInfo) Marshal() (dAtA []byte, err error)

func (*PeerInfo) MarshalTo

func (m *PeerInfo) MarshalTo(dAtA []byte) (int, error)

func (*PeerInfo) MarshalToSizedBuffer

func (m *PeerInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PeerInfo) ProtoMessage

func (*PeerInfo) ProtoMessage()

func (*PeerInfo) Reset

func (m *PeerInfo) Reset()

func (*PeerInfo) Size

func (m *PeerInfo) Size() (n int)

func (*PeerInfo) String

func (m *PeerInfo) String() string

func (*PeerInfo) Unmarshal

func (m *PeerInfo) Unmarshal(dAtA []byte) error

func (*PeerInfo) XXX_DiscardUnknown

func (m *PeerInfo) XXX_DiscardUnknown()

func (*PeerInfo) XXX_Marshal

func (m *PeerInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PeerInfo) XXX_Merge

func (m *PeerInfo) XXX_Merge(src proto.Message)

func (*PeerInfo) XXX_Size

func (m *PeerInfo) XXX_Size() int

func (*PeerInfo) XXX_Unmarshal

func (m *PeerInfo) XXX_Unmarshal(b []byte) error

type PeerType

type PeerType int32

Peers Active Type

const (
	PeerType_UNKNOWN     PeerType = 0
	PeerType_HIGHWAY     PeerType = 1
	PeerType_MOTOR       PeerType = 2
	PeerType_VALIDATOR   PeerType = 3
	PeerType_THIRD_PARTY PeerType = 4
)

func (PeerType) EnumDescriptor

func (PeerType) EnumDescriptor() ([]byte, []int)

func (PeerType) String

func (x PeerType) String() string

type WebauthnAuthenticator

type WebauthnAuthenticator struct {
	// The AAGUID of the authenticator. An AAGUID is defined as an array containing the globally unique
	// identifier of the authenticator model being sought.
	Aaguid []byte `protobuf:"bytes,1,opt,name=aaguid,proto3" json:"aaguid,omitempty"`
	// SignCount -Upon a new login operation, the Relying Party compares the stored signature counter value
	// with the new signCount value returned in the assertion’s authenticator data. If this new
	// signCount value is less than or equal to the stored value, a cloned authenticator may
	// exist, or the authenticator may be malfunctioning.
	SignCount uint32 `protobuf:"varint,2,opt,name=sign_count,json=signCount,proto3" json:"sign_count,omitempty"`
	// CloneWarning - This is a signal that the authenticator may be cloned, i.e. at least two copies of the
	// credential private key may exist and are being used in parallel. Relying Parties should incorporate
	// this information into their risk scoring. Whether the Relying Party updates the stored signature
	// counter value in this case, or not, or fails the authentication ceremony or not, is Relying Party-specific.
	CloneWarning bool `protobuf:"varint,3,opt,name=clone_warning,json=cloneWarning,proto3" json:"clone_warning,omitempty"`
}

WebauthnAuthenticator contains certificate information about a WebAuthn authenticator

func (*WebauthnAuthenticator) Descriptor

func (*WebauthnAuthenticator) Descriptor() ([]byte, []int)

func (*WebauthnAuthenticator) GetAaguid

func (m *WebauthnAuthenticator) GetAaguid() []byte

func (*WebauthnAuthenticator) GetCloneWarning

func (m *WebauthnAuthenticator) GetCloneWarning() bool

func (*WebauthnAuthenticator) GetSignCount

func (m *WebauthnAuthenticator) GetSignCount() uint32

func (*WebauthnAuthenticator) Marshal

func (m *WebauthnAuthenticator) Marshal() (dAtA []byte, err error)

func (*WebauthnAuthenticator) MarshalTo

func (m *WebauthnAuthenticator) MarshalTo(dAtA []byte) (int, error)

func (*WebauthnAuthenticator) MarshalToSizedBuffer

func (m *WebauthnAuthenticator) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*WebauthnAuthenticator) ProtoMessage

func (*WebauthnAuthenticator) ProtoMessage()

func (*WebauthnAuthenticator) Reset

func (m *WebauthnAuthenticator) Reset()

func (*WebauthnAuthenticator) Size

func (m *WebauthnAuthenticator) Size() (n int)

func (*WebauthnAuthenticator) String

func (m *WebauthnAuthenticator) String() string

func (*WebauthnAuthenticator) Unmarshal

func (m *WebauthnAuthenticator) Unmarshal(dAtA []byte) error

func (*WebauthnAuthenticator) UpdateCounter

func (a *WebauthnAuthenticator) UpdateCounter(authDataCount uint32)

VerifyCounter Step 17 of §7.2. about verifying attestation. If the signature counter value authData.signCount is nonzero or the value stored in conjunction with credential’s id attribute is nonzero, then run the following sub-step:

If the signature counter value authData.signCount is

→ Greater than the signature counter value stored in conjunction with credential’s id attribute.
Update the stored signature counter value, associated with credential’s id attribute, to be the value of
authData.signCount.

→ Less than or equal to the signature counter value stored in conjunction with credential’s id attribute.
This is a signal that the authenticator may be cloned, see CloneWarning above for more information.

func (*WebauthnAuthenticator) XXX_DiscardUnknown

func (m *WebauthnAuthenticator) XXX_DiscardUnknown()

func (*WebauthnAuthenticator) XXX_Marshal

func (m *WebauthnAuthenticator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*WebauthnAuthenticator) XXX_Merge

func (m *WebauthnAuthenticator) XXX_Merge(src proto.Message)

func (*WebauthnAuthenticator) XXX_Size

func (m *WebauthnAuthenticator) XXX_Size() int

func (*WebauthnAuthenticator) XXX_Unmarshal

func (m *WebauthnAuthenticator) XXX_Unmarshal(b []byte) error

type WebauthnCredential

type WebauthnCredential struct {
	// A probabilistically-unique byte sequence identifying a public key credential source and its authentication assertions.
	Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// The public key portion of a Relying Party-specific credential key pair, generated by an authenticator and returned to
	// a Relying Party at registration time (see also public key credential). The private key portion of the credential key
	// pair is known as the credential private key. Note that in the case of self attestation, the credential key pair is also
	// used as the attestation key pair, see self attestation for details.
	PublicKey []byte `protobuf:"bytes,2,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
	// The attestation format used (if any) by the authenticator when creating the credential.
	AttestationType string `protobuf:"bytes,3,opt,name=attestation_type,json=attestationType,proto3" json:"attestation_type,omitempty"`
	// The transports used by the authenticator when creating the credential.
	Transport []string `protobuf:"bytes,4,rep,name=transport,proto3" json:"transport,omitempty"`
	// The Authenticator information for a given certificate
	Authenticator *WebauthnAuthenticator `protobuf:"bytes,5,opt,name=authenticator,proto3" json:"authenticator,omitempty"`
}

WebauthnCredential contains all needed information about a WebAuthn credential for storage

func ConvertStdCredential

func ConvertStdCredential(wa *webauthn.Credential) *WebauthnCredential

ConvertStdCredential creates a common.WebauthnCredential from a webauthn.Credential from the go-webauthn package

func NewWebAuthnCredential

func NewWebAuthnCredential(c *protocol.ParsedCredentialCreationData) *WebauthnCredential

NewWebAuthnCredential creates a new WebauthnCredential from a ParsedCredentialCreationData and contains all needed information about a WebAuthn credential for storage. This is then used to create a VerificationMethod for the DID Document.

func (*WebauthnCredential) Descriptor

func (*WebauthnCredential) Descriptor() ([]byte, []int)

func (*WebauthnCredential) Did

func (c *WebauthnCredential) Did() string

func (*WebauthnCredential) GetAttestationType

func (m *WebauthnCredential) GetAttestationType() string

func (*WebauthnCredential) GetAuthenticator

func (m *WebauthnCredential) GetAuthenticator() *WebauthnAuthenticator

func (*WebauthnCredential) GetId

func (m *WebauthnCredential) GetId() []byte

func (*WebauthnCredential) GetPublicKey

func (m *WebauthnCredential) GetPublicKey() []byte

func (*WebauthnCredential) GetTransport

func (m *WebauthnCredential) GetTransport() []string

func (*WebauthnCredential) Marshal

func (m *WebauthnCredential) Marshal() (dAtA []byte, err error)

func (*WebauthnCredential) MarshalTo

func (m *WebauthnCredential) MarshalTo(dAtA []byte) (int, error)

func (*WebauthnCredential) MarshalToSizedBuffer

func (m *WebauthnCredential) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*WebauthnCredential) ProtoMessage

func (*WebauthnCredential) ProtoMessage()

func (*WebauthnCredential) PublicKeyMultibase

func (c *WebauthnCredential) PublicKeyMultibase() string

func (*WebauthnCredential) Reset

func (m *WebauthnCredential) Reset()

func (*WebauthnCredential) Size

func (m *WebauthnCredential) Size() (n int)

func (*WebauthnCredential) String

func (m *WebauthnCredential) String() string

func (*WebauthnCredential) ToMetadata

func (c *WebauthnCredential) ToMetadata() map[string]string

ToMetadata converts a common WebauthnCredential into a map[string]string

func (*WebauthnCredential) ToStdCredential

func (c *WebauthnCredential) ToStdCredential() *webauthn.Credential

ToStdCredential converts a common WebauthnCredential to one that can be used for the go-webauthn package

func (*WebauthnCredential) Unmarshal

func (m *WebauthnCredential) Unmarshal(dAtA []byte) error

func (*WebauthnCredential) Validate

func (c *WebauthnCredential) Validate(pc *webauthn.Credential) error

Validate verifies that this WebauthnCredential is identical to the go-webauthn package credential

func (*WebauthnCredential) XXX_DiscardUnknown

func (m *WebauthnCredential) XXX_DiscardUnknown()

func (*WebauthnCredential) XXX_Marshal

func (m *WebauthnCredential) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*WebauthnCredential) XXX_Merge

func (m *WebauthnCredential) XXX_Merge(src proto.Message)

func (*WebauthnCredential) XXX_Size

func (m *WebauthnCredential) XXX_Size() int

func (*WebauthnCredential) XXX_Unmarshal

func (m *WebauthnCredential) XXX_Unmarshal(b []byte) error

Directories

Path Synopsis
It converts a `WebauthnCredential` to a `webauthn.Credential`
It converts a `WebauthnCredential` to a `webauthn.Credential`
jwt
jwx

Jump to

Keyboard shortcuts

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