auth-sig

Actions

SystemService::AuthSig

struct SystemService::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
};

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::checkAuthSys

void SystemService::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::canAuthUserSys

void SystemService::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::setKey

void SystemService::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.

Tables

SystemService::AuthRecord

struct SystemService::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::AuthRecord::byPubkey

std::tuple<SubjectPublicKeyInfo, AccountNumber> SystemService::AuthRecord::byPubkey() const;