secure-ls2 2.0.0

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.
Files changed (44) hide show
  1. package/.eslintrc +186 -0
  2. package/.github/FUNDING.yml +6 -0
  3. package/.github/workflows/test.yml +65 -0
  4. package/.husky/commit-msg +1 -0
  5. package/.husky/pre-commit +1 -0
  6. package/.husky/pre-push +3 -0
  7. package/.prettierrc +8 -0
  8. package/CODE_OF_CONDUCT.md +76 -0
  9. package/CONTRIBUTING.md +46 -0
  10. package/LICENSE +21 -0
  11. package/README.md +350 -0
  12. package/babel.config.js +3 -0
  13. package/ci-package.json +47 -0
  14. package/commitlint.config.js +12 -0
  15. package/dist/secure-ls.js +5500 -0
  16. package/dist/secure-ls.js.map +1 -0
  17. package/dist/secure-ls.min.js +33 -0
  18. package/dist/secure-ls.min.js.map +1 -0
  19. package/dist/secure-ls2.js +5500 -0
  20. package/dist/secure-ls2.js.map +1 -0
  21. package/dist/secure-ls2.min.js +33 -0
  22. package/dist/secure-ls2.min.js.map +1 -0
  23. package/eslint.config.mjs +12 -0
  24. package/example/aes-compressed-realm.js +28 -0
  25. package/example/aes-compressed.js +12 -0
  26. package/example/aes-uncompressed.js +12 -0
  27. package/example/base64-compressed.js +12 -0
  28. package/example/custom-storage.js +29 -0
  29. package/example/des-compressed.js +12 -0
  30. package/example/des-uncompressed.js +12 -0
  31. package/example/index.html +42 -0
  32. package/example/only-base64.js +12 -0
  33. package/example/only-compressed.js +12 -0
  34. package/example/rabbit-compressed.js +12 -0
  35. package/example/rabbit-uncompressed.js +12 -0
  36. package/example/rc4-compressed.js +12 -0
  37. package/example/rc4-uncompressed.js +12 -0
  38. package/example/sessionStorage.js +13 -0
  39. package/example/standard.js +13 -0
  40. package/example/vendor/screenlog.min.js +5 -0
  41. package/jest.config.js +10 -0
  42. package/package.json +78 -0
  43. package/screenshot.png +0 -0
  44. package/types/secure-ls.d.ts +58 -0
