Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Chain/CurveType.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

description: |
CurveType is the type of cryptographic curve associated with a PublicKey.
CurveType is the type of cryptographic curve associated with a PublicKey.

* secp256k1: SEC compressed - `33 bytes` (https://secg.org/sec1-v2.pdf#subsubsection.2.3.3)
* edwards25519: `y (255-bits) || x-sign-bit (1-bit)` - `32 bytes` (https://ed25519.cr.yp.to/ed25519-20110926.pdf)
Expand Down
39 changes: 21 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ Trades & Orders -->

# Protocol Spec

For ABNF specs, [see the `spec_abnf` dir](https://github.com/freight-trust/protocol/tree/master/spec_abnf/abnf)
For ABNF specs,
[see the `spec_abnf` dir](https://github.com/freight-trust/protocol/tree/master/spec_abnf/abnf)

- directories with `spec_*` are the reference specification
- directories with `lib` or `module`/`component` _should_ be the technical implementation
- directories with `lib` or `module`/`component` _should_ be the technical
implementation

### Interfaces

<img src="service-mesh.png"
alt="Freight Trust Network Interface"
style="float: left; margin-right: 10px;" />
<br />
style="float: left; margin-right: 10px;" /> <br />

### Documents of Trade

Expand All @@ -45,27 +46,29 @@ For ABNF specs, [see the `spec_abnf` dir](https://github.com/freight-trust/proto
- Units of Efferent
- Units of Lexigram

* Controlled Natural Language = Jurisdictional Grammar (see [Burgess](https://github.com/freight-trust/burgess) )
* Controlled Natural Language = Jurisdictional Grammar (see
[Burgess](https://github.com/freight-trust/burgess) )
* Afferent = Towards
* Efferent = Away

## Blocks as `units of agreement`

A couple of specific block linkages are stated as facts. Two general principles of block chaining based on such linkages are stated as "conclusion if condition" rules. (The diagrams' color coding is extended to the symbolic form by using green for facts and their rule-condition counterparts while using red for rule conclusions and their -- recursive -- rule-condition counterpart.)
A couple of specific block linkages are stated as facts. Two general principles
of block chaining based on such linkages are stated as "conclusion if condition"
rules. (The diagrams' color coding is extended to the symbolic form by using
green for facts and their rule-condition counterparts while using red for rule
conclusions and their -- recursive -- rule-condition counterpart.)

Facts
"Block1 links to Block2."
"Block2 links to Block3."
Rules
"x chains to y if x links to y."
"x chains to z if x links to y and y chains to z."
Facts "Block1 links to Block2." "Block2 links to Block3." Rules "x chains to y
if x links to y." "x chains to z if x links to y and y chains to z."

Facts are _primitives_ (i.e. not containing variables) that apply
a predicate to arguments
Facts are _primitives_ (i.e. not containing variables) that apply a predicate to
arguments

to Block1 followed by Block2 and
to Block2 followed by Block3
to Block1 followed by Block2 and to Block2 followed by Block3

Rules are of the form `conclusion :- condition` (i.e. containing variables), with the Prolog-like (symbol) infix `":-"` corresponding to the above "if".
Rules are of the form `conclusion :- condition` (i.e. containing variables),
with the Prolog-like (symbol) infix `":-"` corresponding to the above "if".

This consittutes the extent of which RuleML is applied to the `TradeDocs` system, a basic primitive set for `rule-conditions`
This consittutes the extent of which RuleML is applied to the `TradeDocs`
system, a basic primitive set for `rule-conditions`
2 changes: 0 additions & 2 deletions ROOT/LoadContactInfo.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
"Loop_G61_204": "LoadContactInfo",

"class": {
"L11": "List",
"Item": "G61",

"G61": {
"Name": "G61.Name_02",
"CommunicationNumberQualifier": "G61.CommunicationNumberQualifier_03",
Expand Down
2 changes: 0 additions & 2 deletions ROOT/SpecialServicesCode.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"type": "object",

"properties": {
"SpecialServicesCode": {
"D1": "One - Day Service",
Expand All @@ -15,7 +14,6 @@
"ZZ": "Mutually Defined"
},
"required": ["SpecialServicesCode"],

"dependencies": {
"": [""]
}
Expand Down
26 changes: 15 additions & 11 deletions bin/pem.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ async function run() {
let publicpem = fs.readFileSync("./device.crt", "utf8");
let publickey = await keystore.add(publicpem, "pem");

// we need the public key chain in x5c header. x5c header chain will be used during
// decode, a full cert can be provided to ensure validation all the way to root
// we need the public key chain in x5c header. x5c header chain will be used
// during decode, a full cert can be provided to ensure validation all the
// way to root
// https://tools.ietf.org/html/draft-ietf-jose-json-web-key-41#page-9
// unfortunately we can't just use plain jwk, since jwk is only the *key* and not the
// full *certificate*, so ... x5c it is
// unfortunately we can't just use plain jwk, since jwk is only the *key*
// and not the full *certificate*, so ... x5c it is
let x5cChain = cert_to_x5c(publicpem);

// the message body
Expand All @@ -35,7 +36,8 @@ async function run() {
// and signing options
let signoptions = { fields: { x5c: x5cChain } };

// sign 'message' with the 'privatekey', include the 'x5c' chain in the headers
// sign 'message' with the 'privatekey', include the 'x5c' chain in the
// headers
let signed = await jose.JWS.createSign(signoptions, privatekey)
.update(message, "utf8")
.final();
Expand All @@ -45,7 +47,8 @@ async function run() {

console.log("//////////////////////////////");

// a quick sanity check - the cisco/node-jose lib provides x5c verification fortunately
// a quick sanity check - the cisco/node-jose lib provides x5c verification
// fortunately
let result = await jose.JWS.createVerify().verify(signed);
console.log(JSON.parse(result.payload));

Expand All @@ -61,10 +64,10 @@ async function run() {
console.log("message expiry valid");
}

// and .. it doesn't do the full x509 cert verification, it just checks that the
// key from the first cert in the x5c header can verify the payload so now, we
// need to shell out to openssl to verify that the provided key was signed by the CA
// why oh why is there nothing native for this
// and .. it doesn't do the full x509 cert verification, it just checks that
// the key from the first cert in the x5c header can verify the payload so
// now, we need to shell out to openssl to verify that the provided key was
// signed by the CA why oh why is there nothing native for this
let cert = await x5c_to_cert(result.header.x5c);

// load the CA
Expand Down Expand Up @@ -100,7 +103,8 @@ function cert_to_x5c(cert, maxdepth) {
}
/*
* Convert a PEM-encoded certificate to the version used in the x5c element
* of a [JSON Web Key](http://tools.ietf.org/html/draft-ietf-jose-json-web-key).
* of a [JSON Web
* Key](http://tools.ietf.org/html/draft-ietf-jose-json-web-key).
*
* `cert` PEM-encoded certificate chain
* `maxdepth` The maximum number of certificates to use from the chain.
Expand Down
2 changes: 1 addition & 1 deletion docs/staking/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1873,7 +1873,7 @@ <h3 id="Roadmap" data-id="Roadmap">
>
</li>
</ul>
<pre><code>TradeDocs Form Generator
<pre><code>TradeDocs Form Generator
</code></pre>
<h2 id="TradeDocs-FormGen" data-id="TradeDocs-FormGen">
<a
Expand Down
14 changes: 9 additions & 5 deletions etc/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# LEI Informative

curl --request GET 'https://leilookup.gleif.org/api/v2/leirecords?lei=254900C9UJMDGJ0ILK56' --header 'Content-Type: application/json' --data-raw '[]'
curl --request GET
'https://leilookup.gleif.org/api/v2/leirecords?lei=254900C9UJMDGJ0ILK56'
--header 'Content-Type: application/json' --data-raw '[]'

```json
[
Expand Down Expand Up @@ -132,16 +134,18 @@ freighttrust.com. IN CAA 0 issue "sectigo.com"

parse lei.bloomberg.com

search for... `<div ng-if="leiViewerData" class="ng-scope"><json-viewer data="leiViewerData" class="ng-isolate-scope">`
search for...
`<div ng-if="leiViewerData" class="ng-scope"><json-viewer data="leiViewerData" class="ng-isolate-scope">`

let HashingOutput = Base64URL( Multihash(DATA, 'sha2-256') );

### terms

`credentials`: [source](https://www.w3.org/TR/vc-data-model/#dfn-verifiable-credentials)
`credentials`:
[source](https://www.w3.org/TR/vc-data-model/#dfn-verifiable-credentials)

`derived predicate`
A verifiable, boolean assertion about the value of another attribute in a verifiable credential.
`derived predicate` A verifiable, boolean assertion about the value of another
attribute in a verifiable credential.

## Minimal DID

Expand Down
14 changes: 9 additions & 5 deletions etc/lei/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# LEI Informative

curl --request GET 'https://leilookup.gleif.org/api/v2/leirecords?lei=254900C9UJMDGJ0ILK56' --header 'Content-Type: application/json' --data-raw '[]'
curl --request GET
'https://leilookup.gleif.org/api/v2/leirecords?lei=254900C9UJMDGJ0ILK56'
--header 'Content-Type: application/json' --data-raw '[]'

```json
[
Expand Down Expand Up @@ -132,16 +134,18 @@ freighttrust.com. IN CAA 0 issue "sectigo.com"

parse lei.bloomberg.com

search for... `<div ng-if="leiViewerData" class="ng-scope"><json-viewer data="leiViewerData" class="ng-isolate-scope">`
search for...
`<div ng-if="leiViewerData" class="ng-scope"><json-viewer data="leiViewerData" class="ng-isolate-scope">`

let HashingOutput = Base64URL( Multihash(DATA, 'sha2-256') );

### terms

`credentials`: [source](https://www.w3.org/TR/vc-data-model/#dfn-verifiable-credentials)
`credentials`:
[source](https://www.w3.org/TR/vc-data-model/#dfn-verifiable-credentials)

`derived predicate`
A verifiable, boolean assertion about the value of another attribute in a verifiable credential.
`derived predicate` A verifiable, boolean assertion about the value of another
attribute in a verifiable credential.

## Minimal DID

Expand Down
2 changes: 1 addition & 1 deletion protocol/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion protocol/server.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import MoleServer from "mole-rpc/MoleServer";
import TransportServerWSS from "mole-rpc-transport-ws/TransportServerWSS";
import MoleServer from "mole-rpc/MoleServer";
import { Server } from "ws";

const WSS_PORT = 12345;

function sum(a, b) {
Expand Down
14 changes: 7 additions & 7 deletions protocol/validate-document.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ const enumMap = require("./enummap");

let map = new enumMap();

//Create a new validator
// Create a new validator
let validator = new edi.EDIValidator();

//While validating also load the data in memory
// While validating also load the data in memory
validator.LoadValidatedData = true;

//Load a 5010 validation rules
// Load a 5010 validation rules
let validationRules = fs
.readFileSync("../../Validation Rules/5010/Rules_5010")
.toString();

validator.EDIRulesFileData = validationRules;

//Set the EDI data to validate and load. This can also be read in from a file
// Set the EDI data to validate and load. This can also be read in from a file
validator.EDIDataString =
"ISA*00*..........*01*SECRET....*ZZ*SUBMITTERS.ID..*ZZ*RECEIVERS.ID...*030101*1253*^*00501*000000905*1*T*:~" +
"GS*Hk*SENDER CODE*RECEIVERCODE*19991231*0802*1*X*005010X279A1~" +
Expand All @@ -41,16 +41,16 @@ console.log("Validating 5010 EDI Files");
validator.validate();

console.log("Errors Found");
//Get all errors from the EDI data
// Get all errors from the EDI data
for (let i = 0; i < validator.Errors.Count; i++) {
let error = validator.Errors.getItem(i);

console.log({
Type: "Error",
Line: error.LineNumber,
Transaction: "",
SnipLevel: map.SnipLevelTypes[error.SnipLevel], //SnipTestLevel Enum
Message: map.MessageTypes[error.Message], //EDIValidationMessage Enum
SnipLevel: map.SnipLevelTypes[error.SnipLevel], // SnipTestLevel Enum
Message: map.MessageTypes[error.Message], // EDIValidationMessage Enum
Loop: error.Loop,
Segment: error.Segment,
Element: error.ElementOrdinal,
Expand Down
12 changes: 8 additions & 4 deletions smart_contracts/era.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@

**Parameters:**

- \_domainHash `uint256`: _Keccak256 message digest of the domain to add or update._
- \_domainAuthority `address`: _Contract to resolve sub-domains. This contract must implement this interface._
- \_domainInfo `address`: _Contract which holds domain information for the domain name identified by_
- \_domainOwner `address`: _Account entitled to update the \_domainAuthority or the \_domainInfo address for this domain_
- \_domainHash `uint256`: _Keccak256 message digest of the domain to add or
update._
- \_domainAuthority `address`: _Contract to resolve sub-domains. This contract
must implement this interface._
- \_domainInfo `address`: _Contract which holds domain information for the
domain name identified by_
- \_domainOwner `address`: _Account entitled to update the \_domainAuthority or
the \_domainInfo address for this domain_

## removeDomain

Expand Down
Loading