auth-sig
Actions
SystemService::AuthSig::AuthSig
struct SystemService::AuthSig::AuthSig {
const psibase::AccountNumber service;
checkAuthSys(...); // This is an implementation of the standard auth service interface defined in [SystemService::AuthInterface]
canAuthUserSys(...); // This is an implementation of the standard auth service interface defined in [SystemService::AuthInterface]
setKey(...); // Set the sender's public key
isAuthSys(...); // Check whether a specified set of authorizer accounts are sufficient to authorize sending a transaction from a specified sender.
isRejectSys(...); // Check whether a specified set of rejecter accounts are sufficient to reject (cancel) a transaction from a specified sender.
newAccount(...); // Create a new account using this auth service configured with the specified public key.
};
The auth-sig
service is an auth service that can be used to authenticate actions for accounts..
Any account using this auth service must store in this service a public key that they own. This service will ensure that the specified public key is included in the transaction claims for any transaction sent by this account.
This service supports K1 or R1 keys (Secp256K1 or Secp256R1) keys.
SystemService::AuthSig::AuthSig::checkAuthSys
void SystemService::AuthSig::AuthSig::checkAuthSys(
uint32_t flags,
psibase::AccountNumber requester,
psibase::AccountNumber sender,
ServiceMethod action,
std::vector<ServiceMethod> allowedActions,
std::vector<psibase::Claim> claims
);
This is an implementation of the standard auth service interface defined in SystemService::AuthInterface.
This action is automatically called by transact
when an account using this auth service submits a
transaction.
This action verifies that the transaction contains a claim for the user's public key.
SystemService::AuthSig::AuthSig::canAuthUserSys
void SystemService::AuthSig::AuthSig::canAuthUserSys(
psibase::AccountNumber user
);
This is an implementation of the standard auth service interface defined in SystemService::AuthInterface.
This action is automatically called by accounts
when an account is configured to use this auth service.
Verifies that a particular user is allowed to use a particular auth service.
This action allows any user who has already set a public key using AuthSig::setKey
.
SystemService::AuthSig::AuthSig::setKey
void SystemService::AuthSig::AuthSig::setKey(
SubjectPublicKeyInfo key
);
Set the sender's public key.
This is the public key that must be claimed by the transaction whenever a sender using this auth service submits a transaction.
SystemService::AuthSig::AuthSig::isAuthSys
bool SystemService::AuthSig::AuthSig::isAuthSys(
psibase::AccountNumber sender,
std::vector<psibase::AccountNumber> authorizers
);
Check whether a specified set of authorizer accounts are sufficient to authorize sending a transaction from a specified sender..
sender
: The sender account for the transaction potentially being authorized.authorizers
: The set of accounts that have already authorized the execution of the transaction.
Returns:
true
: If the sender is among the authorizersfalse
: If the sender is not among the authorizers
SystemService::AuthSig::AuthSig::isRejectSys
bool SystemService::AuthSig::AuthSig::isRejectSys(
psibase::AccountNumber sender,
std::vector<psibase::AccountNumber> rejecters
);
Check whether a specified set of rejecter accounts are sufficient to reject (cancel) a transaction from a specified sender..
sender
: The sender account for the transaction potentially being rejected.rejecters
: The set of accounts that have already authorized the rejection of the transaction.
Returns:
true
: If the sender is among the rejectersfalse
: If the sender is not among the rejecters
SystemService::AuthSig::AuthSig::newAccount
void SystemService::AuthSig::AuthSig::newAccount(
psibase::AccountNumber name,
SubjectPublicKeyInfo key
);
Create a new account using this auth service configured with the specified public key..
Tables
SystemService::AuthSig::AuthRecord
struct SystemService::AuthSig::AuthRecord {
psibase::AccountNumber account; // The account whose transactions will be required to contain the specified public key.
SubjectPublicKeyInfo pubkey; // The public key included in the claims for each transaction sent by this account.
byPubkey(...);
};
A record containing the authorization claims needed for an account using this auth service..
SystemService::AuthSig::AuthRecord::byPubkey
std::tuple<string, AccountNumber> SystemService::AuthSig::AuthRecord::byPubkey() const;