package/.eslintrc ADDED
@@ -0,0 +1,186 @@
1
+ {
2
+ "ecmaFeatures": {
3
+ "globalReturn": true,
4
+ "jsx": true,
5
+ "modules": true
6
+ },
7
+
8
+ "env": {
9
+ "browser": true,
10
+ "es6": true,
11
+ "node": true
12
+ },
13
+
14
+ "globals": {
15
+ "document": false,
16
+ "escape": false,
17
+ "navigator": false,
18
+ "unescape": false,
19
+ "window": false,
20
+ "describe": true,
21
+ "before": true,
22
+ "it": true,
23
+ "expect": true,
24
+ "sinon": true
25
+ },
26
+
27
+ "parser": "babel-eslint",
28
+
29
+ "plugins": [
30
+
31
+ ],
32
+
33
+ "rules": {
34
+ "block-scoped-var": 2,
35
+ "brace-style": [2, "1tbs", { "allowSingleLine": true }],
36
+ "camelcase": [2, { "properties": "always" }],
37
+ "comma-dangle": [2, "never"],
38
+ "comma-spacing": [2, { "before": false, "after": true }],
39
+ "comma-style": [2, "last"],
40
+ "complexity": 0,
41
+ "consistent-return": 2,
42
+ "consistent-this": 0,
43
+ "curly": [2, "multi-line"],
44
+ "default-case": 0,
45
+ "dot-location": [2, "property"],
46
+ "dot-notation": 0,
47
+ "eol-last": 2,
48
+ "eqeqeq": [2, "allow-null"],
49
+ "func-names": 0,
50
+ "func-style": 0,
51
+ "generator-star-spacing": [2, "both"],
52
+ "guard-for-in": 0,
53
+ "handle-callback-err": [2, "^(err|error|anySpecificError)$" ],
54
+ "indent": [2, 2, { "SwitchCase": 1 }],
55
+ "key-spacing": [2, { "beforeColon": false, "afterColon": true }],
56
+ "linebreak-style": 0,
57
+ "max-depth": 0,
58
+ "max-len": [2, 120, 4],
59
+ "max-nested-callbacks": 0,
60
+ "max-params": 0,
61
+ "max-statements": 0,
62
+ "new-cap": [2, { "newIsCap": true, "capIsNew": false }],
63
+ "newline-after-var": [2, "always"],
64
+ "new-parens": 2,
65
+ "no-alert": 0,
66
+ "no-array-constructor": 2,
67
+ "no-bitwise": 0,
68
+ "no-caller": 2,
69
+ "no-catch-shadow": 0,
70
+ "no-cond-assign": 2,
71
+ "no-console": 0,
72
+ "no-constant-condition": 0,
73
+ "no-continue": 0,
74
+ "no-control-regex": 2,
75
+ "no-debugger": 2,
76
+ "no-delete-var": 2,
77
+ "no-div-regex": 0,
78
+ "no-dupe-args": 2,
79
+ "no-dupe-keys": 2,
80
+ "no-duplicate-case": 2,
81
+ "no-else-return": 2,
82
+ "no-empty": 0,
83
+ "no-empty-character-class": 2,
84
+ "no-empty-label": 2,
85
+ "no-eq-null": 0,
86
+ "no-eval": 2,
87
+ "no-ex-assign": 2,
88
+ "no-extend-native": 2,
89
+ "no-extra-bind": 2,
90
+ "no-extra-boolean-cast": 2,
91
+ "no-extra-parens": 0,
92
+ "no-extra-semi": 0,
93
+ "no-extra-strict": 0,
94
+ "no-fallthrough": 2,
95
+ "no-floating-decimal": 2,
96
+ "no-func-assign": 2,
97
+ "no-implied-eval": 2,
98
+ "no-inline-comments": 0,
99
+ "no-inner-declarations": [2, "functions"],
100
+ "no-invalid-regexp": 2,
101
+ "no-irregular-whitespace": 2,
102
+ "no-iterator": 2,
103
+ "no-label-var": 2,
104
+ "no-labels": 2,
105
+ "no-lone-blocks": 0,
106
+ "no-lonely-if": 0,
107
+ "no-loop-func": 0,
108
+ "no-mixed-requires": 0,
109
+ "no-mixed-spaces-and-tabs": [2, false],
110
+ "no-multi-spaces": 2,
111
+ "no-multi-str": 2,
112
+ "no-multiple-empty-lines": [2, { "max": 1 }],
113
+ "no-native-reassign": 2,
114
+ "no-negated-in-lhs": 2,
115
+ "no-nested-ternary": 0,
116
+ "no-new": 2,
117
+ "no-new-func": 2,
118
+ "no-new-object": 2,
119
+ "no-new-require": 2,
120
+ "no-new-wrappers": 2,
121
+ "no-obj-calls": 2,
122
+ "no-octal": 2,
123
+ "no-octal-escape": 2,
124
+ "no-path-concat": 0,
125
+ "no-plusplus": 0,
126
+ "no-process-env": 0,
127
+ "no-process-exit": 0,
128
+ "no-proto": 2,
129
+ "no-redeclare": 2,
130
+ "no-regex-spaces": 2,
131
+ "no-reserved-keys": 0,
132
+ "no-restricted-modules": 0,
133
+ "no-return-assign": 2,
134
+ "no-script-url": 0,
135
+ "no-self-compare": 2,
136
+ "no-sequences": 2,
137
+ "no-shadow": 0,
138
+ "no-shadow-restricted-names": 2,
139
+ "no-spaced-func": 2,
140
+ "no-sparse-arrays": 2,
141
+ "no-sync": 0,
142
+ "no-ternary": 0,
143
+ "no-throw-literal": 2,
144
+ "no-trailing-spaces": 2,
145
+ "no-undef": 2,
146
+ "no-undef-init": 2,
147
+ "no-undefined": 0,
148
+ "no-underscore-dangle": 0,
149
+ "no-unneeded-ternary": 2,
150
+ "no-unreachable": 2,
151
+ "no-unused-expressions": 0,
152
+ "no-unused-vars": [2, { "vars": "all", "args": "none" }],
153
+ "no-use-before-define": 2,
154
+ "no-var": 0,
155
+ "no-void": 0,
156
+ "no-warning-comments": 0,
157
+ "no-with": 2,
158
+ "one-var": 0,
159
+ "operator-assignment": 0,
160
+ "operator-linebreak": [2, "after"],
161
+ "padded-blocks": 0,
162
+ "quote-props": 0,
163
+ "quotes": [2, "single", "avoid-escape"],
164
+ "radix": 2,
165
+ "semi": [2, "always"],
166
+ "semi-spacing": 0,
167
+ "sort-vars": 0,
168
+ "space-after-keywords": [2, "always"],
169
+ "space-before-blocks": [2, "always"],
170
+ "space-before-function-paren": [2, {"anonymous": "always", "named": "never"}],
171
+ "space-in-brackets": 0,
172
+ "space-in-parens": [2, "never"],
173
+ "space-infix-ops": 2,
174
+ "space-return-throw-case": 2,
175
+ "space-unary-ops": [2, { "words": true, "nonwords": false }],
176
+ "spaced-comment": [2, "always"],
177
+ "strict": 0,
178
+ "use-isnan": 2,
179
+ "valid-jsdoc": 0,
180
+ "valid-typeof": 2,
181
+ "vars-on-top": 2,
182
+ "wrap-iife": [2, "any"],
183
+ "wrap-regex": 0,
184
+ "yoda": [2, "never"]
185
+ }
186
+ }
@@ -0,0 +1,6 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: [softvar] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
+ patreon: softvar # Replace with a single Patreon username
5
+ open_collective: softvar # Replace with a single Open Collective username
6
+ custom: ['https://paypal.me/softvar'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -0,0 +1,65 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ master, github-action, develop]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ build:
11
+ if: "!contains(toJSON(github.event.commits.*.message), '[skip-ci]')"
12
+ name: Test on node ${{ matrix.node_version }} and ${{ matrix.os }}
13
+ runs-on: ${{ matrix.os }}
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ os:
18
+ - ubuntu-latest
19
+ # - macos-latest
20
+ # - windows-latest
21
+ node_version: [ 10.x, 12.x, 13.x, 14.x, 15.x, 16.x, 18.x, 19.x, 20.x, 21.x, 22.x ]
22
+
23
+ steps:
24
+ - uses: actions/checkout@v2
25
+ - name: Use Node.js ${{ matrix.node_version }}
26
+ uses: actions/setup-node@v1
27
+ with:
28
+ node-version: ${{ matrix.node_version }}
29
+
30
+ - name: Restore packages
31
+ uses: actions/cache@v2
32
+ with:
33
+ path: |
34
+ node_modules
35
+ */*/node_modules
36
+ key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
37
+
38
+ - name: Copy package.json compatible with node version
39
+ run: |
40
+ if [[ ${{ matrix.node_version }} == 10* ]]; then
41
+ cp ci-package.json package.json
42
+ elif [[ ${{ matrix.node_version }} == 12* ]]; then
43
+ cp ci-package.json package.json
44
+ elif [[ ${{ matrix.node_version }} == 13* ]]; then
45
+ cp ci-package.json package.json
46
+ elif [[ ${{ matrix.node_version }} == 14* ]]; then
47
+ cp ci-package.json package.json
48
+ elif [[ ${{ matrix.node_version }} == 15* ]]; then
49
+ cp ci-package.json package.json
50
+ elif [[ ${{ matrix.node_version }} == 16* ]]; then
51
+ cp ci-package.json package.json
52
+ elif [[ ${{ matrix.node_version }} == 19* ]]; then
53
+ cp ci-package.json package.json
54
+ fi
55
+
56
+ - name: Install dependencies and run tests with coverage
57
+ run: |
58
+ yarn install
59
+ yarn test:coverage
60
+
61
+ - name: Upload coverage to Codecov
62
+ uses: codecov/codecov-action@v4.0.1
63
+ with:
64
+ token: ${{ secrets.CODECOV_TOKEN }}
65
+ flags: ${{ runner.os }}
@@ -0,0 +1 @@
1
+ npx --no-install commitlint --edit "$1"
@@ -0,0 +1 @@
1
+ yarn lint-staged
@@ -0,0 +1,3 @@
1
+ yarn lint
2
+ yarn test:prod
3
+ yarn build
package/.prettierrc ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "semi": true,
3
+ "printWidth": 120,
4
+ "tabWidth": 2,
5
+ "useTabs": false,
6
+ "singleQuote": true,
7
+ "bracketSpacing": true
8
+ }
@@ -0,0 +1,76 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ - Using welcoming and inclusive language
18
+ - Being respectful of differing viewpoints and experiences
19
+ - Gracefully accepting constructive criticism
20
+ - Focusing on what is best for the community
21
+ - Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ - The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ - Trolling, insulting/derogatory comments, and personal or political attacks
28
+ - Public or private harassment
29
+ - Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ - Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at dev@wingify.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
74
+
75
+ For answers to common questions about this code of conduct, see
76
+ https://www.contributor-covenant.org/faq
@@ -0,0 +1,46 @@
1
+ ## Contributing to Secure LS
2
+
3
+ We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
4
+
5
+ - Reporting a bug
6
+ - Discussing the current state of the code
7
+ - Submitting a fix
8
+ - Proposing new features
9
+
10
+ ### We Use [Github Flow](https://guides.github.com/introduction/flow/index.html), So All Code Changes Happen Through Pull Requests
11
+
12
+ Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests:
13
+
14
+ 1. Fork the repo and create your branch from `master`.
15
+ 2. If you've added code that should be tested, add tests.
16
+ 3. Ensure the test suite passes.
17
+ 4. Make sure your code lints.
18
+ 5. Open a pull request!
19
+
20
+ ### Any contributions you make will be under the MIT Software License
21
+
22
+ When you submit code changes, your submissions are understood to be under the same [MIT License](https://opensource.org/license/mit) that covers the project. Feel free to contact the maintainers if that's a concern.
23
+
24
+ ### Report bugs using GitHub issues
25
+
26
+ We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/softvar/secure-ls/issues); it's that easy!
27
+
28
+ **Note**: Write bug reports with detail, background, and sample code
29
+
30
+ **Great Bug Reports** tend to have:
31
+
32
+ - A quick summary and/or background
33
+ - Steps to reproduce
34
+ - Be specific!
35
+ - Give sample code if you can.
36
+ - What you expected would happen
37
+ - What actually happens
38
+ - Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
39
+
40
+ ### Use a Consistent Coding Style
41
+
42
+ We use [prettier](https://prettier.io/) for auto-formatting and consistent coding style among developers.
43
+
44
+ ### License
45
+
46
+ By contributing, you agree that your contributions will be licensed under its MIT License.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-2024 Varun Malhotra
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.