W3C home > Mailing lists > Public > public-interledger@w3.org > November 2016

Re: Prefix Conditions

From: Stefan Thomas <stefan@ripple.com>
Date: Tue, 29 Nov 2016 18:24:21 +0000
Message-ID: <CAFpK0Q1qJKhhOpLT=6jqRWzbiaO4vQRX4034KFzji9ewHCbX4w@mail.gmail.com>
To: Andrew Bransford Brown <andrewbb@gmail.com>, Javier Romero <elmurci@gmail.com>
Cc: Interledger Community Group <public-interledger@w3.org>
Hey Javier,

The code you posted looks correct to me and the example you posted
validates for me:

>
cc.validateFulfillment('cf:1:EnsgInZhbHVlIjogMTIuOTkgfQAEYOwXK5OtXlY79JMscOEkUDTDVGfvLv1NZOv4GWg0Z-K_cn3fkbV_PzfYu9p1H7sVCGumRD4yupCF1LBINyBuSaB4tumYfz-bSB1PE006XF8rdW4dO5ZQ2KvsccW2SAz8Cg',
'cc:1:25:kh7u0e_LzueXf_YyKCU_6b9AdkrWyDLghpt7odcp4p4:115')
true

Can you share the code you're using to validate? Note that the prefix
condition *adds* the prefix to the message for all subconditions below it,
so you would want to validate against the empty string. In the JS library
you can do that by just leaving out the message parameter.

The reason it works this way is so that you can have different prefixes in
different parts of the tree as well as prefixes that add on top of each
other. In other words, it enables composability.

> Buffer and Serialize are NOT financial or legal terms.

It might be worth mentioning that crypto-conditions are just a standard way
of doing composable cryptography (primarily complex multi-sig.) You could
use them anywhere that you would use a signature scheme, for example as a
way to authenticate HTTP requests. So they're a neutral technology and not
specific to financial or legal use cases.

That said, I do think that the interface is still very rough, so we should
seriously review it at some point.

On Tue, Nov 29, 2016 at 8:40 AM Andrew Bransford Brown <andrewbb@gmail.com>
wrote:

> The interface appears functional, however, needs serious review.
>
> Buffer and Serialize are NOT financial or legal terms.
>
> Andrew B. Brown
> (512) 947-8282
> http://KidsCourtyard.com
>
>
> On Tue, Nov 29, 2016 at 11:20 AM, Javier Romero <elmurci@gmail.com> wrote:
>
> Hi guys,
>
> I am trying to embed a message (*e.g. {"id": "the_id", "value": 0.98,
> "description": "the description}*) in the condition through a Prefix
> Condition.
>
> I create the condition this way:
>
>
> const sender_fulfillment = new cc.Ed25519()
> // Set public_key
> sender_fulfillment.setPublicKey(new Buffer(pubKey, 'hex'))
> // Prefix
> const prefix = new cc.PrefixSha256()
> prefix.setPrefix(message)
> prefix.setSubfulfillment(sender_fulfillment)
> // Condition
> const condition = prefix.getConditionUri()
>
> And try to fulfil it like this:
>
> const receiver_fulfillment = new cc.Ed25519()
> receiver_fulfillment.setPublicKey(pubKey)
> const condition = receiver_fulfillment.getConditionUri()
> receiver_fulfillment.sign(message, seed)
> const prefix = new cc.PrefixSha256()
> prefix.setPrefix(message)
> prefix.setSubfulfillment(receiver_fulfillment)
> const fulfillment = prefix.serializeUri()
>
>
> These are the outputs:
>
>
> *Condition:* cc:1:25:kh7u0e_LzueXf_YyKCU_6b9AdkrWyDLghpt7odcp4p4:115
>
>
> *Fulfilment:*
> cf:1:EnsgInZhbHVlIjogMTIuOTkgfQAEYOwXK5OtXlY79JMscOEkUDTDVGfvLv1NZOv4GWg0Z-K_cn3fkbV_PzfYu9p1H7sVCGumRD4yupCF1LBINyBuSaB4tumYfz-bSB1PE006XF8rdW4dO5ZQ2KvsccW2SAz8Cg
>
>
> However, I am getting the below error when trying to validate it:
>
>
> ValidationError: Invalid ed25519 signature
>
>
>
> gist: https://gist.github.com/elmurci/d3322fe3798335bac0aa6315349b4447
>
>
> Any ideas?
>
>
>
Received on Tuesday, 29 November 2016 18:25:09 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 29 November 2016 18:25:10 UTC