PageSourceSearch

https://erb.dnb.com/CEP/dnbDeviceAuthentication.js

js dnb.com collected 2026-09-24 09:09:35 UTC 3,413 bytes, 138 lines download raw bytes

1// Trusteer Script
2var sessionId;
3var activity;
4var puid;
5var userId;
6var pinPointId;
7
8var jsURL = "https://dgdq3u054l7rm.cloudfront.net/";
9
10function getIdentity() {
11  var result = {
12    p: {
13      p: puid,
14    },
15    u: {
16      p: userId,
17    },
18    c: sessionId,
19  };
20  return result;
21}
22
23async function start(account_code, session_id, activity_code, pinPointSnippetId) {
24  if (!session_id) {
25    sessionId = await getSessionId();
26  } else {
27    sessionId = session_id;
28  }
29
30  userId = account_code;
31
32  if (!account_code) {
33    puid = "";
34  } else {
35    puid = await generatePUID(account_code);
36  }
37
38  activity = activity_code;
39  pinPointId = pinPointSnippetId;
40
41  loadTrusteerScript(pinPointSnippetId);
42
43  return { puid, sessionId, activity };
44}
45
46function loadTrusteerScript(pinPointSnippetId) {
47  var cookie_value = null;
48  var cookie_value = null;
49  try {
50    cookie_value = document.cookie;
51  } catch (e) {}
52  if (cookie_value) {
53    var re = new RegExp(`(?:^| )(LSESSION_${pinPointSnippetId}=.[^;]+)`, "i"),
54      matches = null;
55    var result = null;
56    if (cookie_value.length > 0) {
57      matches = cookie_value.match(re);
58      if (matches && matches.length == 2) {
59        result = matches[1];
60      }
61    }
62  }
63  var url=jsURL+pinPointId+"/dunsnum.js";
64  var s = document.createElement("script");
65  s.type = "text/javascript";
66  s.async = true;
67  var extra = ["dt=" + activity + "&r=" + Math.random()];
68  if (result) {
69    extra.push(result);
70  }
71  s.src = [url, extra.join("&")].join("?");
72  document.getElementsByTagName("head")[0].appendChild(s);
73
74  if(activity === 'login') {
75    loadTempJS();
76  }
77}
78
79function loadTempJS() {
80var cookie_value = null;
81try {
82  cookie_value = document.cookie;
83} catch (e) {}
84if (cookie_value) {
85  var re = new RegExp(`(?:^| )(LSESSION_${pinPointSnippetId}=.[^;]+)`, "i"),
86    matches = null;
87  var result = null;
88  if (cookie_value.length > 0) {
89    matches = cookie_value.match(re);
90    if (matches && matches.length == 2) {
91      result = matches[1];
92    }
93  }
94}
95var url = jsURL+pinPointId+"/temp.js";
96var s = document.createElement("script");
97s.type = "text/javascript";
98s.async = true;
99var extra = ["r=" + Math.random()];
100if (result) {
101  extra.push(result);
102}
103s.src = [url, extra.join("&")].join("?");
104document.getElementsByTagName("head")[0].appendChild(s);
105}
106
107async function generatePUID(account_code) {
108  const encoder = new TextEncoder();
109  const data = encoder.encode(account_code);
110  const hashBuffer = await crypto.subtle.digest("SHA-256", data);
111  const hashArray = Array.from(new Uint8Array(hashBuffer));
112  const hashHex = hashArray
113    .map((b) => b.toString(16).padStart(2, "0"))
114    .join("");
115  return hashHex;
116}
117
118function generateRandomString(length) {
119  const characters =
120    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
121  let result = "";
122  for (let i = 0; i < length; i++) {
123    const randomIndex = Math.floor(Math.random() * characters.length);
124    result += characters[randomIndex];
125  }
126  return result;
127}
128
129async function getSessionId() {
130  const ele = document.getElementById("session_id");
131  const session_id = ele ? ele.value : null;
132  if (!session_id) {
133    return generatePUID(generateRandomString(16));
134  }
135  return new Promise((resolve) => {
136    resolve(session_id);
137  });
138}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.