Skip to content

Latest commit

 

History

History
23 lines (14 loc) · 8.16 KB

README.md

File metadata and controls

23 lines (14 loc) · 8.16 KB

Signatures used for Authorization in Daemon

High level flow

Details


Details of Signature



Type of Request Check for State or Execute Service Block chain Mode allowed User Flag Request Signature expected Method Called Response sent Comments
Paid Call Grpc State call true NA message ChannelStateRequest "__get_channel_state"+MpeAddress+channelID+CurrentBlockNumber
Bytes Constructed
rpc GetChannelState(ChannelStateRequest) returns (ChannelStateReply) {} message ChannelStateReply Only channel signer/sender/receiver can get latest channel state . Current Block Number passed needs to be +-10 from the latest block number retrieved from the blockchain
Paid Call Grpc State call false NA message ChannelStateRequest NA rpc GetChannelState(ChannelStateRequest) returns (ChannelStateReply) {} message ChannelStateReply Same response is sent every time,Caller would not know if the block chain mode is enabled or disabled.The Signature sent is ignored.
Paid Call Execute Service true true or false Metadata Passed to Daemon should consist of the below header
"snet-payment-type"="escrow"
"snet-payment-channel-id" = "Channeld"
"snet-payment-channel-nonce"="Nonce"
"snet-payment-channel-amount" ="TotalAmount"
"snet-payment-channel-signature-bin"="Signature"
"__MPE_claim_message"+MpeContractAddress+ChannelID+ChannelNonce+SignedAmount
Bytes Constructed
Call to the method in Service Response sent by Service Only channel signer/sender can sign.
, Please note the Total Amount = Amount (retrieved from State call) + Price of the current call , latest nonce is also retrieved from the state call
if the allowed_user flag is true , then Make sure the Signer is also in the list of allowed users defined in the Daemon config.
Please note the allowed user flag is applicable only in test networks like sepolia/goerli etc; but not in mainnet
Free Call Execute Service true true or false Metadata Passed to Daemon should consist of the below header
"snet-payment-type"="free-call"
""snet-free-call-user-id" = "user-id"
"snet-free-call-auth-token-bin"="Auth Token downloaded"
"snet-free-call-token-expiry-block" ="Token Expiry date"
"snet-current-block-number"="CurrentBlockNumber"
"snet-payment-channel-signature-bin"="Signture"
Signature = "__prefix_free_trial"+"user-id"+"organization_id"+"service_id"+BlockNumber+"AuthToken", now check if Auth-token = "user@mail"+"user-public-key"+ "token_issue_date"
from the first signature get the user-public-key, and use this to validate the AuthToken
Bytes Constructed
Call to the method in Service Response sent by Service Only channel signer/sender can sign.
, Please note the Total Amount = Amount (retrieved from State call) + Price of the current call , latest nonce is also retrieved from the state call
if the allowed_user flag is true , then Make sure the Signer is also in the list of allowed users defined in the Daemon config.
Please note the allowed user flag is applicable only in test networks like sepolia/goerli etc; but not in mainnet


Details on headers