mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-04 18:31:41 +00:00
(no commit message provided)
This commit is contained in:
committed by
Prad Nukala (aider)
parent
5fd43dfd6b
commit
2f976209db
@@ -1,42 +0,0 @@
|
||||
//
|
||||
// Copyright Coinbase, Inc. All Rights Reserved.
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
package mina
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/onsonr/hway/crypto/core/curves"
|
||||
)
|
||||
|
||||
type MinaTSchnorrHandler struct{}
|
||||
|
||||
func (m MinaTSchnorrHandler) DeriveChallenge(msg []byte, pubKey curves.Point, r curves.Point) (curves.Scalar, error) {
|
||||
txn := new(Transaction)
|
||||
err := txn.UnmarshalBinary(msg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
input := new(roinput).Init(3, 75)
|
||||
txn.addRoInput(input)
|
||||
|
||||
pt, ok := pubKey.(*curves.PointPallas)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("invalid point")
|
||||
}
|
||||
R, ok := r.(*curves.PointPallas)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("invalid point")
|
||||
}
|
||||
|
||||
pk := new(PublicKey)
|
||||
pk.value = pt.GetEp()
|
||||
|
||||
sc := msgHash(pk, R.X(), input, ThreeW, MainNet)
|
||||
s := new(curves.ScalarPallas)
|
||||
s.SetFq(sc)
|
||||
return s, nil
|
||||
}
|
||||
Reference in New Issue
Block a user