Enhanced API
validateSession
Learn how to use the validateSession JSON-RPC method.
POST
/
#particle_aa_validateSession
validateSession
curl --request POST \
--url 'https://rpc.particle.network/evm-chain/#particle_aa_validateSession' \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": 1,
"method": "particle_aa_validateSession",
"params": [
{
"name": "Example Session",
"version": "1.0",
"ownerAddress": "0xOwnerAddress"
}
]
}
'import requests
url = "https://rpc.particle.network/evm-chain/#particle_aa_validateSession"
payload = {
"jsonrpc": "2.0",
"id": 1,
"method": "particle_aa_validateSession",
"params": [
{
"name": "Example Session",
"version": "1.0",
"ownerAddress": "0xOwnerAddress"
}
]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'particle_aa_validateSession',
params: [{name: 'Example Session', version: '1.0', ownerAddress: '0xOwnerAddress'}]
})
};
fetch('https://rpc.particle.network/evm-chain/#particle_aa_validateSession', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://rpc.particle.network/evm-chain/#particle_aa_validateSession",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '2.0',
'id' => 1,
'method' => 'particle_aa_validateSession',
'params' => [
[
'name' => 'Example Session',
'version' => '1.0',
'ownerAddress' => '0xOwnerAddress'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://rpc.particle.network/evm-chain/#particle_aa_validateSession"
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_aa_validateSession\",\n \"params\": [\n {\n \"name\": \"Example Session\",\n \"version\": \"1.0\",\n \"ownerAddress\": \"0xOwnerAddress\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://rpc.particle.network/evm-chain/#particle_aa_validateSession")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_aa_validateSession\",\n \"params\": [\n {\n \"name\": \"Example Session\",\n \"version\": \"1.0\",\n \"ownerAddress\": \"0xOwnerAddress\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://rpc.particle.network/evm-chain/#particle_aa_validateSession")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_aa_validateSession\",\n \"params\": [\n {\n \"name\": \"Example Session\",\n \"version\": \"1.0\",\n \"ownerAddress\": \"0xOwnerAddress\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": 1,
"result": true,
"chainId": 80001
}Contextualizing validateSession
validateSessionreturns a Boolean,result, indicating the validity of a given session key instance. It takes:- Account config object:
name- string.version- string.ownerAddress- string.biconomyApiKey- (optional), string. It should only be used if you’d like to use a Biconomy Paymaster.
- Array of sessions:
- Session object:
validUntil- integer.validAfter- integer.sessionValidationModule- string.sessionKeyDataInAbi(alternative:sessionKeyData) - array.
- Session object:
- Account config object:
Query example
JSON
{
"chainId": 80001,
"jsonrpc": "2.0",
"id": "0a7a18a1-53af-45b1-8a7f-4ece06c09e04",
"method": "particle_aa_validateSession",
"params": [
{ "name": "BICONOMY", "version": "2.0.0", "ownerAddress": "0xc19dd1f3e212b39a30036EF3DE3F83dEf5a66E41" },
{
"sessions": [
{
"validUntil": 0,
"validAfter": 0,
"sessionValidationModule": "0x4b7f018Fa27a97b6a17b6d4d8Cb3c0e2D9340133",
"sessionKeyDataInAbi": [ // or use sessionKeyData to replace
["address", "address", "address", "uint256"],
[
"0x1dacDa1087C4048774bEce7784EB8EC4CfBeDB2c",
"0x909E30bdBCb728131E3F8d17150eaE740C904649",
"0x11D266772b85C2C5D4f84A41ca3E08e9f04Fb5D3",
1
]
]
}
],
"targetSession": {
"validUntil": 0,
"validAfter": 0,
"sessionValidationModule": "0x4b7f018Fa27a97b6a17b6d4d8Cb3c0e2D9340133",
"sessionKeyDataInAbi": [ // or use sessionKeyData to replace
["address", "address", "address", "uint256"],
[
"0x1dacDa1087C4048774bEce7784EB8EC4CfBeDB2c",
"0x909E30bdBCb728131E3F8d17150eaE740C904649",
"0x11D266772b85C2C5D4f84A41ca3E08e9f04Fb5D3",
1
]
]
}
}
]
}
Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Body
application/json
Request to validate a session.
Version of the JSON-RPC protocol, should be 2.0.
Example:
"2.0"
The request identifier.
Example:
1
API method being called.
Available options:
particle_aa_validateSession Parameters for validating a session.
- Option 1
- Option 2
Show child attributes
Show child attributes
Response
200 - application/json
Successful response indicating the session validity.
Was this page helpful?
⌘I
validateSession
curl --request POST \
--url 'https://rpc.particle.network/evm-chain/#particle_aa_validateSession' \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"id": 1,
"method": "particle_aa_validateSession",
"params": [
{
"name": "Example Session",
"version": "1.0",
"ownerAddress": "0xOwnerAddress"
}
]
}
'import requests
url = "https://rpc.particle.network/evm-chain/#particle_aa_validateSession"
payload = {
"jsonrpc": "2.0",
"id": 1,
"method": "particle_aa_validateSession",
"params": [
{
"name": "Example Session",
"version": "1.0",
"ownerAddress": "0xOwnerAddress"
}
]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'particle_aa_validateSession',
params: [{name: 'Example Session', version: '1.0', ownerAddress: '0xOwnerAddress'}]
})
};
fetch('https://rpc.particle.network/evm-chain/#particle_aa_validateSession', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://rpc.particle.network/evm-chain/#particle_aa_validateSession",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '2.0',
'id' => 1,
'method' => 'particle_aa_validateSession',
'params' => [
[
'name' => 'Example Session',
'version' => '1.0',
'ownerAddress' => '0xOwnerAddress'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://rpc.particle.network/evm-chain/#particle_aa_validateSession"
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_aa_validateSession\",\n \"params\": [\n {\n \"name\": \"Example Session\",\n \"version\": \"1.0\",\n \"ownerAddress\": \"0xOwnerAddress\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://rpc.particle.network/evm-chain/#particle_aa_validateSession")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_aa_validateSession\",\n \"params\": [\n {\n \"name\": \"Example Session\",\n \"version\": \"1.0\",\n \"ownerAddress\": \"0xOwnerAddress\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://rpc.particle.network/evm-chain/#particle_aa_validateSession")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"particle_aa_validateSession\",\n \"params\": [\n {\n \"name\": \"Example Session\",\n \"version\": \"1.0\",\n \"ownerAddress\": \"0xOwnerAddress\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": 1,
"result": true,
"chainId": 80001
}