Contract cf510d418d5673598f3c70430d71bcd733af161f7eb4a75303ac2f9aab9f464b

← Back to Index 📥 Download WASM

Meta

rssdkver 22.0.8#f46e9e0610213bbb72285566f9dd960ff96d03d8
rsver 1.88.0

Instances

  • CBUUI7WKGOTPCLXBPCHTKB5GNATWM4WAH4KMADY6GFCXOCNVF5OCW2WI

Interface

Initializes the contract with an administrative address.

This function can only be called once. Subsequent calls will result in an AlreadyInitialized error.

Arguments

  • admin - The address to be set as the contract administrator.

Errors

Returns Err(errors::Error::AlreadyInitialized) if the contract has already been initialized.

fn initialize(
    env: soroban_sdk::Env,
    admin: soroban_sdk::Address,
) -> Result<(), soroban_sdk::Error>

Registers a new attestation schema.

A schema defines the structure and rules for attestations. Each schema is identified by a unique UID, which is derived from its definition.

Arguments

  • caller - The address of the entity registering the schema. The caller is designated as the schema's creator.
  • schema_definition - A string defining the schema. The format of this string is up to the implementer.
  • resolver - An optional address of a contract that can resolve or validate attestations against this schema.
  • revocable - A boolean indicating whether attestations made against this schema can be revoked.

Returns

Returns a Result containing the 32-byte UID of the newly registered schema, or an error if the registration fails.

fn register(
    env: soroban_sdk::Env,
    caller: soroban_sdk::Address,
    schema_definition: soroban_sdk::String,
    resolver: Option,
    revocable: bool,
) -> Result, soroban_sdk::Error>

Retrieves a registered schema by its UID.

Arguments

  • schema_uid - The 32-byte unique identifier of the schema to retrieve.

Returns

Returns a Result containing the Schema struct if found, or an error if no schema with the given UID exists.

fn get_schema(
    env: soroban_sdk::Env,
    schema_uid: soroban_sdk::BytesN<32>,
) -> Result

Creates an attestation where the attester is also the subject.

This function creates a new attestation based on a specified schema. The attester must authorize this operation by signing the transaction, and they will also be the subject of the attestation.

Arguments

  • attester - The address of the entity making the attestation. Must be the transaction signer.
  • schema_uid - The UID of the schema for which the attestation is being made.
  • value - The value of the attestation, conforming to the schema's definition.
  • expiration_time - An optional Unix timestamp indicating when the attestation expires.

Returns

Returns a Result containing the 32-byte UID of the newly created attestation, or an error if the process fails.

fn attest(
    env: soroban_sdk::Env,
    attester: soroban_sdk::Address,
    schema_uid: soroban_sdk::BytesN<32>,
    value: soroban_sdk::String,
    expiration_time: Option,
) -> Result, soroban_sdk::Error>

Revokes an existing attestation.

Only the original attester or an authorized party (as defined by the schema) can revoke an attestation. The schema must also permit revocations.

Arguments

  • revoker - The address of the entity revoking the attestation. Must be authorized to perform this action.
  • attestation_uid - The UID of the attestation to be revoked.

Returns

Returns Ok(()) on successful revocation, or an error if the revocation fails.

fn revoke(
    env: soroban_sdk::Env,
    revoker: soroban_sdk::Address,
    attestation_uid: soroban_sdk::BytesN<32>,
) -> Result<(), soroban_sdk::Error>

Retrieves an attestation by its UID.

Arguments

  • attestation_uid - The 32-byte unique identifier of the attestation to retrieve.

Returns

Returns a Result containing the Attestation struct if found, or an error if no attestation with the given UID exists.

fn get_attestation(
    env: soroban_sdk::Env,
    attestation_uid: soroban_sdk::BytesN<32>,
) -> Result

Creates an attestation using a delegated signature.

This method allows for gas-less attestations where a submitter can post an attestation on behalf of an attester. The attester's authorization is verified through a signed DelegatedAttestationRequest. The attestation UID can be derived off-chain from the request parameters.

Anyone can submit this transaction, paying the fees.

Arguments

  • submitter - The address submitting the transaction, which must authorize the invocation.
  • request - The DelegatedAttestationRequest struct containing the attestation details and the attester's signature.

Returns

Returns Ok(()) on success, or an error if the request is invalid or signature verification fails.

fn attest_by_delegation(
    env: soroban_sdk::Env,
    submitter: soroban_sdk::Address,
    request: DelegatedAttestationRequest,
) -> Result<(), soroban_sdk::Error>

Revokes an attestation using a delegated signature.

This method allows for gas-less revocations where a submitter can post a revocation on behalf of a revoker. The revoker's authorization is verified through a signed DelegatedRevocationRequest.

Arguments

  • submitter - The address submitting the transaction, which must authorize the invocation.
  • request - The DelegatedRevocationRequest struct containing the revocation details and the revoker's signature.

Returns

Returns Ok(()) on success, or an error if the request is invalid or signature verification fails.

fn revoke_by_delegation(
    env: soroban_sdk::Env,
    submitter: soroban_sdk::Address,
    request: DelegatedRevocationRequest,
) -> Result<(), soroban_sdk::Error>

Gets the next nonce for an attester.

Nonces are used in delegated requests to prevent replay attacks. Each delegated request from an attester must have a unique, sequential nonce.

Arguments

  • attester - The address of the attester.

Returns

Returns the next expected nonce (u64) for the given attester.

fn get_attester_nonce(env: soroban_sdk::Env, attester: soroban_sdk::Address) -> u64

Registers a BLS public key for an attester.

This public key can be used to verify delegated attestations and revocations, enabling more advanced cryptographic operations. The attester must authorize this registration.

Arguments

  • attester - The address of the attester for whom the BLS key is being registered. Must authorize transaction.
  • public_key - The 192-byte BLS public key.

Returns

Returns Ok(()) on successful registration, or an error if one already exists or registration fails.

fn register_bls_key(
    env: soroban_sdk::Env,
    attester: soroban_sdk::Address,
    public_key: soroban_sdk::BytesN<192>,
) -> Result<(), soroban_sdk::Error>

Gets the BLS public key for an attester.

Arguments

  • attester - The address of the attester.

Returns

Returns a Result containing the BlsPublicKey if found, or an error if no key is registered for the given attester.

fn get_bls_key(
    env: soroban_sdk::Env,
    attester: soroban_sdk::Address,
) -> Result

Gets the domain separation tag (DST) for delegated attestations.

The DST is a unique byte string used to ensure that signatures created for one purpose cannot be repurposed for another. This is crucial for the security of delegated operations.

Returns

Returns the Bytes slice representing the DST for delegated attestations.

fn get_dst_for_attestation(env: soroban_sdk::Env) -> soroban_sdk::Bytes

Gets the domain separation tag (DST) for delegated revocations.

The DST is a unique byte string used to ensure that signatures created for one purpose cannot be repurposed for another. This is crucial for the security of delegated operations.

Returns

Returns the Bytes slice representing the DST for delegated revocations.

fn get_dst_for_revocation(env: soroban_sdk::Env) -> soroban_sdk::Bytes

Imports

WebAssembly Text (WAT) ▶