🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@cere-ddc-sdk/key-value-storage

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cere-ddc-sdk/key-value-storage

Key-value storage client

latest
Source
npmnpm
Version
1.9.6
Version published
Maintainers
1
Created
Source

@cere-ddc-sdk/key-value-storage

Package for working with DDC data as Key-Value storage.

Support commands:

  • store - store piece data with required key value
  • read - read values (pieces) by key

Example

Setup

Initialize client by cluster id and secret phrase.

import {KeyValueStorage} from "@cere-ddc-sdk/key-value-storage"

const signatureAlgorithm = "ed25519";
const secretPhrase = "own ranch execute unknown equal will...";
const cdnClusterId = 0n;

const keyValueStorage = await KeyValueStorage.build({
    clusterAddress: cdnClusterId,
    scheme: signatureAlgorithm
}, secretPhrase);

Store

Store piece data with key in DDC.

import {Piece, PieceUri} from "@cere-ddc-sdk/content-addressable-storage";

const data = new Uint8Array([1, 2, 3, 4, 5]);
const bucketId = 1n;
const key = "abcd";
const piece = new Piece(data)

const pieceUri: PieceUri = await keyValueStorage.store(bucketId, key, piece);

Read

Read piece data by key.

import {Piece} from "@cere-ddc-sdk/content-addressable-storage";

const keyValue = "abcd";
const bucketId = 1n;

const pieces: Piece[] = await keyValueStorage.read(bucketId, keyValue);

FAQs

Package last updated on 14 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts