In Aptos, the signer is a built-in resource type within the Move programming language which serves as a representation of an authenticated user who has the authority to perform actions on the behalf of a specific address.

You must import the signer functions from the standard library to be able to use it.

use std::signer;

How its used

const NOT_OWNER: u64 = 0;
const OWNER: address = @jyunth_addr;
 
fun check_owner(account: signer) {
        let address_val = signer::borrow_address(&account);
        print(&utf8(b"Owner confirmed"));
        assert!(signer::address_of(&account) == OWNER, NOT_OWNER);
        print(address_val);
    }

We declare 2 constants, one being an error code, the other being the address of the owner.

Whenever this function is executed, the account of the user trying to run this function gets passed into it as a parameter. To access the account address, we use the signer::borrow_address(&account) to be able to borrow the pointer to the address, which we can then print using the line at the end.

The assert line checks if the signer is the owner, if not, then it throws an error NOT_OWNER

How its tested

#[test(account = @jyunth_addr)]
    fun test_function(account: signer){
        check_owner(account);
    }

Pro tip: You can pass accounts into the test suite with brackets like this, which will then be used to execute the functions beneath it.