Add lock() on pair, hasSecretKey -> isLocked (#187)

This commit is contained in:
Jaco Greeff
2018-08-06 14:38:08 +02:00
committed by GitHub
parent 578619a61f
commit 618429c9f1
16 changed files with 52 additions and 41 deletions
+1 -1
View File
@@ -10,5 +10,5 @@
"packages": [
"packages/*"
],
"version": "0.26.36"
"version": "0.27.0"
}
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/trie-db",
"version": "0.26.36",
"version": "0.27.0",
"description": "This is an implementation of the modified merkle patricia tree as speficed in Ethereum's yellow paper, adpated for Polkadot.",
"main": "index.js",
"scripts": {},
@@ -27,10 +27,10 @@
"license": "MPL-2.0",
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/trie-hash": "^0.26.36",
"@polkadot/util": "^0.26.36",
"@polkadot/util-crypto": "^0.26.36",
"@polkadot/util-rlp": "^0.26.36",
"@polkadot/trie-hash": "^0.27.0",
"@polkadot/util": "^0.27.0",
"@polkadot/util-crypto": "^0.27.0",
"@polkadot/util-rlp": "^0.27.0",
"@types/async": "^2.0.49",
"@types/semaphore": "^1.1.0",
"async": "^1.4.2",
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/trie-hash",
"version": "0.26.36",
"version": "0.27.0",
"description": "Creation of triehash values",
"main": "index.js",
"keywords": [
@@ -34,8 +34,8 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/util": "^0.26.36",
"@polkadot/util-crypto": "^0.26.36",
"@polkadot/util-rlp": "^0.26.36"
"@polkadot/util": "^0.27.0",
"@polkadot/util-crypto": "^0.27.0",
"@polkadot/util-rlp": "^0.27.0"
}
}
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/extrinsics",
"version": "0.26.36",
"version": "0.27.0",
"main": "index.js",
"repository": "https://github.com/polkadot-js/apps.git",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -16,8 +16,8 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/params": "^0.26.36",
"@polkadot/primitives": "^0.26.36",
"@polkadot/util": "^0.26.36"
"@polkadot/params": "^0.27.0",
"@polkadot/primitives": "^0.27.0",
"@polkadot/util": "^0.27.0"
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/jsonrpc",
"version": "0.26.36",
"version": "0.27.0",
"description": "Method definitions for the Polkadot RPC layer",
"main": "index.js",
"engines": {
@@ -34,7 +34,7 @@
"test": "echo \"Tests only available from root wrapper\""
},
"dependencies": {
"@polkadot/params": "^0.26.36",
"@polkadot/params": "^0.27.0",
"babel-runtime": "^6.26.0"
}
}
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/params",
"version": "0.26.36",
"version": "0.27.0",
"description": "Type defintions for parameters as passed in calls",
"main": "index.js",
"engines": {
@@ -34,8 +34,8 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/extrinsics": "^0.26.36",
"@polkadot/primitives": "^0.26.36",
"@polkadot/util": "^0.26.36"
"@polkadot/extrinsics": "^0.27.0",
"@polkadot/primitives": "^0.27.0",
"@polkadot/util": "^0.27.0"
}
}
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/primitives",
"version": "0.26.36",
"version": "0.27.0",
"description": "Type defintions for the Polkadot network",
"main": "index.js",
"engines": {
@@ -34,8 +34,8 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/trie-hash": "^0.26.36",
"@polkadot/util": "^0.26.36"
"@polkadot/trie-hash": "^0.27.0",
"@polkadot/util": "^0.27.0"
},
"devDependencies": {
"bn.js": "^4.11.8"
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/storage",
"version": "0.26.36",
"version": "0.27.0",
"description": "Generic wrapper wrapper around state storage",
"main": "index.js",
"engines": {
@@ -35,10 +35,10 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/params": "^0.26.36",
"@polkadot/primitives": "^0.26.36",
"@polkadot/util": "^0.26.36",
"@polkadot/util-crypto": "^0.26.36",
"@polkadot/util-keyring": "^0.26.36"
"@polkadot/params": "^0.27.0",
"@polkadot/primitives": "^0.27.0",
"@polkadot/util": "^0.27.0",
"@polkadot/util-crypto": "^0.27.0",
"@polkadot/util-keyring": "^0.27.0"
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/util-crypto",
"version": "0.26.36",
"version": "0.27.0",
"description": "A collection of useful crypto utilities for @polkadot",
"main": "index.js",
"keywords": [
@@ -34,7 +34,7 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/util": "^0.26.36",
"@polkadot/util": "^0.27.0",
"blakejs": "^1.1.0",
"js-sha3": "^0.7.0",
"tweetnacl": "^1.0.0",
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/util-keyring",
"version": "0.26.36",
"version": "0.27.0",
"description": "Keyring management",
"main": "index.js",
"engines": {
@@ -36,8 +36,8 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/util": "^0.26.36",
"@polkadot/util-crypto": "^0.26.36",
"@polkadot/util": "^0.27.0",
"@polkadot/util-crypto": "^0.27.0",
"@types/bs58": "^3.0.30",
"bs58": "^4.0.1"
}
+4 -1
View File
@@ -36,8 +36,11 @@ export default function pair ({ publicKey, secretKey }: KeypairType, meta: Keyri
encode(secretKey, passphrase),
getMeta: (): KeyringPair$Meta =>
getMeta(state),
hasSecretKey: (): boolean =>
isLocked: (): boolean =>
!!(secretKey && secretKey.length !== 0),
lock: (): void => {
secretKey = new Uint8Array(0);
},
publicKey: (): Uint8Array =>
publicKey,
setMeta: (meta: KeyringPair$Meta): void =>
+4 -1
View File
@@ -32,8 +32,11 @@ export default function everybody (): KeyringPair {
new Uint8Array(0),
getMeta: (): KeyringPair$Meta =>
meta,
hasSecretKey: (): boolean =>
isLocked: (): boolean =>
true,
lock: (): void => {
// no locking, it is always locked
},
publicKey: (): Uint8Array =>
publicKey,
setMeta: (meta: KeyringPair$Meta): void =>
+5 -1
View File
@@ -38,10 +38,14 @@ export default function testKeyring (): KeyringInstance {
Object
.keys(SEEDS)
.forEach((name) => {
keyring.addFromSeed(SEEDS[name], {
const pair = keyring.addFromSeed(SEEDS[name], {
isTesting: true,
name
});
pair.lock = () => {
// we don't have lock/unlock functionality here
};
});
return keyring;
+2 -1
View File
@@ -22,7 +22,8 @@ export type KeyringPair = {
decodePkcs8: (passphrase?: string, encoded?: Uint8Array) => void,
encodePkcs8: (passphrase?: string) => Uint8Array,
getMeta: () => KeyringPair$Meta,
hasSecretKey: () => boolean,
isLocked: () => boolean,
lock: () => void,
publicKey: () => Uint8Array,
setMeta: (meta: KeyringPair$Meta) => void,
sign (message: Uint8Array): Uint8Array,
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/util-rlp",
"version": "0.26.36",
"version": "0.27.0",
"description": "RLP encoding and decoding",
"main": "index.js",
"keywords": [
@@ -36,7 +36,7 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.51",
"@polkadot/util": "^0.26.36"
"@polkadot/util": "^0.27.0"
},
"devDependencies": {
"ethereumjs-testing": "^1.0.4"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/util",
"version": "0.26.36",
"version": "0.27.0",
"description": "A collection of useful utilities for @polkadot",
"main": "index.js",
"keywords": [