Diff

Differences From Artifact [e039ea66c1]:

To Artifact [f70b629bc8]:


    25     25   # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
    26     26   # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
    27     27   # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    28     28   
    29     29   set passwordFile [lindex $argv 0]
    30     30   set action [lindex $argv 1]
    31     31   
    32         -set validCommands [list "listLocalKeys" "listPasswords" "listAvailablePasswords" "listUsers" "addUser" "addPassword" "authorizeUser" "authorizeUsers" "deauthorizeUser" "deauthorizeUsers" "getPassword" "updatePassword" "deletePassword" "help"]
           32  +set validCommands [list "listLocalKeys" "listPasswords" "listAvailablePasswords" "listUsers" "addUser" "addPassword" "authorizeUser" "authorizeUsers" "deauthorizeUser" "deauthorizeUsers" "getPassword" "updatePassword" "deletePassword" "help" "whoami"]
    33     33   
    34     34   proc _argDescription {command argName} {
    35     35   	switch -- $argName {
    36     36   		"passwordName" {
    37     37   			return "$argName - Name of the password entry"
    38     38   		}
    39     39   		"key" {
................................................................................
   551    551   		set changeRequired 1
   552    552   	}
   553    553   }
   554    554   
   555    555   proc deauthorizeUser {passwordName userName} {
   556    556   	return [deauthorizeUsers $passwordName $userName]
   557    557   }
          558  +
          559  +proc whoami {} {
          560  +	foreach slotInfoDict [_listCertificates] {
          561  +		unset -nocomplain slotInfo
          562  +		array set slotInfo $slotInfoDict
          563  +
          564  +		set pubkey $slotInfo(pubkey)
          565  +
          566  +		unset -nocomplain row
          567  +		db eval {SELECT name FROM users WHERE publicKey = $pubkey;} row {
          568  +			set users($row(name)) 1
          569  +		}
          570  +	}
          571  +
          572  +	puts [join [array names users] {, }]
          573  +}
   558    574   
   559    575   proc help {{action ""}} {
   560    576   	_printHelp stdout $action
   561    577   }
   562    578   # End user CLI functions
   563    579   
   564    580   ### MAIN