CipherStash
CipherStash Documentation

Get a Record

The get API can be used to get a single record by ID. If the record doesn’t exist the method will return null.

import { Stash } from "@cipherstash/stashjs";

interface Movie {
  id?: string;
  title: string;
  runningTime: number;
  year: number;
}

const createAndGetMovie = async () => {
  const stash = await Stash.connect();
  const movies = await stash.loadCollection<Movie>("movies");

  const id = await movies.put({
    title: "CipherStash II",
    runningTime: 60,
    year: 2021,
  });

  // Get the newly created CipherStash II movie
  const created = await movies.get(id);
};

createAndGetMovie();