-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutil.go
51 lines (46 loc) · 1.09 KB
/
util.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
/*
#include <stdlib.h>
#ifndef RESPONSE_H
#define RESPONSE_H
#include "response.h"
#endif
*/
import "C"
import "github.com/AxLabs/neofs-api-shared-lib/client"
//func GetECDSAPrivKey(key *C.char) *ecdsa.PrivateKey {
// keyStr := C.GoString(key)
// bytes, _ := hex.DecodeString(keyStr)
// k := new(big.Int)
// k.SetBytes(bytes)
// priv := new(ecdsa.PrivateKey)
// curve := elliptic.P256()
// priv.PublicKey.Curve = curve
// priv.D = k
// priv.PublicKey.X, priv.PublicKey.Y = curve.ScalarBaseMult(k.Bytes())
// return priv
//}
//func UserIDFromPublicKey(publicKey *C.char) (*user.ID, error) {
// pubKey, err := keys.NewPublicKeyFromString(C.GoString(publicKey))
// if err != nil {
// return nil, err
// }
// var id user.ID
// uint160, err := address.StringToUint160(pubKey.Address())
// if err != nil {
// return nil, err
// }
// id.SetScriptHash(uint160)
// return &id, nil
//}
func GetClient(clientID *C.char) (*client.NeoFSClient, error) {
id, err := uuidToGo(clientID)
if err != nil {
return nil, err
}
c, err := client.GetClient(id)
if err != nil {
return nil, err
}
return c, nil
}