Core concepts
Xrpl Request Signatures
XRP Ledger (XRPL) Signed Requests is a feature that allows you to sign secure requests to the XRPL APIs using your public and private keys.
Only Informative
This page is only information based. The Xrpl signatures are already appended to the request if the keypair is present in the sdk.
You must enable security rules
Do not forget to add the new security rule request.auth.type == xrpl to your rules.json file.
GET Request
The GET request signs the path of the request, making it secure and immutable. Here is an example of how to sign a GET request:
const binary = convertStringToHex(path)
return {
id: id, // request id
type: 'type',
database: database, // "one"
method: method, // "GET"
path: path, // db path Ex: "/Messages/1"
binary: binary, // path as hex
auth: {
// uid: deriveAddress(publicKey),
signature: sign(binary, privateKey),
pk: publicKey,
},
} as Request
POST Request
Similar to the GET request, the POST request signs the data to make the request secure and immutable. Here is an example of how to sign a POST request:
{
id: id, // request id
type: 'type',
database: database, // "one"
method: method, // "POST"
path: path, // db path Ex: "/Messages/1"
binary: binary, // data.encoded()
metadata: metadata, // data.getMetadata()
auth: {
// uid: deriveAddress(publicKey),
signature: sign(binary, privateKey),
pk: publicKey,
},
} as Request