nsIPK11Token.idl 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2. *
  3. * This Source Code Form is subject to the terms of the Mozilla Public
  4. * License, v. 2.0. If a copy of the MPL was not distributed with this
  5. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  6. #include "nsISupports.idl"
  7. [scriptable, uuid(51191434-1dd2-11b2-a17c-e49c4e99a4e3)]
  8. interface nsIPK11Token : nsISupports
  9. {
  10. const long ASK_EVERY_TIME = -1;
  11. const long ASK_FIRST_TIME = 0;
  12. const long ASK_EXPIRE_TIME = 1;
  13. /*
  14. * The name of the token
  15. */
  16. readonly attribute AUTF8String tokenName;
  17. readonly attribute AUTF8String tokenLabel;
  18. /**
  19. * Manufacturer ID of the token.
  20. */
  21. readonly attribute AUTF8String tokenManID;
  22. /**
  23. * Hardware version of the token.
  24. */
  25. readonly attribute AUTF8String tokenHWVersion;
  26. /**
  27. * Firmware version of the token.
  28. */
  29. readonly attribute AUTF8String tokenFWVersion;
  30. readonly attribute AUTF8String tokenSerialNumber;
  31. /*
  32. * Login information
  33. */
  34. boolean isLoggedIn();
  35. void login(in boolean force);
  36. void logoutSimple();
  37. void logoutAndDropAuthenticatedResources();
  38. /*
  39. * Reset password
  40. */
  41. void reset();
  42. /*
  43. * Password information
  44. */
  45. readonly attribute long minimumPasswordLength;
  46. readonly attribute boolean needsUserInit;
  47. /**
  48. * Checks whether the given password is correct. Logs the token out if an
  49. * incorrect password is given.
  50. *
  51. * @param password The password to check.
  52. * @return true if the password was correct, false otherwise.
  53. */
  54. boolean checkPassword(in AUTF8String password);
  55. void initPassword(in AUTF8String initialPassword);
  56. void changePassword(in AUTF8String oldPassword, in AUTF8String newPassword);
  57. long getAskPasswordTimes();
  58. long getAskPasswordTimeout();
  59. void setAskPasswordDefaults([const] in long askTimes, [const] in long timeout);
  60. /*
  61. * Other attributes
  62. */
  63. boolean isHardwareToken();
  64. boolean needsLogin();
  65. boolean isFriendly();
  66. };