netbox-secrets 2.3.1__tar.gz → 2.3.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/MANIFEST.in +2 -1
- {netbox_secrets-2.3.1/netbox_secrets.egg-info → netbox_secrets-2.3.4}/PKG-INFO +1 -1
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/static/netbox_secrets/secrets.js +1 -1
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/static/netbox_secrets/secrets.js.map +3 -3
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4/netbox_secrets.egg-info}/PKG-INFO +1 -1
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets.egg-info/SOURCES.txt +1 -0
- netbox_secrets-2.3.4/requirements.txt +8 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/setup.py +1 -1
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/LICENSE.md +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/README.md +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/__init__.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/api/__init__.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/api/serializers.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/api/urls.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/api/views.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/constants.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/exceptions.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/filtersets.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/forms/__init__.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/forms/bulk_edit.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/forms/bulk_import.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/forms/filterset.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/forms/model_forms.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/graphql/__init__.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/graphql/filters.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/graphql/schema.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/graphql/types.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/hashers.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/migrations/0001_initial.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/migrations/0002_populate_userkeys.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/migrations/0003_populate_secretroles.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/migrations/0004_populate_secrets.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/migrations/0005_alter_secret_custom_field_data_and_more.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/migrations/0006_alter_userkey_created_alter_userkey_last_updated.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/migrations/0007_secret__object_repr_secret_comments_and_more.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/migrations/0008_userkey_custom_field_data_userkey_tags.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/migrations/__init__.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/models/__init__.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/models/secrets.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/navigation.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/querysets.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/signals.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/tables.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/template_content.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/templates/netbox_secrets/activate_keys.html +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/templates/netbox_secrets/inc/private_key_modal.html +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/templates/netbox_secrets/inc/secret_actions.html +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/templates/netbox_secrets/inc/secret_add_button.html +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/templates/netbox_secrets/inc/secrets_panel.html +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/templates/netbox_secrets/secret.html +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/templates/netbox_secrets/secret_edit.html +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/templates/netbox_secrets/secretrole.html +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/templates/netbox_secrets/userkey.html +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/templates/netbox_secrets/userkey_edit.html +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/templates/netbox_secrets/userkey_list.html +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/tests/__init__.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/tests/constants.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/tests/test_api.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/tests/test_filters.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/tests/test_form.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/tests/test_models.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/tests/test_views.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/urls.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/utils/__init__.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/utils/crypto.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/utils/hashers.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/utils/helpers.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/views.py +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets.egg-info/dependency_links.txt +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets.egg-info/not-zip-safe +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets.egg-info/requires.txt +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets.egg-info/top_level.txt +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/pyproject.toml +0 -0
- {netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: netbox-secrets
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.4
|
|
4
4
|
Summary: Enhance your secret management with encrypted storage and flexible, user-friendly features.
|
|
5
5
|
Home-page: https://github.com/Onemind-Services-LLC/netbox-secrets/
|
|
6
6
|
Author: Abhimanyu Saharan
|
{netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/static/netbox_secrets/secrets.js
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var C=Object.create;var b=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var D=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var O=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of _(n))!H.call(e,o)&&o!==t&&b(e,o,{get:()=>n[o],enumerable:!(r=M(n,o))||r.enumerable});return e};var q=(e,n,t)=>(t=e!=null?C($(e)):{},O(n||!e||!e.__esModule?b(t,"default",{value:e,enumerable:!0}):t,e));var y=(e,n,t)=>new Promise((r,o)=>{var i=a=>{try{l(t.next(a))}catch(c){o(c)}},s=a=>{try{l(t.throw(a))}catch(c){o(c)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(i,s);l((t=t.apply(e,n)).next())});var A=D(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.parse=G;E.serialize=V;var j=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,K=/^[\u0021-\u003A\u003C-\u007E]*$/,U=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,z=/^[\u0020-\u003A\u003D-\u007E]*$/,F=Object.prototype.toString,N=(()=>{let e=function(){};return e.prototype=Object.create(null),e})();function G(e,n){let t=new N,r=e.length;if(r<2)return t;let o=(n==null?void 0:n.decode)||J,i=0;do{let s=e.indexOf("=",i);if(s===-1)break;let l=e.indexOf(";",i),a=l===-1?r:l;if(s>a){i=e.lastIndexOf(";",s-1)+1;continue}let c=v(e,i,s),d=T(e,s,c),u=e.slice(c,d);if(t[u]===void 0){let w=v(e,s+1,a),p=T(e,a,w),B=o(e.slice(w,p));t[u]=B}i=a+1}while(i<r);return t}function v(e,n,t){do{let r=e.charCodeAt(n);if(r!==32&&r!==9)return n}while(++n<t);return t}function T(e,n,t){for(;n>t;){let r=e.charCodeAt(--n);if(r!==32&&r!==9)return n+1}return t}function V(e,n,t){let r=(t==null?void 0:t.encode)||encodeURIComponent;if(!j.test(e))throw new TypeError(`argument name is invalid: ${e}`);let o=r(n);if(!K.test(o))throw new TypeError(`argument val is invalid: ${n}`);let i=e+"="+o;if(!t)return i;if(t.maxAge!==void 0){if(!Number.isInteger(t.maxAge))throw new TypeError(`option maxAge is invalid: ${t.maxAge}`);i+="; Max-Age="+t.maxAge}if(t.domain){if(!U.test(t.domain))throw new TypeError(`option domain is invalid: ${t.domain}`);i+="; Domain="+t.domain}if(t.path){if(!z.test(t.path))throw new TypeError(`option path is invalid: ${t.path}`);i+="; Path="+t.path}if(t.expires){if(!X(t.expires)||!Number.isFinite(t.expires.valueOf()))throw new TypeError(`option expires is invalid: ${t.expires}`);i+="; Expires="+t.expires.toUTCString()}if(t.httpOnly&&(i+="; HttpOnly"),t.secure&&(i+="; Secure"),t.partitioned&&(i+="; Partitioned"),t.priority)switch(typeof t.priority=="string"?t.priority.toLowerCase():void 0){case"low":i+="; Priority=Low";break;case"medium":i+="; Priority=Medium";break;case"high":i+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${t.priority}`)}if(t.sameSite)switch(typeof t.sameSite=="string"?t.sameSite.toLowerCase():t.sameSite){case!0:case"strict":i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"none":i+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${t.sameSite}`)}return i}function J(e){if(e.indexOf("%")===-1)return e;try{return decodeURIComponent(e)}catch(n){return e}}function X(e){return F.call(e)==="[object Date]"}});function m(e,n,t,r){let o="mdi-alert";switch(e){case"warning":o="mdi-alert";break;case"success":o="mdi-check-circle";break;case"info":o="mdi-information";break;case"danger":o="mdi-alert";break}let i=document.createElement("div");i.setAttribute("class","toast-container position-fixed bottom-0 end-0 m-3");let s=document.createElement("div");s.setAttribute("class",`toast bg-${e}`),s.setAttribute("role","alert"),s.setAttribute("aria-live","assertive"),s.setAttribute("aria-atomic","true");let l=document.createElement("div");l.setAttribute("class",`toast-header bg-${e} text-body`);let a=document.createElement("i");a.setAttribute("class",`mdi ${o}`);let c=document.createElement("strong");c.setAttribute("class","me-auto ms-1"),c.innerText=n;let d=document.createElement("button");d.setAttribute("type","button"),d.setAttribute("class","btn-close"),d.setAttribute("data-bs-dismiss","toast"),d.setAttribute("aria-label","Close");let u=document.createElement("div");if(u.setAttribute("class","toast-body"),l.appendChild(a),l.appendChild(c),typeof r!="undefined"){let p=document.createElement("small");p.setAttribute("class","text-muted"),l.appendChild(p)}return l.appendChild(d),u.innerText=t.trim(),s.appendChild(l),s.appendChild(u),i.appendChild(s),document.body.appendChild(i),new window.Toast(s)}var L=q(A());function S(e){return"error"in e&&"exception"in e}function k(e){return"error"in e}function x(e){return"value"in e&&"required"in e}function Y(){let{csrftoken:e}=L.
|
|
1
|
+
"use strict";(()=>{var C=Object.create;var b=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var $=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var D=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports);var O=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of _(n))!H.call(e,o)&&o!==t&&b(e,o,{get:()=>n[o],enumerable:!(r=M(n,o))||r.enumerable});return e};var q=(e,n,t)=>(t=e!=null?C($(e)):{},O(n||!e||!e.__esModule?b(t,"default",{value:e,enumerable:!0}):t,e));var y=(e,n,t)=>new Promise((r,o)=>{var i=a=>{try{l(t.next(a))}catch(c){o(c)}},s=a=>{try{l(t.throw(a))}catch(c){o(c)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(i,s);l((t=t.apply(e,n)).next())});var A=D(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.parse=G;E.serialize=V;var j=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,K=/^[\u0021-\u003A\u003C-\u007E]*$/,U=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,z=/^[\u0020-\u003A\u003D-\u007E]*$/,F=Object.prototype.toString,N=(()=>{let e=function(){};return e.prototype=Object.create(null),e})();function G(e,n){let t=new N,r=e.length;if(r<2)return t;let o=(n==null?void 0:n.decode)||J,i=0;do{let s=e.indexOf("=",i);if(s===-1)break;let l=e.indexOf(";",i),a=l===-1?r:l;if(s>a){i=e.lastIndexOf(";",s-1)+1;continue}let c=v(e,i,s),d=T(e,s,c),u=e.slice(c,d);if(t[u]===void 0){let w=v(e,s+1,a),p=T(e,a,w),B=o(e.slice(w,p));t[u]=B}i=a+1}while(i<r);return t}function v(e,n,t){do{let r=e.charCodeAt(n);if(r!==32&&r!==9)return n}while(++n<t);return t}function T(e,n,t){for(;n>t;){let r=e.charCodeAt(--n);if(r!==32&&r!==9)return n+1}return t}function V(e,n,t){let r=(t==null?void 0:t.encode)||encodeURIComponent;if(!j.test(e))throw new TypeError(`argument name is invalid: ${e}`);let o=r(n);if(!K.test(o))throw new TypeError(`argument val is invalid: ${n}`);let i=e+"="+o;if(!t)return i;if(t.maxAge!==void 0){if(!Number.isInteger(t.maxAge))throw new TypeError(`option maxAge is invalid: ${t.maxAge}`);i+="; Max-Age="+t.maxAge}if(t.domain){if(!U.test(t.domain))throw new TypeError(`option domain is invalid: ${t.domain}`);i+="; Domain="+t.domain}if(t.path){if(!z.test(t.path))throw new TypeError(`option path is invalid: ${t.path}`);i+="; Path="+t.path}if(t.expires){if(!X(t.expires)||!Number.isFinite(t.expires.valueOf()))throw new TypeError(`option expires is invalid: ${t.expires}`);i+="; Expires="+t.expires.toUTCString()}if(t.httpOnly&&(i+="; HttpOnly"),t.secure&&(i+="; Secure"),t.partitioned&&(i+="; Partitioned"),t.priority)switch(typeof t.priority=="string"?t.priority.toLowerCase():void 0){case"low":i+="; Priority=Low";break;case"medium":i+="; Priority=Medium";break;case"high":i+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${t.priority}`)}if(t.sameSite)switch(typeof t.sameSite=="string"?t.sameSite.toLowerCase():t.sameSite){case!0:case"strict":i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"none":i+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${t.sameSite}`)}return i}function J(e){if(e.indexOf("%")===-1)return e;try{return decodeURIComponent(e)}catch(n){return e}}function X(e){return F.call(e)==="[object Date]"}});function m(e,n,t,r){let o="mdi-alert";switch(e){case"warning":o="mdi-alert";break;case"success":o="mdi-check-circle";break;case"info":o="mdi-information";break;case"danger":o="mdi-alert";break}let i=document.createElement("div");i.setAttribute("class","toast-container position-fixed bottom-0 end-0 m-3");let s=document.createElement("div");s.setAttribute("class",`toast bg-${e}`),s.setAttribute("role","alert"),s.setAttribute("aria-live","assertive"),s.setAttribute("aria-atomic","true");let l=document.createElement("div");l.setAttribute("class",`toast-header bg-${e} text-body`);let a=document.createElement("i");a.setAttribute("class",`mdi ${o}`);let c=document.createElement("strong");c.setAttribute("class","me-auto ms-1"),c.innerText=n;let d=document.createElement("button");d.setAttribute("type","button"),d.setAttribute("class","btn-close"),d.setAttribute("data-bs-dismiss","toast"),d.setAttribute("aria-label","Close");let u=document.createElement("div");if(u.setAttribute("class","toast-body"),l.appendChild(a),l.appendChild(c),typeof r!="undefined"){let p=document.createElement("small");p.setAttribute("class","text-muted"),l.appendChild(p)}return l.appendChild(d),u.innerText=t.trim(),s.appendChild(l),s.appendChild(u),i.appendChild(s),document.body.appendChild(i),new window.Toast(s)}var L=q(A());function S(e){return"error"in e&&"exception"in e}function k(e){return"error"in e}function x(e){return"value"in e&&"required"in e}function Y(){let{csrftoken:e}=(0,L.parse)(document.cookie);if(typeof e=="undefined")throw new Error("Invalid or missing CSRF token");return e}function I(e,n,t){return y(this,null,function*(){let r=Y(),o=new Headers({"X-CSRFToken":r}),i;typeof t!="undefined"&&(i=JSON.stringify(t),o.set("content-type","application/json"),o.set("Accept","application/json"));let s=yield fetch(e,{method:n,body:i,headers:o,credentials:"same-origin"}),l=s.headers.get("Content-Type");if(typeof l=="string"&&l.includes("text"))return{error:yield s.text()};let a=yield s.json();return!s.ok&&Array.isArray(a)?{error:a.join(`
|
|
2
2
|
`)}:!s.ok&&"detail"in a?{error:a.detail}:a})}function P(e,n){return y(this,null,function*(){return yield I(e,"POST",n)})}function g(e){return y(this,null,function*(){return yield I(e,"GET")})}function f(e){let n=window.location.pathname||"",t=n.indexOf("/plugins/"),r=n.indexOf("/api/"),o=t>=0?t:r;return`${o>=0?n.slice(0,o):""}${e}`}function Q(){let e=document.getElementById("new_keypair_modal"),n=document.getElementById("use_new_pubkey"),t=document.getElementById("copy_prikey"),r=document.getElementById("export_key");if(e===null||n===null||t===null||r===null)return;let o=e.querySelector("textarea#new_pubkey"),i=e.querySelector("textarea#new_privkey");function s(){for(let c of[o,i])c!==null&&c.setAttribute("readonly","");g(f("/api/plugins/secrets/generate-rsa-key-pair/")).then(c=>{if(k(c))m("danger","Error",c.error).show();else{let{private_key:d,public_key:u}=c;o!==null&&i!==null&&(o.value=u,i.value=d)}})}function l(){let c=document.getElementById("id_public_key");o!==null&&(c.value=o.value,c.innerText=o.value)}function a(){let c=`Public Key
|
|
3
3
|
|
|
4
4
|
${o==null?void 0:o.value}
|
{netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/static/netbox_secrets/secrets.js.map
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../node_modules/cookie/src/index.ts", "../src/bs.ts", "../src/util.ts", "../src/secrets.ts", "../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * RegExp to match cookie-name in RFC 6265 sec 4.1.1\n * This refers out to the obsoleted definition of token in RFC 2616 sec 2.2\n * which has been replaced by the token definition in RFC 7230 appendix B.\n *\n * cookie-name = token\n * token = 1*tchar\n * tchar = \"!\" / \"#\" / \"$\" / \"%\" / \"&\" / \"'\" /\n * \"*\" / \"+\" / \"-\" / \".\" / \"^\" / \"_\" /\n * \"`\" / \"|\" / \"~\" / DIGIT / ALPHA\n *\n * Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191\n * Allow same range as cookie value, except `=`, which delimits end of name.\n */\nconst cookieNameRegExp = /^[\\u0021-\\u003A\\u003C\\u003E-\\u007E]+$/;\n\n/**\n * RegExp to match cookie-value in RFC 6265 sec 4.1.1\n *\n * cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )\n * cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E\n * ; US-ASCII characters excluding CTLs,\n * ; whitespace DQUOTE, comma, semicolon,\n * ; and backslash\n *\n * Allowing more characters: https://github.com/jshttp/cookie/issues/191\n * Comma, backslash, and DQUOTE are not part of the parsing algorithm.\n */\nconst cookieValueRegExp = /^[\\u0021-\\u003A\\u003C-\\u007E]*$/;\n\n/**\n * RegExp to match domain-value in RFC 6265 sec 4.1.1\n *\n * domain-value = <subdomain>\n * ; defined in [RFC1034], Section 3.5, as\n * ; enhanced by [RFC1123], Section 2.1\n * <subdomain> = <label> | <subdomain> \".\" <label>\n * <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]\n * Labels must be 63 characters or less.\n * 'let-dig' not 'letter' in the first char, per RFC1123\n * <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>\n * <let-dig-hyp> = <let-dig> | \"-\"\n * <let-dig> = <letter> | <digit>\n * <letter> = any one of the 52 alphabetic characters A through Z in\n * upper case and a through z in lower case\n * <digit> = any one of the ten digits 0 through 9\n *\n * Keep support for leading dot: https://github.com/jshttp/cookie/issues/173\n *\n * > (Note that a leading %x2E (\".\"), if present, is ignored even though that\n * character is not permitted, but a trailing %x2E (\".\"), if present, will\n * cause the user agent to ignore the attribute.)\n */\nconst domainValueRegExp =\n /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;\n\n/**\n * RegExp to match path-value in RFC 6265 sec 4.1.1\n *\n * path-value = <any CHAR except CTLs or \";\">\n * CHAR = %x01-7F\n * ; defined in RFC 5234 appendix B.1\n */\nconst pathValueRegExp = /^[\\u0020-\\u003A\\u003D-\\u007E]*$/;\n\nconst __toString = Object.prototype.toString;\n\nconst NullObject = /* @__PURE__ */ (() => {\n const C = function () {};\n C.prototype = Object.create(null);\n return C;\n})() as unknown as { new (): any };\n\n/**\n * Parse options.\n */\nexport interface ParseOptions {\n /**\n * Specifies a function that will be used to decode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1).\n * Since the value of a cookie has a limited character set (and must be a simple string), this function can be used to decode\n * a previously-encoded cookie value into a JavaScript string.\n *\n * The default function is the global `decodeURIComponent`, wrapped in a `try..catch`. If an error\n * is thrown it will return the cookie's original value. If you provide your own encode/decode\n * scheme you must ensure errors are appropriately handled.\n *\n * @default decode\n */\n decode?: (str: string) => string | undefined;\n}\n\n/**\n * Parse a cookie header.\n *\n * Parse the given cookie header string into an object\n * The object has the various cookies as keys(names) => values\n */\nexport function parse(\n str: string,\n options?: ParseOptions,\n): Record<string, string | undefined> {\n const obj: Record<string, string | undefined> = new NullObject();\n const len = str.length;\n // RFC 6265 sec 4.1.1, RFC 2616 2.2 defines a cookie name consists of one char minimum, plus '='.\n if (len < 2) return obj;\n\n const dec = options?.decode || decode;\n let index = 0;\n\n do {\n const eqIdx = str.indexOf(\"=\", index);\n if (eqIdx === -1) break; // No more cookie pairs.\n\n const colonIdx = str.indexOf(\";\", index);\n const endIdx = colonIdx === -1 ? len : colonIdx;\n\n if (eqIdx > endIdx) {\n // backtrack on prior semicolon\n index = str.lastIndexOf(\";\", eqIdx - 1) + 1;\n continue;\n }\n\n const keyStartIdx = startIndex(str, index, eqIdx);\n const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);\n const key = str.slice(keyStartIdx, keyEndIdx);\n\n // only assign once\n if (obj[key] === undefined) {\n let valStartIdx = startIndex(str, eqIdx + 1, endIdx);\n let valEndIdx = endIndex(str, endIdx, valStartIdx);\n\n const value = dec(str.slice(valStartIdx, valEndIdx));\n obj[key] = value;\n }\n\n index = endIdx + 1;\n } while (index < len);\n\n return obj;\n}\n\nfunction startIndex(str: string, index: number, max: number) {\n do {\n const code = str.charCodeAt(index);\n if (code !== 0x20 /* */ && code !== 0x09 /* \\t */) return index;\n } while (++index < max);\n return max;\n}\n\nfunction endIndex(str: string, index: number, min: number) {\n while (index > min) {\n const code = str.charCodeAt(--index);\n if (code !== 0x20 /* */ && code !== 0x09 /* \\t */) return index + 1;\n }\n return min;\n}\n\n/**\n * Serialize options.\n */\nexport interface SerializeOptions {\n /**\n * Specifies a function that will be used to encode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1).\n * Since value of a cookie has a limited character set (and must be a simple string), this function can be used to encode\n * a value into a string suited for a cookie's value, and should mirror `decode` when parsing.\n *\n * @default encodeURIComponent\n */\n encode?: (str: string) => string;\n /**\n * Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.2).\n *\n * The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and\n * `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,\n * so if both are set, they should point to the same date and time.\n */\n maxAge?: number;\n /**\n * Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.1).\n * When no expiration is set clients consider this a \"non-persistent cookie\" and delete it the current session is over.\n *\n * The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and\n * `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,\n * so if both are set, they should point to the same date and time.\n */\n expires?: Date;\n /**\n * Specifies the value for the [`Domain` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.3).\n * When no domain is set clients consider the cookie to apply to the current domain only.\n */\n domain?: string;\n /**\n * Specifies the value for the [`Path` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.4).\n * When no path is set, the path is considered the [\"default path\"](https://tools.ietf.org/html/rfc6265#section-5.1.4).\n */\n path?: string;\n /**\n * Enables the [`HttpOnly` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.6).\n * When enabled, clients will not allow client-side JavaScript to see the cookie in `document.cookie`.\n */\n httpOnly?: boolean;\n /**\n * Enables the [`Secure` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.5).\n * When enabled, clients will only send the cookie back if the browser has a HTTPS connection.\n */\n secure?: boolean;\n /**\n * Enables the [`Partitioned` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/).\n * When enabled, clients will only send the cookie back when the current domain _and_ top-level domain matches.\n *\n * This is an attribute that has not yet been fully standardized, and may change in the future.\n * This also means clients may ignore this attribute until they understand it. More information\n * about can be found in [the proposal](https://github.com/privacycg/CHIPS).\n */\n partitioned?: boolean;\n /**\n * Specifies the value for the [`Priority` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).\n *\n * - `'low'` will set the `Priority` attribute to `Low`.\n * - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set.\n * - `'high'` will set the `Priority` attribute to `High`.\n *\n * More information about priority levels can be found in [the specification](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).\n */\n priority?: \"low\" | \"medium\" | \"high\";\n /**\n * Specifies the value for the [`SameSite` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).\n *\n * - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement.\n * - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement.\n * - `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie.\n * - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement.\n *\n * More information about enforcement levels can be found in [the specification](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).\n */\n sameSite?: boolean | \"lax\" | \"strict\" | \"none\";\n}\n\n/**\n * Serialize data into a cookie header.\n *\n * Serialize a name value pair into a cookie string suitable for\n * http headers. An optional options object specifies cookie parameters.\n *\n * serialize('foo', 'bar', { httpOnly: true })\n * => \"foo=bar; httpOnly\"\n */\nexport function serialize(\n name: string,\n val: string,\n options?: SerializeOptions,\n): string {\n const enc = options?.encode || encodeURIComponent;\n\n if (!cookieNameRegExp.test(name)) {\n throw new TypeError(`argument name is invalid: ${name}`);\n }\n\n const value = enc(val);\n\n if (!cookieValueRegExp.test(value)) {\n throw new TypeError(`argument val is invalid: ${val}`);\n }\n\n let str = name + \"=\" + value;\n if (!options) return str;\n\n if (options.maxAge !== undefined) {\n if (!Number.isInteger(options.maxAge)) {\n throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);\n }\n\n str += \"; Max-Age=\" + options.maxAge;\n }\n\n if (options.domain) {\n if (!domainValueRegExp.test(options.domain)) {\n throw new TypeError(`option domain is invalid: ${options.domain}`);\n }\n\n str += \"; Domain=\" + options.domain;\n }\n\n if (options.path) {\n if (!pathValueRegExp.test(options.path)) {\n throw new TypeError(`option path is invalid: ${options.path}`);\n }\n\n str += \"; Path=\" + options.path;\n }\n\n if (options.expires) {\n if (\n !isDate(options.expires) ||\n !Number.isFinite(options.expires.valueOf())\n ) {\n throw new TypeError(`option expires is invalid: ${options.expires}`);\n }\n\n str += \"; Expires=\" + options.expires.toUTCString();\n }\n\n if (options.httpOnly) {\n str += \"; HttpOnly\";\n }\n\n if (options.secure) {\n str += \"; Secure\";\n }\n\n if (options.partitioned) {\n str += \"; Partitioned\";\n }\n\n if (options.priority) {\n const priority =\n typeof options.priority === \"string\"\n ? options.priority.toLowerCase()\n : undefined;\n switch (priority) {\n case \"low\":\n str += \"; Priority=Low\";\n break;\n case \"medium\":\n str += \"; Priority=Medium\";\n break;\n case \"high\":\n str += \"; Priority=High\";\n break;\n default:\n throw new TypeError(`option priority is invalid: ${options.priority}`);\n }\n }\n\n if (options.sameSite) {\n const sameSite =\n typeof options.sameSite === \"string\"\n ? options.sameSite.toLowerCase()\n : options.sameSite;\n switch (sameSite) {\n case true:\n case \"strict\":\n str += \"; SameSite=Strict\";\n break;\n case \"lax\":\n str += \"; SameSite=Lax\";\n break;\n case \"none\":\n str += \"; SameSite=None\";\n break;\n default:\n throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);\n }\n }\n\n return str;\n}\n\n/**\n * URL-decode string value. Optimized to skip native call when no %.\n */\nfunction decode(str: string): string {\n if (str.indexOf(\"%\") === -1) return str;\n\n try {\n return decodeURIComponent(str);\n } catch (e) {\n return str;\n }\n}\n\n/**\n * Determine if value is a Date.\n */\nfunction isDate(val: any): val is Date {\n return __toString.call(val) === \"[object Date]\";\n}\n", "type ToastLevel = 'danger' | 'warning' | 'success' | 'info';\n\nexport function createToast(\n level: ToastLevel,\n title: string,\n message: string,\n extra?: string,\n): InstanceType<typeof window.Toast> {\n let iconName = 'mdi-alert';\n switch (level) {\n case 'warning':\n iconName = 'mdi-alert';\n break;\n case 'success':\n iconName = 'mdi-check-circle';\n break;\n case 'info':\n iconName = 'mdi-information';\n break;\n case 'danger':\n iconName = 'mdi-alert';\n break;\n }\n\n const container = document.createElement('div');\n container.setAttribute('class', 'toast-container position-fixed bottom-0 end-0 m-3');\n\n const main = document.createElement('div');\n main.setAttribute('class', `toast bg-${level}`);\n main.setAttribute('role', 'alert');\n main.setAttribute('aria-live', 'assertive');\n main.setAttribute('aria-atomic', 'true');\n\n const header = document.createElement('div');\n header.setAttribute('class', `toast-header bg-${level} text-body`);\n\n const icon = document.createElement('i');\n icon.setAttribute('class', `mdi ${iconName}`);\n\n const titleElement = document.createElement('strong');\n titleElement.setAttribute('class', 'me-auto ms-1');\n titleElement.innerText = title;\n\n const button = document.createElement('button');\n button.setAttribute('type', 'button');\n button.setAttribute('class', 'btn-close');\n button.setAttribute('data-bs-dismiss', 'toast');\n button.setAttribute('aria-label', 'Close');\n\n const body = document.createElement('div');\n body.setAttribute('class', 'toast-body');\n\n header.appendChild(icon);\n header.appendChild(titleElement);\n\n if (typeof extra !== 'undefined') {\n const extraElement = document.createElement('small');\n extraElement.setAttribute('class', 'text-muted');\n header.appendChild(extraElement);\n }\n\n header.appendChild(button);\n\n body.innerText = message.trim();\n\n main.appendChild(header);\n main.appendChild(body);\n container.appendChild(main);\n document.body.appendChild(container);\n\n const toast = new window.Toast(main);\n return toast;\n}\n", "import Cookie from 'cookie';\n\ntype APIRes<T> = T | ErrorBase | APIError;\ntype Method = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';\ntype ReqData = URLSearchParams | Dict | undefined | unknown;\n\n/**\n * Type guard to determine if an API response is a detailed error.\n *\n * @param data API JSON Response\n * @returns Type guard for `data`.\n */\nexport function isApiError(data: Record<string, unknown>): data is APIError {\n return 'error' in data && 'exception' in data;\n}\n\n/**\n * Type guard to determine if an API response is an error.\n *\n * @param data API JSON Response\n * @returns Type guard for `data`.\n */\nexport function hasError(data: Record<string, unknown>): data is ErrorBase {\n return 'error' in data;\n}\n\n/**\n * Type guard to determine if an element is an `HTMLInputElement`.\n *\n * @param element HTML Element.\n */\nexport function isInputElement(element: HTMLElement): element is HTMLInputElement {\n return 'value' in element && 'required' in element;\n}\n\n/**\n * Retrieve the CSRF token from cookie storage.\n */\nexport function getCsrfToken(): string {\n const { csrftoken: csrfToken } = Cookie.parse(document.cookie);\n if (typeof csrfToken === 'undefined') {\n throw new Error('Invalid or missing CSRF token');\n }\n return csrfToken;\n}\n\n/**\n * Authenticate and interact with the NetBox API.\n *\n * @param url Request URL\n * @param method Request Method\n * @param data Data to `POST`, `PATCH`, or `PUT`, if applicable.\n * @returns JSON Response\n */\nexport async function apiRequest<R extends Dict, D extends ReqData = undefined>(\n url: string,\n method: Method,\n data?: D,\n): Promise<APIRes<R>> {\n const token = getCsrfToken();\n const headers = new Headers({ 'X-CSRFToken': token });\n\n let body;\n if (typeof data !== 'undefined') {\n body = JSON.stringify(data);\n headers.set('content-type', 'application/json');\n headers.set('Accept', 'application/json');\n }\n\n const res = await fetch(url, { method, body, headers, credentials: 'same-origin' });\n const contentType = res.headers.get('Content-Type');\n if (typeof contentType === 'string' && contentType.includes('text')) {\n const error = await res.text();\n return { error } as ErrorBase;\n }\n const json = (await res.json()) as R | APIError;\n if (!res.ok && Array.isArray(json)) {\n const error = json.join('\\n');\n return { error } as ErrorBase;\n } else if (!res.ok && 'detail' in json) {\n return { error: json.detail } as ErrorBase;\n }\n return json;\n}\n\n/**\n * `POST` an object as form data to the NetBox API.\n *\n * @param url Request URL\n * @param data Object to convert to form data\n * @returns JSON Response\n */\nexport async function apiPostForm<R extends Dict, D extends Dict>(\n url: string,\n data: D,\n): Promise<APIRes<R>> {\n return await apiRequest<R, D>(url, 'POST', data);\n}\n\n/**\n * `GET` data from the NetBox API.\n *\n * @param url Request URL\n * @returns JSON Response\n */\nexport async function apiGetBase<R extends Dict>(url: string): Promise<APIRes<R>> {\n return await apiRequest<R>(url, 'GET');\n}\n\n/**\n * Prefix a NetBox-relative path with the configured BASE_PATH derived from the current location.\n *\n * Example: with BASE_PATH 'netbox/', window.location.pathname might be '/netbox/plugins/...'.\n * This derives '/netbox' and prefixes it to the provided path (e.g., '/api/...').\n */\nexport function withBasePath(path: string): string {\n const pathname = window.location.pathname || '';\n const pluginsIdx = pathname.indexOf('/plugins/');\n const apiIdx = pathname.indexOf('/api/');\n const cutIdx = pluginsIdx >= 0 ? pluginsIdx : apiIdx;\n const base = cutIdx >= 0 ? pathname.slice(0, cutIdx) : '';\n return `${base}${path}`;\n}\n", "import { createToast } from './bs';\nimport { apiGetBase, apiPostForm, hasError, isApiError, isInputElement, withBasePath } from './util';\n\nimport type { APIKeyPair, APISecret } from './types';\n\n/**\n * Initialize Generate Private Key Pair Elements.\n */\nfunction initGenerateKeyPair() {\n const element = document.getElementById('new_keypair_modal') as HTMLDivElement;\n const accept = document.getElementById('use_new_pubkey') as HTMLButtonElement;\n const copyBtn = document.getElementById('copy_prikey') as HTMLButtonElement;\n const exportBtn = document.getElementById('export_key') as HTMLButtonElement;\n // If the elements are not loaded, stop.\n if (element === null || accept === null || copyBtn === null || exportBtn === null) {\n return;\n }\n const publicElem = element.querySelector<HTMLTextAreaElement>('textarea#new_pubkey');\n const privateElem = element.querySelector<HTMLTextAreaElement>('textarea#new_privkey');\n\n /**\n * Handle Generate Private Key Pair Modal opening.\n */\n function handleOpen() {\n // When the modal opens, set the `readonly` attribute on the textarea elements.\n for (const elem of [publicElem, privateElem]) {\n if (elem !== null) {\n elem.setAttribute('readonly', '');\n }\n }\n // Fetch the key pair from the API.\n apiGetBase<APIKeyPair>(withBasePath('/api/plugins/secrets/generate-rsa-key-pair/')).then(data => {\n if (!hasError(data)) {\n // If key pair generation was successful, set the textarea elements' value to the generated\n // values.\n const { private_key: priv, public_key: pub } = data;\n if (publicElem !== null && privateElem !== null) {\n publicElem.value = pub;\n privateElem.value = priv;\n }\n } else {\n // Otherwise, show an error.\n const toast = createToast('danger', 'Error', data.error);\n toast.show();\n }\n });\n }\n\n /**\n * Set the public key form field's value to the generated public key.\n */\n function handleAccept() {\n const publicKeyField = document.getElementById('id_public_key') as HTMLTextAreaElement;\n if (publicElem !== null) {\n publicKeyField.value = publicElem.value;\n publicKeyField.innerText = publicElem.value;\n }\n }\n\n /**\n * Handles file download functionality.\n */\n function handleExport() {\n const content = `Public Key\\n\\n${publicElem?.value}\\n\\nPrivate Key\\n\\n${privateElem?.value}`;\n\n const blob = new Blob([content], { type: 'text/plain' });\n\n const a = document.createElement('a');\n a.style.display = 'none';\n a.href = window.URL.createObjectURL(blob);\n a.download = 'key.txt';\n document.body.appendChild(a);\n\n a.click();\n\n window.URL.revokeObjectURL(a.href);\n document.body.removeChild(a);\n }\n\n element.addEventListener('shown.bs.modal', () => handleOpen());\n accept.addEventListener('click', () => handleAccept());\n copyBtn.addEventListener('click', () => navigator.clipboard.writeText(privateElem?.value || ''));\n exportBtn.addEventListener('click', () => handleExport());\n}\n\n/**\n * Toggle copy/lock/unlock button visibility based on the action occurring.\n * @param id Secret ID.\n * @param action Lock or Unlock, so we know which buttons to display.\n */\nfunction toggleSecretButtons(id: string, action: 'lock' | 'unlock') {\n const unlockButton = document.querySelector(`button.unlock-secret[secret-id='${id}']`);\n const lockButton = document.querySelector(`button.lock-secret[secret-id='${id}']`);\n const copyButton = document.querySelector(`span[secret-id='${id}']`);\n // If we're unlocking, hide the unlock button. Otherwise, show it.\n if (unlockButton !== null) {\n if (action === 'unlock') unlockButton.classList.add('d-none');\n if (action === 'lock') unlockButton.classList.remove('d-none');\n }\n // If we're unlocking, show the lock button. Otherwise, hide it.\n if (lockButton !== null) {\n if (action === 'unlock') lockButton.classList.remove('d-none');\n if (action === 'lock') lockButton.classList.add('d-none');\n }\n // If we're unlocking, show the copy button. Otherwise, hide it.\n if (copyButton !== null) {\n if (action === 'unlock') copyButton.classList.remove('d-none');\n if (action === 'lock') copyButton.classList.add('d-none');\n }\n}\n\n/**\n * Initialize Lock & Unlock button event listeners & callbacks.\n */\nfunction initLockUnlock() {\n const privateKeyModal = new window.Modal('#privkey_modal');\n\n /**\n * Unlock a secret, or prompt the user for their private key, if a session key is not available.\n *\n * @param id Secret ID\n */\n function unlock(id: string | null) {\n const target = document.getElementById(`secret_${id}`) as HTMLDivElement | HTMLInputElement;\n if (typeof id === 'string' && id !== '') {\n apiGetBase<APISecret>(withBasePath(`/api/plugins/secrets/secrets/${id}/`)).then(data => {\n if (!hasError(data)) {\n const { plaintext } = data;\n // `plaintext` is the plain text value of the secret. If it is null, it has not been\n // decrypted, likely due to a mission session key.\n\n if (target !== null && plaintext !== null) {\n // If `plaintext` is not null, we have the decrypted value. Set the target element's\n // inner text to the decrypted value and toggle copy/lock button visibility.\n if (isInputElement(target)) {\n target.value = plaintext;\n } else {\n target.innerText = plaintext;\n }\n\n toggleSecretButtons(id, 'unlock');\n } else {\n // Otherwise, we do _not_ have the decrypted value and need to prompt the user for\n // their private RSA key, in order to get a session key. The session key is then sent\n // as a cookie in future requests.\n privateKeyModal.show();\n }\n } else {\n if (data.error.toLowerCase().includes('invalid session key')) {\n // If, for some reason, a request was made but resulted in an API error that complains\n // of a missing session key, prompt the user for their session key.\n privateKeyModal.show();\n } else {\n // If we received an API error but it doesn't contain 'invalid session key', show the\n // user an error message.\n const toast = createToast('danger', 'Error', data.error);\n toast.show();\n }\n }\n });\n }\n }\n\n /**\n * Lock a secret and toggle visibility of the unlock button.\n * @param id Secret ID\n */\n function lock(id: string | null) {\n if (typeof id === 'string' && id !== '') {\n const target = document.getElementById(`secret_${id}`) as HTMLDivElement | HTMLInputElement;\n\n // Obscure the inner text of the secret element.\n if (isInputElement(target)) {\n target.value = '********';\n } else {\n target.innerText = '********';\n }\n\n // Toggle visibility of the copy/lock/unlock buttons.\n toggleSecretButtons(id, 'lock');\n }\n }\n\n for (const element of document.querySelectorAll<HTMLButtonElement>('button.unlock-secret')) {\n element.addEventListener('click', () => unlock(element.getAttribute('secret-id')));\n }\n for (const element of document.querySelectorAll<HTMLButtonElement>('button.lock-secret')) {\n element.addEventListener('click', () => lock(element.getAttribute('secret-id')));\n }\n}\n\n/**\n * Request a session key from the API.\n * @param privateKey RSA Private Key (valid JSON string)\n */\nfunction requestSessionKey(privateKey: string) {\n apiPostForm(withBasePath('/api/plugins/secrets/session-keys/'), {\n private_key: privateKey,\n preserve_key: true,\n }).then(res => {\n if (!hasError(res)) {\n // If the session key has been added from the user key page, reload the page.\n if (window.location.pathname === withBasePath('/plugins/secrets/user-key/')) {\n window.location.reload();\n } else {\n // If the response received was not an error, show the user a success message.\n const toast = createToast('success', 'Session Key Received', 'You may now unlock secrets.');\n window.location.reload();\n toast.show();\n }\n } else {\n // Otherwise, show the user an error message.\n let message = res.error;\n if (isApiError(res)) {\n // If the error received was a standard API error containing a Python exception message,\n // append it to the error.\n message += `\\n${res.exception}`;\n }\n const toast = createToast('danger', 'Failed to Retrieve Session Key', message);\n toast.show();\n }\n });\n}\n\n/**\n * Initialize Request Session Key Elements.\n */\nfunction initGetSessionKey() {\n for (const element of document.querySelectorAll<HTMLButtonElement>('#request_session_key')) {\n /**\n * Send the user's input private key to the API to get a session key, which will be stored as\n * a cookie for future requests.\n */\n function handleClick() {\n for (const pk of document.querySelectorAll<HTMLTextAreaElement>('#user_privkey')) {\n requestSessionKey(pk.value);\n // Clear the private key form field value.\n pk.value = '';\n }\n }\n element.addEventListener('click', handleClick);\n }\n}\n\n/**\n * Initialize Secret Edit Form Handler.\n */\nfunction initSecretsEdit() {\n const privateKeyModal = new window.Modal('#privkey_modal');\n\n /**\n * Check the cookie store for a `netbox_secrets_sessionid`. If not present, prompt the user to submit their\n * private key.\n */\n function handleSubmit(event: Event): void {\n if (document.cookie.indexOf('netbox_secrets_sessionid') === -1) {\n event.preventDefault();\n privateKeyModal.show();\n }\n }\n\n for (const element of document.querySelectorAll<HTMLInputElement>('.requires-session-key')) {\n const form = element.closest<HTMLFormElement>('form');\n if (form !== null) {\n form.addEventListener('submit', handleSubmit);\n }\n }\n}\n\nexport function initSecrets() {\n for (const func of [initGenerateKeyPair, initLockUnlock, initGetSessionKey, initSecretsEdit]) {\n func();\n }\n}\n", "import { initSecrets } from './secrets';\n\nif (document.readyState !== 'loading') {\n initSecrets();\n} else {\n document.addEventListener('DOMContentLoaded', initSecrets);\n}\n"],
|
|
5
|
-
"mappings": "mzBAiGAA,EAAA,MAAAC,EAsJAD,EAAA,UAAAE,EAzOA,IAAMC,EAAmB,wCAcnBC,EAAoB,kCAyBpBC,EACJ,sFASIC,EAAkB,kCAElBC,EAAa,OAAO,UAAU,SAE9BC,GAA8B,IAAK,CACvC,IAAMC,EAAI,UAAA,CAAa,EACvB,OAAAA,EAAE,UAAY,OAAO,OAAO,IAAI,EACzBA,CACT,GAAE,EA0BF,SAAgBR,EACdS,EACAC,EAAsB,CAEtB,IAAMC,EAA0C,IAAIJ,EAC9CK,EAAMH,EAAI,OAEhB,GAAIG,EAAM,EAAG,OAAOD,EAEpB,IAAME,GAAMH,GAAA,YAAAA,EAAS,SAAUI,EAC3BC,EAAQ,EAEZ,EAAG,CACD,IAAMC,EAAQP,EAAI,QAAQ,IAAKM,CAAK,EACpC,GAAIC,IAAU,GAAI,MAElB,IAAMC,EAAWR,EAAI,QAAQ,IAAKM,CAAK,EACjCG,EAASD,IAAa,GAAKL,EAAMK,EAEvC,GAAID,EAAQE,EAAQ,CAElBH,EAAQN,EAAI,YAAY,IAAKO,EAAQ,CAAC,EAAI,EAC1C,QACF,CAEA,IAAMG,EAAcC,EAAWX,EAAKM,EAAOC,CAAK,EAC1CK,EAAYC,EAASb,EAAKO,EAAOG,CAAW,EAC5CI,EAAMd,EAAI,MAAMU,EAAaE,CAAS,EAG5C,GAAIV,EAAIY,CAAG,IAAM,OAAW,CAC1B,IAAIC,EAAcJ,EAAWX,EAAKO,EAAQ,EAAGE,CAAM,EAC/CO,EAAYH,EAASb,EAAKS,EAAQM,CAAW,EAE3CE,EAAQb,EAAIJ,EAAI,MAAMe,EAAaC,CAAS,CA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AAK,YAAYD,CAAS,EAErB,IAAI,OAAO,MAAMC,CAAI,CAErC,CCxEA,IAAAO,
|
|
6
|
-
"names": ["exports", "parse", "serialize", "cookieNameRegExp", "cookieValueRegExp", "domainValueRegExp", "pathValueRegExp", "__toString", "NullObject", "C", "str", "options", "obj", "len", "dec", "decode", "index", "eqIdx", "colonIdx", "endIdx", "keyStartIdx", "startIndex", "keyEndIdx", "endIndex", "key", "valStartIdx", "valEndIdx", "value", "max", "code", "min", "name", "val", "enc", "isDate", "e", "createToast", "level", "title", "message", "extra", "iconName", "container", "main", "header", "icon", "titleElement", "button", "body", "extraElement", "import_cookie", "isApiError", "data", "hasError", "isInputElement", "element", "getCsrfToken", "csrfToken", "
|
|
4
|
+
"sourcesContent": ["/**\n * RegExp to match cookie-name in RFC 6265 sec 4.1.1\n * This refers out to the obsoleted definition of token in RFC 2616 sec 2.2\n * which has been replaced by the token definition in RFC 7230 appendix B.\n *\n * cookie-name = token\n * token = 1*tchar\n * tchar = \"!\" / \"#\" / \"$\" / \"%\" / \"&\" / \"'\" /\n * \"*\" / \"+\" / \"-\" / \".\" / \"^\" / \"_\" /\n * \"`\" / \"|\" / \"~\" / DIGIT / ALPHA\n *\n * Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191\n * Allow same range as cookie value, except `=`, which delimits end of name.\n */\nconst cookieNameRegExp = /^[\\u0021-\\u003A\\u003C\\u003E-\\u007E]+$/;\n\n/**\n * RegExp to match cookie-value in RFC 6265 sec 4.1.1\n *\n * cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )\n * cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E\n * ; US-ASCII characters excluding CTLs,\n * ; whitespace DQUOTE, comma, semicolon,\n * ; and backslash\n *\n * Allowing more characters: https://github.com/jshttp/cookie/issues/191\n * Comma, backslash, and DQUOTE are not part of the parsing algorithm.\n */\nconst cookieValueRegExp = /^[\\u0021-\\u003A\\u003C-\\u007E]*$/;\n\n/**\n * RegExp to match domain-value in RFC 6265 sec 4.1.1\n *\n * domain-value = <subdomain>\n * ; defined in [RFC1034], Section 3.5, as\n * ; enhanced by [RFC1123], Section 2.1\n * <subdomain> = <label> | <subdomain> \".\" <label>\n * <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]\n * Labels must be 63 characters or less.\n * 'let-dig' not 'letter' in the first char, per RFC1123\n * <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>\n * <let-dig-hyp> = <let-dig> | \"-\"\n * <let-dig> = <letter> | <digit>\n * <letter> = any one of the 52 alphabetic characters A through Z in\n * upper case and a through z in lower case\n * <digit> = any one of the ten digits 0 through 9\n *\n * Keep support for leading dot: https://github.com/jshttp/cookie/issues/173\n *\n * > (Note that a leading %x2E (\".\"), if present, is ignored even though that\n * character is not permitted, but a trailing %x2E (\".\"), if present, will\n * cause the user agent to ignore the attribute.)\n */\nconst domainValueRegExp =\n /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;\n\n/**\n * RegExp to match path-value in RFC 6265 sec 4.1.1\n *\n * path-value = <any CHAR except CTLs or \";\">\n * CHAR = %x01-7F\n * ; defined in RFC 5234 appendix B.1\n */\nconst pathValueRegExp = /^[\\u0020-\\u003A\\u003D-\\u007E]*$/;\n\nconst __toString = Object.prototype.toString;\n\nconst NullObject = /* @__PURE__ */ (() => {\n const C = function () {};\n C.prototype = Object.create(null);\n return C;\n})() as unknown as { new (): any };\n\n/**\n * Parse options.\n */\nexport interface ParseOptions {\n /**\n * Specifies a function that will be used to decode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1).\n * Since the value of a cookie has a limited character set (and must be a simple string), this function can be used to decode\n * a previously-encoded cookie value into a JavaScript string.\n *\n * The default function is the global `decodeURIComponent`, wrapped in a `try..catch`. If an error\n * is thrown it will return the cookie's original value. If you provide your own encode/decode\n * scheme you must ensure errors are appropriately handled.\n *\n * @default decode\n */\n decode?: (str: string) => string | undefined;\n}\n\n/**\n * Parse a cookie header.\n *\n * Parse the given cookie header string into an object\n * The object has the various cookies as keys(names) => values\n */\nexport function parse(\n str: string,\n options?: ParseOptions,\n): Record<string, string | undefined> {\n const obj: Record<string, string | undefined> = new NullObject();\n const len = str.length;\n // RFC 6265 sec 4.1.1, RFC 2616 2.2 defines a cookie name consists of one char minimum, plus '='.\n if (len < 2) return obj;\n\n const dec = options?.decode || decode;\n let index = 0;\n\n do {\n const eqIdx = str.indexOf(\"=\", index);\n if (eqIdx === -1) break; // No more cookie pairs.\n\n const colonIdx = str.indexOf(\";\", index);\n const endIdx = colonIdx === -1 ? len : colonIdx;\n\n if (eqIdx > endIdx) {\n // backtrack on prior semicolon\n index = str.lastIndexOf(\";\", eqIdx - 1) + 1;\n continue;\n }\n\n const keyStartIdx = startIndex(str, index, eqIdx);\n const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);\n const key = str.slice(keyStartIdx, keyEndIdx);\n\n // only assign once\n if (obj[key] === undefined) {\n let valStartIdx = startIndex(str, eqIdx + 1, endIdx);\n let valEndIdx = endIndex(str, endIdx, valStartIdx);\n\n const value = dec(str.slice(valStartIdx, valEndIdx));\n obj[key] = value;\n }\n\n index = endIdx + 1;\n } while (index < len);\n\n return obj;\n}\n\nfunction startIndex(str: string, index: number, max: number) {\n do {\n const code = str.charCodeAt(index);\n if (code !== 0x20 /* */ && code !== 0x09 /* \\t */) return index;\n } while (++index < max);\n return max;\n}\n\nfunction endIndex(str: string, index: number, min: number) {\n while (index > min) {\n const code = str.charCodeAt(--index);\n if (code !== 0x20 /* */ && code !== 0x09 /* \\t */) return index + 1;\n }\n return min;\n}\n\n/**\n * Serialize options.\n */\nexport interface SerializeOptions {\n /**\n * Specifies a function that will be used to encode a [cookie-value](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1.1).\n * Since value of a cookie has a limited character set (and must be a simple string), this function can be used to encode\n * a value into a string suited for a cookie's value, and should mirror `decode` when parsing.\n *\n * @default encodeURIComponent\n */\n encode?: (str: string) => string;\n /**\n * Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.2).\n *\n * The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and\n * `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,\n * so if both are set, they should point to the same date and time.\n */\n maxAge?: number;\n /**\n * Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.1).\n * When no expiration is set clients consider this a \"non-persistent cookie\" and delete it the current session is over.\n *\n * The [cookie storage model specification](https://tools.ietf.org/html/rfc6265#section-5.3) states that if both `expires` and\n * `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this,\n * so if both are set, they should point to the same date and time.\n */\n expires?: Date;\n /**\n * Specifies the value for the [`Domain` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.3).\n * When no domain is set clients consider the cookie to apply to the current domain only.\n */\n domain?: string;\n /**\n * Specifies the value for the [`Path` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.4).\n * When no path is set, the path is considered the [\"default path\"](https://tools.ietf.org/html/rfc6265#section-5.1.4).\n */\n path?: string;\n /**\n * Enables the [`HttpOnly` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.6).\n * When enabled, clients will not allow client-side JavaScript to see the cookie in `document.cookie`.\n */\n httpOnly?: boolean;\n /**\n * Enables the [`Secure` `Set-Cookie` attribute](https://tools.ietf.org/html/rfc6265#section-5.2.5).\n * When enabled, clients will only send the cookie back if the browser has a HTTPS connection.\n */\n secure?: boolean;\n /**\n * Enables the [`Partitioned` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/).\n * When enabled, clients will only send the cookie back when the current domain _and_ top-level domain matches.\n *\n * This is an attribute that has not yet been fully standardized, and may change in the future.\n * This also means clients may ignore this attribute until they understand it. More information\n * about can be found in [the proposal](https://github.com/privacycg/CHIPS).\n */\n partitioned?: boolean;\n /**\n * Specifies the value for the [`Priority` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).\n *\n * - `'low'` will set the `Priority` attribute to `Low`.\n * - `'medium'` will set the `Priority` attribute to `Medium`, the default priority when not set.\n * - `'high'` will set the `Priority` attribute to `High`.\n *\n * More information about priority levels can be found in [the specification](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1).\n */\n priority?: \"low\" | \"medium\" | \"high\";\n /**\n * Specifies the value for the [`SameSite` `Set-Cookie` attribute](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).\n *\n * - `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement.\n * - `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement.\n * - `'none'` will set the `SameSite` attribute to `None` for an explicit cross-site cookie.\n * - `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement.\n *\n * More information about enforcement levels can be found in [the specification](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7).\n */\n sameSite?: boolean | \"lax\" | \"strict\" | \"none\";\n}\n\n/**\n * Serialize data into a cookie header.\n *\n * Serialize a name value pair into a cookie string suitable for\n * http headers. An optional options object specifies cookie parameters.\n *\n * serialize('foo', 'bar', { httpOnly: true })\n * => \"foo=bar; httpOnly\"\n */\nexport function serialize(\n name: string,\n val: string,\n options?: SerializeOptions,\n): string {\n const enc = options?.encode || encodeURIComponent;\n\n if (!cookieNameRegExp.test(name)) {\n throw new TypeError(`argument name is invalid: ${name}`);\n }\n\n const value = enc(val);\n\n if (!cookieValueRegExp.test(value)) {\n throw new TypeError(`argument val is invalid: ${val}`);\n }\n\n let str = name + \"=\" + value;\n if (!options) return str;\n\n if (options.maxAge !== undefined) {\n if (!Number.isInteger(options.maxAge)) {\n throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);\n }\n\n str += \"; Max-Age=\" + options.maxAge;\n }\n\n if (options.domain) {\n if (!domainValueRegExp.test(options.domain)) {\n throw new TypeError(`option domain is invalid: ${options.domain}`);\n }\n\n str += \"; Domain=\" + options.domain;\n }\n\n if (options.path) {\n if (!pathValueRegExp.test(options.path)) {\n throw new TypeError(`option path is invalid: ${options.path}`);\n }\n\n str += \"; Path=\" + options.path;\n }\n\n if (options.expires) {\n if (\n !isDate(options.expires) ||\n !Number.isFinite(options.expires.valueOf())\n ) {\n throw new TypeError(`option expires is invalid: ${options.expires}`);\n }\n\n str += \"; Expires=\" + options.expires.toUTCString();\n }\n\n if (options.httpOnly) {\n str += \"; HttpOnly\";\n }\n\n if (options.secure) {\n str += \"; Secure\";\n }\n\n if (options.partitioned) {\n str += \"; Partitioned\";\n }\n\n if (options.priority) {\n const priority =\n typeof options.priority === \"string\"\n ? options.priority.toLowerCase()\n : undefined;\n switch (priority) {\n case \"low\":\n str += \"; Priority=Low\";\n break;\n case \"medium\":\n str += \"; Priority=Medium\";\n break;\n case \"high\":\n str += \"; Priority=High\";\n break;\n default:\n throw new TypeError(`option priority is invalid: ${options.priority}`);\n }\n }\n\n if (options.sameSite) {\n const sameSite =\n typeof options.sameSite === \"string\"\n ? options.sameSite.toLowerCase()\n : options.sameSite;\n switch (sameSite) {\n case true:\n case \"strict\":\n str += \"; SameSite=Strict\";\n break;\n case \"lax\":\n str += \"; SameSite=Lax\";\n break;\n case \"none\":\n str += \"; SameSite=None\";\n break;\n default:\n throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);\n }\n }\n\n return str;\n}\n\n/**\n * URL-decode string value. Optimized to skip native call when no %.\n */\nfunction decode(str: string): string {\n if (str.indexOf(\"%\") === -1) return str;\n\n try {\n return decodeURIComponent(str);\n } catch (e) {\n return str;\n }\n}\n\n/**\n * Determine if value is a Date.\n */\nfunction isDate(val: any): val is Date {\n return __toString.call(val) === \"[object Date]\";\n}\n", "type ToastLevel = 'danger' | 'warning' | 'success' | 'info';\n\nexport function createToast(\n level: ToastLevel,\n title: string,\n message: string,\n extra?: string,\n): InstanceType<typeof window.Toast> {\n let iconName = 'mdi-alert';\n switch (level) {\n case 'warning':\n iconName = 'mdi-alert';\n break;\n case 'success':\n iconName = 'mdi-check-circle';\n break;\n case 'info':\n iconName = 'mdi-information';\n break;\n case 'danger':\n iconName = 'mdi-alert';\n break;\n }\n\n const container = document.createElement('div');\n container.setAttribute('class', 'toast-container position-fixed bottom-0 end-0 m-3');\n\n const main = document.createElement('div');\n main.setAttribute('class', `toast bg-${level}`);\n main.setAttribute('role', 'alert');\n main.setAttribute('aria-live', 'assertive');\n main.setAttribute('aria-atomic', 'true');\n\n const header = document.createElement('div');\n header.setAttribute('class', `toast-header bg-${level} text-body`);\n\n const icon = document.createElement('i');\n icon.setAttribute('class', `mdi ${iconName}`);\n\n const titleElement = document.createElement('strong');\n titleElement.setAttribute('class', 'me-auto ms-1');\n titleElement.innerText = title;\n\n const button = document.createElement('button');\n button.setAttribute('type', 'button');\n button.setAttribute('class', 'btn-close');\n button.setAttribute('data-bs-dismiss', 'toast');\n button.setAttribute('aria-label', 'Close');\n\n const body = document.createElement('div');\n body.setAttribute('class', 'toast-body');\n\n header.appendChild(icon);\n header.appendChild(titleElement);\n\n if (typeof extra !== 'undefined') {\n const extraElement = document.createElement('small');\n extraElement.setAttribute('class', 'text-muted');\n header.appendChild(extraElement);\n }\n\n header.appendChild(button);\n\n body.innerText = message.trim();\n\n main.appendChild(header);\n main.appendChild(body);\n container.appendChild(main);\n document.body.appendChild(container);\n\n const toast = new window.Toast(main);\n return toast;\n}\n", "import { parse as parseCookie } from 'cookie';\n\ntype APIRes<T> = T | ErrorBase | APIError;\ntype Method = 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';\ntype ReqData = URLSearchParams | Dict | undefined | unknown;\n\n/**\n * Type guard to determine if an API response is a detailed error.\n *\n * @param data API JSON Response\n * @returns Type guard for `data`.\n */\nexport function isApiError(data: Record<string, unknown>): data is APIError {\n return 'error' in data && 'exception' in data;\n}\n\n/**\n * Type guard to determine if an API response is an error.\n *\n * @param data API JSON Response\n * @returns Type guard for `data`.\n */\nexport function hasError(data: Record<string, unknown>): data is ErrorBase {\n return 'error' in data;\n}\n\n/**\n * Type guard to determine if an element is an `HTMLInputElement`.\n *\n * @param element HTML Element.\n */\nexport function isInputElement(element: HTMLElement): element is HTMLInputElement {\n return 'value' in element && 'required' in element;\n}\n\n/**\n * Retrieve the CSRF token from cookie storage.\n */\nexport function getCsrfToken(): string {\n const { csrftoken: csrfToken } = parseCookie(document.cookie);\n if (typeof csrfToken === 'undefined') {\n throw new Error('Invalid or missing CSRF token');\n }\n return csrfToken;\n}\n\n/**\n * Authenticate and interact with the NetBox API.\n *\n * @param url Request URL\n * @param method Request Method\n * @param data Data to `POST`, `PATCH`, or `PUT`, if applicable.\n * @returns JSON Response\n */\nexport async function apiRequest<R extends Dict, D extends ReqData = undefined>(\n url: string,\n method: Method,\n data?: D,\n): Promise<APIRes<R>> {\n const token = getCsrfToken();\n const headers = new Headers({ 'X-CSRFToken': token });\n\n let body;\n if (typeof data !== 'undefined') {\n body = JSON.stringify(data);\n headers.set('content-type', 'application/json');\n headers.set('Accept', 'application/json');\n }\n\n const res = await fetch(url, { method, body, headers, credentials: 'same-origin' });\n const contentType = res.headers.get('Content-Type');\n if (typeof contentType === 'string' && contentType.includes('text')) {\n const error = await res.text();\n return { error } as ErrorBase;\n }\n const json = (await res.json()) as R | APIError;\n if (!res.ok && Array.isArray(json)) {\n const error = json.join('\\n');\n return { error } as ErrorBase;\n } else if (!res.ok && 'detail' in json) {\n return { error: json.detail } as ErrorBase;\n }\n return json;\n}\n\n/**\n * `POST` an object as form data to the NetBox API.\n *\n * @param url Request URL\n * @param data Object to convert to form data\n * @returns JSON Response\n */\nexport async function apiPostForm<R extends Dict, D extends Dict>(\n url: string,\n data: D,\n): Promise<APIRes<R>> {\n return await apiRequest<R, D>(url, 'POST', data);\n}\n\n/**\n * `GET` data from the NetBox API.\n *\n * @param url Request URL\n * @returns JSON Response\n */\nexport async function apiGetBase<R extends Dict>(url: string): Promise<APIRes<R>> {\n return await apiRequest<R>(url, 'GET');\n}\n\n/**\n * Prefix a NetBox-relative path with the configured BASE_PATH derived from the current location.\n *\n * Example: with BASE_PATH 'netbox/', window.location.pathname might be '/netbox/plugins/...'.\n * This derives '/netbox' and prefixes it to the provided path (e.g., '/api/...').\n */\nexport function withBasePath(path: string): string {\n const pathname = window.location.pathname || '';\n const pluginsIdx = pathname.indexOf('/plugins/');\n const apiIdx = pathname.indexOf('/api/');\n const cutIdx = pluginsIdx >= 0 ? pluginsIdx : apiIdx;\n const base = cutIdx >= 0 ? pathname.slice(0, cutIdx) : '';\n return `${base}${path}`;\n}\n", "import { createToast } from './bs';\nimport {\n apiGetBase,\n apiPostForm,\n hasError,\n isApiError,\n isInputElement,\n withBasePath,\n} from './util';\n\nimport type { APIKeyPair, APISecret } from './types';\n\n/**\n * Initialize Generate Private Key Pair Elements.\n */\nfunction initGenerateKeyPair() {\n const element = document.getElementById('new_keypair_modal') as HTMLDivElement;\n const accept = document.getElementById('use_new_pubkey') as HTMLButtonElement;\n const copyBtn = document.getElementById('copy_prikey') as HTMLButtonElement;\n const exportBtn = document.getElementById('export_key') as HTMLButtonElement;\n // If the elements are not loaded, stop.\n if (element === null || accept === null || copyBtn === null || exportBtn === null) {\n return;\n }\n const publicElem = element.querySelector<HTMLTextAreaElement>('textarea#new_pubkey');\n const privateElem = element.querySelector<HTMLTextAreaElement>('textarea#new_privkey');\n\n /**\n * Handle Generate Private Key Pair Modal opening.\n */\n function handleOpen() {\n // When the modal opens, set the `readonly` attribute on the textarea elements.\n for (const elem of [publicElem, privateElem]) {\n if (elem !== null) {\n elem.setAttribute('readonly', '');\n }\n }\n // Fetch the key pair from the API.\n apiGetBase<APIKeyPair>(withBasePath('/api/plugins/secrets/generate-rsa-key-pair/')).then(\n data => {\n if (!hasError(data)) {\n // If key pair generation was successful, set the textarea elements' value to the generated\n // values.\n const { private_key: priv, public_key: pub } = data;\n if (publicElem !== null && privateElem !== null) {\n publicElem.value = pub;\n privateElem.value = priv;\n }\n } else {\n // Otherwise, show an error.\n const toast = createToast('danger', 'Error', data.error);\n toast.show();\n }\n },\n );\n }\n\n /**\n * Set the public key form field's value to the generated public key.\n */\n function handleAccept() {\n const publicKeyField = document.getElementById('id_public_key') as HTMLTextAreaElement;\n if (publicElem !== null) {\n publicKeyField.value = publicElem.value;\n publicKeyField.innerText = publicElem.value;\n }\n }\n\n /**\n * Handles file download functionality.\n */\n function handleExport() {\n const content = `Public Key\\n\\n${publicElem?.value}\\n\\nPrivate Key\\n\\n${privateElem?.value}`;\n\n const blob = new Blob([content], { type: 'text/plain' });\n\n const a = document.createElement('a');\n a.style.display = 'none';\n a.href = window.URL.createObjectURL(blob);\n a.download = 'key.txt';\n document.body.appendChild(a);\n\n a.click();\n\n window.URL.revokeObjectURL(a.href);\n document.body.removeChild(a);\n }\n\n element.addEventListener('shown.bs.modal', () => handleOpen());\n accept.addEventListener('click', () => handleAccept());\n copyBtn.addEventListener('click', () => navigator.clipboard.writeText(privateElem?.value || ''));\n exportBtn.addEventListener('click', () => handleExport());\n}\n\n/**\n * Toggle copy/lock/unlock button visibility based on the action occurring.\n * @param id Secret ID.\n * @param action Lock or Unlock, so we know which buttons to display.\n */\nfunction toggleSecretButtons(id: string, action: 'lock' | 'unlock') {\n const unlockButton = document.querySelector(`button.unlock-secret[secret-id='${id}']`);\n const lockButton = document.querySelector(`button.lock-secret[secret-id='${id}']`);\n const copyButton = document.querySelector(`span[secret-id='${id}']`);\n // If we're unlocking, hide the unlock button. Otherwise, show it.\n if (unlockButton !== null) {\n if (action === 'unlock') unlockButton.classList.add('d-none');\n if (action === 'lock') unlockButton.classList.remove('d-none');\n }\n // If we're unlocking, show the lock button. Otherwise, hide it.\n if (lockButton !== null) {\n if (action === 'unlock') lockButton.classList.remove('d-none');\n if (action === 'lock') lockButton.classList.add('d-none');\n }\n // If we're unlocking, show the copy button. Otherwise, hide it.\n if (copyButton !== null) {\n if (action === 'unlock') copyButton.classList.remove('d-none');\n if (action === 'lock') copyButton.classList.add('d-none');\n }\n}\n\n/**\n * Initialize Lock & Unlock button event listeners & callbacks.\n */\nfunction initLockUnlock() {\n const privateKeyModal = new window.Modal('#privkey_modal');\n\n /**\n * Unlock a secret, or prompt the user for their private key, if a session key is not available.\n *\n * @param id Secret ID\n */\n function unlock(id: string | null) {\n const target = document.getElementById(`secret_${id}`) as HTMLDivElement | HTMLInputElement;\n if (typeof id === 'string' && id !== '') {\n apiGetBase<APISecret>(withBasePath(`/api/plugins/secrets/secrets/${id}/`)).then(data => {\n if (!hasError(data)) {\n const { plaintext } = data;\n // `plaintext` is the plain text value of the secret. If it is null, it has not been\n // decrypted, likely due to a mission session key.\n\n if (target !== null && plaintext !== null) {\n // If `plaintext` is not null, we have the decrypted value. Set the target element's\n // inner text to the decrypted value and toggle copy/lock button visibility.\n if (isInputElement(target)) {\n target.value = plaintext;\n } else {\n target.innerText = plaintext;\n }\n\n toggleSecretButtons(id, 'unlock');\n } else {\n // Otherwise, we do _not_ have the decrypted value and need to prompt the user for\n // their private RSA key, in order to get a session key. The session key is then sent\n // as a cookie in future requests.\n privateKeyModal.show();\n }\n } else {\n if (data.error.toLowerCase().includes('invalid session key')) {\n // If, for some reason, a request was made but resulted in an API error that complains\n // of a missing session key, prompt the user for their session key.\n privateKeyModal.show();\n } else {\n // If we received an API error but it doesn't contain 'invalid session key', show the\n // user an error message.\n const toast = createToast('danger', 'Error', data.error);\n toast.show();\n }\n }\n });\n }\n }\n\n /**\n * Lock a secret and toggle visibility of the unlock button.\n * @param id Secret ID\n */\n function lock(id: string | null) {\n if (typeof id === 'string' && id !== '') {\n const target = document.getElementById(`secret_${id}`) as HTMLDivElement | HTMLInputElement;\n\n // Obscure the inner text of the secret element.\n if (isInputElement(target)) {\n target.value = '********';\n } else {\n target.innerText = '********';\n }\n\n // Toggle visibility of the copy/lock/unlock buttons.\n toggleSecretButtons(id, 'lock');\n }\n }\n\n for (const element of document.querySelectorAll<HTMLButtonElement>('button.unlock-secret')) {\n element.addEventListener('click', () => unlock(element.getAttribute('secret-id')));\n }\n for (const element of document.querySelectorAll<HTMLButtonElement>('button.lock-secret')) {\n element.addEventListener('click', () => lock(element.getAttribute('secret-id')));\n }\n}\n\n/**\n * Request a session key from the API.\n * @param privateKey RSA Private Key (valid JSON string)\n */\nfunction requestSessionKey(privateKey: string) {\n apiPostForm(withBasePath('/api/plugins/secrets/session-keys/'), {\n private_key: privateKey,\n preserve_key: true,\n }).then(res => {\n if (!hasError(res)) {\n // If the session key has been added from the user key page, reload the page.\n if (window.location.pathname === withBasePath('/plugins/secrets/user-key/')) {\n window.location.reload();\n } else {\n // If the response received was not an error, show the user a success message.\n const toast = createToast('success', 'Session Key Received', 'You may now unlock secrets.');\n window.location.reload();\n toast.show();\n }\n } else {\n // Otherwise, show the user an error message.\n let message = res.error;\n if (isApiError(res)) {\n // If the error received was a standard API error containing a Python exception message,\n // append it to the error.\n message += `\\n${res.exception}`;\n }\n const toast = createToast('danger', 'Failed to Retrieve Session Key', message);\n toast.show();\n }\n });\n}\n\n/**\n * Initialize Request Session Key Elements.\n */\nfunction initGetSessionKey() {\n for (const element of document.querySelectorAll<HTMLButtonElement>('#request_session_key')) {\n /**\n * Send the user's input private key to the API to get a session key, which will be stored as\n * a cookie for future requests.\n */\n function handleClick() {\n for (const pk of document.querySelectorAll<HTMLTextAreaElement>('#user_privkey')) {\n requestSessionKey(pk.value);\n // Clear the private key form field value.\n pk.value = '';\n }\n }\n element.addEventListener('click', handleClick);\n }\n}\n\n/**\n * Initialize Secret Edit Form Handler.\n */\nfunction initSecretsEdit() {\n const privateKeyModal = new window.Modal('#privkey_modal');\n\n /**\n * Check the cookie store for a `netbox_secrets_sessionid`. If not present, prompt the user to submit their\n * private key.\n */\n function handleSubmit(event: Event): void {\n if (document.cookie.indexOf('netbox_secrets_sessionid') === -1) {\n event.preventDefault();\n privateKeyModal.show();\n }\n }\n\n for (const element of document.querySelectorAll<HTMLInputElement>('.requires-session-key')) {\n const form = element.closest<HTMLFormElement>('form');\n if (form !== null) {\n form.addEventListener('submit', handleSubmit);\n }\n }\n}\n\nexport function initSecrets() {\n for (const func of [initGenerateKeyPair, initLockUnlock, initGetSessionKey, initSecretsEdit]) {\n func();\n }\n}\n", "import { initSecrets } from './secrets';\n\nif (document.readyState !== 'loading') {\n initSecrets();\n} else {\n document.addEventListener('DOMContentLoaded', initSecrets);\n}\n"],
|
|
5
|
+
"mappings": "mzBAiGAA,EAAA,MAAAC,EAsJAD,EAAA,UAAAE,EAzOA,IAAMC,EAAmB,wCAcnBC,EAAoB,kCAyBpBC,EACJ,sFASIC,EAAkB,kCAElBC,EAAa,OAAO,UAAU,SAE9BC,GAA8B,IAAK,CACvC,IAAMC,EAAI,UAAA,CAAa,EACvB,OAAAA,EAAE,UAAY,OAAO,OAAO,IAAI,EACzBA,CACT,GAAE,EA0BF,SAAgBR,EACdS,EACAC,EAAsB,CAEtB,IAAMC,EAA0C,IAAIJ,EAC9CK,EAAMH,EAAI,OAEhB,GAAIG,EAAM,EAAG,OAAOD,EAEpB,IAAME,GAAMH,GAAA,YAAAA,EAAS,SAAUI,EAC3BC,EAAQ,EAEZ,EAAG,CACD,IAAMC,EAAQP,EAAI,QAAQ,IAAKM,CAAK,EACpC,GAAIC,IAAU,GAAI,MAElB,IAAMC,EAAWR,EAAI,QAAQ,IAAKM,CAAK,EACjCG,EAASD,IAAa,GAAKL,EAAMK,EAEvC,GAAID,EAAQE,EAAQ,CAElBH,EAAQN,EAAI,YAAY,IAAKO,EAAQ,CAAC,EAAI,EAC1C,QACF,CAEA,IAAMG,EAAcC,EAAWX,EAAKM,EAAOC,CAAK,EAC1CK,EAAYC,EAASb,EAAKO,EAAOG,CAAW,EAC5CI,EAAMd,EAAI,MAAMU,EAAaE,CAAS,EAG5C,GAAIV,EAAIY,CAAG,IAA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", "parse", "serialize", "cookieNameRegExp", "cookieValueRegExp", "domainValueRegExp", "pathValueRegExp", "__toString", "NullObject", "C", "str", "options", "obj", "len", "dec", "decode", "index", "eqIdx", "colonIdx", "endIdx", "keyStartIdx", "startIndex", "keyEndIdx", "endIndex", "key", "valStartIdx", "valEndIdx", "value", "max", "code", "min", "name", "val", "enc", "isDate", "e", "createToast", "level", "title", "message", "extra", "iconName", "container", "main", "header", "icon", "titleElement", "button", "body", "extraElement", "import_cookie", "isApiError", "data", "hasError", "isInputElement", "element", "getCsrfToken", "csrfToken", "parseCookie", "apiRequest", "url", "method", "__async", "token", "headers", "body", "res", "contentType", "json", "apiPostForm", "apiGetBase", "withBasePath", "path", "pathname", "pluginsIdx", "apiIdx", "cutIdx", "initGenerateKeyPair", "element", "accept", "copyBtn", "exportBtn", "publicElem", "privateElem", "handleOpen", "elem", "apiGetBase", "withBasePath", "data", "hasError", "createToast", "priv", "pub", "handleAccept", "publicKeyField", "handleExport", "content", "blob", "a", "toggleSecretButtons", "id", "action", "unlockButton", "lockButton", "copyButton", "initLockUnlock", "privateKeyModal", "unlock", "target", "plaintext", "isInputElement", "lock", "requestSessionKey", "privateKey", "apiPostForm", "res", "message", "isApiError", "toast", "initGetSessionKey", "handleClick", "pk", "initSecretsEdit", "handleSubmit", "event", "form", "initSecrets", "func", "initSecrets"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: netbox-secrets
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.4
|
|
4
4
|
Summary: Enhance your secret management with encrypted storage and flexible, user-friendly features.
|
|
5
5
|
Home-page: https://github.com/Onemind-Services-LLC/netbox-secrets/
|
|
6
6
|
Author: Abhimanyu Saharan
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/migrations/0002_populate_userkeys.py
RENAMED
|
File without changes
|
{netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/migrations/0003_populate_secretroles.py
RENAMED
|
File without changes
|
{netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/migrations/0004_populate_secrets.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/templates/netbox_secrets/secret.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_secrets-2.3.1 → netbox_secrets-2.3.4}/netbox_secrets/templates/netbox_secrets/userkey.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|