Skip to content

Releases: capsule-corp-ternoa/ternoa-js

1.6.4 Helpers improvements

24 Apr 13:12
Compare
Choose a tag to compare

This release aims to:

  • Improve http and tee clusters helpers.

Contributors: @Victor-Salomon

✅ No breaking changes

HttpClient helper src/helper/http.ts

  • HttpClient() now accepts an optional timeout.
	const timeout = 10000 // 10sec(s)
	const http = new HttpClient(ensureHttps(enclaveUrl), timeout)

Tee helpers src/helper/tee.ts

  • getEnclaveHealthStatus() now accepts the optional timeout to manage HttpClient. (Default is 10000)
  • getEnclaveDataAndHealth() now accepts the optional timeout to manage HttpClient. (Default is 10000)
  • getFirstPublicClusterAvailable() now executes a health check within the function itself. The returned Cluster ID does not require the health check anymore. It also handles the new optional timeout to manage HttpClient. (Default is 10000).

Utility helper src/utils/tee.ts

  • timeoutTrigger() is a generic function that timeouts a promise.

v1.6.3: Balances structure upgrade

15 Feb 14:37
Compare
Choose a tag to compare

This release aims to:

  • Update & fix Balances structures according to Substrate upagrade.

Contributors: @Victor-Salomon

⚠️ Important note: This release comes with several breaking changes and must be installed to fix any alphanet issues related to balances!

✋Breaking changes (3)

According to the last Alphanet runtime upgrade and Polkadot/Substrate, the Balances architecture returned from the system pallet has changed. We support the old structure on the mainnet (with miscFrozen and feeFrozen balances) and the new structure on the alphanet (with frozen and flags balances) for now. Be aware that after the next Mainnet runtime upgrade, the old structure will be kept to support legacy requests but not directly provided as part of the new response anymore.

Balances Helpers in src/balance/storage.ts

  • getBalances() now returns the Balances type.
  • The new Balances type supports both the old and the new structure where the following key objects are optional and might be undefined (typescript will throw an alert). If you use any of the miscFrozen or feeFrozen balances keys in your code, be aware that they will not be directly provided as part of the new response anymore from chain version 26.
    (At the time of release note, Mainnet is on v25 and Alphanet is on v26)
export type Balances = {
    free: BN,
    reserved: BN,
    frozen?: BN,
    flags?: BN,
    miscFrozen?: BN,
    feeFrozen?: BN,
}
  • getTransferrableBalance() handle both old and new balances structure to provide a carefree package upgrade & support legacy requests.

Fixes (1)

  • getTransferrableBalance() cf previous section.

v1.6.2

22 Jan 14:42
Compare
Choose a tag to compare

This tiny release aims to:

  • Add extrinsics to 🔒 TEE pallet.
  • Upgrade packages, dependencies & fix vulnerabilities.
  • Improve SDK internal structure

Contributors: @Victor-Salomon

Features Added (4)

tee/extrinsics:

  • claimTeeRewardsTx()- Creates an unsigned unsubmitted Claim Tee Rewards Transaction Hash for an Era.
  • claimTeeRewards()- Claim the operator reward for a specific era.

src/helpers/tee.ts:

  • formatReconciliationIntervalPayload()- Prepares post request payload to reconciliate the list of secret/capsule NFT synced on a block interval period.
  • teeNFTReconciliation()- Get a reconciliation list of secret/capsule NFT synced on a block interval period.

Fixes (2)

  • Failing tests
  • getEnclaveDataAndHealth()return type

v1.6.0-rc1: TEE Secret node open sourcing (Update)

11 Sep 10:26
Compare
Choose a tag to compare

This release aims to:

  • improve 🔒 TEE Cluster/Enclaves interaction with SDK.
  • allow ⏱️ Metrics Server Reporting #173

⚠️ Important note: This release comes with several breaking changes and must be installed to use alphabet!

Please read carefully the previous changelog for the v1.6.0-rc0.

✋ This new version requires you to update your application accordingly: ✋
For now the following breaking changes only concern the Alphanet chain network (the updated TEE/SGX code is being tested on alphanet and not yet available on Mainnet).

  • This package version is currently available as a release-candidate version. It's close to the next stable version but is still subject to minor changes. It is only available and usable on the Alphanet chain network in a first time - before being deployed to Mainnet production network.

  • 📅 A release schedule of the Mainnet chain network will soon be provided. The release target is between the 11th and 15th of September.

Contributors: @Victor-Salomon

Features Added (9)

TEE Pallet updated with METRICS SERVER REPORTING

tee/storage:

  • getNextClusterIdAvailable()- Provides the next available cluster id.

src/helpers/tee.ts

  • getPublicsClusters() - Provides the list of the availables publics clusters. (an array of cluster ids)
  • getFirstPublicClusterAvailable() - Provides the id of the first available public cluster.

v1.6.0-rc0: TEE Secret node open sourcing

01 Sep 13:02
Compare
Choose a tag to compare

This release aims to:

  • improve 🔒 TEE Cluster/Enclaves interaction with SDK.
  • allow ⏱️ Metrics Server Reporting #173

⚠️ Important note: This release comes with several breaking changes and must be installed to use alphanet!

✋ This new version requires you to update your application accordingly: ✋
For now the following breaking changes only concern the Alphanet chain network (the updated TEE/SGX code is being tested on alphanet and not yet available on Mainnet).

  • This package version is currently available as a release-candidate version. It's close to the next stable version but is still subject to minor changes. It is only available and usable on the Alphanet chain network in a first time - before being deployed to Mainnet production network.

  • 📅 A release schedule of the Mainnet chain network will soon be provided.

Contributors: @Victor-Salomon

Breaking changes (4)

TEE Pallet Helpers in src/helpers/tee.ts

  • teeUpload() renamed to => teePost()
    • Migration information: update the name of the function.

  • getClusterData() now returns both the enclave operator address and enclave slot, alongside with clusterType ("Disabled" | "Admin" | "Public" | "Private").
    👀 If you intend to create a Secret NFT or a Capsule NFT, the good practice will be to filter the public clusters only, (unless you have access to a private or an admin cluster).
    (ClusterDataType updated according to new response format).
    • Migration information: Update the response according to the ClusterDataType and add a filter on "public" cluster types.

      From:
      {
      enclaves: string[ ]
      }
      ==> To:
      {
      enclaves: [string, number][ ]
      clusterType: "Disabled" | "Admin" | "Public" | "Private"
      }
      JSON Response example:
      {
      enclaves: [
      [ 5CcqaTBwW...pPVT3Xf8v7tC, 0]
      [ 5G1AGcU2...KGmhyV9DrzFs, 1]
      ...
      ]
      clusterType: Public
      }

  • teeKeySharesStore() now also return enclaveAddress, enclaveSlot, and operatorAddress
    (TeeSharesStoreType updated according to new response format).
    • Migration information: no particular thing to do after package upgrade.

  • getEnclaveHealthStatus() now also return block_number, sync_state, version. Date is not anymore returned. Under the hood, the status returned is now a true https status (this does not change anything from a code point of view but, provides a more accurate status code). About the sync_state key: When the returned status is 200, you also receive the new sync_state key info, which can be either a block "number", an empty string, or a "setup". Only the block "number" can be considered as an available enclave. This function automatically applies the check on status & sync_state. 😎
    (EnclaveHealthType updated according to the corresponding response retrurned by enclave health check).

    • Migration information: no particular thing to do after package upgrade unless you do any manual checks or use the returned response.
    • If you do and use the date key, remove it.
    • Reminder of this rule: only 200 http status providing a block "number" for the key sync_state can be considered as an available enclave.

Features Added (6)

TEE Pallet updated with METRICS SERVER REPORTING

nft/extrinsics:

  • submitMetricsServerReportTx()- Creates an unsigned unsubmitted Submit Metrics Server Report Transaction Hash for an Era.
  • submitMetricsServerReport()- Submit the metrics server report for a specific era. Returns a MetricsServerReportSubmittedEvent Blockchain event.

src/helpers/tee.ts

  • populateEnclavesData() - Populate enclaves data with addresses, slot and urls. This should be used rather than using the getClusterData()storage request.
  • getEnclaveDataAndHealth() - Get the enclave data from a cluster populated with a health check. This should be used rather than using the getEnclaveHealthStatus() helper.
  • getEnclavesQuote() generate the enclaves quote report.

