Unverified Commit 7936b21c authored by Justin Welch's avatar Justin Welch Committed by GitHub

Merge pull request #104 from steemit/allow-active-image-upload

Allow uploading image with signature from active key
parents 875ccbc4 d594d6af
......@@ -125,9 +125,17 @@ export async function uploadHandler(ctx: KoaContext) {
throw new APIError({code: APIError.Code.InvalidSignature, cause})
}
const threshold = account.posting.weight_threshold
const thresholdPosting = account.posting.weight_threshold
for (const auth of account.posting.key_auths) {
if (auth[0] === publicKey && auth[1] >= threshold) {
if (auth[0] === publicKey && auth[1] >= thresholdPosting) {
validSignature = true
break
}
}
const thresholdActive = account.active.weight_threshold
for (const auth of account.active.key_auths) {
if (auth[0] === publicKey && auth[1] >= thresholdActive) {
validSignature = true
break
}
......
......@@ -17,6 +17,11 @@ export const mockAccounts: any = {
weight_threshold: 1,
account_auths: [],
key_auths: [[testKeys.foo.createPublic().toString(), 1]]
},
active: {
weight_threshold: 1,
account_auths: [],
key_auths: [[testKeys.foo.createPublic().toString(), 1]]
}
},
bar: {
......@@ -26,6 +31,11 @@ export const mockAccounts: any = {
weight_threshold: 1,
account_auths: [],
key_auths: [[testKeys.bar.createPublic().toString(), 1]]
},
active: {
weight_threshold: 1,
account_auths: [],
key_auths: [[testKeys.foo.createPublic().toString(), 1]]
}
}
}
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment