Skip to main content

Module iota::zklogin_verified_issuer

use iota::address; use iota::hex; use iota::object; use iota::transfer; use iota::tx_context; use std::ascii; use std::bcs; use std::option; use std::string; use std::vector;

Struct VerifiedIssuer

Possession of a VerifiedIssuer proves that the user's address was created using zklogin and with the given issuer (identity provider).

public struct VerifiedIssuer has key

Fields
id: iota::object::UID

The ID of this VerifiedIssuer

owner: address

The address this VerifiedID is associated with

issuer: std::string::String

The issuer

Constants

Error if the proof consisting of the inputs provided to the verification function is invalid.

const EInvalidInput: u64 = 0;

Error if the proof consisting of the inputs provided to the verification function is invalid.

const EInvalidProof: u64 = 1;

Function owner

Returns the address associated with the given VerifiedIssuer

public fun owner(verified_issuer: &iota::zklogin_verified_issuer::VerifiedIssuer): address

Implementation

public fun owner(verified_issuer: &VerifiedIssuer): address { verified_issuer.owner }

Function issuer

Returns the issuer associated with the given VerifiedIssuer

public fun issuer(verified_issuer: &iota::zklogin_verified_issuer::VerifiedIssuer): &std::string::String

Implementation

public fun issuer(verified_issuer: &VerifiedIssuer): &String { &verified_issuer.issuer }

Function delete

Delete a VerifiedIssuer

public fun delete(verified_issuer: iota::zklogin_verified_issuer::VerifiedIssuer)

Implementation

public fun delete(verified_issuer: VerifiedIssuer) { let VerifiedIssuer { id, owner: _, issuer: _ } = verified_issuer; id.delete(); }

Function verify_zklogin_issuer

Verify that the caller's address was created using zklogin with the given issuer. If so, a VerifiedIssuer object with the issuers id transferred to the caller.

Aborts with EInvalidProof if the verification fails.

public fun verify_zklogin_issuer(address_seed: u256, issuer: std::string::String, ctx: &mut iota::tx_context::TxContext)

Implementation

public fun verify_zklogin_issuer(address_seed: u256, issuer: String, ctx: &mut TxContext) { let sender = ctx.sender(); assert!(check_zklogin_issuer(sender, address_seed, &issuer), EInvalidProof); transfer::transfer( VerifiedIssuer { id: object::new(ctx), owner: sender, issuer, }, sender, ) }

Function check_zklogin_issuer

Returns true if address was created using zklogin with the given issuer and address seed.

public fun check_zklogin_issuer(address: address, address_seed: u256, issuer: &std::string::String): bool

Implementation

public fun check_zklogin_issuer(address: address, address_seed: u256, issuer: &String): bool { check_zklogin_issuer_internal(address, address_seed, issuer.as_bytes()) }

Function check_zklogin_issuer_internal

Returns true if address was created using zklogin with the given issuer and address seed.

Aborts with EInvalidInput if the iss input is not a valid UTF-8 string.

fun check_zklogin_issuer_internal(address: address, address_seed: u256, issuer: &vector<u8>): bool

Implementation

native fun check_zklogin_issuer_internal( address: address, address_seed: u256, issuer: &vector<u8>, ): bool;