【问题标题】:Problems understanding Dexie Encrypted理解 Dexie 加密的问题
【发布时间】:2021-12-26 23:42:48
【问题描述】:

有人可以帮助我找到dexie-encrypted here 。所提供的文档非常简短,并且缺少有关如何实际加密和解密来自indexDb 的数据的真实示例。

【问题讨论】:

  • 请编辑问题以将其限制为具有足够详细信息的特定问题,以确定适当的答案。

标签: encryption dexie


【解决方案1】:

我已经使用 dexie-encrypted 实现了一个项目,您将了解它是如何工作的。 Dexie encrypted 具有基于先前版本的过时文档 在最新版本中,他们更改了函数名称

import { applyEncryptionMiddleware } from "dexie-encrypted";
import { cryptoOptions } from "dexie-encrypted";
import { clearAllTables } from "dexie-encrypted";
const nacl = require("tweetnacl");

const keyPair = nacl.sign.keyPair.fromSeed(new Uint8Array(32));


applyEncryptionMiddleware(
  db,
  keyPair.publicKey,
  {
    friends: {
      type: cryptoOptions.ENCRYPT_LIST,
      fields: ["ssn", "phone"] // note: these cannot be indices
    },
    enemies: cryptoOptions.NON_INDEXED_FIELDS
  },
  clearAllTables
);

db.version(5).stores({
  friends: "++id",
  enemies: "++id"
});


您还可以找到 看一下这个 https://codesandbox.io/s/dexie-encrypted-working-example-2hiqu

【讨论】:

  • 虽然此链接可能会回答问题,但最好在此处包含答案的基本部分并提供链接以供参考。如果链接页面发生更改,仅链接答案可能会失效。 - From Review
猜你喜欢
  • 1970-01-01
  • 2015-06-22
  • 1970-01-01
  • 1970-01-01
  • 2011-08-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-07-20
相关资源
最近更新 更多