ETH Sign
The EthSignature class represents an Ethereum signature.
Used to parse the signed result returned by the device.
Inputs
| Field | Value Type | Meaning |
|---|---|---|
signature | Buffer | The signature data (65 bytes: r + s + v) |
requestId | Buffer | The request ID (optional) |
origin | string | The origin information (optional) |
UR Demo
UR:ETH-SIGNATURE/OTADTPDAGDSWNNYAHGTOKPFPIAPANNROLNSAVYDTHHAOHDFPCATKCPPFYLENGAGLMKMUCAYKFPFSDREOMENTPKBGEONDCHFDNBKOSSTPDWETSGBZDNCMCHKPNYDMKIDPTDRYJSDRTKCTIOFPQZHFLNSKVACLMNIYTKLGISFRWLKTZTREAEAXIYGWJTIHGRIHKKPLGDEEDS
Decode Demo
import { URDecoder } from "@ngraveio/bc-ur";
import { EthSignature } from "@keystonehq/bc-ur-registry-eth";
const dec = new URDecoder();
// Feed each scanned frame string into the decoder
// feed each scanned frame into dec.receivePart(frame)
if (dec.isComplete()) {
const ur = dec.resultUR(); // the decoded UR should be of type 'eth-signature'
const signatureData = EthSignature.fromCBOR(ur.cbor);
const requestId = signatureData.getRequestId();
const signature = signatureData.getSignature();
// Extract the r, s, and v components
const r = signature.slice(0, 32);
const s = signature.slice(32, 64);
const v = signature.slice(64, 65);
// Attach it to the transaction and broadcast
}
Signature Format
The signature is 65 bytes:
r(32 bytes): First part of ECDSA signatures(32 bytes): Second part of ECDSA signaturev(1 byte): Recovery ID