core-3nweb-client-lib 0.48.2 → 0.48.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,7 +22,6 @@ const id_to_email_map_1 = require("./id-to-email-map");
22
22
  const common_1 = require("./common");
23
23
  const async_cryptor_wrap_1 = require("../../lib-common/async-cryptor-wrap");
24
24
  const xsp_files_1 = require("xsp-files");
25
- const random = require("../../lib-common-on-node/random-node");
26
25
  const buffer_utils_1 = require("../../lib-common/buffer-utils");
27
26
  const canonical_address_1 = require("../../lib-common/canonical-address");
28
27
  const common_2 = require("../asmail/delivery/common");
@@ -119,7 +118,7 @@ class Keyrings {
119
118
  }
120
119
  const { msgMasterKey, currentPair, msgCount } = await ck.getSendingPair(introPKeyFromServer);
121
120
  // prepare message encryptor
122
- const nextNonce = await random.bytes(xsp_files_1.NONCE_LENGTH);
121
+ const nextNonce = await this.random(xsp_files_1.NONCE_LENGTH);
123
122
  const encryptor = (0, async_cryptor_wrap_1.makeEncryptor)(this.cryptor, this.workLabel, msgMasterKey, nextNonce);
124
123
  msgMasterKey.fill(0);
125
124
  return { encryptor, currentPair, msgCount };
@@ -19,7 +19,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.LocalStorage = void 0;
20
20
  const common_1 = require("../../../lib-client/xsp-fs/common");
21
21
  const exceptions_1 = require("../../../lib-client/xsp-fs/exceptions");
22
- const random_node_1 = require("../../../lib-common-on-node/random-node");
23
22
  const ecma_nacl_1 = require("ecma-nacl");
24
23
  const buffer_utils_1 = require("../../../lib-common/buffer-utils");
25
24
  const obj_files_1 = require("./obj-files");
@@ -75,7 +74,7 @@ class LocalStorage {
75
74
  return obj.localStatus();
76
75
  }
77
76
  async generateNewObjId() {
78
- const nonce = await (0, random_node_1.bytes)(ecma_nacl_1.secret_box.NONCE_LENGTH);
77
+ const nonce = await this.random(ecma_nacl_1.secret_box.NONCE_LENGTH);
79
78
  const id = buffer_utils_1.base64urlSafe.pack(nonce);
80
79
  if (this.nodes.reserveId(id)) {
81
80
  return id;
@@ -21,7 +21,6 @@ const common_1 = require("../../../lib-client/xsp-fs/common");
21
21
  const exceptions_1 = require("../../../lib-client/xsp-fs/exceptions");
22
22
  const storage_owner_1 = require("../../../lib-client/3nstorage/storage-owner");
23
23
  const obj_files_1 = require("./obj-files");
24
- const random_node_1 = require("../../../lib-common-on-node/random-node");
25
24
  const buffer_utils_1 = require("../../../lib-common/buffer-utils");
26
25
  const xsp_files_1 = require("xsp-files");
27
26
  const remote_events_1 = require("./remote-events");
@@ -160,7 +159,7 @@ class SyncedStore {
160
159
  return this.remoteStorage.getKeyDerivParams();
161
160
  }
162
161
  async generateNewObjId() {
163
- const nonce = await (0, random_node_1.bytes)(xsp_files_1.NONCE_LENGTH);
162
+ const nonce = await this.random(xsp_files_1.NONCE_LENGTH);
164
163
  const id = buffer_utils_1.base64urlSafe.pack(nonce);
165
164
  if (this.nodes.reserveId(id)) {
166
165
  return id;
@@ -1,4 +1,4 @@
1
- import type { BufferEncodingOption, Mode, ObjectEncodingOptions, OpenMode, RmDirOptions, StatOptions, Stats } from 'fs';
1
+ import type { BufferEncodingOption, Mode, ObjectEncodingOptions, RmDirOptions, Stats } from 'fs';
2
2
  export type { Stats } from 'fs';
3
3
  export type { FileException } from '../lib-common/exceptions/file';
4
4
  /**
@@ -37,7 +37,7 @@ declare function readFile(path: string, options: {
37
37
  declare function readFile(path: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
38
38
  declare function writeFile(file: string, data: string | Uint8Array, options?: (ObjectEncodingOptions & {
39
39
  mode?: Mode;
40
- flag?: OpenMode;
40
+ flag?: string;
41
41
  flush?: boolean;
42
42
  }) | BufferEncoding | null): Promise<void>;
43
43
  declare function appendFile(path: string, data: string | Uint8Array, options?: (ObjectEncodingOptions & {
@@ -46,13 +46,13 @@ declare function appendFile(path: string, data: string | Uint8Array, options?: (
46
46
  declare function mkdir(path: string, options?: {
47
47
  recursive?: boolean;
48
48
  }): Promise<unknown>;
49
- declare function open(path: string, flags?: string | number, mode?: Mode): Promise<FileHandle>;
49
+ declare function open(path: string, flags?: string, mode?: Mode): Promise<FileHandle>;
50
50
  declare function symlink(target: string, path: string, type?: string | null): Promise<void>;
51
51
  declare function readlink(path: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
52
52
  declare function readlink(path: string, options: BufferEncodingOption): Promise<Buffer>;
53
53
  declare function readlink(path: string, options?: ObjectEncodingOptions | string | null): Promise<string | Buffer>;
54
- declare function lstat(path: string, opts?: StatOptions): Promise<Stats>;
55
- declare function stat(path: string, opts?: StatOptions): Promise<Stats>;
54
+ declare function lstat(path: string): Promise<Stats>;
55
+ declare function stat(path: string): Promise<Stats>;
56
56
  declare function readdir(path: string): Promise<string[]>;
57
57
  declare function rmdir(path: string, options?: RmDirOptions): Promise<void>;
58
58
  declare function unlink(path: string): Promise<void>;
@@ -7,9 +7,9 @@ export type { FileHandle, FileException, Stats } from '../injected-globals/platf
7
7
  */
8
8
  export declare const appendFile: (path: string, data: string | Uint8Array, options?: (import("fs").ObjectEncodingOptions & {
9
9
  flush?: boolean | undefined;
10
- }) | BufferEncoding | null) => Promise<void>, lstat: (path: string, opts?: import("fs").StatOptions) => Promise<import("fs").Stats>, mkdir: (path: string, options?: {
10
+ }) | BufferEncoding | null) => Promise<void>, lstat: (path: string) => Promise<import("fs").Stats>, mkdir: (path: string, options?: {
11
11
  recursive?: boolean;
12
- }) => Promise<unknown>, open: (path: string, flags?: string | number, mode?: import("fs").Mode) => Promise<FileHandle>, readFile: {
12
+ }) => Promise<unknown>, open: (path: string, flags?: string, mode?: import("fs").Mode) => Promise<FileHandle>, readFile: {
13
13
  (path: string, options?: {
14
14
  encoding?: null;
15
15
  } | null): Promise<Buffer>;
@@ -21,9 +21,9 @@ export declare const appendFile: (path: string, data: string | Uint8Array, optio
21
21
  (path: string, options?: import("fs").ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
22
22
  (path: string, options: import("fs").BufferEncodingOption): Promise<Buffer>;
23
23
  (path: string, options?: import("fs").ObjectEncodingOptions | string | null): Promise<string | Buffer>;
24
- }, rename: (oldPath: string, newPath: string) => Promise<void>, rmdir: (path: string, options?: import("fs").RmDirOptions) => Promise<void>, stat: (path: string, opts?: import("fs").StatOptions) => Promise<import("fs").Stats>, symlink: (target: string, path: string, type?: string | null) => Promise<void>, truncate: (path: string, len?: number) => Promise<void>, unlink: (path: string) => Promise<void>, writeFile: (file: string, data: string | Uint8Array, options?: (import("fs").ObjectEncodingOptions & {
24
+ }, rename: (oldPath: string, newPath: string) => Promise<void>, rmdir: (path: string, options?: import("fs").RmDirOptions) => Promise<void>, stat: (path: string) => Promise<import("fs").Stats>, symlink: (target: string, path: string, type?: string | null) => Promise<void>, truncate: (path: string, len?: number) => Promise<void>, unlink: (path: string) => Promise<void>, writeFile: (file: string, data: string | Uint8Array, options?: (import("fs").ObjectEncodingOptions & {
25
25
  mode?: import("fs").Mode;
26
- flag?: import("fs").OpenMode;
26
+ flag?: string;
27
27
  flush?: boolean;
28
28
  }) | BufferEncoding | null) => Promise<void>, copyFile: (src: string, dst: string, overwrite?: boolean, dstMode?: string) => Promise<void>;
29
29
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "core-3nweb-client-lib",
3
- "version": "0.48.2",
3
+ "version": "0.48.3",
4
4
  "description": "3NWeb client core library, embeddable into different environments",
5
5
  "main": "build/lib-index.js",
6
6
  "types": "build/lib-index.d.ts",