mirror of
https://github.com/bigchaindb/js-bigchaindb-driver.git
synced 2024-12-28 15:47:50 +01:00
remove signature in details and rename subfulfillments to subconditions
This commit is contained in:
parent
49c91a0916
commit
529c18a753
@ -17,7 +17,7 @@ export default function makeOutput(condition, amount = '1') {
|
||||
publicKeys.push(details.public_key)
|
||||
}
|
||||
} else if (details.type === 'threshold-sha-256') {
|
||||
details.subfulfillments.map(getPublicKeys)
|
||||
details.subconditions.map(getPublicKeys)
|
||||
}
|
||||
}
|
||||
getPublicKeys(condition.details)
|
||||
|
@ -22,12 +22,12 @@ export default function ccJsonLoad(conditionJson) {
|
||||
if (conditionJson.type === 'threshold-sha-256') {
|
||||
fulfillment = new cc.ThresholdSha256()
|
||||
fulfillment.threshold = conditionJson.threshold
|
||||
conditionJson.subfulfillments.forEach((subfulfillmentJson) => {
|
||||
const subfulfillment = ccJsonLoad(subfulfillmentJson)
|
||||
if ('getConditionUri' in subfulfillment) {
|
||||
fulfillment.addSubfulfillment(subfulfillment)
|
||||
} else if ('serializeUri' in subfulfillment) {
|
||||
fulfillment.addSubcondition(subfulfillment)
|
||||
conditionJson.subconditions.forEach((subconditionJson) => {
|
||||
const subcondition = ccJsonLoad(subconditionJson)
|
||||
if ('getConditionUri' in subcondition) {
|
||||
fulfillment.addSubfulfillment(subcondition)
|
||||
} else if ('serializeUri' in subcondition) {
|
||||
fulfillment.addSubcondition(subcondition)
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -35,9 +35,6 @@ export default function ccJsonLoad(conditionJson) {
|
||||
if (conditionJson.type === 'ed25519-sha-256') {
|
||||
fulfillment = new cc.Ed25519Sha256()
|
||||
fulfillment.publicKey = new Buffer(base58.decode(conditionJson.public_key))
|
||||
if (conditionJson.signature) {
|
||||
fulfillment.signature = new Buffer(base58.decode(conditionJson.signature))
|
||||
}
|
||||
}
|
||||
return fulfillment
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ export default function ccJsonify(fulfillment) {
|
||||
'details': {
|
||||
'type': 'threshold-sha-256',
|
||||
'threshold': fulfillment.threshold,
|
||||
'subfulfillments': fulfillment.subconditions.map((subcondition) => {
|
||||
'subconditions': fulfillment.subconditions.map((subcondition) => {
|
||||
const subconditionJson = ccJsonify(subcondition.body)
|
||||
return subconditionJson.details
|
||||
})
|
||||
@ -48,7 +48,6 @@ export default function ccJsonify(fulfillment) {
|
||||
jsonBody.details.type = 'ed25519-sha-256'
|
||||
|
||||
if ('publicKey' in fulfillment) {
|
||||
jsonBody.details.signature = null
|
||||
jsonBody.details.public_key = base58.encode(fulfillment.publicKey)
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ test('Ed25519 condition encoding', t => {
|
||||
details: {
|
||||
type: 'ed25519-sha-256',
|
||||
public_key: publicKey,
|
||||
signature: null,
|
||||
},
|
||||
uri: 'ni:///sha-256;uLdVX7FEjLWVDkAkfMAkEqPPwFqZj7qfiGE152t_x5c?fpt=ed25519-sha-256&cost=131072'
|
||||
}
|
||||
@ -28,16 +27,14 @@ test('Threshold condition encoding', t => {
|
||||
details: {
|
||||
type: 'threshold-sha-256',
|
||||
threshold: 1,
|
||||
subfulfillments: [
|
||||
subconditions: [
|
||||
{
|
||||
type: 'ed25519-sha-256',
|
||||
public_key: publicKey,
|
||||
signature: null,
|
||||
},
|
||||
{
|
||||
type: 'ed25519-sha-256',
|
||||
public_key: publicKey,
|
||||
signature: null,
|
||||
}
|
||||
]
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user