mirror of
https://github.com/bigchaindb/js-bigchaindb-driver.git
synced 2024-12-29 08:07:51 +01:00
cc2 ed25519 condition creation
This commit is contained in:
parent
f6be556317
commit
07e6584cf4
@ -59,7 +59,7 @@
|
||||
"decamelize": "^1.2.0",
|
||||
"es6-promise": "^4.0.5",
|
||||
"fetch-ponyfill": "^4.0.0",
|
||||
"five-bells-condition": "3.3.1",
|
||||
"five-bells-condition": "^5.0.1",
|
||||
"isomorphic-fetch": "^2.2.1",
|
||||
"js-sha3": "^0.5.7",
|
||||
"js-utility-belt": "^1.5.0",
|
||||
|
@ -16,7 +16,7 @@ import ccJsonify from './utils/ccJsonify'
|
||||
export default function makeEd25519Condition(publicKey, json = true) {
|
||||
const publicKeyBuffer = new Buffer(base58.decode(publicKey))
|
||||
|
||||
const ed25519Fulfillment = new cc.Ed25519()
|
||||
const ed25519Fulfillment = new cc.Ed25519Sha256()
|
||||
ed25519Fulfillment.setPublicKey(publicKeyBuffer)
|
||||
|
||||
if (json) {
|
||||
|
15
test/test.js
15
test/test.js
@ -28,3 +28,18 @@ test('Valid CREATE transaction is evaluated by BigchainDB', t => {
|
||||
.then(resTx => t.truthy(resTx))
|
||||
})
|
||||
|
||||
test('Ed25519 condition correctly formed', t => {
|
||||
const publicKey = '4zvwRjXUKGfvwnParsHAS3HuSVzV5cA4McphgmoCtajS'
|
||||
const output = Transaction.makeOutput(Transaction.makeEd25519Condition(publicKey))
|
||||
const target = {
|
||||
details: {
|
||||
type_id: 4,
|
||||
bitmask: 32,
|
||||
signature: null,
|
||||
public_key: publicKey,
|
||||
type: 'fulfillment'
|
||||
},
|
||||
uri: 'ni:///sha-256;uLdVX7FEjLWVDkAkfMAkEqPPwFqZj7qfiGE152t_x5c?fpt=ed25519-sha-256&cost=131072'
|
||||
}
|
||||
t.deepEqual(target, output.condition)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user