Skip to content

Commit

Permalink
Merge pull request #26 from Lamden/Added-keystore-file-Class
Browse files Browse the repository at this point in the history
Keystore class v1
  • Loading branch information
JeffWScott authored Feb 19, 2021
2 parents f4a63c5 + 37ca482 commit 63c2664
Show file tree
Hide file tree
Showing 11 changed files with 1,336 additions and 183 deletions.
21 changes: 0 additions & 21 deletions con_values_testing.py

This file was deleted.

401 changes: 345 additions & 56 deletions dist/lamden.js

Large diffs are not rendered by default.

248 changes: 248 additions & 0 deletions docs/keystore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
#### constructor([arg])

Lamden Keystores

This Class will create a lamden keystore instance




##### Parameters

| Name | Type | Description | |
| ---- | ---- | ----------- | -------- |
| arg | `Object` | constructor argument | *Optional* |
| arg.key | `String` | Create an instance and load it with one private key | *Optional* |
| arg.keyList | `String` | Create an instance and load it with an array of private keys | *Optional* |
| arg.keystoreData | `String` | Create an instance from an existing keystore file data | *Optional* |




##### Returns


- `Keystore`



#### addKeys(keyList)

Add a list of keys to add to the keystore




##### Parameters

| Name | Type | Description | |
| ---- | ---- | ----------- | -------- |
| keyList | `Array.<String>` | An array of 32 character long Lamden private keys | &nbsp; |




##### Returns


- `Void`



#### addKey(key)

Add a key to the keystore




##### Parameters

| Name | Type | Description | |
| ---- | ---- | ----------- | -------- |
| key | `string` | A 32 character long Lamden private key | &nbsp; |




##### Returns


- `Void`



#### addKeystoreData(keystoreData)

Load the keystore with the data from an existing keystore




##### Parameters

| Name | Type | Description | |
| ---- | ---- | ----------- | -------- |
| keystoreData | `string` | The contents of an existing encrypted keystore file | &nbsp; |




##### Returns


- `Void`



#### getPasswordHint([keystoreData])

Returns the password hint in a keystore file




##### Parameters

| Name | Type | Description | |
| ---- | ---- | ----------- | -------- |
| keystoreData | `String` | The contents of an existing encrypted keystore file if one wasn't supplied to the constructor | *Optional* |




##### Returns


- `Void`



#### clearKeys()

Clears all keys from the keystore






##### Returns


- `Void`



#### wallets()

Clears all keys from the keystore






##### Returns


- `Array.&lt;Object&gt;` An array of wallet objects



#### getWallet(vk)

Load the keystore with the data from an existing keystore




##### Parameters

| Name | Type | Description | |
| ---- | ---- | ----------- | -------- |
| vk | `String` | A 32 character long Lamden public key | &nbsp; |




##### Returns


- `Object` A wallet object



#### validateKeyStore(keystoreData)

Used to validate that a keystore is the proper Lamden Format (does not decrypt data)




##### Parameters

| Name | Type | Description | |
| ---- | ---- | ----------- | -------- |
| keystoreData | `String` | The contents of an existing encrypted keystore file | &nbsp; |




##### Returns


- `Boolean` valid



#### createKeystore(password[, hint])

Create a Keystore text string from the keys contained in the Keystore instance




##### Parameters

| Name | Type | Description | |
| ---- | ---- | ----------- | -------- |
| password | `String` | A password to encrypt the data | &nbsp; |
| hint | `String` | An optional password hint. Not stored in clear text (obsured) but not encrypted with the password. | *Optional* |




##### Returns


- `String` A JSON stringified object containing the encrypted data



#### decryptKeystore(password[, keystoreData])

Decrypt a keystore into a useable array of wallets. Any decrypted keys will be added to existing keys in the keystore.




##### Parameters

| Name | Type | Description | |
| ---- | ---- | ----------- | -------- |
| password | `String` | A password to encrypt the data | &nbsp; |
| keystoreData | `String` | The encrypted contents from a keystore file if not passed into the constructor. | *Optional* |




##### Returns


- `Void`




*Documentation generated with [doxdox](https://github.com/neogeek/doxdox).*
Loading

0 comments on commit 63c2664

Please sign in to comment.