forked from TrueCloudLab/frostfs-sdk-go
[#199] owner: Rename to user
, refactor and doc
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
d20999113a
commit
1ed426b8a6
36 changed files with 546 additions and 557 deletions
24
user/util_test.go
Normal file
24
user/util_test.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
package user_test
|
||||
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
"crypto/elliptic"
|
||||
"encoding/hex"
|
||||
"testing"
|
||||
|
||||
"github.com/nspcc-dev/neofs-sdk-go/user"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestIDFromKey(t *testing.T) {
|
||||
// examples are taken from https://docs.neo.org/docs/en-us/basic/concept/wallets.html
|
||||
rawPub, _ := hex.DecodeString("03cdb067d930fd5adaa6c68545016044aaddec64ba39e548250eaea551172e535c")
|
||||
x, y := elliptic.UnmarshalCompressed(elliptic.P256(), rawPub)
|
||||
require.True(t, x != nil && y != nil)
|
||||
|
||||
var id user.ID
|
||||
|
||||
user.IDFromKey(&id, ecdsa.PublicKey{Curve: elliptic.P256(), X: x, Y: y})
|
||||
|
||||
require.Equal(t, "NNLi44dJNXtDNSBkofB48aTVYtb1zZrNEs", id.EncodeToString())
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue