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"use strict";
6
7var EXPORTED_SYMBOLS = ["NormandyUtils"];
8
9const { XPCOMUtils } = ChromeUtils.import(
10  "resource://gre/modules/XPCOMUtils.jsm"
11);
12
13XPCOMUtils.defineLazyServiceGetter(
14  this,
15  "uuidGenerator",
16  "@mozilla.org/uuid-generator;1",
17  "nsIUUIDGenerator"
18);
19
20var NormandyUtils = {
21  generateUuid() {
22    // Generate a random UUID, convert it to a string, and slice the braces off the ends.
23    return uuidGenerator
24      .generateUUID()
25      .toString()
26      .slice(1, -1);
27  },
28};
29