πŸ”‘Auth by Keys

Prerequisites

Ensure you have the following libraries installed:

pip install asyncio json sha256 base58 ed25519 httpx py_near

Import Necessary Modules

import asyncio
import json
from hashlib import sha256
import base58
import ed25519
import httpx
from py_near.account import Account
from app import dao_nc
from configs import CONFIG

Define Keys and Wallet ID

public_key = "[KEY]"
private_key = "...."
wallet_id = "EHGDUJ7GDASucUVU4ngsgUsTYZT1FpG91CTFG8iUmGQ5"
pk = ed25519.SigningKey(base58.b58decode(private_key))

Add Access

The following steps outline how to add access to a wallet.

  1. Get Wallet Information

  2. Prepare Access Data

  3. Create and Sign the Message

  4. Call the grant_assess Function

Revoke Access

The following steps outline how to revoke access from a wallet.

  1. Create and Sign the Message for Revoking Access

  2. Call the revoke_assess Function

Execute Multiple Actions

The following steps outline how to execute multiple actions in a single call.

  1. Create and Sign the Messages

  2. Call the execute Function

Running the Function

To run the function, use the following:

This documentation provides a clear example of how to manage wallet access using digital signatures and API calls in an asynchronous Python environment.

Last updated