Documentation
¶
Index ¶
- Constants
- Variables
- func ApprovalPayload(approval Approval) string
- func Challenge(publicKey, r Point, message []byte) (*big.Int, error)
- func ChallengeHex(publicKey, r Point, message []byte) (string, error)
- func CombineSignatureShares(shares []ShareProof) (string, error)
- func CommitmentsHash(commitments []PublicCommitment) (string, error)
- func CurveOrder() *big.Int
- func DecodePoint(point Point) (*big.Int, *big.Int, bool)
- func DecodeScalar(value string) (*big.Int, bool)
- func DecryptFragment(privateKey *ecdh.PrivateKey, fragment EncryptedFragment) ([]byte, error)
- func EncodeScalar(value *big.Int) string
- func EvalPolynomial(coefficients []*big.Int, x *big.Int) *big.Int
- func EvaluateCommitment(coefficients []Point, partyID int) (*big.Int, *big.Int, bool)
- func FragmentAttestationPayload(attestation FragmentAttestation) string
- func FragmentEnvelopeHash(fragment EncryptedFragment) (string, error)
- func GeneratePolynomial(threshold int) ([]*big.Int, error)
- func LagrangeCoefficientAtZero(partyID int, participants []int) (*big.Int, error)
- func MessageHash(message []byte) string
- func NormalizeParticipants(participants []int, threshold int, partyIDs []int) ([]int, error)
- func PadScalar(value *big.Int) []byte
- func RandomScalar() (*big.Int, error)
- func SignShare(localShare, nonce, challenge *big.Int, partyID int, participants []int) (*big.Int, error)
- func Verify(message []byte, publicKey Point, sig *Signature) bool
- func VerifyApproval(publicKey string, approval Approval, now time.Time) bool
- func VerifyFragmentAttestation(publicKey string, attestation FragmentAttestation) bool
- func VerifyPolynomialShare(shareHex string, recipientID int, commitment PublicCommitment) bool
- func ZeroScalars(values []*big.Int)
- type Approval
- type Commitment
- type EncryptedFragment
- type FragmentAttestation
- type KeyMeta
- type PartyInfo
- type Point
- func AddEncodedPoints(points []Point) (Point, error)
- func AggregateCommitments(commitments []Commitment) (Point, error)
- func CombinePublicKey(commitments []PublicCommitment) (Point, error)
- func PublicShareCommitment(commitments []PublicCommitment, partyID int) (Point, error)
- func ScalarBasePoint(value *big.Int) Point
- type Provider
- type ProviderInfo
- type ProviderStatus
- type PublicCommitment
- type PublicKey
- type ShareProof
- type Signature
- type SignerIdentity
Constants ¶
View Source
const ( AlgorithmExperimentalP256Schnorr = "experimental-p256-schnorr-v1" AlgorithmFROSTSecp256k1 = "frost-secp256k1-v1" )
View Source
const (
CurveName = "P-256"
)
View Source
const FragmentEnvelope = "ecdh-p256-aes-256-gcm-v1"
Variables ¶
View Source
var ( ErrInvalidKey = errors.New("invalid key") ErrInvalidParticipants = errors.New("invalid participants") )
Functions ¶
func ApprovalPayload ¶
func CombineSignatureShares ¶
func CombineSignatureShares(shares []ShareProof) (string, error)
func CommitmentsHash ¶
func CommitmentsHash(commitments []PublicCommitment) (string, error)
func CurveOrder ¶
func DecryptFragment ¶
func DecryptFragment(privateKey *ecdh.PrivateKey, fragment EncryptedFragment) ([]byte, error)
func EncodeScalar ¶
func EvaluateCommitment ¶
func FragmentAttestationPayload ¶
func FragmentAttestationPayload(attestation FragmentAttestation) string
func FragmentEnvelopeHash ¶
func FragmentEnvelopeHash(fragment EncryptedFragment) (string, error)
func MessageHash ¶
func NormalizeParticipants ¶
func RandomScalar ¶
func VerifyFragmentAttestation ¶
func VerifyFragmentAttestation(publicKey string, attestation FragmentAttestation) bool
func VerifyPolynomialShare ¶
func VerifyPolynomialShare(shareHex string, recipientID int, commitment PublicCommitment) bool
func ZeroScalars ¶
Types ¶
type Approval ¶
type Approval struct {
VaultID string `json:"vault_id"`
SessionID string `json:"session_id"`
KeyID string `json:"key_id"`
PartyID int `json:"party_id"`
Threshold int `json:"threshold"`
Participants []int `json:"participants"`
MessageHash string `json:"message_hash"`
MessageType string `json:"message_type,omitempty"`
Chain string `json:"chain,omitempty"`
Network string `json:"network,omitempty"`
TransactionDigest string `json:"transaction_digest,omitempty"`
ExpiresAt time.Time `json:"expires_at"`
Signature string `json:"signature"`
}
func SignApproval ¶
func SignApproval(privateKey ed25519.PrivateKey, approval Approval) (Approval, error)
type Commitment ¶
type EncryptedFragment ¶
type EncryptedFragment struct {
KeyID string `json:"key_id"`
PartyID int `json:"party_id"`
Algorithm string `json:"algorithm"`
EphemeralPublicKey string `json:"ephemeral_public_key"`
Nonce string `json:"nonce"`
Ciphertext string `json:"ciphertext"`
Attestation *FragmentAttestation `json:"attestation,omitempty"`
}
func EncryptFragment ¶
type FragmentAttestation ¶
type FragmentAttestation struct {
VaultID string `json:"vault_id"`
DKGSessionID string `json:"dkg_session_id"`
KeyID string `json:"key_id"`
PartyID int `json:"party_id"`
CommitmentsHash string `json:"commitments_hash"`
FragmentEnvelopeHash string `json:"fragment_envelope_hash"`
ApprovalPublicKey string `json:"approval_public_key"`
CreatedAt time.Time `json:"created_at"`
Signature string `json:"signature"`
}
func SignFragmentAttestation ¶
func SignFragmentAttestation(privateKey ed25519.PrivateKey, attestation FragmentAttestation) (FragmentAttestation, error)
type KeyMeta ¶
type KeyMeta struct {
ID string
CreatedAt time.Time
Threshold int
Parties []PartyInfo
PublicKey Point
Commitments []PublicCommitment
}
func NewKeyMeta ¶
func (*KeyMeta) NormalizeParticipants ¶
type Point ¶
func AddEncodedPoints ¶
func AggregateCommitments ¶
func AggregateCommitments(commitments []Commitment) (Point, error)
func CombinePublicKey ¶
func CombinePublicKey(commitments []PublicCommitment) (Point, error)
func PublicShareCommitment ¶
func PublicShareCommitment(commitments []PublicCommitment, partyID int) (Point, error)
func ScalarBasePoint ¶
type Provider ¶
type Provider interface {
Info() ProviderInfo
NewKeyMeta(id string, threshold int, parties []PartyInfo, commitments []PublicCommitment) (*KeyMeta, error)
AggregateCommitments(commitments []Commitment) (Point, error)
ChallengeHex(publicKey, r Point, message []byte) (string, error)
Verify(message []byte, publicKey Point, sig *Signature) bool
ValidateKeyFragments(keyID string, parties []PartyInfo, commitments []PublicCommitment, fragments []EncryptedFragment) error
}
func GetProvider ¶
type ProviderInfo ¶
type ProviderInfo struct {
Algorithm string `json:"algorithm"`
Curve string `json:"curve"`
Status ProviderStatus `json:"status"`
Domain string `json:"domain"`
ProductionReady bool `json:"production_ready"`
SupportsKeygen bool `json:"supports_keygen"`
SupportsSigning bool `json:"supports_signing"`
SupportsRecoveryImportAttestations bool `json:"supports_recovery_import_attestations"`
DeterministicTranscriptValidation bool `json:"deterministic_transcript_validation"`
ChainCompatibility []string `json:"chain_compatibility,omitempty"`
}
func SupportedProviders ¶
func SupportedProviders() []ProviderInfo
type ProviderStatus ¶
type ProviderStatus string
const ( ProviderStatusExperimental ProviderStatus = "experimental" ProviderStatusProduction ProviderStatus = "production" )
type PublicCommitment ¶
type PublicCommitment struct {
PartyID int `json:"partyId"`
Coefficients []Point `json:"coefficients"`
}
func CommitmentsForPolynomial ¶
func CommitmentsForPolynomial(partyID int, coefficients []*big.Int) PublicCommitment
type ShareProof ¶
type ShareProof struct {
}
type Signature ¶
type Signature struct {
Curve string `json:"curve"`
R Point `json:"r"`
Z string `json:"z"`
Challenge string `json:"challenge"`
Commitments []Commitment `json:"commitments"`
}
type SignerIdentity ¶
type SignerIdentity struct {
PartyID int `json:"party_id"`
Name string `json:"name,omitempty"`
URL string `json:"url,omitempty"`
EncryptionPublicKey string `json:"encryption_public_key"`
ApprovalPublicKey string `json:"approval_public_key"`
}
func GenerateSignerIdentity ¶
func GenerateSignerIdentity(partyID int, name, url string) (*ecdh.PrivateKey, ed25519.PrivateKey, SignerIdentity, error)
Click to show internal directories.
Click to hide internal directories.