helper/http.ts

  • getRaw() - return both data and raw HTTP status code

Storage Updated (1)

Tee Storage: src/tee/storage.ts

  • getClusterData() - see breaking change section

Fixes (3)

  • sharesAvailableOnTeeCluster() loop can't overpass the enclave's length anymore.
  • ensureHttps() now return an error in case of a missing URL.
  • mintCapsuleNFT() now handle dynamic cluster ids

Feel free to ask any question in discussion #175.

v1.5.2

17 May 11:14
5e00160
Compare
Choose a tag to compare

Update SIGNER_BLOCK_VALIDITY to 10

v1.5.1

19 Apr 12:03
Compare
Choose a tag to compare

Update SIGNER_BLOCK_VALIDITY to 20

v1.5.0: Secret NFT, Capsules pallets, TEE, Transmission Protocols pallets

17 Apr 10:58
Compare
Choose a tag to compare

This release aims to bring Ternoa Phase 4 main features:

  • Secret NFT🕵
  • Capsules 🔮
  • Transmission Protocols 🔑
  • TEE 🔒

Important note: This release comes with several breaking changes have been implemented in this version ⚠️
It is strongly recommend to update your application accordingly.

Contributors: @Victor-Salomon @ipapandinas @dhammani

Breaking changes (6)

Pallet Helpers

Account
  • generateAccount helper is removed
Marketplace/Auction
  • buyItNowTx & buyItNow require a new nftBuyingPrice argument
  • buyNftTx & buyNft require a new nftBuyingPrice argument
  • formatMarketplaceFee renamed => convertMarketplaceFee
Rent
  • rentTx & rent require a new contractCreationBlockId argument
  • makeRentOfferTx & makeRentOffer require a new contractCreationBlockId argument

Types

  • SubmitTxBlockingType type now expect a third element : txHash: 0x${string} in order to fix issue #154.

IPFS

  • secretNFTMetadata : improved response object. according to TIPs 520
  • capsuleMetadata : according to TIPs 530
    • improved response object.
    • encryptedMedia renamed => encrypted_media
    • publicKey renamed => public_key_of_nft
  • Updated Types and Helpers: Removed unnecessary generics types: cf list at the end of the changelog.

MISC

  • getSignature renamed => getSignatureFromKeyring

Features Added (6)

1- NFT Pallet extended with Secret NFT 🕵️

This pallet is a complex module to create and handle secret NFT. The related TIP is TIP-520.

nft/constants:

  • getInitialSecretMintFee - Original secret mint fee.

nft/extrinsics:

  • createSecretNft - Creates a Secret NFT on chain.
  • addSecretToNft - Adds a Secret to an NFT on chain.

nft/storages:

  • getSecretNftMintFee - Fee to mint a secret NFT (extra fee on top of the tx fees and basic nft).
  • getSecretNftOffchainData - Get the secret offchain data of a Secret NFT.

2- NFT Pallet extended with Caspule NFT 🔮

This pallet is a complex module to create and handle secret NFT. The related TIP is TIP-530.

nft/constants:

  • getInitialSecretMintFee - Original secret mint fee.

nft/extrinsics:

  • convertNftToCapsule - Convert an existing basic NFT into a Capsule NFT.
  • createCapsule - Convert an existing basic NFT into a Capsule NFT.
  • revertCapsule - Removes the capsule part of an NFT.
  • setCapsuleOffchaindata - Sets the offchain data of a Capsule NFT.
  • notifyEnclaveKeyUpdate - Notifies the enclave that capsule owner requests new keys.

nft/storages:

  • getCapsuleMintFee - Fee to mint a Capsule. (extra fee on top of the tx fees).
  • getCapsuleOffchainData - Get the capsule offchain data.
  • notifyEnclaveKeyUpdate - Notifies the enclave that capsule owner requests new keys.

3- Protocols Pallet 🔑

This pallet is a complex module to create and handle secret NFT. The related TIP is TIP-540.

protocols/constants:

  • getProtocolsActionsInBlockLimit - Maximum number of actions in one block.
  • getSimultaneousTransmissionLimit - Maximum number of simultaneous transmission protocol.
  • getMaxConsentListSize - Maximum size for the consent list.
  • getMaxBlockDuration - Maximum block duration for a protocol.

protocols/extrinsics:

  • setTransmissionProtocol - Adds a transmission protocol to any type of NFT.
  • removeTransmissionProtocol - Remove a transmission protocol from an NFT.
  • resetTranmissionProtocolTimer - Reset the block execusion of the transmission protocol.
  • addConsentToOnConsentProtocol - Adds user consent to transmit the NFT (for users specified in the account list for OnConsent protocol only)

protocols/storages:

  • getTransmissionAtBlockFee - Fee to set an AtBlock protocol.
  • getTransmissionAtBlockWithResetFee - Fee to set an AtBlockWithReset protocol.
  • getTransmissionOnConsentFee - Fee to set an OnConsentFee protocol.
  • getTransmissionOnConsentAtBlockFee - Fee to set an OnConsentAtBlockFee protocol.
  • getTransmissionAtBlockQueue - Provides the data of a set transmission protocol.
  • getTransmissions - Notifies the enclave that capsule owner requests new keys.
  • getTransmissionOnConsentData - Provides the list of address that gave their consent to a transmission protocol.

protocols/utils:

  • formatAtBlockProtocol - Returns an object according to the atBlock transmission protocol format.
  • formatAtBlockWithResetProtocol - Returns an object according to the atBlockWithReset transmission protocol format.
  • formatOnConsentProtocol - Returns an object according to the OnConsent transmission protocol format.
  • formatOnConsentAtBlockProtocol - Returns an object according to the onConsentAtBlock transmission protocol format.
  • formatProtocolCancellation - Returns an object according to the cancellation kind required.

4- TEE Pallet 🔒

Storages needed to proceed to the secret keys upload. The related TIP is TIP-510.

protocols/storages:

  • getClusterData - Provides the data related to a cluster.
  • getEnclaveData - Provides the data related to an enclave.

5- NFT Pallet extended with Collection off-chain data set 🃏

nft/extrinsics:

  • setCollectionOffchaindata - Sets the off-chain data of a Collection..

A new event CollectionOffchainDataSetEvent is available.

6- Rent Pallet ✍️

rent/storage:

  • getRentalContractData: creationBlock & creationBlockDate added to RentalContractDataType

Helpers Added (7)

src/helpers/crypto.ts

  • getSignatureFromKeyring - Signs data using the keyring.
  • getSignatureFromExtension - Signs data using an injector extension. We recommend the Polkadot extension.
  • getLastBlock - Retrieve the last block number.

src/helpers/encryption.ts

  • generatePGPKeys - Generates a new PGP key pair.
  • encryptContent - Encrypts a content (string).
  • encryptFile - Encrypts file with the public key.
  • decryptFile - Decrypts message with the private key.

src/helpers/nft.ts

  • secretNftEncryptAndUploadFile - Encrypts and uploads a file on an IFPS gateway.
  • mintSecretNFT - Encrypts your data to create a secret NFT and uploads your key's shards on a TEE.
  • viewSecretNFT - Retrieves and decrypts the secret NFT hash.
  • mintCapsuleNFT - Create a Capsule NFT and uploads your key's shards on a TEE.
  • getCapsuleNFTPrivateKey - Retrieves the capsule NFT private key to decrypt the secret hashes from properties.
  • getTemporarySignerKeys - Generates a temporary signer account with soft-derivation.
  • prepareAndStoreKeyShares - Splits the private key into shards, and format and send them for upload onto a Tee Cluster.

src/helpers/tee.ts

  • generateKeyShares - Generates an array of shares from the incoming parameter string.
  • combineKeyShares - Combines an array of shares to reconstruct data.
  • getEnclaveHealthStatus - Check that all TEE enclaves from a cluster are ready to be used.
  • getTeeEnclavesBaseUrl - Retrieves the TEE enclaves urls stored on-chain.
  • getEnclaveSharesAvailablility - Check that an enclave from a cluster have registered a Capsule NFT or a Secret NFT's key shares.
  • formatStorePayload - Prepares post request payload to store secret/capsule NFT data into TEE enclaves.
  • formatRetrievePayload - Prepares post request payload to retrieve secret/capsule NFT data into TEE enclaves.
  • teeUpload - Upload secret payload data to an TEE enclave.
  • teeKeySharesStore - Upload secret shares to TEE enclaves with retry.
    -sharesAvailableOnTeeCluster - Check that all enclaves from a cluster have registered a the Capsule NFT or a Secret NFT's key shares
  • teeKeySharesRetrieve - Get secret data shares from TEE enclaves.
  • teeKeySharesRemove - Remove the share of a burnt NFT from the enclaves.

src/helpers/utils.ts

  • convertFileToBuffer - Converts a File to Buffer.
  • retryPost - Retries a function according to the number required.
  • ensureHttps - Ensure enclaves starts by 'https://'.

src/helpers/ipfs.ts

  • storeSecretNFT
  • storeCapsuleNFT
  • validateOptionalNFTMetadata
  • marketplaceIpfsUpload, nftIpfsUpload, collectionIpfsUpload moved to new IPFS Client

src/marketplace/utils.ts

Couple of formatters to configure a Marketplace easily

  • convertMarketplaceFee - Checks the type fee and format it accordingly. Numbers are formatted into BN. Percentages are formatted in Permill.
  • formatMarketplaceFee - Returns an object representing either the marketplace commission or listing fee in either Flat or Percentage format.
  • formatMarketplaceAccountList - Returns an object representing a list of accounts.
  • formatMarketplaceOffchainData - Returns the off-chain related marketplace metadata.
  • formatMarketplaceCollectionList - Returns an object representing a list of collections of NFT.

Events (2)

  • New CollectionOffchainDataSetEvent
  • creationBlockId added to **ContractCr...
Read more

v1.5.0-rc0 => v1.5.3-rc3 : Improvements

28 Mar 16:04
56d67a4
Compare
Choose a tag to compare
Pre-release

This release aims to improve the developer experience (DX) with some useful helpers, and provides a bunch of minor fixes:

  • Marketplace formatters added #98
  • Function documentation improved
  • Better flow to format payloads while storing/retrieving the secretNFT capsuleNFT keys: Using the extension (high compatibility with the Polkadot Extension) to sign payloads is now possible.

Breaking changes (5)

  • formatRetrievePayload() is now asynchronous.
  • formatMarketplaceFee() renamed => convertMarketplaceFee()
  • IPFS :
    • secretNFTMetadata : improved response object. according to TIPs 520
    • capsuleMetadata : according to TIPs 530
      • improved response object.
      • encryptedMedia renamed => encrypted_media
      • publicKey renamed => public_key_of_nft
  • Updated Types and Helpers: Removed unnecessary generics types: cf list at the end of the changelog*.
  • getSignature() renamed => getSignatureFromKeyring()

Updated Formatters (6) :

  • formatRetrievePayload(), viewSecretNFT() & getCapsuleNFTPrivateKey() - now handle signing with extension :
    - requester params now also accept string type: IKeyringPair | string
    - new optional parameter:extensionInjector - The signer method retrieved from your extension.

  • formatRetrievePayload() :

    • now asynchronous - <Bytes></Bytes> added tag to const data to improve consistency when signing with extension.
  • formatStorePayload() : <Bytes></Bytes> added tag to const data to improve consistency when signing with extension.

  • Both mintSecretNFT() & mintCapsuleNFT():

    • now use the improved flow with atomic function: prepareAndStoreKeyShares()
    • Added optional dynamic params: royalty (defaulted to 0), collectionId (defaulted to undefined), isSoulbound (defaulted to false), and waitUntil (defaulted to WaitUntil.BlockInclusion)

Added Formatters(7) :

Secret and Capsule NFT helpers

  • getSignatureFromExtension() - Signs data using an injector extension. We recommend the Polkadot extension.
  • getTemporarySignerKeys() - Generates a temporary signer account with soft-derivation.
  • prepareAndStoreKeyShares() - Splits the private key into shards, and format and send them for upload onto a Tee Cluster.

Marketplace helpers

  • formatMarketplaceFee() - Returns an object representing either the marketplace commission or listing fee in either Flat or Percentage format.
  • formatMarketplaceAccountList() - Returns an object representing a list of accounts.
  • formatMarketplaceOffchainData() - Returns the off-chain related marketplace metadata.
  • formatMarketplaceCollectionList() - Returns an object representing a list of collections of NFT.

Removed generic types (19):

From types:
- NftMetadataType
- MediaMetadataType
- CollectionMetadataType
- MarketplaceMetadataType
- CapsuleMedia
- CapsuleEncryptedMedia

From IPFS helper:
- storeNFT
- storeSecretNFT
- storeCapsuleNFT
- capsuleMedia
- storeCollection
- storeMarketplace
- validateNFTMetadata
- validateOptionalNFTMetadata
- validateCollectionMetadata
- validateMarketplaceMetadata

From NFT helper:
- secretNftEncryptAndUploadFile
- mintSecretNFT
- mintCapsuleNFT

v1.5.0-rc0: Secret NFT, Capsules pallets, TEE, Transmission Protocols pallets

03 Mar 10:53
Compare
Choose a tag to compare

Secret NFT, Capsules pallets, TEE, Transmission Protocols pallets

This release aims to bring Ternoa Phase 4 main features:
- Secret NFT🕵
- Capsules 🔮
- Transmission Protocols 🔑
- TEE 🔒

Important note: This release comes with several breaking changes have been implemented in this version ⚠️
It is strongly recommend to update your application accordingly.

Breaking changes (1)

  • SubmitTxBlockingType type now expect a third element : txHash: 0x${string} in order to fix issue #154.
  • Fixing typos: Look at the Fixes section in the end of the changelog.

Features Added (4)

1- NFT Pallet update with Secret NFT 🕵️

This pallet is a complex module to create and handle secret NFT. The related TIP is TIP-520.

nft/constants:

  • getInitialSecretMintFee - Original secret mint fee.

nft/extrinsics:

  • createSecretNft - Creates a Secret NFT on chain.
  • addSecretToNft - Adds a Secret to an NFT on chain.

nft/storages:

  • getSecretNftMintFee - Fee to mint a secret NFT (extra fee on top of the tx fees and basic nft).
  • getSecretNftOffchainData - Get the secret offchain data of a Secret NFT.

2- NFT Pallet update with Caspule NFT 🔮

This pallet is a complex module to create and handle secret NFT. The related TIP is TIP-530.

nft/constants:

  • getInitialSecretMintFee - Original secret mint fee.

nft/extrinsics:

  • convertNftToCapsule - Convert an existing basic NFT into a Capsule NFT.
  • createCapsule - Convert an existing basic NFT into a Capsule NFT.
  • revertCapsule - Removes the capsule part of an NFT.
  • setCapsuleOffchaindata - Sets the offchain data of a Capsule NFT.
  • notifyEnclaveKeyUpdate - Notifies the enclave that capsule owner requests new keys.

nft/storages:

  • getCapsuleMintFee - Fee to mint a Capsule. (extra fee on top of the tx fees).
  • getCapsuleOffchainData - Get the capsule offchain data.
  • notifyEnclaveKeyUpdate - Notifies the enclave that capsule owner requests new keys.

3- Protocols Pallet 🔑

This pallet is a complex module to create and handle secret NFT. The related TIP is TIP-540.

protocols/constants:

  • getProtocolsActionsInBlockLimit - Maximum number of actions in one block.
  • getSimultaneousTransmissionLimit - Maximum number of simultaneous transmission protocol.
  • getMaxConsentListSize - Maximum size for the consent list.
  • getMaxBlockDuration - Maximum block duration for a protocol.

protocols/extrinsics:

  • setTransmissionProtocol - Adds a transmission protocol to any type of NFT.
  • removeTransmissionProtocol - Remove a transmission protocol from an NFT.
  • resetTranmissionProtocolTimer - Reset the block execusion of the transmission protocol.
  • addConsentToOnConsentProtocol - Adds user consent to transmit the NFT (for users specified in the account list for OnConsent protocol only)

protocols/storages:

  • getTransmissionAtBlockFee - Fee to set an AtBlock protocol.
  • getTransmissionAtBlockWithResetFee - Fee to set an AtBlockWithReset protocol.
  • getTransmissionOnConsentFee - Fee to set an OnConsentFee protocol.
  • getTransmissionOnConsentAtBlockFee - Fee to set an OnConsentAtBlockFee protocol.
  • getTransmissionAtBlockQueue - Provides the data of a set transmission protocol.
  • getTransmissions - Notifies the enclave that capsule owner requests new keys.
  • getTransmissionOnConsentData - Provides the list of address that gave their consent to a transmission protocol.

