forked from TrueCloudLab/frostfs-rest-gw
[#15] Sign base64 token representation
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
5bee10d096
commit
fd0ff4b803
4 changed files with 21 additions and 4 deletions
|
@ -924,11 +924,13 @@ func signToken(t *testing.T, key *keys.PrivateKey, data []byte) *handlers.Bearer
|
|||
}
|
||||
|
||||
func signTokenWalletConnect(t *testing.T, key *keys.PrivateKey, data []byte) *handlers.BearerToken {
|
||||
sm, err := walletconnect.SignMessage(&key.PrivateKey, data[:])
|
||||
b64Token := make([]byte, base64.StdEncoding.EncodedLen(len(data)))
|
||||
base64.StdEncoding.Encode(b64Token, data)
|
||||
sm, err := walletconnect.SignMessage(&key.PrivateKey, b64Token[:])
|
||||
require.NoError(t, err)
|
||||
|
||||
return &handlers.BearerToken{
|
||||
Token: base64.StdEncoding.EncodeToString(data),
|
||||
Token: string(b64Token),
|
||||
Signature: hex.EncodeToString(append(sm.Data, sm.Salt...)),
|
||||
Key: hex.EncodeToString(key.PublicKey().Bytes()),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue