core-3nweb-client-lib 0.30.2 → 0.30.4
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.
- package/build/api-defs/asmail.d.ts +9 -6
- package/build/core/app-files.d.ts +4 -4
- package/build/core/app-files.js +2 -2
- package/build/core/asmail/asmail-cap-ipc.d.ts +1 -1
- package/build/core/asmail/asmail-cap-ipc.js +2 -3
- package/build/core/asmail/config/common.d.ts +2 -2
- package/build/core/asmail/config/index.d.ts +1 -1
- package/build/core/asmail/config/invitations-anon.d.ts +1 -1
- package/build/core/asmail/config/invitations-anon.js +1 -2
- package/build/core/asmail/config/published-intro-key.d.ts +2 -2
- package/build/core/asmail/config/published-intro-key.js +1 -2
- package/build/core/asmail/delivery/common.d.ts +6 -6
- package/build/core/asmail/delivery/common.js +3 -3
- package/build/core/asmail/delivery/index.d.ts +4 -4
- package/build/core/asmail/delivery/msg.d.ts +4 -4
- package/build/core/asmail/delivery/msg.js +3 -3
- package/build/core/asmail/inbox/attachments/fs.d.ts +1 -1
- package/build/core/asmail/inbox/attachments/fs.js +1 -2
- package/build/core/asmail/inbox/inbox-events.d.ts +4 -3
- package/build/core/asmail/inbox/inbox-events.js +1 -1
- package/build/core/asmail/inbox/index.d.ts +2 -2
- package/build/core/asmail/inbox/index.js +7 -4
- package/build/core/asmail/inbox/msg-indexing/index.d.ts +2 -2
- package/build/core/asmail/inbox/msg-indexing/logs-n-entries.d.ts +3 -3
- package/build/core/asmail/inbox/msg-indexing/logs-n-entries.js +2 -2
- package/build/core/asmail/inbox/msg-indexing/sql-indexing.d.ts +1 -1
- package/build/core/asmail/inbox/msg-indexing/sql-indexing.js +1 -2
- package/build/core/asmail/inbox/msg-on-disk.d.ts +2 -2
- package/build/core/asmail/inbox/msg-on-disk.js +3 -3
- package/build/core/asmail/index.d.ts +3 -3
- package/build/core/asmail/key-verification.js +2 -3
- package/build/core/asmail/keyring/common.d.ts +1 -1
- package/build/core/asmail/keyring/common.js +7 -7
- package/build/core/asmail/keyring/correspondent-keys.d.ts +1 -1
- package/build/core/asmail/keyring/correspondent-keys.js +5 -5
- package/build/core/asmail/keyring/index.d.ts +3 -3
- package/build/core/asmail/keyring/index.js +2 -2
- package/build/core/asmail/keyring/keyring-storage.d.ts +1 -1
- package/build/core/asmail/keyring/keyring-storage.js +1 -2
- package/build/core/asmail/msg/attachments-container.d.ts +3 -3
- package/build/core/asmail/msg/attachments-container.js +7 -8
- package/build/core/asmail/msg/opener.js +2 -2
- package/build/core/asmail/msg/packer.d.ts +2 -2
- package/build/core/asmail/sending-params/index.d.ts +3 -3
- package/build/core/asmail/sending-params/own-params.d.ts +3 -3
- package/build/core/asmail/sending-params/params-from-others.d.ts +3 -3
- package/build/core/id-manager/index.d.ts +4 -4
- package/build/core/id-manager/key-storage.d.ts +1 -1
- package/build/core/id-manager/mailerid-cap-ipc.d.ts +1 -1
- package/build/core/id-manager/mailerid-cap-ipc.js +2 -3
- package/build/core/index.d.ts +3 -3
- package/build/core/startup/sign-in.d.ts +6 -6
- package/build/core/startup/sign-in.js +2 -2
- package/build/core/startup/sign-up.d.ts +1 -1
- package/build/core/startup/sign-up.js +6 -6
- package/build/core/startup/startup-cap.d.ts +2 -2
- package/build/core/startup/startup-cap.js +4 -5
- package/build/core/storage/common/obj-info-file.js +12 -13
- package/build/core/storage/common/utils.js +2 -3
- package/build/core/storage/index.d.ts +5 -5
- package/build/core/storage/index.js +2 -2
- package/build/core/storage/local/storage.d.ts +3 -3
- package/build/core/storage/storage-cap-ipc.d.ts +1 -1
- package/build/core/storage/storage-cap-ipc.js +3 -4
- package/build/core/storage/synced/obj-files.d.ts +1 -1
- package/build/core/storage/synced/obj-status.d.ts +2 -2
- package/build/core/storage/synced/obj-status.js +2 -2
- package/build/core/storage/synced/storage.d.ts +4 -4
- package/build/core/storage/synced/upload-header-file.js +3 -3
- package/build/core/storage/synced/upsyncer.d.ts +1 -1
- package/build/core/storage/system-folders/apps-data.d.ts +1 -1
- package/build/core/storage/system-folders/index.d.ts +2 -2
- package/build/core/storage/system-folders/index.js +4 -4
- package/build/core-ipc/bytes.d.ts +2 -2
- package/build/core-ipc/bytes.js +4 -5
- package/build/core-ipc/common-caps.d.ts +1 -1
- package/build/core-ipc/common-caps.js +3 -4
- package/build/core-ipc/file.d.ts +13 -14
- package/build/core-ipc/file.js +31 -31
- package/build/core-ipc/fs.d.ts +3 -3
- package/build/core-ipc/fs.js +6 -6
- package/build/core-ipc/generic.d.ts +4 -4
- package/build/core-ipc/generic.js +3 -4
- package/build/core-ipc/log-cap.d.ts +1 -1
- package/build/core-ipc/log-cap.js +2 -3
- package/build/core-ipc/startup-caps.d.ts +1 -1
- package/build/core-ipc/startup-caps.js +2 -3
- package/build/ipc-via-protobuf/connector.d.ts +6 -7
- package/build/ipc-via-protobuf/connector.js +3 -3
- package/build/ipc-via-protobuf/protobuf-msg.d.ts +1 -2
- package/build/ipc-via-protobuf/protobuf-msg.js +20 -20
- package/build/lib-client/3nstorage/exceptions.d.ts +1 -1
- package/build/lib-client/3nstorage/exceptions.js +9 -10
- package/build/lib-client/3nstorage/service.d.ts +2 -2
- package/build/lib-client/3nstorage/util/file-based-json.d.ts +3 -3
- package/build/lib-client/3nstorage/util/for-arrays.js +1 -2
- package/build/lib-client/3nstorage/xsp-fs/attrs.d.ts +1 -2
- package/build/lib-client/3nstorage/xsp-fs/common.d.ts +12 -12
- package/build/lib-client/3nstorage/xsp-fs/common.js +5 -5
- package/build/lib-client/3nstorage/xsp-fs/file-node.d.ts +4 -4
- package/build/lib-client/3nstorage/xsp-fs/file.d.ts +15 -15
- package/build/lib-client/3nstorage/xsp-fs/folder-node-serialization.js +2 -3
- package/build/lib-client/3nstorage/xsp-fs/folder-node.d.ts +7 -7
- package/build/lib-client/3nstorage/xsp-fs/fs.d.ts +27 -27
- package/build/lib-client/3nstorage/xsp-fs/link-node.d.ts +2 -2
- package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +7 -7
- package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +11 -11
- package/build/lib-client/3nstorage/xsp-fs/node-persistence.d.ts +2 -2
- package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v1.js +1 -2
- package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v2.js +3 -4
- package/build/lib-client/3nweb-signup.js +4 -5
- package/build/lib-client/asmail/recipient.d.ts +1 -1
- package/build/lib-client/asmail/recipient.js +4 -4
- package/build/lib-client/asmail/sender.d.ts +3 -3
- package/build/lib-client/asmail/sender.js +9 -9
- package/build/lib-client/cryptor/cryptor-in-worker.d.ts +2 -2
- package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
- package/build/lib-client/cryptor/cryptor.d.ts +2 -2
- package/build/lib-client/cryptor/cryptor.js +3 -3
- package/build/lib-client/cryptor/cryptor.wasm +0 -0
- package/build/lib-client/cryptor/in-proc-js.js +1 -2
- package/build/lib-client/cryptor/in-proc-wasm.js +1 -2
- package/build/lib-client/cryptor/serialization-for-wasm.d.ts +1 -2
- package/build/lib-client/cryptor/serialization-for-wasm.js +6 -7
- package/build/lib-client/cryptor/wasm-mp1-modules.js +1 -2
- package/build/lib-client/cryptor-work-labels.js +1 -1
- package/build/lib-client/fs-utils/files-select.d.ts +3 -3
- package/build/lib-client/fs-utils/files-select.js +1 -2
- package/build/lib-client/fs-utils/files.d.ts +7 -7
- package/build/lib-client/fs-utils/files.js +7 -8
- package/build/lib-client/fs-utils/fs-collection.d.ts +1 -1
- package/build/lib-client/fs-utils/fs-collection.js +2 -3
- package/build/lib-client/fs-utils/fs-sync-utils.d.ts +5 -5
- package/build/lib-client/fs-utils/fs-sync-utils.js +4 -5
- package/build/lib-client/fs-utils/fs-view.d.ts +4 -4
- package/build/lib-client/fs-utils/fs-view.js +1 -2
- package/build/lib-client/key-derivation.js +3 -4
- package/build/lib-client/local-files/dev-file-sink.d.ts +2 -3
- package/build/lib-client/local-files/dev-file-src.d.ts +0 -1
- package/build/lib-client/local-files/device-fs.d.ts +18 -18
- package/build/lib-client/logging/log-to-file.d.ts +5 -5
- package/build/lib-client/logging/log-to-file.js +2 -2
- package/build/lib-client/mailer-id/login.js +2 -3
- package/build/lib-client/objs-on-disk/file-writing-proc.d.ts +1 -1
- package/build/lib-client/objs-on-disk/obj-folders.d.ts +1 -1
- package/build/lib-client/objs-on-disk/obj-folders.js +9 -5
- package/build/lib-client/objs-on-disk/obj-on-disk.d.ts +1 -1
- package/build/lib-client/protobuf-type.d.ts +0 -1
- package/build/lib-client/request-utils.d.ts +2 -4
- package/build/lib-client/request-utils.js +6 -6
- package/build/lib-client/service-locator.d.ts +3 -4
- package/build/lib-client/service-locator.js +5 -6
- package/build/lib-client/user-with-mid-session.d.ts +1 -1
- package/build/lib-client/user-with-mid-session.js +17 -17
- package/build/lib-client/user-with-pkl-session.js +16 -16
- package/build/lib-client/ws-utils.js +1 -2
- package/build/lib-common/assert.js +1 -2
- package/build/lib-common/async-cryptor-wrap.js +4 -5
- package/build/lib-common/async-fs-node.d.ts +0 -3
- package/build/lib-common/async-fs-node.js +35 -35
- package/build/lib-common/async-iter.js +2 -3
- package/build/lib-common/big-endian.d.ts +0 -1
- package/build/lib-common/big-endian.js +10 -11
- package/build/lib-common/binding.js +1 -2
- package/build/lib-common/buffer-utils.d.ts +0 -1
- package/build/lib-common/buffer-utils.js +9 -9
- package/build/lib-common/byte-streaming/bytes-fifo-buffer.js +5 -5
- package/build/lib-common/byte-streaming/pipe.d.ts +2 -2
- package/build/lib-common/byte-streaming/pipe.js +1 -2
- package/build/lib-common/byte-streaming/wrapping.d.ts +2 -2
- package/build/lib-common/byte-streaming/wrapping.js +3 -4
- package/build/lib-common/bytes-equal.js +1 -2
- package/build/lib-common/canonical-address.js +3 -4
- package/build/lib-common/exceptions/error.js +3 -4
- package/build/lib-common/exceptions/file.d.ts +2 -2
- package/build/lib-common/exceptions/file.js +7 -7
- package/build/lib-common/exceptions/http.js +2 -3
- package/build/lib-common/exceptions/runtime.js +1 -2
- package/build/lib-common/ipc/generic-ipc.d.ts +3 -3
- package/build/lib-common/ipc/generic-ipc.js +11 -11
- package/build/lib-common/ipc/ws-ipc.js +2 -2
- package/build/lib-common/json-utils.js +4 -5
- package/build/lib-common/jwkeys.d.ts +1 -1
- package/build/lib-common/jwkeys.js +13 -13
- package/build/lib-common/mid-sigs-NaCl-Ed.d.ts +3 -3
- package/build/lib-common/mid-sigs-NaCl-Ed.js +5 -5
- package/build/lib-common/obj-streaming/sink-utils.d.ts +2 -2
- package/build/lib-common/obj-streaming/sink-utils.js +2 -3
- package/build/lib-common/obj-streaming/wrapping.js +1 -2
- package/build/lib-common/objs-on-disk/file-layout.d.ts +4 -5
- package/build/lib-common/objs-on-disk/obj-file.d.ts +0 -1
- package/build/lib-common/objs-on-disk/utils.d.ts +3 -5
- package/build/lib-common/objs-on-disk/utils.js +5 -6
- package/build/lib-common/objs-on-disk/v1-obj-file-format.d.ts +0 -1
- package/build/lib-common/objs-on-disk/v1-obj-file-format.js +1 -1
- package/build/lib-common/processes/deferred.js +1 -2
- package/build/lib-common/processes/sleep.js +1 -2
- package/build/lib-common/processes/synced.d.ts +1 -1
- package/build/lib-common/processes/synced.js +2 -2
- package/build/lib-common/processes/timeout.js +1 -2
- package/build/lib-common/random-node.js +10 -11
- package/build/lib-common/service-api/3nstorage/owner.js +19 -19
- package/build/lib-common/service-api/asmail/config.js +3 -3
- package/build/lib-common/service-api/asmail/delivery.js +8 -8
- package/build/lib-common/service-api/asmail/retrieval.js +11 -11
- package/build/lib-common/service-api/mailer-id/login.js +2 -2
- package/build/lib-common/service-api/mailer-id/provisioning.js +2 -2
- package/build/lib-common/service-api/pub-key-login.js +2 -2
- package/build/lib-common/service-api/web-socket-base.d.ts +1 -1
- package/build/lib-common/service-api/web-socket-base.js +3 -3
- package/build/lib-common/session-encryptor.js +1 -2
- package/build/lib-common/timed-cache.js +1 -2
- package/build/lib-common/user-admin-api/signup.js +4 -4
- package/build/lib-common/utils-for-observables.js +5 -5
- package/build/lib-sqlite-on-3nstorage/deferred.js +1 -2
- package/build/lib-sqlite-on-3nstorage/index.d.ts +5 -5
- package/build/lib-sqlite-on-3nstorage/index.js +2 -2
- package/build/lib-sqlite-on-3nstorage/synced.d.ts +1 -1
- package/build/lib-sqlite-on-3nstorage/synced.js +2 -2
- package/build/raw-3nweb-clients.d.ts +7 -7
- package/build/raw-3nweb-clients.js +2 -2
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright (C) 2016, 2020, 2022 3NSoft Inc.
|
|
2
|
+
Copyright (C) 2016, 2020, 2022, 2024 3NSoft Inc.
|
|
3
3
|
|
|
4
4
|
This program is free software: you can redistribute it and/or modify it under
|
|
5
5
|
the terms of the GNU General Public License as published by the Free Software
|
|
@@ -217,18 +217,21 @@ declare namespace web3n.asmail {
|
|
|
217
217
|
* from event source, or if next throws something, although it must
|
|
218
218
|
* handle its own stuff.
|
|
219
219
|
*/
|
|
220
|
-
subscribe(event:
|
|
220
|
+
subscribe(event: InboxEventType, observer: Observer<IncomingMessage>):
|
|
221
221
|
() => void;
|
|
222
222
|
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
+
type InboxEventType = 'message';
|
|
226
|
+
|
|
225
227
|
interface MsgStruct {
|
|
226
228
|
/**
|
|
227
229
|
* Message type can be
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
230
|
+
* - "mail" for messages that better be viewed in mail styly UI,
|
|
231
|
+
* - "chat" for messages that better be viewed in chat style UI,
|
|
232
|
+
* - "app:<app-domain>" for application messages, for example, messages
|
|
233
|
+
* with type "app:app.example.com" is for app.example.com app,
|
|
234
|
+
* - "webrtc-signaling" for WebRTC off band signalling.
|
|
232
235
|
*/
|
|
233
236
|
msgType: string;
|
|
234
237
|
subject?: string;
|
|
@@ -5,7 +5,7 @@ export declare function appDirs(appDir: string): Readonly<{
|
|
|
5
5
|
inboxPathFor(user: string): string;
|
|
6
6
|
getUsersOnDisk(): Promise<string[]>;
|
|
7
7
|
}>;
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
8
|
+
export type AppDirs = ReturnType<typeof appDirs>;
|
|
9
|
+
export type GetUsersOnDisk = AppDirs['getUsersOnDisk'];
|
|
10
|
+
export type StoragePathForUser = AppDirs['storagePathFor'];
|
|
11
|
+
export type InboxPathForUser = AppDirs['inboxPathFor'];
|
package/build/core/app-files.js
CHANGED
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
19
|
+
exports.UTIL_DIR = void 0;
|
|
20
|
+
exports.appDirs = appDirs;
|
|
20
21
|
const device_fs_1 = require("../lib-client/local-files/device-fs");
|
|
21
22
|
const async_fs_node_1 = require("../lib-common/async-fs-node");
|
|
22
23
|
const buffer_utils_1 = require("../lib-common/buffer-utils");
|
|
@@ -79,5 +80,4 @@ function appDirs(appDir) {
|
|
|
79
80
|
},
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
|
-
exports.appDirs = appDirs;
|
|
83
83
|
Object.freeze(exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExposedObj, Caller, ExposedServices } from '../../ipc-via-protobuf/connector';
|
|
2
|
-
|
|
2
|
+
type ASMailService = web3n.asmail.Service;
|
|
3
3
|
export declare function exposeASMailCAP(cap: ASMailService, expServices: ExposedServices): ExposedObj<ASMailService>;
|
|
4
4
|
export declare function makeASMailCaller(caller: Caller, objPath: string[]): ASMailService;
|
|
5
5
|
export {};
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
19
|
+
exports.exposeASMailCAP = exposeASMailCAP;
|
|
20
|
+
exports.makeASMailCaller = makeASMailCaller;
|
|
20
21
|
const protobuf_msg_1 = require("../../ipc-via-protobuf/protobuf-msg");
|
|
21
22
|
const protobuf_type_1 = require("../../lib-client/protobuf-type");
|
|
22
23
|
const asmail_proto_1 = require("../../protos/asmail.proto");
|
|
@@ -47,7 +48,6 @@ function exposeASMailCAP(cap, expServices) {
|
|
|
47
48
|
},
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
|
-
exports.exposeASMailCAP = exposeASMailCAP;
|
|
51
51
|
function makeASMailCaller(caller, objPath) {
|
|
52
52
|
const delivPath = (0, protobuf_msg_1.methodPathFor)(objPath, 'delivery');
|
|
53
53
|
const inboxPath = (0, protobuf_msg_1.methodPathFor)(objPath, 'inbox');
|
|
@@ -70,7 +70,6 @@ function makeASMailCaller(caller, objPath) {
|
|
|
70
70
|
},
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
-
exports.makeASMailCaller = makeASMailCaller;
|
|
74
73
|
var getUserId;
|
|
75
74
|
(function (getUserId) {
|
|
76
75
|
function wrapService(fn) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MailConfigurator } from '../../../lib-client/asmail/service-config';
|
|
2
2
|
import { JsonFileProc } from '../../../lib-client/3nstorage/util/file-based-json';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type WritableFile = web3n.files.WritableFile;
|
|
4
|
+
type FileEvent = web3n.files.FileEvent;
|
|
5
5
|
export declare abstract class ParamOnFileAndServer<TF, TS> extends JsonFileProc<TF> {
|
|
6
6
|
private paramPath;
|
|
7
7
|
private serviceConf;
|
|
@@ -3,7 +3,7 @@ import { GetSigner } from '../../id-manager';
|
|
|
3
3
|
import { MsgKeyRole } from '../keyring';
|
|
4
4
|
import { JWKeyPair } from '../keyring/common';
|
|
5
5
|
import { NetClient } from '../../../lib-client/request-utils';
|
|
6
|
-
|
|
6
|
+
type WritableFS = web3n.files.WritableFS;
|
|
7
7
|
/**
|
|
8
8
|
* Instance of this class updates and checks setting of ASMail server.
|
|
9
9
|
*/
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
You should have received a copy of the GNU General Public License along with
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.makeInvites =
|
|
18
|
+
exports.makeInvites = makeInvites;
|
|
19
19
|
const random = require("../../../lib-common/random-node");
|
|
20
20
|
const api = require("../../../lib-common/service-api/asmail/config");
|
|
21
21
|
const common_1 = require("./common");
|
|
@@ -29,7 +29,6 @@ function makeInvites(serviceConf) {
|
|
|
29
29
|
start: invites.start.bind(invites)
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
exports.makeInvites = makeInvites;
|
|
33
32
|
class InvitesData extends common_1.ParamOnFileAndServer {
|
|
34
33
|
constructor(serviceConf) {
|
|
35
34
|
super(api.p.anonSenderInvites.URL_END, serviceConf);
|
|
@@ -2,8 +2,8 @@ import { MailConfigurator } from '../../../lib-client/asmail/service-config';
|
|
|
2
2
|
import * as api from '../../../lib-common/service-api/asmail/config';
|
|
3
3
|
import { GetSigner } from '../../id-manager';
|
|
4
4
|
import { JWKeyPair, MsgKeyRole } from '../keyring/common';
|
|
5
|
-
|
|
6
|
-
export
|
|
5
|
+
type WritableFile = web3n.files.WritableFile;
|
|
6
|
+
export type Certs = api.p.initPubKey.Certs;
|
|
7
7
|
export interface PublishedIntroKey {
|
|
8
8
|
update: () => Promise<void>;
|
|
9
9
|
find: (kid: string) => {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
You should have received a copy of the GNU General Public License along with
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.makePublishedIntroKey =
|
|
18
|
+
exports.makePublishedIntroKey = makePublishedIntroKey;
|
|
19
19
|
const api = require("../../../lib-common/service-api/asmail/config");
|
|
20
20
|
const common_1 = require("../keyring/common");
|
|
21
21
|
const common_2 = require("./common");
|
|
@@ -28,7 +28,6 @@ function makePublishedIntroKey(getSigner, serviceConf) {
|
|
|
28
28
|
start: published.start.bind(published)
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
exports.makePublishedIntroKey = makePublishedIntroKey;
|
|
32
31
|
class PublishedKey extends common_2.ParamOnFileAndServer {
|
|
33
32
|
constructor(getSigner, serviceConf) {
|
|
34
33
|
super(api.p.initPubKey.URL_END, serviceConf);
|
|
@@ -7,12 +7,12 @@ import { ASMailKeyPair } from '../keyring/common';
|
|
|
7
7
|
import { NetClient } from '../../../lib-client/request-utils';
|
|
8
8
|
import { LogWarning, LogError } from '../../../lib-client/logging/log-to-file';
|
|
9
9
|
import { ServiceLocator } from '../../../lib-client/service-locator';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
type OutgoingMessage = web3n.asmail.OutgoingMessage;
|
|
11
|
+
type DeliveryProgress = web3n.asmail.DeliveryProgress;
|
|
12
|
+
type DeliveryOptions = web3n.asmail.DeliveryOptions;
|
|
13
|
+
type AttachmentsContainer = web3n.asmail.AttachmentsContainer;
|
|
14
|
+
type FS = web3n.files.FS;
|
|
15
|
+
type WritableFS = web3n.files.WritableFS;
|
|
16
16
|
export declare class Attachments {
|
|
17
17
|
container: AttachmentsContainer | undefined;
|
|
18
18
|
fs: FS | undefined;
|
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
You should have received a copy of the GNU General Public License along with
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
18
|
+
exports.SEG_SIZE_IN_K_QUATS = exports.Attachments = void 0;
|
|
19
|
+
exports.estimatePackedSizeOf = estimatePackedSizeOf;
|
|
20
|
+
exports.addToNumberLineSegments = addToNumberLineSegments;
|
|
19
21
|
const attachments_container_1 = require("../msg/attachments-container");
|
|
20
22
|
const buffer_utils_1 = require("../../../lib-common/buffer-utils");
|
|
21
23
|
const ATTACHMENTS_NAME = 'attachments';
|
|
@@ -136,7 +138,6 @@ function estimatePackedSizeOf(size) {
|
|
|
136
138
|
}
|
|
137
139
|
return 148 + numOfCompleteSegs * exports.SEG_SIZE_IN_K_QUATS * 256 + lastSegSize;
|
|
138
140
|
}
|
|
139
|
-
exports.estimatePackedSizeOf = estimatePackedSizeOf;
|
|
140
141
|
/**
|
|
141
142
|
* This is a utility function that adds a number into given number line
|
|
142
143
|
* segments. Each segment is represented by an array, in which 0-th element is
|
|
@@ -182,5 +183,4 @@ function addToNumberLineSegments(segments, n) {
|
|
|
182
183
|
}
|
|
183
184
|
segments.unshift([n, n]);
|
|
184
185
|
}
|
|
185
|
-
exports.addToNumberLineSegments = addToNumberLineSegments;
|
|
186
186
|
Object.freeze(exports);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ResourcesForSending } from './common';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
type WritableFS = web3n.files.WritableFS;
|
|
3
|
+
type DeliveryService = web3n.asmail.DeliveryService;
|
|
4
|
+
type DeliveryProgress = web3n.asmail.DeliveryProgress;
|
|
5
|
+
type Observer<T> = web3n.Observer<T>;
|
|
6
6
|
export declare class Delivery {
|
|
7
7
|
private readonly fs;
|
|
8
8
|
private readonly r;
|
|
@@ -2,10 +2,10 @@ import { MsgPacker, PackJSON } from '../msg/packer';
|
|
|
2
2
|
import { ResourcesForSending, Attachments } from './common';
|
|
3
3
|
import { WIPstate } from './per-recipient-wip';
|
|
4
4
|
import { Observable } from 'rxjs';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
type WritableFS = web3n.files.WritableFS;
|
|
6
|
+
type DeliveryProgress = web3n.asmail.DeliveryProgress;
|
|
7
|
+
type OutgoingMessage = web3n.asmail.OutgoingMessage;
|
|
8
|
+
type DeliveryOptions = web3n.asmail.DeliveryOptions;
|
|
9
9
|
export declare class Msg {
|
|
10
10
|
readonly id: string;
|
|
11
11
|
readonly r: ResourcesForSending;
|
|
@@ -55,6 +55,9 @@ async function estimatedPackedSize(msgToSend, attachments) {
|
|
|
55
55
|
return totalSize;
|
|
56
56
|
}
|
|
57
57
|
class Msg {
|
|
58
|
+
get progress$() {
|
|
59
|
+
return this.progressPublisher.asObservable();
|
|
60
|
+
}
|
|
58
61
|
constructor(id, r, progress, msgFS) {
|
|
59
62
|
this.id = id;
|
|
60
63
|
this.r = r;
|
|
@@ -74,9 +77,6 @@ class Msg {
|
|
|
74
77
|
this.progressPublisher = new rxjs_1.Subject();
|
|
75
78
|
Object.seal(this);
|
|
76
79
|
}
|
|
77
|
-
get progress$() {
|
|
78
|
-
return this.progressPublisher.asObservable();
|
|
79
|
-
}
|
|
80
80
|
static async forNew(id, msgFS, msgToSend, sender, recipients, r, attachments, localMeta, retryOpts) {
|
|
81
81
|
const progress = {
|
|
82
82
|
msgSize: await estimatedPackedSize(msgToSend, attachments),
|
|
@@ -2,6 +2,6 @@ import { StorageGetter, FolderInJSON } from '../../../../lib-client/3nstorage/xs
|
|
|
2
2
|
import { AsyncSBoxCryptor } from 'xsp-files';
|
|
3
3
|
import { MsgOnDisk } from '../msg-on-disk';
|
|
4
4
|
import { LogError } from '../../../../lib-client/logging/log-to-file';
|
|
5
|
-
|
|
5
|
+
type ReadonlyFS = web3n.files.ReadonlyFS;
|
|
6
6
|
export declare function fsForAttachments(msg: MsgOnDisk, rootJson: FolderInJSON, storages: StorageGetter, cryptor: AsyncSBoxCryptor, logError: LogError): ReadonlyFS;
|
|
7
7
|
export {};
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.fsForAttachments =
|
|
19
|
+
exports.fsForAttachments = fsForAttachments;
|
|
20
20
|
const common_1 = require("../../../../lib-client/3nstorage/xsp-fs/common");
|
|
21
21
|
const fs_1 = require("../../../../lib-client/3nstorage/xsp-fs/fs");
|
|
22
22
|
class AttachmentStore {
|
|
@@ -72,5 +72,4 @@ function fsForAttachments(msg, rootJson, storages, cryptor, logError) {
|
|
|
72
72
|
const fs = fs_1.XspFS.fromASMailMsgRootFromJSON(storage, rootJson, 'attachments');
|
|
73
73
|
return fs;
|
|
74
74
|
}
|
|
75
|
-
exports.fsForAttachments = fsForAttachments;
|
|
76
75
|
Object.freeze(exports);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { MailRecipient } from '../../../lib-client/asmail/recipient';
|
|
2
2
|
import { LogError } from '../../../lib-client/logging/log-to-file';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type IncomingMessage = web3n.asmail.IncomingMessage;
|
|
4
|
+
type InboxEventType = web3n.asmail.InboxEventType;
|
|
5
|
+
type Observer<T> = web3n.Observer<T>;
|
|
5
6
|
/**
|
|
6
7
|
* Instance of this class handles event subscription from UI side. It observes
|
|
7
8
|
* inbox server events, handles them, and generates respective events for UI
|
|
@@ -10,6 +11,6 @@ declare type Observer<T> = web3n.Observer<T>;
|
|
|
10
11
|
export declare class InboxEvents {
|
|
11
12
|
constructor(msgReceiver: MailRecipient, getMsg: (msgId: string) => Promise<IncomingMessage>, logError: LogError);
|
|
12
13
|
private newMsg$;
|
|
13
|
-
subscribe<T>(event:
|
|
14
|
+
subscribe<T>(event: InboxEventType, observer: Observer<T>): () => void;
|
|
14
15
|
}
|
|
15
16
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2017, 2019, 2022 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2017, 2019, 2022, 2024 3NSoft Inc.
|
|
4
4
|
|
|
5
5
|
This program is free software: you can redistribute it and/or modify it under
|
|
6
6
|
the terms of the GNU General Public License as published by the Free Software
|
|
@@ -10,8 +10,8 @@ import { LogError } from '../../../lib-client/logging/log-to-file';
|
|
|
10
10
|
import { AsyncSBoxCryptor } from 'xsp-files';
|
|
11
11
|
import { SendingParams } from '../msg/common';
|
|
12
12
|
import { NetClient } from '../../../lib-client/request-utils';
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
type WritableFS = web3n.files.WritableFS;
|
|
14
|
+
type InboxService = web3n.asmail.InboxService;
|
|
15
15
|
export interface ResourcesForReceiving {
|
|
16
16
|
address: string;
|
|
17
17
|
getSigner: GetSigner;
|
|
@@ -165,8 +165,10 @@ class InboxOnServer {
|
|
|
165
165
|
return true;
|
|
166
166
|
}
|
|
167
167
|
catch (exc) {
|
|
168
|
-
await msgOnDisk.updateMsgKeyStatus('fail');
|
|
169
168
|
await this.logError(exc, `Problem with opening message ${msgId}`);
|
|
169
|
+
if (msgOnDisk.keyStatus !== 'ok') {
|
|
170
|
+
await msgOnDisk.updateMsgKeyStatus('fail');
|
|
171
|
+
}
|
|
170
172
|
return false;
|
|
171
173
|
}
|
|
172
174
|
}
|
|
@@ -187,8 +189,8 @@ class InboxOnServer {
|
|
|
187
189
|
checkServerAuthIfPresent(meta, decrInfo) {
|
|
188
190
|
// if sender authenticated to server, check that it matches address,
|
|
189
191
|
// recovered from message decryption
|
|
190
|
-
if (meta.authSender
|
|
191
|
-
!(0, canonical_address_1.areAddressesEqual)(meta.authSender, decrInfo.correspondent)) {
|
|
192
|
+
if (meta.authSender
|
|
193
|
+
&& !(0, canonical_address_1.areAddressesEqual)(meta.authSender, decrInfo.correspondent)) {
|
|
192
194
|
throw new Error(`Sender authenticated to server as ${meta.authSender}, while decrypting key is associated with ${decrInfo.correspondent}`);
|
|
193
195
|
}
|
|
194
196
|
}
|
|
@@ -227,7 +229,8 @@ class InboxOnServer {
|
|
|
227
229
|
if (msgIds.length === 0) {
|
|
228
230
|
return indexedMsgs;
|
|
229
231
|
}
|
|
230
|
-
const keying = msgIds.map(msgId => this.startCachingAndAddKeyToIndex(msgId)
|
|
232
|
+
const keying = msgIds.map(msgId => this.startCachingAndAddKeyToIndex(msgId)
|
|
233
|
+
.catch(async (exc) => {
|
|
231
234
|
await this.logError(exc, `Failed to start caching message ${msgId}`);
|
|
232
235
|
}));
|
|
233
236
|
await Promise.all(keying);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MsgKeyInfo, MsgKeyRole } from '../../keyring';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type WritableFS = web3n.files.WritableFS;
|
|
3
|
+
type MsgInfo = web3n.asmail.MsgInfo;
|
|
4
4
|
/**
|
|
5
5
|
* This message index stores info for messages present on the server, in the
|
|
6
6
|
* inbox. Records contain message key info, time of delivery, and time of
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MsgKeyInfo, MsgKeyRole } from '../../keyring';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type WritableFS = web3n.files.WritableFS;
|
|
3
|
+
type MsgInfo = web3n.asmail.MsgInfo;
|
|
4
4
|
interface MsgOpenedLog {
|
|
5
5
|
msgState: 'opened';
|
|
6
6
|
msgId: string;
|
|
@@ -16,7 +16,7 @@ interface MsgRemovedLog {
|
|
|
16
16
|
msgId: string;
|
|
17
17
|
deliveryTS: number;
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
type MsgLog = MsgOpenedLog | MsgRemovedLog;
|
|
20
20
|
export interface MsgKey {
|
|
21
21
|
msgKey: Uint8Array;
|
|
22
22
|
msgKeyRole: MsgKeyRole;
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.MsgLogs =
|
|
19
|
+
exports.MsgLogs = void 0;
|
|
20
|
+
exports.makeJsonBasedIndexedRecords = makeJsonBasedIndexedRecords;
|
|
20
21
|
const synced_1 = require("../../../../lib-common/processes/synced");
|
|
21
22
|
const buffer_utils_1 = require("../../../../lib-common/buffer-utils");
|
|
22
23
|
const timed_cache_1 = require("../../../../lib-common/timed-cache");
|
|
@@ -68,7 +69,6 @@ function notFoundOrReThrow(exc) {
|
|
|
68
69
|
function makeJsonBasedIndexedRecords(logs) {
|
|
69
70
|
return new JsonBasedIndexedRecords(logs);
|
|
70
71
|
}
|
|
71
|
-
exports.makeJsonBasedIndexedRecords = makeJsonBasedIndexedRecords;
|
|
72
72
|
function toMsgOpenedLog(msgInfo, decrInfo, removeAfter) {
|
|
73
73
|
if (!decrInfo.key) {
|
|
74
74
|
throw new Error(`Given message decryption info doesn't have a key for message ${msgInfo.msgId}`);
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.makeSqliteBasedIndexedRecords =
|
|
19
|
+
exports.makeSqliteBasedIndexedRecords = makeSqliteBasedIndexedRecords;
|
|
20
20
|
const timed_cache_1 = require("../../../../lib-common/timed-cache");
|
|
21
21
|
const lib_sqlite_on_3nstorage_1 = require("../../../../lib-sqlite-on-3nstorage");
|
|
22
22
|
const file_1 = require("../../../../lib-common/exceptions/file");
|
|
@@ -316,5 +316,4 @@ Object.freeze(SqliteBasedIndexedRecords);
|
|
|
316
316
|
function makeSqliteBasedIndexedRecords(syncedFS) {
|
|
317
317
|
return SqliteBasedIndexedRecords.makeAndStart(syncedFS);
|
|
318
318
|
}
|
|
319
|
-
exports.makeSqliteBasedIndexedRecords = makeSqliteBasedIndexedRecords;
|
|
320
319
|
Object.freeze(exports);
|
|
@@ -2,7 +2,7 @@ import { ObjOnDisk } from '../../../lib-client/objs-on-disk/obj-on-disk';
|
|
|
2
2
|
import { MsgMeta } from '../../../lib-common/service-api/asmail/retrieval';
|
|
3
3
|
import { ObjSource } from 'xsp-files';
|
|
4
4
|
import { MsgDownloader } from './msg-downloader';
|
|
5
|
-
export
|
|
5
|
+
export type MsgKeyStatus = 'not-checked' | 'not-found' | 'fail' | 'ok';
|
|
6
6
|
export interface ObjSize {
|
|
7
7
|
header: number;
|
|
8
8
|
segments: number;
|
|
@@ -32,6 +32,6 @@ export declare class MsgOnDisk {
|
|
|
32
32
|
getMsgObj(objId: string): Promise<ObjSource>;
|
|
33
33
|
get deliveryTS(): number;
|
|
34
34
|
get keyStatus(): MsgKeyStatus;
|
|
35
|
-
updateMsgKeyStatus(newStatus: MsgKeyStatus): Promise<void>;
|
|
35
|
+
updateMsgKeyStatus(newStatus: Exclude<MsgKeyStatus, 'not-checked'>): Promise<void>;
|
|
36
36
|
private saveStatusToDisk;
|
|
37
37
|
}
|
|
@@ -100,12 +100,12 @@ class MsgOnDisk {
|
|
|
100
100
|
}
|
|
101
101
|
updateMsgKeyStatus(newStatus) {
|
|
102
102
|
return this.syncProc.startOrChain(async () => {
|
|
103
|
-
if (newStatus === 'not-checked') {
|
|
104
|
-
throw new Error(`New key status cannot be ${newStatus}.`);
|
|
105
|
-
}
|
|
106
103
|
if (this.status.keyStatus === 'not-checked') {
|
|
107
104
|
this.status.keyStatus = newStatus;
|
|
108
105
|
}
|
|
106
|
+
else if (this.status.keyStatus === newStatus) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
109
|
else {
|
|
110
110
|
throw Error(`Message has key status ${this.status.keyStatus}, and can't be updated to ${newStatus}`);
|
|
111
111
|
}
|
|
@@ -5,9 +5,9 @@ import { AsyncSBoxCryptor } from 'xsp-files';
|
|
|
5
5
|
import { Logger } from '../../lib-client/logging/log-to-file';
|
|
6
6
|
import { ServiceLocatorMaker } from '../../lib-client/service-locator';
|
|
7
7
|
import { MakeNet } from '..';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export
|
|
8
|
+
type WritableFS = web3n.files.WritableFS;
|
|
9
|
+
type Service = web3n.asmail.Service;
|
|
10
|
+
export type MailCAPMaker = () => Service;
|
|
11
11
|
export declare class ASMail {
|
|
12
12
|
private readonly cryptor;
|
|
13
13
|
private readonly makeNet;
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
You should have received a copy of the GNU General Public License along with
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
18
|
+
exports.checkAndExtractPKey = checkAndExtractPKey;
|
|
19
|
+
exports.checkAndExtractPKeyWithAddress = checkAndExtractPKeyWithAddress;
|
|
19
20
|
const canonical_address_1 = require("../../lib-common/canonical-address");
|
|
20
21
|
const mid_sigs_NaCl_Ed_1 = require("../../lib-common/mid-sigs-NaCl-Ed");
|
|
21
22
|
const jwkeys_1 = require("../../lib-common/jwkeys");
|
|
@@ -40,7 +41,6 @@ async function checkAndExtractPKey(client, resolver, address, certs) {
|
|
|
40
41
|
const pkey = mid_sigs_NaCl_Ed_1.relyingParty.verifyPubKey(certs.pkeyCert, address, { user: certs.userCert, prov: certs.provCert, root: rootCert }, rootAddr, validAt);
|
|
41
42
|
return pkey;
|
|
42
43
|
}
|
|
43
|
-
exports.checkAndExtractPKey = checkAndExtractPKey;
|
|
44
44
|
/**
|
|
45
45
|
* This returns a promise, resolvable to public key and related address, when
|
|
46
46
|
* certificates' verification is successful, and rejectable in all other cases.
|
|
@@ -69,5 +69,4 @@ async function checkAndExtractPKeyWithAddress(client, resolver, certs, validAt)
|
|
|
69
69
|
const pkey = mid_sigs_NaCl_Ed_1.relyingParty.verifyPubKey(certs.pkeyCert, address, { user: certs.userCert, prov: certs.provCert, root: rootCert }, rootAddr, validAt);
|
|
70
70
|
return { address, pkey };
|
|
71
71
|
}
|
|
72
|
-
exports.checkAndExtractPKeyWithAddress = checkAndExtractPKeyWithAddress;
|
|
73
72
|
Object.freeze(exports);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JsonKey, JsonKeyShort } from '../../../lib-common/jwkeys';
|
|
2
|
-
export
|
|
2
|
+
export type MsgKeyRole = 'suggested' | 'in_use' | 'old' | 'published_intro' | 'prev_published_intro' | 'introductory';
|
|
3
3
|
export declare const KID_LENGTH = 16;
|
|
4
4
|
export declare const PID_LENGTH = 2;
|
|
5
5
|
export interface JWKeyPair {
|
|
@@ -16,7 +16,13 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.
|
|
19
|
+
exports.KEY_USE = exports.PID_LENGTH = exports.KID_LENGTH = void 0;
|
|
20
|
+
exports.generateKeyPair = generateKeyPair;
|
|
21
|
+
exports.generateSymmetricKey = generateSymmetricKey;
|
|
22
|
+
exports.extractSKeyBytes = extractSKeyBytes;
|
|
23
|
+
exports.extractPKeyBytes = extractPKeyBytes;
|
|
24
|
+
exports.extractKeyBytes = extractKeyBytes;
|
|
25
|
+
exports.msgKeyPackSizeFor = msgKeyPackSizeFor;
|
|
20
26
|
/**
|
|
21
27
|
* This file contains common functions used by parts of a keyring.
|
|
22
28
|
*/
|
|
@@ -55,7 +61,6 @@ async function generateKeyPair() {
|
|
|
55
61
|
};
|
|
56
62
|
return { skey: skey, pkey: pkey };
|
|
57
63
|
}
|
|
58
|
-
exports.generateKeyPair = generateKeyPair;
|
|
59
64
|
;
|
|
60
65
|
/**
|
|
61
66
|
* We have this function for future use by a keyring, that takes symmetric key.
|
|
@@ -72,7 +77,6 @@ async function generateSymmetricKey() {
|
|
|
72
77
|
kid: await (0, random_node_1.stringOfB64Chars)(exports.KID_LENGTH)
|
|
73
78
|
};
|
|
74
79
|
}
|
|
75
|
-
exports.generateSymmetricKey = generateSymmetricKey;
|
|
76
80
|
;
|
|
77
81
|
function getKeyBytesFrom(key, use, alg, klen) {
|
|
78
82
|
if (key.use === use) {
|
|
@@ -98,7 +102,6 @@ function getKeyBytesFrom(key, use, alg, klen) {
|
|
|
98
102
|
function extractSKeyBytes(key) {
|
|
99
103
|
return getKeyBytesFrom(key, exports.KEY_USE.SECRET, ecma_nacl_1.box.JWK_ALG_NAME, ecma_nacl_1.box.KEY_LENGTH);
|
|
100
104
|
}
|
|
101
|
-
exports.extractSKeyBytes = extractSKeyBytes;
|
|
102
105
|
/**
|
|
103
106
|
* This returns bytes of from a given public key's JWK form
|
|
104
107
|
* @param key is a JWK form of a key
|
|
@@ -106,7 +109,6 @@ exports.extractSKeyBytes = extractSKeyBytes;
|
|
|
106
109
|
function extractPKeyBytes(key) {
|
|
107
110
|
return getKeyBytesFrom(key, exports.KEY_USE.PUBLIC, ecma_nacl_1.box.JWK_ALG_NAME, ecma_nacl_1.box.KEY_LENGTH);
|
|
108
111
|
}
|
|
109
|
-
exports.extractPKeyBytes = extractPKeyBytes;
|
|
110
112
|
/**
|
|
111
113
|
* This returns bytes of a given public key's short JWK form
|
|
112
114
|
* @param key is a short JWK form of a key
|
|
@@ -118,7 +120,6 @@ function extractKeyBytes(key) {
|
|
|
118
120
|
}
|
|
119
121
|
return bytes;
|
|
120
122
|
}
|
|
121
|
-
exports.extractKeyBytes = extractKeyBytes;
|
|
122
123
|
/**
|
|
123
124
|
* This returns a length of a message key pack, used with a given public key
|
|
124
125
|
* crypt-algorithms assembly.
|
|
@@ -132,5 +133,4 @@ function msgKeyPackSizeFor(alg) {
|
|
|
132
133
|
throw new Error(`Encryption algorithm ${alg} is not known.`);
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
|
-
exports.msgKeyPackSizeFor = msgKeyPackSizeFor;
|
|
136
136
|
Object.freeze(exports);
|
|
@@ -76,7 +76,7 @@ export interface RatchetedSendingPair extends BaseSendingPair {
|
|
|
76
76
|
lastTS: number;
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
-
export
|
|
79
|
+
export type SendingPair = IntroductorySendingPair | RatchetedSendingPair;
|
|
80
80
|
export declare function msgMasterDecryptor(cryptor: AsyncSBoxCryptor, skey: JsonKey, pkey: JsonKeyShort): Decryptor;
|
|
81
81
|
export declare class CorrespondentKeys {
|
|
82
82
|
private keyring;
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.CorrespondentKeys =
|
|
19
|
+
exports.CorrespondentKeys = void 0;
|
|
20
|
+
exports.msgMasterDecryptor = msgMasterDecryptor;
|
|
20
21
|
/**
|
|
21
22
|
* This file contains functionality, used inside keyring.
|
|
22
23
|
*/
|
|
@@ -41,7 +42,6 @@ function msgMasterDecryptor(cryptor, skey, pkey) {
|
|
|
41
42
|
msgMasterKey.fill(0);
|
|
42
43
|
return masterDecr;
|
|
43
44
|
}
|
|
44
|
-
exports.msgMasterDecryptor = msgMasterDecryptor;
|
|
45
45
|
function calcMsgMasterKey(skey, pkey) {
|
|
46
46
|
if (skey.alg === ecma_nacl_1.box.JWK_ALG_NAME) {
|
|
47
47
|
const sk = (0, common_1.extractSKeyBytes)(skey);
|
|
@@ -58,6 +58,9 @@ function calcMsgMasterKeyB64(skey, pkey) {
|
|
|
58
58
|
}
|
|
59
59
|
const MIN_PERIOD_FOR_PAIR = 15 * 60 * 1000;
|
|
60
60
|
class CorrespondentKeys {
|
|
61
|
+
get correspondent() {
|
|
62
|
+
return this.keys.correspondent;
|
|
63
|
+
}
|
|
61
64
|
/**
|
|
62
65
|
* @param keyring in which these keys are hanging.
|
|
63
66
|
* @param address of this correspondent.
|
|
@@ -86,9 +89,6 @@ class CorrespondentKeys {
|
|
|
86
89
|
}
|
|
87
90
|
Object.seal(this);
|
|
88
91
|
}
|
|
89
|
-
get correspondent() {
|
|
90
|
-
return this.keys.correspondent;
|
|
91
|
-
}
|
|
92
92
|
/**
|
|
93
93
|
* This attaches all keys into ring's maps.
|
|
94
94
|
* Theis method should be called only once, and only on a deserialized
|