UNPKG

@toruslabs/metadata-helpers

Version:
19 lines (18 loc) 1.5 kB
import { Ecies } from "@toruslabs/eccrypto"; import { MetadataStorageLayer, PubKeyParams } from "./MetadataStorageLayer"; export type EciesHex = { iv: string; ephemPublicKey: string; ciphertext: string; mac: string; }; export declare function encParamsHexToBuf(encParamsHex: EciesHex): Ecies; export declare function encParamsBufToHex(encParams: Ecies): EciesHex; export declare function encryptData(privKeyBytes: Uint8Array, d: unknown): Promise<string>; export declare function decryptData<T>(privKeyBytes: Uint8Array, d: string): Promise<T>; export declare function getAndDecryptData<T>(m: MetadataStorageLayer, privKeyBytes: Uint8Array, namespace: string): Promise<Record<string, T> | null>; export declare function encryptAndSetData(m: MetadataStorageLayer, privKeyBytes: Uint8Array, d: Record<string, unknown>, namespace: string): Promise<void>; export declare function setTorusShare(m: MetadataStorageLayer, webAuthnPubKey: PubKeyParams, webAuthnRefBytes: Uint8Array, subspace: string, subspaceData: unknown): Promise<void>; export declare function setDeviceShare(m: MetadataStorageLayer, webAuthnRefBytes: Uint8Array, subspace: string, subspaceData: unknown): Promise<void>; export declare function getTorusShare<T>(m: MetadataStorageLayer, webAuthnKeyBytes: Uint8Array, webAuthnRefBytes: Uint8Array, subspace: string): Promise<T | null>; export declare function getDeviceShare<T>(m: MetadataStorageLayer, webAuthnRefBytes: Uint8Array, subspace: string): Promise<T | null>;