From 854fb1006d2c05b47938576d370382c6214e98c2 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Tue, 21 May 2019 21:08:10 -0700 Subject: [PATCH] [keystore] add harmony keystore package Signed-off-by: Leo Chen --- internal/keystore/keystore.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 internal/keystore/keystore.go diff --git a/internal/keystore/keystore.go b/internal/keystore/keystore.go new file mode 100644 index 000000000..6c2fc17f6 --- /dev/null +++ b/internal/keystore/keystore.go @@ -0,0 +1,24 @@ +package keystore + +import ( + "sync" + + "github.com/harmony-one/harmony/accounts/keystore" +) + +var ( + // DefaultKeyStoreDir is the default directory of the keystore + DefaultKeyStoreDir = ".hmy/keystore" + onceForKeyStore sync.Once + scryptN = keystore.StandardScryptN + scryptP = keystore.StandardScryptP + hmyKeystore *keystore.KeyStore +) + +// GetHmyKeyStore returns the only keystore of the node +func GetHmyKeyStore() *keystore.KeyStore { + onceForKeyStore.Do(func() { + hmyKeystore = keystore.NewKeyStore(DefaultKeyStoreDir, scryptN, scryptP) + }) + return hmyKeystore +}