Documentation ¶
Index ¶
- Constants
- Variables
- func AddressInArray(addr string, allowed []string) bool
- func BTCVerifySig(address, pubkey, sigHex string, msg []byte) bool
- func DecryptMsg(ecdsaPrivkey *ecdsa.PrivateKey, msg []byte) ([]byte, error)
- func ETHVerifySig(from, sigHex string, msg []byte) bool
- func EncodeVarint(x uint64) []byte
- func EncryptWithDIDPubkey(msg []byte, didpubkey []byte) ([]byte, error)
- func EthSignHash(data []byte) []byte
- func FormatMessageForSigning(msg []byte) []byte
- func GetChainFromDID(did string) (string, error)
- func IntToBytes(n int) []byte
- func KlayVerifySig(address, publickey, sigHex string, msg []byte) bool
- func NEOVerifySig(address, pubkey, sigHex string, msg []byte) bool
- func ONTVerifySig(address, pubkey, sigHex string, msg []byte) bool
- func OpenAccount(path string, pwd string, addr string, ontSdk *ontology_go_sdk.OntologySdk) (*ontology_go_sdk.Account, error)
- func PrivateKeyToEcdsaPrivkey(data []byte) (*ecdsa.PrivateKey, error)
- func TronSignHash(data []byte) []byte
- func UnmarshalPubkey(data []byte) (*ecdsa.PublicKey, error)
- func VerifyDIDSigs(chain, address, did, sig, pubkey string) bool
- func VerifyJSonSchema(jschema, jsonstr string) (bool, error)
Constants ¶
View Source
const ( PUBLISHED = "published" UNSUBMIT = "unsubmit" DRAFT = "draft" FAILED = "failed" VERIFYING = "verifying" REVOKING = "revoking" DP_LABELS = "DP" AP_LABELS = "AP" )
View Source
const ( BTC_CHAIN = "btc" ETH_CHAIN = "eth" ONT_CHAIN = "ont" TRON_CHAIN = "trx" DOT_CHAIN = "dot" KLAY_CHAIN = "klay" NEO_CHAIN = "neo" )
Variables ¶
View Source
var BITCOIN_SIGNED_MESSAGE_HEADER = "Bitcoin Signed Message:\n"
Functions ¶
func AddressInArray ¶
func BTCVerifySig ¶
todo currently , only support btc address from onto
func DecryptMsg ¶
func DecryptMsg(ecdsaPrivkey *ecdsa.PrivateKey, msg []byte) ([]byte, error)
func ETHVerifySig ¶
func EncodeVarint ¶
func EthSignHash ¶
func FormatMessageForSigning ¶
func GetChainFromDID ¶
func IntToBytes ¶
func KlayVerifySig ¶
func TRONVerifySig(address, publickey, sigHex string, msg []byte) bool {
sig := hexutil.MustDecode(sigHex) // https://github.com/ethereum/go-ethereum/blob/55599ee95d4151a2502465e0afc7c47bd1acba77/internal/ethapi/api.go#L442 if sig[64] != 27 && sig[64] != 28 { return false } sig[64] -= 27 pubKey, err := crypto.SigToPub(TronSignHash(msg), sig) if err != nil { return false } addr := tron.PubkeyToAddress(*pubKey) return strings.EqualFold(addr.String(), address) }
func NEOVerifySig ¶
func ONTVerifySig ¶
func OpenAccount ¶
func OpenAccount(path string, pwd string, addr string, ontSdk *ontology_go_sdk.OntologySdk) (*ontology_go_sdk.Account, error)
func PrivateKeyToEcdsaPrivkey ¶
func PrivateKeyToEcdsaPrivkey(data []byte) (*ecdsa.PrivateKey, error)
func TronSignHash ¶
func VerifyDIDSigs ¶
func VerifyJSonSchema ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.