Documentation ¶
Index ¶
- Variables
- func AesDecryptWithKey(aesKey, ciphertext []byte) ([]byte, error)
- func AesDecryptWithPassword(password string, ciphertext []byte) ([]byte, error)
- func AesEncryptWithKey(aesKey, plaintext []byte) ([]byte, error)
- func AesEncryptWithPassword(password string, plaintext []byte) ([]byte, error)
- func DecodePublicKey(coseKey *COSEKey) (crypto.PublicKey, error)
- func NewAesKey() ([]byte, error)
- func SerializeSignature(sig *ecdsa.Signature) ([]byte, error)
- func SignatureFromBytes(sigStr []byte) (*ecdsa.Signature, error)
- func VerifySignature(rawKey cbor.RawMessage, message, sig []byte) error
- type COSEAlgorithmIdentifier
- type COSEEllipticCurve
- type COSEKey
- type COSEKeyType
- type Error
- type Network
- type Wallet
- func (w *Wallet) Address(id ...party.ID) (string, error)
- func (w *Wallet) Config() *cmp.Config
- func (w *Wallet) CreateInitialShards() (dscShard, pskShard, recShard []byte, unused [][]byte, err error)
- func (w *Wallet) GetSigners() party.IDSlice
- func (w *Wallet) Marshal() ([]byte, error)
- func (w *Wallet) PublicKey() ([]byte, error)
- func (w *Wallet) PublicKeyBase58() (string, error)
- func (w *Wallet) PublicKeyProto() (*secp256k1.PubKey, error)
- func (w *Wallet) Refresh(pl *pool.Pool) (*cmp.Config, error)
- func (w *Wallet) Sign(m []byte) (*ecdsa.Signature, error)
- func (w *Wallet) Unmarshal(buf []byte) error
- func (w *Wallet) Verify(m []byte, sig []byte) bool
- type WalletOption
Constants ¶
This section is empty.
Variables ¶
var ( ErrDecodeAttestedCredentialData = Error{/* contains filtered or unexported fields */} ErrDecodeAuthenticatorData = Error{/* contains filtered or unexported fields */} ErrDecodeCOSEKey = Error{/* contains filtered or unexported fields */} ErrECDAANotSupported = Error{/* contains filtered or unexported fields */} ErrEncodeAttestedCredentialData = Error{/* contains filtered or unexported fields */} ErrEncodeAuthenticatorData = Error{/* contains filtered or unexported fields */} ErrGenerateChallenge = Error{/* contains filtered or unexported fields */} ErrMarshalAttestationObject = Error{/* contains filtered or unexported fields */} ErrOption = Error{/* contains filtered or unexported fields */} ErrNotImplemented = Error{/* contains filtered or unexported fields */} ErrUnmarshalAttestationObject = Error{/* contains filtered or unexported fields */} ErrVerifyAttestation = Error{/* contains filtered or unexported fields */} ErrVerifyAuthentication = Error{/* contains filtered or unexported fields */} ErrVerifyClientExtensionOutput = Error{/* contains filtered or unexported fields */} ErrVerifyRegistration = Error{/* contains filtered or unexported fields */} ErrVerifySignature = Error{/* contains filtered or unexported fields */} )
Categorical top-level errors
Functions ¶
func AesDecryptWithKey ¶
AesDecryptWithKey uses the give 32-bit key to decrypt plaintext.
func AesDecryptWithPassword ¶
AesDecryptWithPassword uses the give password to generate an aes key and encrypt plaintext.
func AesEncryptWithKey ¶
AesEncryptWithKey uses the give 32-bit key to encrypt plaintext.
func AesEncryptWithPassword ¶
AesEncryptWithPassword uses the give password to generate an aes key and decrypt plaintext.
func DecodePublicKey ¶
DecodePublicKey parses a crypto.PublicKey from a COSEKey
func SerializeSignature ¶
SerializeSignature marshals an ECDSA signature to DER format for use with the CMP protocol
func SignatureFromBytes ¶
- The R and S values must be in the valid range for secp256k1 scalars:
- Negative values are rejected
- Zero is rejected
- Values greater than or equal to the secp256k1 group order are rejected
func VerifySignature ¶
VerifySignature verifies a signature using a provided COSEKey, message, and signature
Types ¶
type COSEAlgorithmIdentifier ¶
type COSEAlgorithmIdentifier int
COSEAlgorithmIdentifier is a number identifying a cryptographic algorithm
const ( AlgorithmRS1 COSEAlgorithmIdentifier = -65535 AlgorithmRS512 COSEAlgorithmIdentifier = -259 AlgorithmRS384 COSEAlgorithmIdentifier = -258 AlgorithmRS256 COSEAlgorithmIdentifier = -257 AlgorithmPS512 COSEAlgorithmIdentifier = -39 AlgorithmPS384 COSEAlgorithmIdentifier = -38 AlgorithmPS256 COSEAlgorithmIdentifier = -37 AlgorithmES512 COSEAlgorithmIdentifier = -36 AlgorithmES384 COSEAlgorithmIdentifier = -35 AlgorithmEdDSA COSEAlgorithmIdentifier = -8 AlgorithmES256 COSEAlgorithmIdentifier = -7 )
enum values for COSEAlgorithmIdentifier type
type COSEEllipticCurve ¶
type COSEEllipticCurve int
COSEEllipticCurve is a number identifying an elliptic curve
const ( CurveP256 COSEEllipticCurve = 1 CurveP384 COSEEllipticCurve = 2 CurveP521 COSEEllipticCurve = 3 )
enum values for COSEEllipticCurve type
type COSEKey ¶
type COSEKey struct { Kty int `cbor:"1,keyasint,omitempty"` Kid []byte `cbor:"2,keyasint,omitempty"` Alg int `cbor:"3,keyasint,omitempty"` KeyOpts int `cbor:"4,keyasint,omitempty"` IV []byte `cbor:"5,keyasint,omitempty"` CrvOrNOrK cbor.RawMessage `cbor:"-1,keyasint,omitempty"` // K for symmetric keys, Crv for elliptic curve keys, N for RSA modulus XOrE cbor.RawMessage `cbor:"-2,keyasint,omitempty"` // X for curve x-coordinate, E for RSA public exponent Y cbor.RawMessage `cbor:"-3,keyasint,omitempty"` // Y for curve y-cooridate D []byte `cbor:"-4,keyasint,omitempty"` }
COSEKey represents a key decoded from COSE format.
type COSEKeyType ¶
type COSEKeyType int
COSEKeyType is a number identifying a key type
const ( KeyTypeOKP COSEKeyType = 1 KeyTypeEC2 COSEKeyType = 2 KeyTypeRSA COSEKeyType = 3 )
enum values for COSEKeyType type
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error represents an error in a WebAuthn relying party operation
type Network ¶
type Network struct {
// contains filtered or unexported fields
}
Network simulates a point-to-point network between different parties using Go channels. The same network is used by all processes, and can be reused for different protocols. When used with test.Handler, no interaction from the user is required beyond creating the network.
func NewNetwork ¶
type Wallet ¶
type Wallet struct { ID party.ID PubKey []byte Configs map[party.ID]*cmp.Config ConfigsLock sync.Mutex Network *Network Threshold int // contains filtered or unexported fields }
func GenerateWallet ¶
func GenerateWallet(cb common.MotorCallback, options ...WalletOption) (*Wallet, error)
GenerateWallet a new ECDSA private key shared among all the given participants.
func (*Wallet) CreateInitialShards ¶
func (*Wallet) GetSigners ¶
GetSigners returns the list of signers for the given message.
func (*Wallet) PublicKeyBase58 ¶
Returns the ECDSA public key of the given party.
type WalletOption ¶
type WalletOption func(*walletConfig)
WalletOption is a function that applies a configuration option to a walletConfig
func WithBase58PubKey ¶ added in v0.6.0
func WithBase58PubKey(key string) WalletOption
func WithConfigs ¶
func WithConfigs(cnfs map[party.ID]*cmp.Config) WalletOption
WithConfigs sets the configs used for the MPC wallet
func WithParticipants ¶
func WithParticipants(participants ...party.ID) WalletOption
WithParticipants adds a list of participants to the wallet
func WithThreshold ¶
func WithThreshold(threshold int) WalletOption
WithThreshold sets the threshold of the MPC wallet