Releases: KILTprotocol/sdk-js
v0.24.2 (2021-12-22)
This release fixes an issue with the encoding of the additional details of light DIDs.
They were using base64, which is not allowed per the DID spec.
We switched to using base58 and introduced flags for the encoding and serialisation algorithms for future proofing.
This breaks compatibility with v0.24.0 and v0.24.1 - If you have created light dids already, you will need to switch them to the new format.
v0.24.1 (2021-12-07)
This release updates the @polkadot
dependencies to the latest versions.
v0.24.0 (2021-11-19)
Compare with v0.22.0
v0.23.0 was skipped
This release is the first SDK release for our parachain Kilt Spiritnet. 🎉
It is still using the v0.x versioning scheme, because we are working on some refactorings, which should provide ease-of-use, despite the complex new DID integration.
Breaking Changes
- Compatible with Kilt Spiritnet and Kilt Peregrine, but NOT compatible with Kilt Mashnet anymore.
- Made DID a first-class citizen. (#382) (caeb321)
Please refer to our updated getting-started guide to find out, how to use it.
Features
- @cfworker instead of ajv schema validator (#423) (40e34f7)
- new / changed message types for credential api v1 (#433) (5a6096d)
- add new version of DID service endpoints (#428) (bb3fdbc)
- add querying support for deposits and deleted DIDs (#430) (7cf1b76)
- add support for DID deposit and submitter info in DID creation (#421) (fd979cc)
- add support for exporting DID details to W3C-compliant DID Document (#411) (9cf4d99)
- light (offchain) DIDs (#408) (7f0343c)
- make light DIDs unusable after migrated and deleted (#431) (865e165)
- moving DID to the documentation page (#432) (c5bdfa1)
- new DID integration (#405) (172d220)
- support for DID migrations (#414) (7b47824)
- deposit script (#429) (bb87925)
- update SDK to support new DID pallet version + attestation deposits + delegation deposits + new CType creation structure (#415) (9daf8d6)
- update SDK to work with refactored delegation pallet (#406) (59c9d7c)
Chores
- update polkadot dependencies to support polkadot 0.9.11 (#426) (18376eb)
- explicitly export keyring in utils and keyringpair in types (#427) (4d6df7f)
- chore: convert default to names imports/exports + update lint/prettier and address all lint warnings + update JSDocs (#434) (7609a07)
- chore: update cbor to v8 (#437) (b7baf2c)
Bug Fixes
v0.22.0 (2021-06-22)
SDK Release notes 0.22.0 (2021-06-22)
Features
-
refactored
DelegationNode
&DelegationRootNode
constructors to allow setting the revocation status at creation (#377) (c6e96c7). For example, aDelegationNode
is now instantiated as follows:import { DelegationNode, Permission, Utils } from '@kiltprotocol/sdk-js' // with // root: DelegationRootNode // parent: DelegationNode const delegation = new DelegationNode({ id: Utils.UUID.generate(), rootId: root.id, account: delegee.address, permissions: [Permission.ATTEST], parentId: parent.id, revoked: false, })
-
we now add a bundle of the
sdk-js
package to our releases, allowing easy consumption in web applications (#367) (6849d04). Click here to find out how to embed the bundle in your web site. -
added a
createPresentation
method to theAttestedClaim
which produces a deep copy of your credential, optionally filtering the attributes you want to disclose (#398) (18d4df4). Example:import { AttestedClaim } from '@kiltprotocol/sdk-js' const credential = AttestedClaim.fromRequestAndAttestation(request, attestation) // produce a copy of your credential that only discloses the value of attribute 'a', // blinding all other attributes: const presentation = credential.createPresentation(['a'])
-
added the option to send
CType
objects as part of Terms on theSubmit-Terms
message type for repository-independent attestation workflows (#399) (a67fc24):import Kilt, { MessageBody } from '@kiltprotocol/sdk-js' // given some ICType `autonomousVehicleIdCType` const messageBody: MessageBody = { content: { claim: { cTypeHash: autonomousVehicleIdCType.hash, contents: { id: 'abc-defg', licensePlate: 'B-OB 1234' }, }, cTypes: [autonomousVehicleIdCType], prerequisiteClaims: [], }, type: Kilt.Message.BodyType.SUBMIT_TERMS, } const message = new Kilt.Message(messageBody, sender, recipient)
-
now providing a
jsonld-signatures
suite in thevc-export
package, which allows verifying Kilt Verifiable Credentials invc-js
(#365) (e3c085d). Refer to the README to find out how. -
polkadot type definitions are now imported from
@kiltprotocol/type-definitions
- the types that are also included in@polkadot-js/apps
for KILT chains (#393) (986850b). -
added content checks to message constructors to assure that instantiated message objects contain reasonable data (#391) (7d0ad63).
Chores
- update polkadot dependencies to
4.12.1
(api) /6.6.1
(keyring & utils) and upgraded to typescript4.0.0
(#397) (b620fd5). - bump lodash to 4.17.21 (c7c3556).
- removed
formatKiltBalanceDecimalPlacement
from the Balance utils, which was not exposed and no longer used (#389) (95ecc8e).
Ci
- set up CI to run non-required integration tests against additional mashnet-node built (#387) (b2a9224).
- introduced caching of package builds to CI to reduce redundant building and installs (#323) (35bcea3).
- remove accidentally committed yarn version files that broke the CI (#385 - c276f9b; #390 - a85c8f0; e3c44b1).
Documentation Changes
- documented an easier way to create kilt messages in the getting-started-guide #388 (81a427e).
- removed misleading references to our legacy (experimental) privacy enhancement in README (1ade250).
- updated README with our shiny new logo! (bdd813b)
Refactoring
v0.21.0 (2021-04-30)
SDK Release notes 0.21.0
Flexible balance formatting (ff6aa7d)
The changes to the balances module give more flexibility by giving an option
parameter with the type
BalanceOptions
to specify number of decimal places and unit and other optional fields.
interface BalanceOptions {
decimals?: number
forceUnit?: string
withSi?: boolean
withSiFull?: boolean
withUnit?: boolean | string
}
Displaying locked, reserved and free balances (6f8d52f)
Querying the account balance returns locked reserved and free balances as an overview.
Originally, we only returned the free balance as a number with the changes it returns as an object. To get the free balance:
const balance = await getBalances(address)
balance.free
Tips (758890b)
Adds the ability to provide AnyNumber
as tip for the validator when signing the tx, which increases the transactions priority when importing in the pool.
Additional properties for request for claims message (edb044b)
Request for claims message type now has two new optional properties, requiredProperties
and approvedAttesters
.
interface IRequestClaimsForCTypesContent {
cTypeHash: ICType['hash']
acceptedAttester?: Array<IPublicIdentity['address']>
requiredProperties?: string[]
}
This allows Verifiers to communicate efficiently which credentials they accept, and helps Claimers select AttestedClaims and build presentations in line with these specifications.
Transaction workflow revamp (f30cb77)
Functions creating a SubmittableExtrinsic
(e.g. attestation.store()
) do not sign the transaction anymore.
These now have to be signed manually before submitting to the chain.
You can use our all purpose BlockchainUtils.signAndSubmitTx
function, with which unsigned SubmittableExtrinsic
can be signed and dispatched with additional optional resolve/reject criteria and the possibility to apply nonce collision recovery logic with the reSign flag.
Alternatively, you can also use polkadot/api native functions, like tx.signAndSend()
.
Bug Fixes
Documentation changes
- Dev vs Master mixups (#358) (9ed2db6)
- fix listenToBalanceChanges example (#359) (5a3bb9d)
- Updated our getting started guide, examples, and documentation (daa99e8)
- Outdated docs, unrequired identity (#376) (063467a)
Features
- Flexible balance formatting (#363) (ff6aa7d)
- Adding balance locked, reserved and free (#364) (6f8d52f)
- Optional tip for signing tx (#378) (758890b)
- Tx workflow revamp (#372) (f30cb77)
- Move signandsubmit (#375) (69a289e)
- Use typescript type imports (#366) (1c03765)
- Request claims required Properties and approved attesters (#370) (edb044b)
- encrypted message body naming (#371) (9aea418)
- rm yarn/version files (6b4ed58)
- Current release candidate 0.21.0-rc.7 (4bc2078)
- Integration tests on mashnet-staging (#373) (45290ea)
v0.20.0 (2021-03-10)
SDK split-up / Monorepo
This release changes a lot in the structure of the SDK.
The SDK was split-up into multiple separate packages. Namely:
@kiltprotocol/core
-> KILTs core functionality.@kiltprotocol/types
-> Shared typescript types.@kiltprotocol/config
-> A new config service.@kiltprotocol/utils
-> Stateless utility functions and SDK Errors.@kiltprotocol/messaging
-> Everything related to messages and messaging.@kiltprotocol/chain-helpers
-> Functions to build and hold a blockchain connection. Also contains error handling for blockchain related errors.@kiltprotocol/actors-api
-> A convenience layer on top of KILT, to simplify usage and workflows.@kiltprotocol/sdk-js
-> A re-export of all the above.
Additionally, in our effort to aligning with the DID/VC spec, we have added following package:
@kiltprotocol/vc-export
-> Converts a KILT credential to a "Verifiable Credential" and allows building presentations of it.
JSON-LD based claim hashing (cfa9534)
In preparation for the VC-Export package, we changed our KILT credentials, to use a JSON-LD based property hashing algorithm. This also fixes a potential exploit, where labels could be reordered and still lead to the same root hash.
Remove Portablegabi (deaca75)
The experimental anonymous credential feature "portablegabi" was removed, to investigate alternative solutions and to simplify the SDK. This fixes related project setup issues regarding the included WASM and asynchronous instantiation of identities.
Multi-TX (affad9d)
This feature allows the user to trigger blockchain transactions one after another, without having to wait for the preceding one to finish. It is accomplished by counting up the next nonce on the client-side, if possible, and by resigning transactions if the returned error from the chain is recoverable. The corresponding function is called Blockchain.submitTxWithReSign()
, but also the Blockchain.submitTx()
has resigning and nonce calculation activated.
Explicit transaction & await self defined TX status (c4490e3)
With this change, functions that require blockchain writes (store Attestation / CType, revoke Attestation, make transfer, etc.) will no longer submit the transaction, but only prepare it. Instead, a signed SubmittableExtrinsic
is returned which the end user then submits by calling its send()
method (optionally attaching a listener to it) or by passing it to the submitSignedTx()
helper function, which allows you to promisify and await any tx status change (e.g. Finalized
or inBlock
)
Config Service (a1b224b)
We introduced a new Config Service, which can be used to configure the node address to connect to and to set the log level. This will be expanded on, whenever we need to introduce new configs. It can be called with KILT.config({})
.
Connection Workflow (b0da030)
To connect to a KILT node, it is now required to call KILT.init({ address: <YOUR NODE ADDRESS> })
or KILT.config({ address: <YOUR NODE ADDRESS> })
before connecting, or using a blockchain function, which will implicitly connect using the set configuration. KILT.connect()
doesn't take an address parameter anymore, but just connects to whatever was set via the KILT.init
or the KILT.config
function.
For advanced use-cases it is also possible to build the connection yourself and set it for the application as KILT.config
or KILT.init
would do.
SR25519 (744de64)
We changed the default identity key pair type from ed25519
to sr25519
. It is still possible to use an ed25519
identity by adding the { signingKeyPairType: 'ed25519' }
option to the identity builder.
This change relies on polkadot-js crypto functions, which themselves rely on an included wasm library. Because we need to wait for the crypto library to be ready, we added the await KILT.init({ ... })
function, which combines the configuration functionality of KILT.config
with asynchronously waiting until the crypto is ready.
You can also wait for the crypto by calling await Identity.cryptoWaitReady()
, or check if the crypto is ready by calling Identity.cryptoIsReady()
.
Message compression / decompression (e8d8a01)
Messages can now be compressed and decompressed by calling compress()
on a Message
object and just giving the CompressedMessageBody
to the Message
constructor, which decompresses it automatically.
Unit denomination tools (be43462)
There are new tools available to format a KILT balance and converting it back to the base unit: BalanceUtils.formatKiltBalance()
and BalanceUtils.asFemtoKilt()
.
Attestation.verify(fe23e59)
Renamed to Attestation.checkValidity()
to prevent misunderstandings.
Yarn & Prereleases
The SDK now uses yarn v2 for package management and publishes prereleases to npm instead of github packages.
Bug Fixes
- add missing did type (#342) (0a196cc)
- default was missing for Blockchain.submitSignedTx (0a30adf)
- delegation revocation (#349) (656a104)
- integration tests, dev node startup command (#343) (4ec90e3)
- no expectations about GAS amount in tests (05d3f2c)
- packaging (99255da)
- setting prerelease version (753d1f9)
- undefined assignment on double spread (#318) (10a774f)
- versioning on devpackpublish (10dc4cd)
Features
- add yarn version plugin (e1550cb)
- change blockchain connection workflow (#346) (b0da030)
- configuration service for LogLevel and chain ws address (#312) (a1b224b)
- convert to monorepo (#319) (e300727)
- creating messaging package (#339) (5fe645a)
- export Blockchain utils (#315) (e48f1e2)
- export other packages as named exports in sdk-js (#351) (22d90ac)
- export utils from sdk-js (6b9ffd6)
- give root a version (e04262c)
- json-ld based claim property hashing for selective disclosure (#306) (cfa9534)
- limit unneccessary gh test runs & builds (#317) (5164c4b)
- Message compression & decompression (#331) (e8d8a01)
- multiple transactions per account (#220) (affad9d)
- on-chain DID type (#348) (389131d)
- publish prerelease to npm...
v0.19.0 (2020-08-05)
Overview
This release is a big one. We included new features, security improvements, dependency updates for substrate 2 compatibility and more tests.
Substrate 2
In regards to our substrate 2 chain update, we updated all our dependencies to be compatible to that.
Privacy enhanced credentials (Portablegabi)
We integrated an option to use fully anonymous credentials, we call "privacy enhanced credentials", based on our portablegabi library, which itself is based on Gabi Go from the Privacy By Design Foundation
Nested CTypes
You are now able to reference another CType in a field of a CType. This requires them to use a unique URI like string in the $id
field, which we are generating for you. You can reference another CType with the $ref
key.
Input checks
All our classes now check in the constructor, if the provided parameters are of expected type and format. You can also use new custom typeguards, to check if some data is of a specific type yourself, e.g. Attestation.isAttestation(data)
.
Compress / Decompress objects
For easier storage of objects, they can now be converted to a simple object presentation of themselves. To turn them back into class instances, you can use the decompress functions.
Changelog
BREAKING CHANGES
- CTypes now require a URI-like string in the
$id
field. This has to be in the formatkilt:ctype:0x123456
with the hex part being the hash of the ctype schema. This$id
is generated for you, when using theCType.fromSchema
function. You can also generate it yourself withCTypeUtils.getIdForSchema(schema)
. - refactor message encryption and decryption (#276) (b029028)
message.getEncryptedMessage
renamed tomessage.encrypt
Message.createFromEncryptedMessage
renamed toMessage.decrypt
- include
Message.ensureHashAndSignature
andMessage.ensureOwnerIsSender
indecrypt
per default
listenToBalanceChanges
now returns the unsub method so that listeners can unsubscribe, thelistener
parameter is now required
Features
Major
- add optional privacy enhancement by implementing anonymous credentials from portablegabi (#258) (0cb1b2e)
- opt-in by default (#292) (8e5d788)
- adds multi-show unlinkability and selective disclosure to KILT credentials
- see docs/example.ts for code
- add Nested CTypes (#222) (4a09b7b)
- enable users to link pre-existing CTypes to create deeper nested data structures
- add compression and decompression of objects (#240) (3d28420)
- add type checks on chain queries + improvements to static typing (#260) (791206c) and (#286) (15bfc92)
- add constructor input checks (601f30a)
- replace
TxStatus
withSubmittableResult
(#250) (82c3d59) - add query of delegation root id (#276) (f8e96f6)
Attestation.getDelegationRoot(delegationId)
Minor
- summarize errors in SDKErrors (a5b4ff2)
- add index filed (fb21ee9)
- reject attestation should reference the request (122ba69)
- add required fields from ctype schema to wrapper schema (#272) (f1ba0d9)
- some fields were not marked as required before
- copy jsonabc into project (#293) (a32f8af)
- and build with it (0ebbd75)
- publish
develop
branch to github packages (#274) (5b84729) - add dockerfile for running integration tests (#254) (2acbafb)
Bug Fixes
Minor
- ctype compress accepts nulled owner (1eb044a)
getCached
returnsBlockchainApi
instead ofBlockchain
(#270) (76e65b6)- leaked subscription (#266) (edbc02a)
getPublicIdentity
should be instanceofPublicIdentity
instead ofobject
(#264) (b4f4d0c)
Tests
v0.18.0
Features
- Quote metaschema and validation (#216) (3bfecb2):
- big new feature! 🎉 A contract-like exchange can now occur between a claimer and an attester.
- CI badge (#233) (1c7c973):
- because who doesn't like to see a green CI badge on a repository's README?
Tests
Bug Fixes
Major
- Blockchain connection disconnect (#232) (31eed91):
- fixed an issue where a connection looked open, when in fact it wasn't.
- ctype.verifyStored() always returned false when owner not set (#231) (905b70d):
- fixed an issue where verifying that a CTYPE was stored on-chain was unreliable.
- Take delegationId from request (#239) (62611d1):
- fixed a bug that was causing issues in trust structures that include delegations.
- DID module not found because of casing (#223) (d5fcb85):
- fixed an issue where the SDK couldn't access the chain's DID functionalities.
- Empty address was decoded to string representation (#218) (458f10f):
- fixed a decoding bug.
Minor
v0.17.1
v0.17.0
0.17.0 (2020-01-15)
Refactoring
refactor: Constructor and fromObject() | lodash dependency removal (#199) (f8fe82c)
Big Refactoring happened: We replaced all our fromObject
methods with constructors
and made new methods to initialize objects comfortably.
So instead of doing
const attestation = new Attestation(requestForAttestation, attester)
you now have to do
const attestation = Kilt.Attestation.fromRequestAndPublicIdentity(
requestForAttestation,
attester.getPublicIdentity()
);
For serialization, you can now do:
const serialized = JSON.stringify(attestation)
const deserialized = new Attestation(serialized)
instead of using fromObject
refactor: Splitting metadata from the schema (#211) (891fbc0)
This refactoring disconnects the ctype object from its metadata.
Before, you would have to add metadata in the constructor
of CType
, now you don't do that and use the new class CTypeMetadata
, where you just reference the corresponding ctype via ctypehash.
We also added a json-schema definition for those metadata objects.