Commit Graph

11 Commits

Author SHA1 Message Date
Felix Lange 487f68ec48 accounts: add {Timed,}Unlock, remove SignLocked 2015-03-10 00:19:01 +01:00
Felix Lange fb53a9362e accounts: AccountManager -> Manager 2015-03-08 01:58:35 +01:00
Felix Lange afc530ea41 accounts: use time.Duration correctly
There is no point to using time.Duration if the value is interpreted as
milliseconds. Callers should use the standard multiplication idiom to
choose the unit. In fact, the only caller outside of the tests already
does so.
2015-03-08 00:35:23 +01:00
Felix Lange fda7b4c79d accounts: use pointers consistently
Account is now always a non-pointer. This will be important once
the manager starts remembering accounts.

AccountManager is now always a pointer because it contains locks
and locks cannot be copied.
2015-03-08 00:18:13 +01:00
Gustav Simonsson d1311c53ee Address pull request comments
* Use RWMutex instead of Mutex
* Use time.Duration instead of int for unlock time
* Use time.After with select instead of time.Sleep
2015-02-25 18:40:59 +01:00
Gustav Simonsson b296b36d2b Add automatic locking / unlocking of accounts
* Change account signing API to two sign functions;
  Sign without passphrase - works if account is unlocked
  Sign with passphrase - always works and unlocks the account
* Account stays unlocked for X ms and is then automatically locked
2015-02-25 17:37:12 +01:00
Gustav Simonsson 923950ccaa Fix key store address hex decoding and accounts test
Thanks to https://github.com/jaekwon for original fix!
2015-02-24 18:05:10 +01:00
Maran 40adb7feb6 Implement OS sensitive dataDirs 2015-02-23 11:28:20 +01:00
Felix Lange 4ab7a290cd accounts: use crypto/randentropy in test 2015-02-20 11:40:58 +01:00
Gustav Simonsson 8d9752a557 Address pull request comments
* Use crypto.Sign instead of directly calling secp256k1 lib
* Rename UserAccount to Account and Addr to Address (for consistency)
* Change AccountManager.Sign to take ptr to Account instead of
  address byte array
* Simplify copying of Accounts in Accounts()
* PubkeyToAddress and GetEntropyCSPRNG now exported
2015-01-28 05:12:57 +01:00
Gustav Simonsson 512ffa2bf4 Add accounts package and refactor key stores
* Add initial UserAccount and AccountManager structs
* Add NewAccount, Sign and Accounts functions
* Refactor key stores to use key address as main identifier
  while keeping the UUID.
* Use key address as file/dir names instead of UUID
2015-01-26 04:30:17 +01:00