User Approvals
The Karrier Number system can be used to verify a user approves an action. This enables phone number based 2FA using the blockchain.
User approvals offer secure methods for verifying wallet or address ownership. There are two primary approaches:
Signature Verification: Verifies ownership without recording any transaction on the blockchain, thus avoiding associated gas costs.
Event Verification: Confirms ownership through a blockchain event emitted by a contract. This method incurs a minor transaction cost and leaves an on-chain record.
In both cases, the approval flow remains consistent:
Generate an Approval URL 📄
Redirect the User to the Approval URL 👉
Handle the Return URL 🔧
Lookup the Response to Confirm Approval ✅
Example Call Using 'event' Verification
// Example Call using 'event' verification
curl --location 'https://kns-api.karrier.dev/kns/approval' \
--header 'x-api-key: testkey' \
--header 'Content-Type: application/json' \
--data '{
"title": "SIM SWAP",
"message": "Would you like to deactivate your previous SIM card and activate a new SIM card?",
"phoneNumber": "+15552221234",
"successRedirectUrl": "yes/success",
"cancelRedirectUrl": "no/failure",
"referenceNumber": "I#23493249243932",
"method":"event"
}'
{
"approvalUrl": "https://dashboard.karrier.dev/kns-approve?ref=ea24b697d2730d82c755a5b7",
"approvalNumber": "ea24b697d2730d82c755a5b7"
}The title of the approval request.
SIM Replacement ApprovalA description of what the approval request is for.
Would you like to deactivate your previous SIM card and activate a new SIM card?The URL to redirect to if the user approves the request.
https://example.com/approvedPattern: ^https?:\/\/.*$The URL to redirect to if the user cancels the approval request.
https://example.com/cancelPattern: ^https?:\/\/.*$The reference number for the approval request.
SIM-1234The method to use for the approval request. This can be either "sign" or "event".
signPossible values: The user's phone number in E.164 format.
+14445551234Pattern: ^\+?[1-9]\d{5,14}$Ok
POST /kns/approval-phone HTTP/1.1
Host: kns-api.karrier.one
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 304
{
"title": "SIM Replacement Approval",
"message": "Would you like to deactivate your previous SIM card and activate a new SIM card?",
"successRedirectUrl": "https://example.com/approved",
"cancelRedirectUrl": "https://example.com/cancel",
"referenceNumber": "SIM-1234",
"method": "sign",
"phoneNumber": "+14445551234"
}{
"approvalUrl": "text",
"approvalNumber": "text",
"error": "text"
}Last updated