@protontech/drive-sdk 0.1.2 → 0.2.1
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/dist/crypto/driveCrypto.d.ts +11 -0
- package/dist/crypto/driveCrypto.js +20 -7
- package/dist/crypto/driveCrypto.js.map +1 -1
- package/dist/crypto/interface.d.ts +10 -1
- package/dist/crypto/openPGPCrypto.d.ts +18 -2
- package/dist/crypto/openPGPCrypto.js +25 -6
- package/dist/crypto/openPGPCrypto.js.map +1 -1
- package/dist/diagnostic/telemetry.d.ts +1 -1
- package/dist/diagnostic/telemetry.js +1 -1
- package/dist/diagnostic/telemetry.js.map +1 -1
- package/dist/interface/download.d.ts +46 -0
- package/dist/interface/index.d.ts +2 -2
- package/dist/interface/index.js.map +1 -1
- package/dist/interface/nodes.d.ts +26 -1
- package/dist/interface/nodes.js.map +1 -1
- package/dist/interface/sharing.d.ts +3 -1
- package/dist/interface/telemetry.d.ts +5 -2
- package/dist/interface/telemetry.js.map +1 -1
- package/dist/internal/apiService/apiService.js +1 -1
- package/dist/internal/apiService/apiService.js.map +1 -1
- package/dist/internal/apiService/driveTypes.d.ts +78 -165
- package/dist/internal/apiService/errorCodes.d.ts +1 -0
- package/dist/internal/apiService/errors.js +1 -0
- package/dist/internal/apiService/errors.js.map +1 -1
- package/dist/internal/apiService/index.d.ts +1 -1
- package/dist/internal/apiService/index.js +2 -2
- package/dist/internal/apiService/index.js.map +1 -1
- package/dist/internal/apiService/transformers.d.ts +1 -1
- package/dist/internal/apiService/transformers.js +2 -2
- package/dist/internal/apiService/transformers.js.map +1 -1
- package/dist/internal/download/blockIndex.d.ts +11 -0
- package/dist/internal/download/blockIndex.js +35 -0
- package/dist/internal/download/blockIndex.js.map +1 -0
- package/dist/internal/download/blockIndex.test.d.ts +1 -0
- package/dist/internal/download/blockIndex.test.js +147 -0
- package/dist/internal/download/blockIndex.test.js.map +1 -0
- package/dist/internal/download/fileDownloader.d.ts +6 -2
- package/dist/internal/download/fileDownloader.js +83 -6
- package/dist/internal/download/fileDownloader.js.map +1 -1
- package/dist/internal/download/fileDownloader.test.js +69 -4
- package/dist/internal/download/fileDownloader.test.js.map +1 -1
- package/dist/internal/download/interface.d.ts +4 -4
- package/dist/internal/download/seekableStream.d.ts +80 -0
- package/dist/internal/download/seekableStream.js +163 -0
- package/dist/internal/download/seekableStream.js.map +1 -0
- package/dist/internal/download/seekableStream.test.d.ts +1 -0
- package/dist/internal/download/seekableStream.test.js +149 -0
- package/dist/internal/download/seekableStream.test.js.map +1 -0
- package/dist/internal/download/telemetry.js +1 -1
- package/dist/internal/download/telemetry.js.map +1 -1
- package/dist/internal/download/telemetry.test.js +7 -7
- package/dist/internal/download/telemetry.test.js.map +1 -1
- package/dist/internal/errors.d.ts +1 -1
- package/dist/internal/errors.js +7 -1
- package/dist/internal/errors.js.map +1 -1
- package/dist/internal/errors.test.js +44 -10
- package/dist/internal/errors.test.js.map +1 -1
- package/dist/internal/events/index.js +1 -1
- package/dist/internal/events/index.js.map +1 -1
- package/dist/internal/nodes/apiService.js +16 -3
- package/dist/internal/nodes/apiService.js.map +1 -1
- package/dist/internal/nodes/apiService.test.js +43 -7
- package/dist/internal/nodes/apiService.test.js.map +1 -1
- package/dist/internal/nodes/cache.js +12 -3
- package/dist/internal/nodes/cache.js.map +1 -1
- package/dist/internal/nodes/cache.test.js +31 -1
- package/dist/internal/nodes/cache.test.js.map +1 -1
- package/dist/internal/nodes/cryptoService.d.ts +4 -1
- package/dist/internal/nodes/cryptoService.js +66 -16
- package/dist/internal/nodes/cryptoService.js.map +1 -1
- package/dist/internal/nodes/cryptoService.test.js +129 -46
- package/dist/internal/nodes/cryptoService.test.js.map +1 -1
- package/dist/internal/nodes/extendedAttributes.d.ts +2 -1
- package/dist/internal/nodes/extendedAttributes.js +27 -1
- package/dist/internal/nodes/extendedAttributes.js.map +1 -1
- package/dist/internal/nodes/extendedAttributes.test.js +59 -6
- package/dist/internal/nodes/extendedAttributes.test.js.map +1 -1
- package/dist/internal/nodes/index.test.js +1 -1
- package/dist/internal/nodes/index.test.js.map +1 -1
- package/dist/internal/nodes/interface.d.ts +18 -2
- package/dist/internal/nodes/nodesAccess.js +11 -1
- package/dist/internal/nodes/nodesAccess.js.map +1 -1
- package/dist/internal/nodes/nodesManagement.js +1 -1
- package/dist/internal/nodes/nodesManagement.js.map +1 -1
- package/dist/internal/nodes/nodesRevisions.d.ts +4 -3
- package/dist/internal/nodes/nodesRevisions.js +2 -2
- package/dist/internal/nodes/nodesRevisions.js.map +1 -1
- package/dist/internal/shares/cryptoService.js +7 -4
- package/dist/internal/shares/cryptoService.js.map +1 -1
- package/dist/internal/shares/cryptoService.test.js +5 -3
- package/dist/internal/shares/cryptoService.test.js.map +1 -1
- package/dist/internal/sharing/apiService.js +5 -5
- package/dist/internal/sharing/apiService.js.map +1 -1
- package/dist/internal/sharing/cryptoService.d.ts +1 -0
- package/dist/internal/sharing/cryptoService.js +22 -10
- package/dist/internal/sharing/cryptoService.js.map +1 -1
- package/dist/internal/sharing/cryptoService.test.js +7 -4
- package/dist/internal/sharing/cryptoService.test.js.map +1 -1
- package/dist/internal/sharing/sharingAccess.js +4 -2
- package/dist/internal/sharing/sharingAccess.js.map +1 -1
- package/dist/internal/sharing/sharingAccess.test.js +6 -0
- package/dist/internal/sharing/sharingAccess.test.js.map +1 -1
- package/dist/internal/upload/telemetry.js +2 -2
- package/dist/internal/upload/telemetry.js.map +1 -1
- package/dist/internal/upload/telemetry.test.js +7 -7
- package/dist/internal/upload/telemetry.test.js.map +1 -1
- package/dist/telemetry.d.ts +2 -2
- package/dist/telemetry.js +2 -2
- package/dist/telemetry.js.map +1 -1
- package/dist/tests/telemetry.js +1 -1
- package/dist/tests/telemetry.js.map +1 -1
- package/dist/transformers.d.ts +1 -1
- package/dist/transformers.js +2 -1
- package/dist/transformers.js.map +1 -1
- package/package.json +1 -1
- package/src/crypto/driveCrypto.ts +70 -25
- package/src/crypto/interface.ts +15 -0
- package/src/crypto/openPGPCrypto.ts +37 -5
- package/src/diagnostic/telemetry.ts +1 -1
- package/src/interface/download.ts +46 -0
- package/src/interface/index.ts +2 -1
- package/src/interface/nodes.ts +28 -1
- package/src/interface/sharing.ts +3 -1
- package/src/interface/telemetry.ts +6 -1
- package/src/internal/apiService/apiService.ts +1 -1
- package/src/internal/apiService/driveTypes.ts +78 -165
- package/src/internal/apiService/errorCodes.ts +1 -0
- package/src/internal/apiService/errors.ts +1 -0
- package/src/internal/apiService/index.ts +1 -1
- package/src/internal/apiService/transformers.ts +1 -1
- package/src/internal/download/blockIndex.test.ts +158 -0
- package/src/internal/download/blockIndex.ts +36 -0
- package/src/internal/download/fileDownloader.test.ts +100 -7
- package/src/internal/download/fileDownloader.ts +109 -9
- package/src/internal/download/interface.ts +4 -4
- package/src/internal/download/seekableStream.test.ts +187 -0
- package/src/internal/download/seekableStream.ts +182 -0
- package/src/internal/download/telemetry.test.ts +7 -7
- package/src/internal/download/telemetry.ts +1 -1
- package/src/internal/errors.test.ts +45 -11
- package/src/internal/errors.ts +8 -0
- package/src/internal/events/index.ts +1 -1
- package/src/internal/nodes/apiService.test.ts +59 -15
- package/src/internal/nodes/apiService.ts +21 -4
- package/src/internal/nodes/cache.test.ts +34 -1
- package/src/internal/nodes/cache.ts +12 -3
- package/src/internal/nodes/cryptoService.test.ts +139 -47
- package/src/internal/nodes/cryptoService.ts +94 -9
- package/src/internal/nodes/extendedAttributes.test.ts +60 -7
- package/src/internal/nodes/extendedAttributes.ts +37 -1
- package/src/internal/nodes/index.test.ts +1 -1
- package/src/internal/nodes/interface.ts +19 -2
- package/src/internal/nodes/nodesAccess.ts +15 -1
- package/src/internal/nodes/nodesManagement.ts +1 -1
- package/src/internal/nodes/nodesRevisions.ts +14 -5
- package/src/internal/shares/cryptoService.test.ts +5 -3
- package/src/internal/shares/cryptoService.ts +7 -4
- package/src/internal/sharing/apiService.ts +6 -6
- package/src/internal/sharing/cryptoService.test.ts +7 -4
- package/src/internal/sharing/cryptoService.ts +27 -10
- package/src/internal/sharing/sharingAccess.test.ts +6 -0
- package/src/internal/sharing/sharingAccess.ts +4 -2
- package/src/internal/upload/telemetry.test.ts +7 -7
- package/src/internal/upload/telemetry.ts +2 -2
- package/src/telemetry.ts +2 -2
- package/src/tests/telemetry.ts +1 -1
- package/src/transformers.ts +4 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export interface Telemetry<MetricEvent> {
|
|
2
2
|
getLogger: (name: string) => Logger;
|
|
3
|
-
|
|
3
|
+
recordMetric: (event: MetricEvent) => void;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
export interface Logger {
|
|
@@ -64,6 +64,7 @@ export interface MetricDecryptionErrorEvent {
|
|
|
64
64
|
field: MetricsDecryptionErrorField;
|
|
65
65
|
fromBefore2024?: boolean;
|
|
66
66
|
error?: unknown;
|
|
67
|
+
uid: string;
|
|
67
68
|
}
|
|
68
69
|
export type MetricsDecryptionErrorField =
|
|
69
70
|
| 'shareKey'
|
|
@@ -81,9 +82,13 @@ export interface MetricVerificationErrorEvent {
|
|
|
81
82
|
field: MetricVerificationErrorField;
|
|
82
83
|
addressMatchingDefaultShare?: boolean;
|
|
83
84
|
fromBefore2024?: boolean;
|
|
85
|
+
error?: unknown;
|
|
86
|
+
uid: string;
|
|
84
87
|
}
|
|
85
88
|
export type MetricVerificationErrorField =
|
|
86
89
|
| 'shareKey'
|
|
90
|
+
| 'membershipInviter'
|
|
91
|
+
| 'membershipInvitee'
|
|
87
92
|
| 'nodeKey'
|
|
88
93
|
| 'nodeName'
|
|
89
94
|
| 'nodeHashKey'
|
|
@@ -1924,27 +1924,6 @@ export interface paths {
|
|
|
1924
1924
|
patch?: never;
|
|
1925
1925
|
trace?: never;
|
|
1926
1926
|
};
|
|
1927
|
-
'/drive/sanitization/asv': {
|
|
1928
|
-
parameters: {
|
|
1929
|
-
query?: never;
|
|
1930
|
-
header?: never;
|
|
1931
|
-
path?: never;
|
|
1932
|
-
cookie?: never;
|
|
1933
|
-
};
|
|
1934
|
-
/** List top level ShareIDs for the user Volume in AUTO_RESTORE state. */
|
|
1935
|
-
get: operations['get_drive-sanitization-asv'];
|
|
1936
|
-
put?: never;
|
|
1937
|
-
/**
|
|
1938
|
-
* Log Missing Keys error for restore process
|
|
1939
|
-
* @description Log a Restore Procedure error when Web detects that Keys are missing.
|
|
1940
|
-
*/
|
|
1941
|
-
post: operations['post_drive-sanitization-asv'];
|
|
1942
|
-
delete?: never;
|
|
1943
|
-
options?: never;
|
|
1944
|
-
head?: never;
|
|
1945
|
-
patch?: never;
|
|
1946
|
-
trace?: never;
|
|
1947
|
-
};
|
|
1948
1927
|
'/drive/shares': {
|
|
1949
1928
|
parameters: {
|
|
1950
1929
|
query?: never;
|
|
@@ -2636,7 +2615,9 @@ export interface paths {
|
|
|
2636
2615
|
};
|
|
2637
2616
|
/**
|
|
2638
2617
|
* List volumes
|
|
2639
|
-
* @description List all volumes
|
|
2618
|
+
* @description List all volumes owned by the current user - can be between zero and two: none, regular and/or photo.
|
|
2619
|
+
* It can also return volumes in locked state, which are - upon creation of new volumes - re-activated with new root shares.
|
|
2620
|
+
* The pagination params Page and PageSize are deprecated.
|
|
2640
2621
|
*/
|
|
2641
2622
|
get: operations['get_drive-volumes'];
|
|
2642
2623
|
put?: never;
|
|
@@ -2647,7 +2628,8 @@ export interface paths {
|
|
|
2647
2628
|
* + Main share for the new Volume
|
|
2648
2629
|
* + Adds ShareMember with given Address ID
|
|
2649
2630
|
*
|
|
2650
|
-
*
|
|
2631
|
+
* If the user already has a locked volume, then this locked volume is re-activated
|
|
2632
|
+
* with a new root share and folder instead of creating a new volume.
|
|
2651
2633
|
*/
|
|
2652
2634
|
post: operations['post_drive-volumes'];
|
|
2653
2635
|
delete?: never;
|
|
@@ -2706,10 +2688,8 @@ export interface paths {
|
|
|
2706
2688
|
get?: never;
|
|
2707
2689
|
/**
|
|
2708
2690
|
* Restore locked data in volume.
|
|
2709
|
-
* @description
|
|
2710
|
-
*
|
|
2711
|
-
* one of the same type (e.g., locked regular into active regular). This is processed async.
|
|
2712
|
-
* 2. When the user has locked root shares in an active volume, the data is restored within the same volume. This is done synchronous.
|
|
2691
|
+
* @description The locked root shares in the volume can be recovered by providing the new encryption material for each share.
|
|
2692
|
+
* This operation used to be heavy and processed async. But now it's quick and done synchronously.
|
|
2713
2693
|
*/
|
|
2714
2694
|
put: operations['put_drive-volumes-{volumeID}-restore'];
|
|
2715
2695
|
post?: never;
|
|
@@ -3871,8 +3851,9 @@ export interface components {
|
|
|
3871
3851
|
/**
|
|
3872
3852
|
* Format: email
|
|
3873
3853
|
* @description Signature email address used to sign the blocks content
|
|
3854
|
+
* @default null
|
|
3874
3855
|
*/
|
|
3875
|
-
SignatureEmail
|
|
3856
|
+
SignatureEmail: string | null;
|
|
3876
3857
|
/** @default [] */
|
|
3877
3858
|
BlockList: components['schemas']['AnonymousUploadBlockDto'][];
|
|
3878
3859
|
/** @default [] */
|
|
@@ -3889,6 +3870,14 @@ export interface components {
|
|
|
3889
3870
|
*/
|
|
3890
3871
|
Code: 1000;
|
|
3891
3872
|
};
|
|
3873
|
+
LinkMapQueryParameters: {
|
|
3874
|
+
/** @default null */
|
|
3875
|
+
SessionName: string | null;
|
|
3876
|
+
/** @default null */
|
|
3877
|
+
LastIndex: number | null;
|
|
3878
|
+
/** @default 500 */
|
|
3879
|
+
PageSize: number;
|
|
3880
|
+
};
|
|
3892
3881
|
LinkMapResponse: {
|
|
3893
3882
|
SessionName: string;
|
|
3894
3883
|
More: number;
|
|
@@ -3956,12 +3945,6 @@ export interface components {
|
|
|
3956
3945
|
*/
|
|
3957
3946
|
PossibleKeyPackets: components['schemas']['KeyPacketResponseDto'][];
|
|
3958
3947
|
RootLinkRecoveryPassphrase?: components['schemas']['PGPMessage2'] | null;
|
|
3959
|
-
/**
|
|
3960
|
-
* @deprecated
|
|
3961
|
-
* @description User for AutoRestoreProcedure, see /sanitization/asv endpoint(s)
|
|
3962
|
-
* @default false
|
|
3963
|
-
*/
|
|
3964
|
-
ForASV: boolean;
|
|
3965
3948
|
/**
|
|
3966
3949
|
* ProtonResponseCode
|
|
3967
3950
|
* @example 1000
|
|
@@ -3978,15 +3961,6 @@ export interface components {
|
|
|
3978
3961
|
*/
|
|
3979
3962
|
Code: 1000;
|
|
3980
3963
|
};
|
|
3981
|
-
ListAutoRestoreVolumeRootSharesResponseDto: {
|
|
3982
|
-
ShareIDs: components['schemas']['Id2'][];
|
|
3983
|
-
/**
|
|
3984
|
-
* ProtonResponseCode
|
|
3985
|
-
* @example 1000
|
|
3986
|
-
* @enum {integer}
|
|
3987
|
-
*/
|
|
3988
|
-
Code: 1000;
|
|
3989
|
-
};
|
|
3990
3964
|
ListSharesResponseDto: {
|
|
3991
3965
|
Shares: components['schemas']['ShareResponseDto'][];
|
|
3992
3966
|
/**
|
|
@@ -3996,9 +3970,6 @@ export interface components {
|
|
|
3996
3970
|
*/
|
|
3997
3971
|
Code: 1000;
|
|
3998
3972
|
};
|
|
3999
|
-
LogFailedRestoreProcedureRequestDto: {
|
|
4000
|
-
Shares: components['schemas']['FailedRestoreProcedureShareDataDto'][];
|
|
4001
|
-
};
|
|
4002
3973
|
TransferInput: {
|
|
4003
3974
|
/** @description The ID of the new address */
|
|
4004
3975
|
AddressID: string;
|
|
@@ -4489,47 +4460,15 @@ export interface components {
|
|
|
4489
4460
|
*/
|
|
4490
4461
|
Code: 1000;
|
|
4491
4462
|
};
|
|
4492
|
-
/** @description Name, Hash, NodePassphrase and NodePassphraseSignature are required when restoring a regular volume but should not be passed when restoring a photo volume. Please pass them as part of MainShares array to support multiple locked main shares. */
|
|
4493
4463
|
RestoreVolumeDto: {
|
|
4494
4464
|
/** Format: email */
|
|
4495
4465
|
SignatureAddress: string;
|
|
4496
|
-
/**
|
|
4497
|
-
* @deprecated
|
|
4498
|
-
* @default null
|
|
4499
|
-
*/
|
|
4500
|
-
TargetVolumeID: components['schemas']['Id'] | null;
|
|
4501
|
-
/**
|
|
4502
|
-
* @deprecated
|
|
4503
|
-
* @description Folder name as armored PGP message
|
|
4504
|
-
* @default null
|
|
4505
|
-
*/
|
|
4506
|
-
Name: string | null;
|
|
4507
|
-
/**
|
|
4508
|
-
* @deprecated
|
|
4509
|
-
* @description Hash of the name
|
|
4510
|
-
*/
|
|
4511
|
-
Hash?: string | null;
|
|
4512
|
-
/**
|
|
4513
|
-
* @deprecated
|
|
4514
|
-
* @default null
|
|
4515
|
-
*/
|
|
4516
|
-
NodePassphrase: components['schemas']['PGPMessage'] | null;
|
|
4517
|
-
/**
|
|
4518
|
-
* @deprecated
|
|
4519
|
-
* @default null
|
|
4520
|
-
*/
|
|
4521
|
-
NodePassphraseSignature: components['schemas']['PGPSignature'] | null;
|
|
4522
4466
|
/** @default [] */
|
|
4523
4467
|
MainShares: components['schemas']['RestoreMainShareDto'][];
|
|
4524
4468
|
/** @default [] */
|
|
4525
|
-
Devices: components['schemas']['
|
|
4469
|
+
Devices: components['schemas']['RestoreRootShareDto'][];
|
|
4526
4470
|
/** @default [] */
|
|
4527
|
-
PhotoShares: components['schemas']['
|
|
4528
|
-
/**
|
|
4529
|
-
* @deprecated
|
|
4530
|
-
* @default null
|
|
4531
|
-
*/
|
|
4532
|
-
NodeHashKey: components['schemas']['PGPMessage'] | null;
|
|
4471
|
+
PhotoShares: components['schemas']['RestoreRootShareDto'][];
|
|
4533
4472
|
/** @description User's encrypted AddressKeyID. Must be the primary key from the signatureAddress */
|
|
4534
4473
|
AddressKeyID: string;
|
|
4535
4474
|
};
|
|
@@ -4768,8 +4707,6 @@ export interface components {
|
|
|
4768
4707
|
/** @description Unencrypted signature of the content session key (plain text of the ContentKeyPacket), signed with the NodeKey. */
|
|
4769
4708
|
ContentKeyPacketSignature?: string | null;
|
|
4770
4709
|
ManifestSignature: components['schemas']['PGPSignature'];
|
|
4771
|
-
/** @description Encrypted PGP Signature of the raw block content. Is null for empty files as they do not have blocks or when uploaded by anonymous users. */
|
|
4772
|
-
ContentBlockEncSignature?: string | null;
|
|
4773
4710
|
ContentBlockVerificationToken?: components['schemas']['BinaryString'] | null;
|
|
4774
4711
|
/**
|
|
4775
4712
|
* @description Extended attributes encrypted with link key
|
|
@@ -4778,6 +4715,11 @@ export interface components {
|
|
|
4778
4715
|
XAttr: string | null;
|
|
4779
4716
|
/** @default null */
|
|
4780
4717
|
Photo: components['schemas']['CommitRevisionPhotoDto'] | null;
|
|
4718
|
+
/**
|
|
4719
|
+
* @description Encrypted PGP Signature of the raw block content. Is null for empty files as they do not have blocks or when uploaded by anonymous users. Deprecated: Once clients do not validate the block signature, it should also not be calculated and uploaded anymore.
|
|
4720
|
+
* @default null
|
|
4721
|
+
*/
|
|
4722
|
+
ContentBlockEncSignature: string | null;
|
|
4781
4723
|
};
|
|
4782
4724
|
SmallRevisionUploadMetadataRequestDto: {
|
|
4783
4725
|
CurrentRevisionID: components['schemas']['Id'];
|
|
@@ -5293,12 +5235,15 @@ export interface components {
|
|
|
5293
5235
|
Size: number;
|
|
5294
5236
|
/** @description Index of block in list (must be consecutive starting at 1) */
|
|
5295
5237
|
Index: number;
|
|
5296
|
-
/** @description Encrypted PGP Signature of the raw block content */
|
|
5297
|
-
EncSignature: string;
|
|
5298
5238
|
/** @description Hash of encrypted block, base64 encoded */
|
|
5299
5239
|
Hash: string;
|
|
5300
5240
|
/** @default null */
|
|
5301
5241
|
Verifier: components['schemas']['Verifier'] | null;
|
|
5242
|
+
/**
|
|
5243
|
+
* @description Encrypted PGP Signature of the raw block content. Deprecated: Once clients do not validate the block signature, it should also not be calculated and uploaded anymore.
|
|
5244
|
+
* @default null
|
|
5245
|
+
*/
|
|
5246
|
+
EncSignature: string | null;
|
|
5302
5247
|
};
|
|
5303
5248
|
RequestUploadThumbnailInput: {
|
|
5304
5249
|
/** @description Block size in bytes. WARNING: when type is NOT 2=HDPreview(1920) then the max size is 65536 */
|
|
@@ -5385,11 +5330,14 @@ export interface components {
|
|
|
5385
5330
|
Size: number;
|
|
5386
5331
|
/** @description Index of block in list (must be consecutive starting at 1) */
|
|
5387
5332
|
Index: number;
|
|
5388
|
-
/** @description Encrypted PGP Signature of the raw block content */
|
|
5389
|
-
EncSignature: string;
|
|
5390
5333
|
/** @description Hash of encrypted block, base64 encoded */
|
|
5391
5334
|
Hash: string;
|
|
5392
5335
|
Verifier: components['schemas']['Verifier'];
|
|
5336
|
+
/**
|
|
5337
|
+
* @description Encrypted PGP Signature of the raw block content. Deprecated: Once clients do not validate the block signature, it should also not be calculated and uploaded anymore.
|
|
5338
|
+
* @default null
|
|
5339
|
+
*/
|
|
5340
|
+
EncSignature: string | null;
|
|
5393
5341
|
};
|
|
5394
5342
|
ShareURLContext: {
|
|
5395
5343
|
/** @description Share ID of the share highest in the tree with permissions */
|
|
@@ -5431,6 +5379,8 @@ export interface components {
|
|
|
5431
5379
|
Passphrase: components['schemas']['PGPMessage2'];
|
|
5432
5380
|
PassphraseSignature: components['schemas']['PGPSignature2'];
|
|
5433
5381
|
AddressID: components['schemas']['Id2'];
|
|
5382
|
+
InviterSharePassphraseKeyPacketSignature?: components['schemas']['PGPSignature2'] | null;
|
|
5383
|
+
InviteeSharePassphraseSessionKeySignature?: components['schemas']['PGPSignature2'] | null;
|
|
5434
5384
|
};
|
|
5435
5385
|
FolderDetailsDto2: {
|
|
5436
5386
|
Link: components['schemas']['LinkDto2'];
|
|
@@ -5544,10 +5494,6 @@ export interface components {
|
|
|
5544
5494
|
/** @deprecated */
|
|
5545
5495
|
VolumeSoftDeleted: boolean;
|
|
5546
5496
|
};
|
|
5547
|
-
FailedRestoreProcedureShareDataDto: {
|
|
5548
|
-
ShareID: components['schemas']['Id'];
|
|
5549
|
-
Reason: string;
|
|
5550
|
-
};
|
|
5551
5497
|
ShareKPMigrationData: {
|
|
5552
5498
|
/** @description Share to migrate. Can only be Active (State=1) Shares of Type=2 */
|
|
5553
5499
|
ShareID: string;
|
|
@@ -6139,15 +6085,7 @@ export interface components {
|
|
|
6139
6085
|
*/
|
|
6140
6086
|
NodeHashKey: string | null;
|
|
6141
6087
|
};
|
|
6142
|
-
|
|
6143
|
-
/** @description ShareID of the existing share on the old volume */
|
|
6144
|
-
LockedShareID: string;
|
|
6145
|
-
/** @description Key packet for the share passphrase, encrypted with the active key associated with the new volume. Encoded with Base64. */
|
|
6146
|
-
ShareKeyPacket: string;
|
|
6147
|
-
/** @description Signed with new key as armored PGP signature */
|
|
6148
|
-
PassphraseSignature: string;
|
|
6149
|
-
};
|
|
6150
|
-
RestorePhotoShareDto: {
|
|
6088
|
+
RestoreRootShareDto: {
|
|
6151
6089
|
/** @description ShareID of the existing share on the old volume */
|
|
6152
6090
|
LockedShareID: string;
|
|
6153
6091
|
/** @description Key packet for the share passphrase, encrypted with the active key associated with the new volume. Encoded with Base64. */
|
|
@@ -6452,6 +6390,8 @@ export interface components {
|
|
|
6452
6390
|
SignatureEmail?: string | null;
|
|
6453
6391
|
/** Format: email */
|
|
6454
6392
|
NameSignatureEmail?: string | null;
|
|
6393
|
+
/** @default null */
|
|
6394
|
+
DirectPermissions: number | null;
|
|
6455
6395
|
};
|
|
6456
6396
|
FileDto: {
|
|
6457
6397
|
TotalEncryptedSize: number;
|
|
@@ -6476,6 +6416,15 @@ export interface components {
|
|
|
6476
6416
|
* @enum {integer}
|
|
6477
6417
|
*/
|
|
6478
6418
|
Permissions: 4 | 6 | 22;
|
|
6419
|
+
InviteTime: number;
|
|
6420
|
+
/** Format: email */
|
|
6421
|
+
InviterEmail: string;
|
|
6422
|
+
/** @description base64 encoded key packet, encrypting the share passphrase's session key with the invitee's address key */
|
|
6423
|
+
MemberSharePassphraseKeyPacket: string;
|
|
6424
|
+
/** @description PGP signature of the member key packet (encrypted) by inviter */
|
|
6425
|
+
InviterSharePassphraseKeyPacketSignature: string;
|
|
6426
|
+
/** @description Signature of the share passphrase's session key with the private key of the user (invitee). */
|
|
6427
|
+
InviteeSharePassphraseSessionKeySignature: string;
|
|
6479
6428
|
};
|
|
6480
6429
|
FolderDto: {
|
|
6481
6430
|
NodeHashKey?: components['schemas']['PGPMessage'] | null;
|
|
@@ -6545,6 +6494,8 @@ export interface components {
|
|
|
6545
6494
|
SignatureEmail?: string | null;
|
|
6546
6495
|
/** Format: email */
|
|
6547
6496
|
NameSignatureEmail?: string | null;
|
|
6497
|
+
/** @default null */
|
|
6498
|
+
DirectPermissions: number | null;
|
|
6548
6499
|
};
|
|
6549
6500
|
FolderDto2: {
|
|
6550
6501
|
NodeHashKey?: components['schemas']['PGPMessage2'] | null;
|
|
@@ -6566,6 +6517,15 @@ export interface components {
|
|
|
6566
6517
|
* @enum {integer}
|
|
6567
6518
|
*/
|
|
6568
6519
|
Permissions: 4 | 6 | 22;
|
|
6520
|
+
InviteTime: number;
|
|
6521
|
+
/** Format: email */
|
|
6522
|
+
InviterEmail: string;
|
|
6523
|
+
/** @description base64 encoded key packet, encrypting the share passphrase's session key with the invitee's address key */
|
|
6524
|
+
MemberSharePassphraseKeyPacket: string;
|
|
6525
|
+
/** @description PGP signature of the member key packet (encrypted) by inviter */
|
|
6526
|
+
InviterSharePassphraseKeyPacketSignature: string;
|
|
6527
|
+
/** @description Signature of the share passphrase's session key with the private key of the user (invitee). */
|
|
6528
|
+
InviteeSharePassphraseSessionKeySignature: string;
|
|
6569
6529
|
};
|
|
6570
6530
|
/**
|
|
6571
6531
|
* @description <p>1=active, 3=locked</p><details><summary>See values descriptions</summary><details><summary>See values descriptions</summary><table><tr><th>Value</th><th>Name</th><th>Description</th></tr><tr><td>1</td><td>Active</td><td></td></tr><tr><td>2</td><td>Deleted</td><td></td></tr><tr><td>3</td><td>Locked</td><td>* Locked membership can have two reasons:
|
|
@@ -6599,12 +6559,18 @@ export interface components {
|
|
|
6599
6559
|
/** @deprecated */
|
|
6600
6560
|
URL?: string | null;
|
|
6601
6561
|
BareURL?: string | null;
|
|
6602
|
-
|
|
6562
|
+
/**
|
|
6563
|
+
* @deprecated
|
|
6564
|
+
* @default null
|
|
6565
|
+
*/
|
|
6566
|
+
EncSignature: components['schemas']['PGPMessage2'] | null;
|
|
6603
6567
|
/**
|
|
6604
6568
|
* Format: email
|
|
6569
|
+
* @deprecated
|
|
6605
6570
|
* @description Email used to sign block
|
|
6571
|
+
* @default null
|
|
6606
6572
|
*/
|
|
6607
|
-
SignatureEmail
|
|
6573
|
+
SignatureEmail: string | null;
|
|
6608
6574
|
};
|
|
6609
6575
|
PhotoResponseDto: {
|
|
6610
6576
|
LinkID: components['schemas']['Id2'];
|
|
@@ -6662,12 +6628,18 @@ export interface components {
|
|
|
6662
6628
|
/** @deprecated */
|
|
6663
6629
|
URL?: string | null;
|
|
6664
6630
|
BareURL?: string | null;
|
|
6665
|
-
|
|
6631
|
+
/**
|
|
6632
|
+
* @deprecated
|
|
6633
|
+
* @default null
|
|
6634
|
+
*/
|
|
6635
|
+
EncSignature: components['schemas']['PGPMessage'] | null;
|
|
6666
6636
|
/**
|
|
6667
6637
|
* Format: email
|
|
6638
|
+
* @deprecated
|
|
6668
6639
|
* @description Email used to sign block
|
|
6640
|
+
* @default null
|
|
6669
6641
|
*/
|
|
6670
|
-
SignatureEmail
|
|
6642
|
+
SignatureEmail: string | null;
|
|
6671
6643
|
};
|
|
6672
6644
|
PhotoResponseDto2: {
|
|
6673
6645
|
LinkID: components['schemas']['Id'];
|
|
@@ -6948,7 +6920,6 @@ export interface operations {
|
|
|
6948
6920
|
content: {
|
|
6949
6921
|
'application/json': {
|
|
6950
6922
|
/** @description Potential codes and their meaning:
|
|
6951
|
-
* - 200001: Maximum number of volumes reached for current user
|
|
6952
6923
|
* - 2500: A volume is already active
|
|
6953
6924
|
* - 2500: Cannot create the new Photo volume. Should be migrated from current Photo stream
|
|
6954
6925
|
* - 2001: Invalid PGP message
|
|
@@ -10983,11 +10954,9 @@ export interface operations {
|
|
|
10983
10954
|
'get_drive-shares-{shareID}-map': {
|
|
10984
10955
|
parameters: {
|
|
10985
10956
|
query?: {
|
|
10986
|
-
|
|
10987
|
-
|
|
10988
|
-
|
|
10989
|
-
/** @description Index value of last element in previous request */
|
|
10990
|
-
LastIndex?: number;
|
|
10957
|
+
SessionName?: components['schemas']['LinkMapQueryParameters']['SessionName'];
|
|
10958
|
+
LastIndex?: components['schemas']['LinkMapQueryParameters']['LastIndex'];
|
|
10959
|
+
PageSize?: components['schemas']['LinkMapQueryParameters']['PageSize'];
|
|
10991
10960
|
};
|
|
10992
10961
|
header?: never;
|
|
10993
10962
|
path: {
|
|
@@ -11133,52 +11102,6 @@ export interface operations {
|
|
|
11133
11102
|
};
|
|
11134
11103
|
};
|
|
11135
11104
|
};
|
|
11136
|
-
'get_drive-sanitization-asv': {
|
|
11137
|
-
parameters: {
|
|
11138
|
-
query?: never;
|
|
11139
|
-
header?: never;
|
|
11140
|
-
path?: never;
|
|
11141
|
-
cookie?: never;
|
|
11142
|
-
};
|
|
11143
|
-
requestBody?: never;
|
|
11144
|
-
responses: {
|
|
11145
|
-
/** @description Success */
|
|
11146
|
-
200: {
|
|
11147
|
-
headers: {
|
|
11148
|
-
'x-pm-code': 1000;
|
|
11149
|
-
[name: string]: unknown;
|
|
11150
|
-
};
|
|
11151
|
-
content: {
|
|
11152
|
-
'application/json': components['schemas']['ListAutoRestoreVolumeRootSharesResponseDto'];
|
|
11153
|
-
};
|
|
11154
|
-
};
|
|
11155
|
-
};
|
|
11156
|
-
};
|
|
11157
|
-
'post_drive-sanitization-asv': {
|
|
11158
|
-
parameters: {
|
|
11159
|
-
query?: never;
|
|
11160
|
-
header?: never;
|
|
11161
|
-
path?: never;
|
|
11162
|
-
cookie?: never;
|
|
11163
|
-
};
|
|
11164
|
-
requestBody?: {
|
|
11165
|
-
content: {
|
|
11166
|
-
'application/json': components['schemas']['LogFailedRestoreProcedureRequestDto'];
|
|
11167
|
-
};
|
|
11168
|
-
};
|
|
11169
|
-
responses: {
|
|
11170
|
-
/** @description Success */
|
|
11171
|
-
200: {
|
|
11172
|
-
headers: {
|
|
11173
|
-
'x-pm-code': 1000;
|
|
11174
|
-
[name: string]: unknown;
|
|
11175
|
-
};
|
|
11176
|
-
content: {
|
|
11177
|
-
'application/json': components['schemas']['SuccessfulResponse'];
|
|
11178
|
-
};
|
|
11179
|
-
};
|
|
11180
|
-
};
|
|
11181
|
-
};
|
|
11182
11105
|
'get_drive-shares': {
|
|
11183
11106
|
parameters: {
|
|
11184
11107
|
query?: {
|
|
@@ -12747,16 +12670,6 @@ export interface operations {
|
|
|
12747
12670
|
'application/json': components['schemas']['SuccessfulResponse'];
|
|
12748
12671
|
};
|
|
12749
12672
|
};
|
|
12750
|
-
/** @description Accepted */
|
|
12751
|
-
202: {
|
|
12752
|
-
headers: {
|
|
12753
|
-
'x-pm-code': 1002;
|
|
12754
|
-
[name: string]: unknown;
|
|
12755
|
-
};
|
|
12756
|
-
content: {
|
|
12757
|
-
'application/json': components['schemas']['AcceptedResponse'];
|
|
12758
|
-
};
|
|
12759
|
-
};
|
|
12760
12673
|
422: components['responses']['ProtonErrorResponse'];
|
|
12761
12674
|
};
|
|
12762
12675
|
};
|
|
@@ -46,6 +46,7 @@ export function apiErrorFactory({ response, result }: { response: Response; resu
|
|
|
46
46
|
// Here we convert only general enough codes. Specific cases that are
|
|
47
47
|
// not clear from the code itself must be handled by each module
|
|
48
48
|
// separately.
|
|
49
|
+
case ErrorCode.INVALID_VALUE:
|
|
49
50
|
case ErrorCode.NOT_ENOUGH_PERMISSIONS:
|
|
50
51
|
case ErrorCode.NOT_ENOUGH_PERMISSIONS_TO_GRANT_PERMISSIONS:
|
|
51
52
|
case ErrorCode.ALREADY_EXISTS:
|
|
@@ -2,6 +2,6 @@ export { DriveAPIService } from './apiService';
|
|
|
2
2
|
export type { paths as drivePaths } from './driveTypes';
|
|
3
3
|
export type { paths as corePaths } from './coreTypes';
|
|
4
4
|
export { HTTPErrorCode, ErrorCode, isCodeOk, isCodeOkAsync } from './errorCodes';
|
|
5
|
-
export { nodeTypeNumberToNodeType,
|
|
5
|
+
export { nodeTypeNumberToNodeType, permissionsToMemberRole, memberRoleToPermission } from './transformers';
|
|
6
6
|
export { ObserverStream } from './observerStream';
|
|
7
7
|
export * from './errors';
|
|
@@ -14,7 +14,7 @@ export function nodeTypeNumberToNodeType(logger: Logger, nodeTypeNumber: number)
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export function
|
|
17
|
+
export function permissionsToMemberRole(logger: Logger, permissionsNumber?: number): MemberRole {
|
|
18
18
|
switch (permissionsNumber) {
|
|
19
19
|
case undefined:
|
|
20
20
|
return MemberRole.Inherited;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { DEFAULT_FILE_CHUNK_SIZE, getBlockIndex } from './blockIndex';
|
|
2
|
+
|
|
3
|
+
describe('getBlockIndex', () => {
|
|
4
|
+
describe('default behavior (no claimedBlockSize)', () => {
|
|
5
|
+
it('should handle position 0', () => {
|
|
6
|
+
const result = getBlockIndex(undefined, 0);
|
|
7
|
+
expect(result).toEqual({
|
|
8
|
+
done: false,
|
|
9
|
+
value: {
|
|
10
|
+
blockIndex: 1,
|
|
11
|
+
blockOffset: 0,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('should handle position within first block', () => {
|
|
17
|
+
const position = 1024; // 1KB
|
|
18
|
+
const result = getBlockIndex(undefined, position);
|
|
19
|
+
expect(result).toEqual({
|
|
20
|
+
done: false,
|
|
21
|
+
value: {
|
|
22
|
+
blockIndex: 1,
|
|
23
|
+
blockOffset: 1024,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should handle position at exact block boundary', () => {
|
|
29
|
+
const position = DEFAULT_FILE_CHUNK_SIZE; // Exactly 4MB
|
|
30
|
+
const result = getBlockIndex(undefined, position);
|
|
31
|
+
expect(result).toEqual({
|
|
32
|
+
done: false,
|
|
33
|
+
value: {
|
|
34
|
+
blockIndex: 2,
|
|
35
|
+
blockOffset: 0,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should handle position in second block', () => {
|
|
41
|
+
const position = DEFAULT_FILE_CHUNK_SIZE + 1024; // 4MB + 1KB
|
|
42
|
+
const result = getBlockIndex(undefined, position);
|
|
43
|
+
expect(result).toEqual({
|
|
44
|
+
done: false,
|
|
45
|
+
value: {
|
|
46
|
+
blockIndex: 2,
|
|
47
|
+
blockOffset: 1024,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe('default behavior (empty claimedBlockSize)', () => {
|
|
54
|
+
it('should handle empty array like undefined', () => {
|
|
55
|
+
const position = DEFAULT_FILE_CHUNK_SIZE + 1024;
|
|
56
|
+
const result = getBlockIndex([], position);
|
|
57
|
+
expect(result).toEqual({
|
|
58
|
+
done: false,
|
|
59
|
+
value: {
|
|
60
|
+
blockIndex: 2,
|
|
61
|
+
blockOffset: 1024,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
describe('variable block sizes', () => {
|
|
68
|
+
const claimedBlockSizes = [1024, 2048, 4096]; // 1KB, 2KB, 4KB blocks
|
|
69
|
+
|
|
70
|
+
it('should handle position in first block of custom sizes', () => {
|
|
71
|
+
const result = getBlockIndex(claimedBlockSizes, 512);
|
|
72
|
+
expect(result).toEqual({
|
|
73
|
+
done: false,
|
|
74
|
+
value: {
|
|
75
|
+
blockIndex: 1,
|
|
76
|
+
blockOffset: 512,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('should handle position at exact first block boundary', () => {
|
|
82
|
+
const result = getBlockIndex(claimedBlockSizes, 1024);
|
|
83
|
+
expect(result).toEqual({
|
|
84
|
+
done: false,
|
|
85
|
+
value: {
|
|
86
|
+
blockIndex: 2,
|
|
87
|
+
blockOffset: 0,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('should handle position in second block', () => {
|
|
93
|
+
const result = getBlockIndex(claimedBlockSizes, 1024 + 512);
|
|
94
|
+
expect(result).toEqual({
|
|
95
|
+
done: false,
|
|
96
|
+
value: {
|
|
97
|
+
blockIndex: 2,
|
|
98
|
+
blockOffset: 512,
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('should handle position at second block boundary', () => {
|
|
104
|
+
const result = getBlockIndex(claimedBlockSizes, 1024 + 2048);
|
|
105
|
+
expect(result).toEqual({
|
|
106
|
+
done: false,
|
|
107
|
+
value: {
|
|
108
|
+
blockIndex: 3,
|
|
109
|
+
blockOffset: 0,
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it('should handle position in third block', () => {
|
|
115
|
+
const result = getBlockIndex(claimedBlockSizes, 1024 + 2048 + 1000);
|
|
116
|
+
expect(result).toEqual({
|
|
117
|
+
done: false,
|
|
118
|
+
value: {
|
|
119
|
+
blockIndex: 3,
|
|
120
|
+
blockOffset: 1000,
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('should handle position at very end of last block', () => {
|
|
126
|
+
const result = getBlockIndex(claimedBlockSizes, 1024 + 2048 + 4096 - 1);
|
|
127
|
+
expect(result).toEqual({
|
|
128
|
+
done: false,
|
|
129
|
+
value: {
|
|
130
|
+
blockIndex: 3,
|
|
131
|
+
blockOffset: 4095,
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it('should handle zero-sized blocks mixed with normal blocks', () => {
|
|
137
|
+
const claimedBlockSizes = [0, 1000, 0, 2000];
|
|
138
|
+
const result = getBlockIndex(claimedBlockSizes, 500);
|
|
139
|
+
expect(result).toEqual({
|
|
140
|
+
done: false,
|
|
141
|
+
value: {
|
|
142
|
+
blockIndex: 2,
|
|
143
|
+
blockOffset: 500,
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('should throw error when position is beyond file with custom block sizes', () => {
|
|
149
|
+
const claimedBlockSizes = [1024, 2048, 4096];
|
|
150
|
+
const totalSize = 1024 + 2048 + 4096;
|
|
151
|
+
const result = getBlockIndex(claimedBlockSizes, totalSize);
|
|
152
|
+
expect(result).toEqual({
|
|
153
|
+
done: true,
|
|
154
|
+
value: undefined,
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
});
|