mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 13:07:09 +00:00
* feat: add docs and CI workflow for publishing to onsonr.dev * (refactor): Move hway,motr executables to their own repos * feat: simplify devnet and testnet configurations * refactor: update import path for didcrypto package * docs(networks): Add README with project overview, architecture, and community links * refactor: Move network configurations to deploy directory * build: update golang version to 1.23 * refactor: move logger interface to appropriate package * refactor: Move devnet configuration to networks/devnet * chore: improve release process with date variable * (chore): Move Crypto Library * refactor: improve code structure and readability in DID module * feat: integrate Trunk CI checks * ci: optimize CI workflow by removing redundant build jobs --------- Co-authored-by: Darp Alakun <i@prad.nu>
80 lines
1.8 KiB
Go
Executable File
80 lines
1.8 KiB
Go
Executable File
//
|
|
// Copyright Coinbase, Inc. All Rights Reserved.
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
package common
|
|
|
|
import (
|
|
"io"
|
|
|
|
"github.com/onsonr/sonr/crypto/core/curves"
|
|
)
|
|
|
|
// ProofMessage classifies how a message is presented in a proof
|
|
// Either Revealed or Hidden. Hidden has two sub categories:
|
|
// proof specific i.e. the message is only used for this proof or
|
|
// shared i.e. the message should be proved to be common across proofs
|
|
type ProofMessage interface {
|
|
// IsHidden indicates the message should be hidden
|
|
IsHidden() bool
|
|
// GetBlinding is used for hidden messages
|
|
// blindings can either be proof specific to a signature
|
|
// or involved with other proofs like boundchecks,
|
|
// set memberships, or inequalities so the blinding
|
|
// factor is shared among proofs to produce a common
|
|
// schnorr linking proof
|
|
GetBlinding(reader io.Reader) curves.Scalar
|
|
// GetMessage returns the underlying message
|
|
GetMessage() curves.Scalar
|
|
}
|
|
|
|
type RevealedMessage struct {
|
|
Message curves.Scalar
|
|
}
|
|
|
|
func (r RevealedMessage) IsHidden() bool {
|
|
return false
|
|
}
|
|
|
|
func (r RevealedMessage) GetBlinding(reader io.Reader) curves.Scalar {
|
|
return nil
|
|
}
|
|
|
|
func (r RevealedMessage) GetMessage() curves.Scalar {
|
|
return r.Message
|
|
}
|
|
|
|
type ProofSpecificMessage struct {
|
|
Message curves.Scalar
|
|
}
|
|
|
|
func (ps ProofSpecificMessage) IsHidden() bool {
|
|
return true
|
|
}
|
|
|
|
func (ps ProofSpecificMessage) GetBlinding(reader io.Reader) curves.Scalar {
|
|
return ps.Message.Random(reader)
|
|
}
|
|
|
|
func (ps ProofSpecificMessage) GetMessage() curves.Scalar {
|
|
return ps.Message
|
|
}
|
|
|
|
type SharedBlindingMessage struct {
|
|
Message, Blinding curves.Scalar
|
|
}
|
|
|
|
func (ps SharedBlindingMessage) IsHidden() bool {
|
|
return true
|
|
}
|
|
|
|
func (ps SharedBlindingMessage) GetBlinding(reader io.Reader) curves.Scalar {
|
|
return ps.Blinding
|
|
}
|
|
|
|
func (ps SharedBlindingMessage) GetMessage() curves.Scalar {
|
|
return ps.Message
|
|
}
|