Generate JWS keys
Generate a key pair, upload the public key, and use the private key to sign each protected request.Generate a pair of public and private JWS keys
Run these commands in your terminal:private_key.pem, which contains your private key.public_key.pem.pub, which contains your public key.
public_key.pem
private_key.pem
Upload your public key to the dashboard
- Open dashboard.fintoc.com.
- Select API Keys in the sidebar.
- If your organization has a product that requires JWS, find the JWS Public Keys section. Select Add JWS Key, and upload your JWS public key.
Generate a signature
After you upload your public key to the Fintoc dashboard, use your private key to generate a signature. The signature verifies the integrity and authenticity of each Transfers API request that moves money.Use an SDK
The Python SDK and Node SDK generate signatures for you. Initialize the Fintoc client with your private key:Node
Follow a step-by-step example
Follow these steps to write your own implementation or use a different programming language.Prepare the payload
Generate the JWS signature from the exact JSON string that you send in the HTTP request. Use your language’s JSON serializer to convert the outbound transfer request body to a JSON string.Use the same JSON stringUse the same serialized JSON string for both actions:
- Create the JWS signature.
- Send the payload in your HTTP request.
Load the private key and configure headers
Load your private key from the PEM file and configure the JWS headers. Include theRS256 signing algorithm, a unique nonce, the current Unix timestamp, and the critical header names.
Prevent a replay attack
Fintoc uses thenonce and ts headers to protect requests against replay attacks. The headers also help verify request integrity.
Set nonce to a unique, random value for every request. This value makes each signature distinct, even when you send the same data more than once. Fintoc rejects a request if its nonce was already used.
Set ts to the Unix timestamp when you create the request. Fintoc rejects requests outside a two-minute window.
Together, nonce and ts prevent an intercepted request from being reused.
Generate the signing input
Create the JWS signing input by joining the base64url-encodedheaders and raw_body with a period (.). Encode both values without padding:
Generate the JWS token signature
Create the cryptographic signature from the signing input and your private key:-
Sign the input using your private key with:
- RSA with PKCS1v15 padding
- SHA-256 hashing
- Base64URL-encode the resulting signature (without padding)
Optional: verify the JWS token
Some libraries re-encode JSON payloads with different spacing, key ordering, or character encoding. To debug a signature locally, decode the payload and compare it with theraw_body sent in the HTTP request. You can also inspect a token containing only non-sensitive test data at jwt.io.
Construct the Fintoc-JWS-Signature header
Construct the Fintoc-JWS-Signature header by joining the protected header and signature: