# Signature
# Signature
# Signature.signBuffer(buffer, private_key) ⇒ Signature
Kind: static method of Signature
Returns: Signature
- you can use .toHex to get signature hex string
Param | Type | Description |
---|---|---|
buffer | Object | a buffer |
private_key | String | private key |
Example
import { Signature } from 'gxclient'
const buf = Buffer.from('hello')
Signature.signBuffer(buf, '5KQNge45iAFohAJFnXowuPk3ob3eiGbAQMCtff7tM78i5RNywMe')
Example
// if you want to use verify_signature function in contract, you must serialize your buffer first
import {serialize, Types} from 'gxclient'
const buf = serialize('hello', Types.string)
Signature.signBuffer(buf, '5KQNge45iAFohAJFnXowuPk3ob3eiGbAQMCtff7tM78i5RNywMe')