@ngxsp/core 0.2.1 → 0.3.0
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/index.cjs +0 -59
- package/index.cjs.map +1 -1
- package/index.d.ts +0 -1
- package/index.js +1 -54
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/domain/vault.d.ts +0 -55
package/package.json
CHANGED
package/domain/vault.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Media kept behind a lock.
|
|
3
|
-
*
|
|
4
|
-
* What is locked is not merely refused: it is **absent**. It is in no shelf, no search, no
|
|
5
|
-
* history, no queue, until the vault is opened. Anything less tells whoever is holding the
|
|
6
|
-
* device that there is something to look for, which is the thing a lock is meant to avoid.
|
|
7
|
-
*
|
|
8
|
-
* The code is never kept. What is kept is a salt and the result of stretching the code through
|
|
9
|
-
* PBKDF2 with it, so the stored record cannot be read backwards, and the same code typed twice
|
|
10
|
-
* on two devices does not produce the same record.
|
|
11
|
-
*/
|
|
12
|
-
/** What is written down about the code. The code itself never is. */
|
|
13
|
-
export interface VaultPasscode {
|
|
14
|
-
/** Random, per vault, so two vaults with the same code do not look alike. */
|
|
15
|
-
salt: string;
|
|
16
|
-
/** The stretched code, base64. */
|
|
17
|
-
hash: string;
|
|
18
|
-
/** How many rounds produced it, so a record made today still opens after the cost is raised. */
|
|
19
|
-
rounds: number;
|
|
20
|
-
}
|
|
21
|
-
/** The parts of Web Crypto this needs, named so a test can stand in for them. */
|
|
22
|
-
export interface VaultCrypto {
|
|
23
|
-
getRandomValues(array: Uint8Array): Uint8Array;
|
|
24
|
-
subtle: Pick<SubtleCrypto, 'importKey' | 'deriveBits'>;
|
|
25
|
-
}
|
|
26
|
-
export declare const VAULT_ROUNDS = 310000;
|
|
27
|
-
/**
|
|
28
|
-
* Stretches a code into something that can be written down.
|
|
29
|
-
*
|
|
30
|
-
* The rounds are the cost of one guess. They are stored with the record rather than assumed, so
|
|
31
|
-
* raising them later does not lock anyone out of a vault they already have.
|
|
32
|
-
*/
|
|
33
|
-
export declare function hashPasscode(code: string, crypto: VaultCrypto, options?: {
|
|
34
|
-
salt?: string;
|
|
35
|
-
rounds?: number;
|
|
36
|
-
}): Promise<VaultPasscode>;
|
|
37
|
-
/**
|
|
38
|
-
* Whether a code opens a record. Compared in constant time, so the time an answer takes says
|
|
39
|
-
* nothing about how much of the code was right.
|
|
40
|
-
*/
|
|
41
|
-
export declare function verifyPasscode(code: string, record: VaultPasscode | null, crypto: VaultCrypto): Promise<boolean>;
|
|
42
|
-
/** A code short enough to guess is not a code. Four is the floor every phone uses. */
|
|
43
|
-
export declare function isUsablePasscode(code: string): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* The ids that must not be shown.
|
|
46
|
-
*
|
|
47
|
-
* Nothing is hidden while the vault is open, and nothing is hidden when there is no code — a
|
|
48
|
-
* vault nobody can open is a way of losing media, not of protecting it.
|
|
49
|
-
*/
|
|
50
|
-
export declare function hiddenIds(locked: Iterable<string>, state: {
|
|
51
|
-
open: boolean;
|
|
52
|
-
hasPasscode: boolean;
|
|
53
|
-
}): Set<string>;
|
|
54
|
-
/** Keeps only what may be seen, in the order it was given. */
|
|
55
|
-
export declare function withoutHidden<T>(items: readonly T[], idOf: (item: T) => string, hidden: ReadonlySet<string>): T[];
|