5.10.97 • Published 1 year ago

@diotoborg/quas-quo v5.10.97

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

code style | standard

          _
 _ . _  _|__  _  _|
|_)|(_(_)|(/_(/_(_| v5
|

Space Efficient Chain of Blocks

  • Flat memory layout / zero copy access
  • Single dependency EdDSA
  • Fast & compact Curve25519 + Ed25519 signatures
  • Pure ES6 (+JSDoc Type annotations)
  • ~450LOC / +41.3kB bundle size
  • Test Coverage 💯
  • Uint8Arrays (no node:buffer or bn.js)

Intro

Imagine git as a jar, then using pliers pull out a branch. That single detached branch is synonymous with one @diotoborg/quas-quo - a memorybuffer containing cryptographically signed blocks:

|------|-----|------------------|----------------------|
| PiC0 | Key | Block 0: "hello" | Block 1: "picoverse" |
| 4B   | 33B |    71 Bytes      |     138 Bytes        |
|------|-----|------------------|----------------------|

This library provides a high level API to append, slice and merge such feeds - block contents is upto application.

Picofeeds have so far been observed within:

  • QR-Codes (out-of-band-signaling)
  • URLs (cross-messenger / platform-as-a-public-database)
  • DNS-Records (webhosting)

We target user devices, this module is the basic building block for the frontend-blockchain-toolkit picostack

discord

Install

yarn add @diotoborg/quas-quo
# or
npm install @diotoborg/quas-quo

Usage

import { Feed, toHex } from '@diotoborg/quas-quo'

const { pk: publicKey, sk: secret } = Feed.signPair()

const feed = new Feed()

feed.append('Hello', secret) // => height 1
feed.blocks[0].body // => 'Hello'
feed.blocks[0].blockSize // => 72 bytes

const verifiableData = feed.buffer

// -- Share buffer anyhow --

const remoteFeed = Feed.from(verifiableData) // Verifies signatures

remoteFeed.blocks[0].body // => 'Hello'

toHex(remoteFeed.blocks[0].key) === alice.pk // true

Changelog

5.0.1

  • phat-bit replaced with varint
  • changed secp256k1 in favour of Ed25519
  • fixed merge() bug
  • removed u8n util

4.x

  • signPair() returns hexstring keys
  • sk.slice(32) no longer works, use getPublicKey(sk)
  • block.parentSig renamed to block.psig
  • block.isGenesis renamed to block.genesis
  • feed.get(n) renamed to feed.block(n)
  • feed.blocks() removed in favour of feed.blocks
  • feed.pickle() removed until further notice.
  • feed.fromBlocksArray() incorporated into feedFrom() / Feed.from()
  • Not backwards compatible with 3.x feeds

3.4.0

  • updated README.md
  • added Feed.fromBlocksArray(Block[]) to perform bulk-merge, 24x perf increase compared to Feed.merge(block)
  • removed Feed subclassing/metaprogramming support, it was fun but footgun (don't solve problems by subclassing Feed).

3.3.0

  • added Feed.first
  • added Feed.get(-3) as equivalent of f.get(f.length - 3)
  • added Block.isGenesis getter
  • added static Feed.KEY_SIZE constant
  • replaced hardcoded key-size lenghts with KEY_SIZE constant

3.2.2

  • optimization feed._steal() also steals cache

3.2.1

  • fixed bug feed._steal(other) causing cache corruption
  • changed return value of feed.inspect() is now conditional
  • fixed bug where A < B; A.merge(B, withCallback) did not merge
  • fixed bug where keychain cache contained boatloads of duplicate keys

3.1.0

  • added feed.merge(block) support

3.0.0

  • removed automatic encodings
  • changed feed.get(n) returns instance of BlockMapper.
  • changed feed.slice(start, end)
  • added block cache to avoid redundant signature-verifications
  • added BlockMapper now also contains public-key
  • sodium-universal upgraded to 3.0.0

2.2.0

  • Added feed.merge(other, opts, indexingCallback) that allows validation + abort merge interactively
  • Added feed.last which returns the block-contents using provided encoding.

2.0.0

  • Added feed slices and merge

License

AGPL-3.0-or-later

2020-2023 🄯 Tony Ivanov

ArrayBufferreact animation.envespreegroupdeepcopyrangeerrorfixed-widthminimalweaksetremoveoutputbootstrap cssargsperformanceurlgetlocalcloudwatchpluginoptionstylingnpmpostcss-pluginvisuallocationauthenticationlruwindowendpointconsoleObject.fromEntriesReactiveXtoStringTagmacosframermapdataObservablesnamesidentifiersreduxjavascriptserializerbinariesStreamsharmonyBigInt64ArraygenericsisConcatSpreadablevaluesCSSStyleDeclarationemrflagsqssyntaxerrorString.prototype.trimstringifynegative zeropnpm9jsxpushback-endsymbolObject.valuesfpsprotobuffilterRxlengthECMAScript 2018s3performantdescriptorsecmascriptObject.assignasserts0filemakefigletes6iterationconfigurableworkspace:*serverfantasy-landtstimewaapi@@toStringTagstylesheetobjectimportexportBigUint64ArrayRegExp.prototype.flagswafsortedArray.prototype.findLastIndexenvironmentskinesisexit-coderoutingprotoscheme-validationserializefullwidthrgbchinesemomentES3deeppromisefpformatnumbertelephonepersistentspeedECMAScript 2020user-streamsjson-schema-validatorflatbundlerpreserve-symlinksglacierfast-deep-clonefast-clonethreesameValueZeroowncall-boundcompile lessuploadcurriedcommanderparsersubprocessreact-testing-librarycertificatesasterisksgradients csscolumnsECMAScript 2017groupByObjectelmassertstringifierbyteLengthsharedarraybuffereslintconfigFloat64ArraypipesomeincludesSystem.globalcolumnchromiumspinnersjson-schema-validationECMAScript 2023starterresolvecharacterenvimmerboundisECMAScript 6eslintpluginquerystringxtermES2015Uint8Arrayrdses-shimsless mixinsmockqueryES2017fssignedespackagesObject.definePropertysymbolsform-validationes2017xhrtoobjectselfpureUint8ClampedArraydom-testing-librarycrypthelpersettingsES2022snsrequestoperating-systemastinvariantpropertiestypedarrayscss variableObject.keyspopmotionsharedcommandsortdomESnextlesses7wgetprocesslivefunctionvpchookshttpreducerarktypesymlinksreact-hook-formES8ECMAScript 3formmonorepoutilitiesTypeBoxconfigjestECMAScriptposevardeletecjkspecawsinputtypedarrayelasticachetc39airbnbshamauthredactdeep-cloneloggerrouteserializationhandlerreadajaxpyyamlnodejserror-handlingArray.prototype.containsjapanesefull-widthtrimInt16ArrayarraysESlesscssexpressobjmergecopyunicodeES2023validcss nestingECMAScript 2019sequenceshellyamlrandomgdprinternal slotbeanstalkRxJSassignflagemitglobalstypedPromisetostringtagloadingrulesdirio-tstestingcloudformationansiuninstalljQuerydescriptorflatMapdefineProperty6to5takefromeast-asian-widthchromeeslint-pluginargumentWeakSetphonecollectionsigintelbinoptimizerbundlingCSSMicrosoftconstrobustreducevestjsdiff$.extendchaidescriptionhasOwncalltypeofiteratecurlfunctionalreact posegettersafeequal[[Prototype]]metadatapatchES2019varsspringschemacontainscompareletwaitclassesSymbolinferencecoredateECMAScript 7css-in-jsconcatMappackage.jsonArray.prototype.findLastaccessibilitydragcachecreatejoiIteratorfullclass-validatortermequalityshebangweakmaputilityHyBihotoptimistSetpinoObservablefunction.lengthlastenvironmentmobilevalueECMAScript 5command-linerecursiveprogressautoprefixercss lesswhatwgless.jsWebSockettextArrayBuffer.prototype.slicetransportbinzeromake dirbrowserslistasciies-shim APIformattingarraybuffer__proto__validatestylefastwhichlinklogginglazyprettylintnested cssdefineclipredictableTypedArrayvariables in csscolorsforkyupeffect-tsJSONdeep-copyYAMLreal-timees5Int32Arraywarningconsumestatustacitdirectorybrowserlistreadableimporthaslanguagetslibdotenvregexppathprivate datadeterministicsuperstructsignalsmulti-packageintrinsicregexendernegativequeueomitfile systemjsonArray.prototype.filterrapidacornArray.prototype.flatMapcloneshrinkwrapsetImmediatespawnclassnamemkdirpshimString.prototype.matchAllredux-toolkitworkflowbytekeysapimkdirsnativetypesafeJSON-SchemasymlinkmatchAllasyncwidthmatchesTypeScriptbootstrap lesslistenersloga11ynoderuntimeAsyncIteratorglobal objectURLSearchParamsjson-schemaReactiveExtensionstypesArray.prototype.includesimmutablespinnerenumerablefront-endelectronstyleguidecircularReflect.getPrototypeOfbusymoduleSymbol.toStringTagcomputed-typestranspiletoolssetPrototypeOfbddreact-componentescaperegular-expressiontesterautoscalingzxArray.prototype.flat
5.10.97

1 year ago

5.10.96

1 year ago

5.10.95

1 year ago

5.10.94

1 year ago

5.10.93

1 year ago

5.10.92

1 year ago

5.9.92

1 year ago

5.9.91

1 year ago

5.9.90

1 year ago

5.9.89

1 year ago

5.9.88

1 year ago

5.9.87

1 year ago

5.9.86

1 year ago

5.9.85

1 year ago

5.9.84

1 year ago

5.9.83

1 year ago

5.9.82

1 year ago

5.9.81

1 year ago

5.9.80

1 year ago

5.9.79

1 year ago

5.9.78

1 year ago

5.9.77

1 year ago

5.9.76

1 year ago

5.9.75

1 year ago

5.9.74

1 year ago

5.8.74

1 year ago

5.8.73

1 year ago

5.8.72

1 year ago

5.8.71

1 year ago

5.8.70

1 year ago

5.7.70

1 year ago

5.7.69

1 year ago

5.7.68

1 year ago

5.7.67

1 year ago

5.7.66

1 year ago

5.7.65

1 year ago

5.7.64

1 year ago

5.7.63

1 year ago

4.7.63

1 year ago

4.7.62

1 year ago

4.7.61

1 year ago

4.6.61

1 year ago

4.6.60

1 year ago

4.5.60

1 year ago

4.5.59

1 year ago

4.5.58

1 year ago

4.5.57

1 year ago

4.5.56

1 year ago

4.5.55

1 year ago

4.5.54

1 year ago

4.5.53

1 year ago

4.5.52

1 year ago

4.5.51

1 year ago

4.5.50

1 year ago

4.5.49

1 year ago

4.5.48

1 year ago

4.5.47

1 year ago

4.5.46

1 year ago

4.5.45

1 year ago

4.5.44

1 year ago

4.5.43

1 year ago

4.5.42

1 year ago

4.5.41

1 year ago

4.5.40

1 year ago

3.5.40

1 year ago

3.5.39

1 year ago

3.4.39

1 year ago

3.4.38

1 year ago

3.4.37

1 year ago

3.4.36

1 year ago

3.3.36

1 year ago

3.3.35

1 year ago

3.2.35

1 year ago

3.2.34

1 year ago

3.2.33

1 year ago

2.2.33

1 year ago

2.2.32

1 year ago

2.2.31

1 year ago

2.1.31

1 year ago

2.1.30

1 year ago

2.1.29

1 year ago

2.1.28

1 year ago

2.1.27

1 year ago

2.1.26

1 year ago

2.1.25

1 year ago

2.1.24

1 year ago

2.1.23

1 year ago

2.1.22

1 year ago

2.1.21

1 year ago

2.1.20

1 year ago

2.1.19

1 year ago

2.1.18

1 year ago

2.1.17

1 year ago

1.1.17

1 year ago

1.1.16

1 year ago

1.1.15

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago