1.9.6 • Published 2 years ago

@cere-ddc-sdk/core v1.9.6

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

@cere-ddc-sdk/core

Utility package with common logic and classes (CID builder, Scheme for signing requests etc.)

CID Builder

Utility service for building CID based on hash of data, hash algorithm blake2b-256.

Setup

import {CidBuilder} from "@cere-ddc-sdk/core";

const cidBuilder = new CidBuilder();

Create CID

const data = new Uint8Array([1, 2, 3, 4]);
const cid = cidBuilder.build(data);

Scheme

Utility service for signing data using ed25519 or sr25519 algorithm. PolkadotDappScheme is scheme service for signing through Polkadot browser extension.

Setup

import {Scheme} from "@cere-ddc-sdk/core";
import {mnemonicGenerate} from "@polkadot/util-crypto";

const schemeName = "sr25519";
const secretPhrase = mnemonicGenerate();
const scheme = await Scheme.createScheme(createScheme, secretPhrase);

Sign data

const data = new Uint8Array([1, 2, 3, 4]);
const signatureHex = await scheme.sign(data);

Cipher

Utility service for encrypt data.

  • NaclCipher is the default service that uses Nacl algorithm for encryption.
  • DEK is is a data encryption key used to encrypt the data.

Setup

import {NaclCipher} from "@cere-ddc-sdk/core";

const cipher = new NaclCipher();

Encrypt

const data = new Uint8Array([1, 2, 3, 4]);
const dek = "/data/bob" // can be as Uint8Array

const encryptedData = cipher.encrypt(data, dek);

Decrypt

const encryptedData = new Uint8Array([1, 2, 3, 4]);
const dek = new Uint8Array([1, 2, 3, 4]) // can be as string

const data = cipher.decrypt(encryptedData, dek);
1.9.0-rc.10

2 years ago

1.7.6-rc.1

2 years ago

1.9.0-rc.9

2 years ago

1.9.0-rc.8

2 years ago

1.9.0-rc.7

2 years ago

1.9.0-rc.6

2 years ago

1.8.0-rc.5

2 years ago

1.8.0-rc.6

2 years ago

1.8.0-rc.7

2 years ago

1.8.0-rc.8

2 years ago

1.9.0-rc.1

2 years ago

1.8.0-rc.1

2 years ago

1.9.0-rc.0

2 years ago

1.8.0-rc.2

2 years ago

1.8.0-rc.3

2 years ago

1.8.0-rc.4

2 years ago

1.9.0-rc.5

2 years ago

1.9.0-rc.4

2 years ago

1.9.0-rc.3

2 years ago

1.9.0-rc.2

2 years ago

1.7.6-rc.2

2 years ago

1.7.6-rc.3

2 years ago

1.7.6-rc.4

2 years ago

1.9.6

2 years ago

1.9.5

2 years ago

1.9.4

2 years ago

1.7.6

2 years ago

1.9.3

2 years ago

1.9.2

2 years ago

2.0.0-rc.4

2 years ago

2.0.0-rc.0

2 years ago

2.0.0-rc.1

2 years ago

1.9.1

2 years ago

1.9.0

2 years ago

1.7.5-beta.1

2 years ago

1.7.5-beta.2

2 years ago

1.7.5-beta.3

2 years ago

1.7.5-RC2

2 years ago

1.7.5-RC1

2 years ago

1.7.5

2 years ago

1.7.4

2 years ago

1.7.3

3 years ago

1.7.2

3 years ago

1.7.1

3 years ago

1.4.4

3 years ago

1.7.0

3 years ago

1.6.0

3 years ago

1.5.0

3 years ago

1.4.3

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.4

3 years ago

1.2.0

3 years ago

1.2.18

3 years ago

1.2.19

3 years ago

1.2.8

3 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.3.3

3 years ago

1.2.4

3 years ago

1.3.2

3 years ago

1.2.3

3 years ago

1.3.1

3 years ago

1.2.2

3 years ago

1.3.0

3 years ago

1.2.1

3 years ago

1.2.9

3 years ago

1.1.0

3 years ago