Home

js-spectre @64337f178d031116037b497b1c69ac477df5cfe0 - refs - log -
-
https://git.jolheiser.com/js-spectre.git
JS implementation for spectre/masterpassword
js-spectre / lib / scope.js
- raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { Template } from "./template.js";
export var Scope;
(function (Scope) {
    Scope["AUTHENTICATION"] = "Authentication";
    Scope["IDENTIFICATION"] = "Identification";
    Scope["RECOVERY"] = "Recovery";
})(Scope || (Scope = {}));
export function defaultTemplate(s) {
    switch (s) {
        case Scope.AUTHENTICATION:
            return Template.LONG;
        case Scope.IDENTIFICATION:
            return Template.NAME;
        case Scope.RECOVERY:
            return Template.MAXIMUM;
    }
}
export class SimpleScoper {
    key;
    constructor(key) {
        this.key = key;
    }
    scope(s) {
        switch (s) {
            case Scope.AUTHENTICATION:
                return this.key;
            case Scope.IDENTIFICATION:
                return `${this.key}.login`;
            case Scope.RECOVERY:
                return `${this.key}.answer`;
        }
    }
}
export const defaultScoper = new SimpleScoper("com.lyndir.masterpassword");