Before we get to how to use resources, you need to learn about
signer type, and why this type exists.
Signer is a native non-copyable (resource-like) type which holds address of transaction sender.
Signer type represents sender authority. In other words - using signer means accessing sender's address and resources. It has no direct relation to signatures or literally signing, in terms of Rogue VM it simply represents sender.
Signer type has only one ability - Drop.
Since signer is a native type, it has to be created. Though unlike
vector it cannot be directly created in code, but can be received as a script argument:
Signer argument is put into your scripts automatically by VM, which means that there's no way nor is their a need to pass it into script manually. Worth remembering that it's always a reference. Even though standard library (in the case of Dijets) has access to the actual value of signer, functions using this value are private and there's no way to use or pass signer value anywhere else.
Currently, canonical name of the variable holding signer type is account
Native types require native functions, and for signer type it is
0x1::Signer. This method is fairly simple:
As you can see, there are essentisally 2 methods, one of which is native and the other one is more handy as it copies address with dereference operator.
Usage of this method is just as simple:
&signertype as argument explicitly show that they are using sender's address.
One of the reasons for this type was to show which methods require sender authority and which ones don't. So method cannot trick user into unauthorized access to its resources.