crypto

package
v4.0.0-rc.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthCrypto        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCrypto          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupCrypto = fmt.Errorf("proto: unexpected end of group")
)

Functions

func MarshalAuthnPubKey

func MarshalAuthnPubKey(pubKey *AuthnPubKey) ([]byte, error)

MarshalAuthnPubKey marshals the AuthnPubKey to bytes

Types

type AuthnPubKey

type AuthnPubKey struct {
	// The key_id (or credential ID) is a unique identifier for a passkey.
	// This ID is provided by the authenticator when the passkey is created.
	// As it is not possible to retrieve the public key from the authenticator
	// after the passkey is created, if the user loses the public key - id
	// association, the key_id can be used to retrieve the public key.
	KeyId string `protobuf:"bytes,1,opt,name=key_id,json=keyId,proto3" json:"key_id,omitempty"`
	// Store the COSE algorithm identifier. Since authn allows multiple different
	// public key credential algorithm, eg.
	// -7(ES256) - ECDSA with SHA-256 on the P-256 curve
	// -257(RS256) - RSASSA-PKCS1-v1_5 with SHA-256
	// we need to store the algorithm identifier to be able to verify the
	// signature according to the algorithm the public key is using.
	CoseAlgorithm int32 `protobuf:"varint,2,opt,name=cose_algorithm,json=coseAlgorithm,proto3" json:"cose_algorithm,omitempty"`
	// The public key bytes
	Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"`
}

PubKey defines an authn public key

func UnmarshalAuthnPubKey

func UnmarshalAuthnPubKey(bz []byte) (*AuthnPubKey, error)

UnmarshalAuthnPubKey unmarshals bytes to an AuthnPubKey

func (*AuthnPubKey) Address

func (pubKey *AuthnPubKey) Address() cryptotypes.Address

Address returns the address of the public key

func (*AuthnPubKey) Bytes

func (pubKey *AuthnPubKey) Bytes() []byte

Bytes returns the raw bytes of the public key

func (*AuthnPubKey) Descriptor

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

func (*AuthnPubKey) Equals

func (pubKey *AuthnPubKey) Equals(other cryptotypes.PubKey) bool

Equals checks if two public keys are equal

func (*AuthnPubKey) GetCoseAlgorithm

func (m *AuthnPubKey) GetCoseAlgorithm() int32

func (*AuthnPubKey) GetKey

func (m *AuthnPubKey) GetKey() []byte

func (*AuthnPubKey) GetKeyId

func (m *AuthnPubKey) GetKeyId() string

func (*AuthnPubKey) Marshal

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

func (*AuthnPubKey) MarshalTo

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

func (*AuthnPubKey) MarshalToSizedBuffer

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

func (*AuthnPubKey) ProtoMessage

func (*AuthnPubKey) ProtoMessage()

func (*AuthnPubKey) Reset

func (m *AuthnPubKey) Reset()

func (*AuthnPubKey) Size

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

func (*AuthnPubKey) String

func (pubKey *AuthnPubKey) String() string

String returns a string representation of the public key

func (*AuthnPubKey) Type

func (pubKey *AuthnPubKey) Type() string

Type returns the type of the public key

func (*AuthnPubKey) Unmarshal

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

func (*AuthnPubKey) VerifySignature

func (pubKey *AuthnPubKey) VerifySignature(msg []byte, sigBytes []byte) bool

VerifySignature verifies a signature over the given message

func (*AuthnPubKey) XXX_DiscardUnknown

func (m *AuthnPubKey) XXX_DiscardUnknown()

func (*AuthnPubKey) XXX_Marshal

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

func (*AuthnPubKey) XXX_Merge

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

func (*AuthnPubKey) XXX_Size

func (m *AuthnPubKey) XXX_Size() int

func (*AuthnPubKey) XXX_Unmarshal

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

type ClientData

type ClientData struct {
	Type      string `json:"type"`
	Challenge string `json:"challenge"`
	Origin    string `json:"origin"`
}

ClientData represents the WebAuthn client data

type Signature

type Signature struct {
	AuthenticatorData string `json:"authenticatorData"`
	ClientDataJSON    string `json:"clientDataJSON"`
	Signature         string `json:"signature"`
}

Signature represents the WebAuthn signature data

Jump to

Keyboard shortcuts

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