git.frostfs.info/TrueCloudLab/frostfs-sdk-go@v0.0.0-20241022124111-5361f0ecebd3/user/doc.go (about) 1 /* 2 Package user provides functionality related to FrostFS users. 3 4 User identity is reflected in ID type. Each user has its own unique identifier 5 within the same network. 6 7 FrostFS user identification is compatible with Neo accounts: 8 9 import "github.com/nspcc-dev/neo-go/pkg/crypto/keys" 10 import "github.com/nspcc-dev/neo-go/pkg/crypto/hash" 11 12 var id user.ID 13 14 var scriptHash util.Uint160 // user account in FrostFS 15 id.SetScriptHash(scriptHash) 16 17 var key keys.PublicKey // user's public key 18 user.IDFromKey(&id, k.PrivateKey.PublicKey) 19 20 ID is compatible with the FrostFS Smart Contract API: 21 22 var id user.ID 23 // ... 24 25 wallet := id.WalletBytes() 26 27 // use wallet in call 28 29 Encoding/decoding mechanisms are used to transfer identifiers: 30 31 var id user.ID 32 // ... 33 34 s := id.EncodeToString() // on transmitter 35 err = id.DecodeString(s) // on receiver 36 37 Instances can be also used to process FrostFS API protocol messages 38 (see neo.fs.v2.refs package in https://git.frostfs.info/TrueCloudLab/frostfs-api). 39 40 On client side: 41 42 import "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" 43 44 var msg refs.OwnerID 45 id.WriteToV2(&msg) 46 47 // send msg 48 49 On server side: 50 51 // recv msg 52 53 var id user.ID 54 55 err := id.ReadFromV2(msg) 56 // ... 57 58 // process id 59 */ 60 package user