protocols/utils:

  • formatAtBlockProtocol - Returns an object according to the atBlock transmission protocol format.
  • formatAtBlockWithResetProtocol - Returns an object according to the atBlockWithReset transmission protocol format.
  • formatOnConsentProtocol - Returns an object according to the OnConsent transmission protocol format.
  • formatOnConsentAtBlockProtocol - Returns an object according to the onConsentAtBlock transmission protocol format.
  • formatProtocolCancellation - Returns an object according to the cancellation kind required.

4- TEE Pallet 🔒

Storages needed to proceed to the secret keys upload. The related TIP is TIP-510.

protocols/storages:

  • getClusterData - Provides the data related to a cluster.
  • getEnclaveData - Provides the data related to an enclave.

Helpers Added (5 Files)

src/helpers/crypto.ts:

  • getSignature - Signs data using the keyring.
  • getLastBlock - Retrieve the last block number.

src/helpers/encryption.ts:

  • generatePGPKeys - Generates a new PGP key pair.
  • encryptContent - Encrypts a content (string).
  • encryptFile - Encrypts file with the public key.
  • decryptFile - Decrypts message with the private key.

src/helpers/nft.ts:

  • secretNftEncryptAndUploadFile - Encrypts and uploads a file on an IFPS gateway.
  • mintSecretNFT - Encrypts your data to create a secret NFT and uploads your key's shards on a TEE.
  • viewSecretNFT - Retrieves and decrypts the secret NFT hash.
  • mintCapsuleNFT - Create a Capsule NFT and uploads your key's shards on a TEE.
  • getCapsuleNFTPrivateKey - Retrieves the capsule NFT private key to decrypt the secret hashes from properties.

src/helpers/tee.ts

  • generateKeyShares - Generates an array of shares from the incoming parameter string.
  • combineKeyShares - Combines an array of shares to reconstruct data.
  • getEnclaveHealthStatus - Check that all TEE enclaves from a cluster are ready to be used.
  • getTeeEnclavesBaseUrl - Retrieves the TEE enclaves urls stored on-chain.
  • getEnclaveSharesAvailablility - Check that an enclave from a cluster have registered a Capsule NFT or a Secret NFT's key shares.
  • formatStorePayload - Prepares post request payload to store secret/capsule NFT data into TEE enclaves.
  • formatRetrievePayload - Prepares post request payload to retrieve secret/capsule NFT data into TEE enclaves.
  • teeUpload - Upload secret payload data to an TEE enclave.
  • teeKeySharesStore - Upload secret shares to TEE enclaves with retry.
    -sharesAvailableOnTeeCluster - Check that all enclaves from a cluster have registered a the Capsule NFT or a Secret NFT's key shares
  • teeKeySharesRetrieve - Get secret data shares from TEE enclaves.
  • teeKeySharesRemove - Remove the share of a burnt NFT from the enclaves.

src/helpers/utils.ts

  • convertFileToBuffer - Converts a File to Buffer.
  • retryPost - Retries a function according to the number required.
  • ensureHttps - Ensure enclaves starts by 'https://'.

src/helpers/ipfs.ts

  • storeSecretNFT
  • storeCapsuleNFT
  • validateOptionalNFTMetadata
  • marketplaceIpfsUpload, nftIpfsUpload, collectionIpfsUpload moved to new IPFS Client

Fixes (1)

According to issue #154:

  • submitTxBlocking() now return a third argument : the submitted transaction hash.
  • submitTxNonBlocking() now return a third argument : the submitted transaction hash.
  • SubmitTxBlockingType now expect a third element : txHash: 0x${string}
  • storeFile()in IFPS got "form.set" raplaced by "form.append".

Helper : formatedRoyalty() renamed => formattedRoyality()

Libraries 📚

  • openpgp (5.5.0)
  • buffer( 6.0.x)
  • sssa-js (0.0.1)
  • (+ devDependancies)