Source code

Revision control

Other Tools

1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
* License, v. 2.0. If a copy of the MPL was not distributed with this
3
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5
6
#include "nsISupports.idl"
7
8
[scriptable, uuid(2030770e-542e-40cd-8061-cd9d4ad4227f)]
9
interface nsILoginManagerCrypto : nsISupports {
10
11
const unsigned long ENCTYPE_BASE64 = 0; // obsolete
12
const unsigned long ENCTYPE_SDR = 1;
13
14
/**
15
* encrypt
16
*
17
* @param plainText
18
* The string to be encrypted.
19
*
20
* Encrypts the specified string, returning the ciphertext value.
21
*
22
* NOTE: The current implemention of this inferface simply uses NSS/PSM's
23
* "Secret Decoder Ring" service. It is not recommended for general
24
* purpose encryption/decryption.
25
*
26
* Can throw if the user cancels entry of their master password.
27
*/
28
AString encrypt(in AString plainText);
29
30
/*
31
* encryptMany
32
*
33
* @param plainTexts
34
* The strings to be encrypted.
35
*
36
* Encrypts the specified strings, similar to encrypt, but returning a promise
37
* which resolves with the the encrypted strings.
38
*/
39
Promise encryptMany(in jsval plainTexts);
40
41
/**
42
* decrypt
43
*
44
* @param cipherText
45
* The string to be decrypted.
46
*
47
* Decrypts the specified string, returning the plaintext value.
48
*
49
* Can throw if the user cancels entry of their master password, or if the
50
* cipherText value can not be successfully decrypted (eg, if it was
51
* encrypted with some other key).
52
*/
53
AString decrypt(in AString cipherText);
54
55
/**
56
* @param cipherTexts
57
* The strings to be decrypted.
58
*
59
* Decrypts the specified strings, returning the plaintext values.
60
*
61
* Can throw if the user cancels entry of their master password, or if the
62
* cipherText value can not be successfully decrypted (eg, if it was
63
* encrypted with some other key).
64
*/
65
Promise decryptMany(in jsval cipherTexts);
66
67
/**
68
* uiBusy
69
*
70
* True when a master password prompt is being displayed.
71
*/
72
readonly attribute boolean uiBusy;
73
74
/**
75
* isLoggedIn
76
*
77
* Current login state of the token used for encryption. If the user is
78
* not logged in, performing a crypto operation will result in a master
79
* password prompt.
80
*/
81
readonly attribute boolean isLoggedIn;
82
83
/**
84
* defaultEncType
85
*
86
* Default encryption type used by an implementation of this interface.
87
*/
88
readonly attribute unsigned long defaultEncType;
89
};