aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/key.go
diff options
context:
space:
mode:
authorGustav Simonsson <gustav.simonsson@gmail.com>2015-05-11 02:30:02 +0800
committerGustav Simonsson <gustav.simonsson@gmail.com>2015-05-12 23:22:17 +0800
commit2c1b0ff17e020f300ed9d5a5a244f59b4febfe66 (patch)
treecafa9b03743b00d4ef902ddf3effc1734e885a89 /crypto/key.go
parentfe9e95a3fd6275fe2740261d3d110c13de4aa0ce (diff)
downloadgo-tangerine-2c1b0ff17e020f300ed9d5a5a244f59b4febfe66.tar.gz
go-tangerine-2c1b0ff17e020f300ed9d5a5a244f59b4febfe66.tar.zst
go-tangerine-2c1b0ff17e020f300ed9d5a5a244f59b4febfe66.zip
Update key store to new spec but keep address field for now
* Also fix address types post-rebase
Diffstat (limited to 'crypto/key.go')
-rw-r--r--crypto/key.go50
1 files changed, 25 insertions, 25 deletions
diff --git a/crypto/key.go b/crypto/key.go
index 1af69d795..0c5ce4254 100644
--- a/crypto/key.go
+++ b/crypto/key.go
@@ -48,47 +48,47 @@ type Key struct {
}
type plainKeyJSON struct {
- Version string
- Id string
- Address string
- PrivateKey string
+ Address string `json:"address"`
+ PrivateKey string `json:"privatekey"`
+ Id string `json:"id"`
+ Version string `json:"version"`
}
type encryptedKeyJSON struct {
- Version string
- Id string
- Address string
- Crypto cipherJSON
+ Address string `json:"address"`
+ Crypto cryptoJSON
+ Id string `json:"id"`
+ Version string `json:"version"`
}
-type cipherJSON struct {
- MAC string
- Salt string
- IV string
- KeyHeader keyHeaderJSON
- CipherText string
+type cryptoJSON struct {
+ Cipher string `json:"cipher"`
+ CipherText string `json:"ciphertext"`
+ CipherParams cipherparamsJSON `json:"cipherparams"`
+ KDF string `json:"kdf"`
+ KDFParams scryptParamsJSON `json:"kdfparams"`
+ MAC string `json:"mac"`
+ Version string `json:"version"`
}
-type keyHeaderJSON struct {
- Version string
- Kdf string
- KdfParams scryptParamsJSON
+type cipherparamsJSON struct {
+ IV string `json:"iv"`
}
type scryptParamsJSON struct {
- N int
- R int
- P int
- DkLen int
- SaltLen int
+ N int `json:"n"`
+ R int `json:"r"`
+ P int `json:"p"`
+ DkLen int `json:"dklen"`
+ Salt string `json:"salt"`
}
func (k *Key) MarshalJSON() (j []byte, err error) {
jStruct := plainKeyJSON{
- version,
- k.Id.String(),
hex.EncodeToString(k.Address[:]),
hex.EncodeToString(FromECDSA(k.PrivateKey)),
+ k.Id.String(),
+ version,
}
j, err = json.Marshal(jStruct)
return j, err