Skip to main content

Module 0x2::zklogin_verified_id

use 0x1::string;
use 0x2::object;
use 0x2::tx_context;

Resource VerifiedID

Possession of a VerifiedID proves that the user's address was created using zklogin and the given parameters.

struct VerifiedID has key
Fields
id: object::UID
The ID of this VerifiedID
owner: address
The address this VerifiedID is associated with
key_claim_name: string::String
The name of the key claim
key_claim_value: string::String
The value of the key claim
issuer: string::String
The issuer
audience: string::String
The audience (wallet)

Constants

const EFunctionDisabled: u64 = 0;

Function owner

Returns the address associated with the given VerifiedID

public fun owner(verified_id: &zklogin_verified_id::VerifiedID): address
Implementation
public fun owner(verified_id: &VerifiedID): address {
    verified_id.owner
}

Function key_claim_name

Returns the name of the key claim associated with the given VerifiedID

public fun key_claim_name(verified_id: &zklogin_verified_id::VerifiedID): &string::String
Implementation
public fun key_claim_name(verified_id: &VerifiedID): &String {
    &verified_id.key_claim_name
}

Function key_claim_value

Returns the value of the key claim associated with the given VerifiedID

public fun key_claim_value(verified_id: &zklogin_verified_id::VerifiedID): &string::String
Implementation
public fun key_claim_value(verified_id: &VerifiedID): &String {
    &verified_id.key_claim_value
}

Function issuer

Returns the issuer associated with the given VerifiedID

public fun issuer(verified_id: &zklogin_verified_id::VerifiedID): &string::String
Implementation
public fun issuer(verified_id: &VerifiedID): &String {
    &verified_id.issuer
}

Function audience

Returns the audience (wallet) associated with the given VerifiedID

public fun audience(verified_id: &zklogin_verified_id::VerifiedID): &string::String
Implementation
public fun audience(verified_id: &VerifiedID): &String {
    &verified_id.audience
}

Function delete

Delete a VerifiedID

public fun delete(verified_id: zklogin_verified_id::VerifiedID)
Implementation
public fun delete(verified_id: VerifiedID) {
    let VerifiedID { id, owner: _, key_claim_name: _, key_claim_value: _, issuer: _, audience: _ } = verified_id;
    id.delete();
}

Function verify_zklogin_id

This function has been disabled.

public fun verify_zklogin_id(_key_claim_name: string::String, _key_claim_value: string::String, _issuer: string::String, _audience: string::String, _pin_hash: u256, _ctx: &mut tx_context::TxContext)
Implementation
public fun verify_zklogin_id(
    _key_claim_name: String,
    _key_claim_value: String,
    _issuer: String,
    _audience: String,
    _pin_hash: u256,
    _ctx: &mut TxContext,
) {
    assert!(false, EFunctionDisabled);
}

Function check_zklogin_id

This function has been disabled.

public fun check_zklogin_id(_address: address, _key_claim_name: &string::String, _key_claim_value: &string::String, _issuer: &string::String, _audience: &string::String, _pin_hash: u256): bool
Implementation
public fun check_zklogin_id(
    _address: address,
    _key_claim_name: &String,
    _key_claim_value: &String,
    _issuer: &String,
    _audience: &String,
    _pin_hash: u256
): bool {
    assert!(false, EFunctionDisabled);
    false
}

Function check_zklogin_id_internal

Returns true if address was created using zklogin and the given parameters.

Aborts with EInvalidInput if any of kc_name, kc_value, iss and aud is not a properly encoded UTF-8 string or if the inputs are longer than the allowed upper bounds: kc_name must be at most 32 characters, kc_value must be at most 115 characters and aud must be at most 145 characters.

fun check_zklogin_id_internal(address: address, key_claim_name: &vector<u8>, key_claim_value: &vector<u8>, issuer: &vector<u8>, audience: &vector<u8>, pin_hash: u256): bool
Implementation
native fun check_zklogin_id_internal(
    address: address,
    key_claim_name: &vector<u8>,
    key_claim_value: &vector<u8>,
    issuer: &vector<u8>,
    audience: &vector<u8>,
    pin_hash: u256
): bool;