Installations
npm install csgo-sharecode
Developer Guide
Typescript
Yes
Module System
ESM
Min. Node Version
>=10.8.0
Node Version
18.17.1
NPM Version
9.6.7
Score
73.6
Supply Chain
99.4
Quality
75.7
Maintenance
100
Vulnerability
80.9
License
Releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (99.17%)
JavaScript (0.83%)
Developer
Download Statistics
Total Downloads
19,962
Last Day
31
Last Week
280
Last Month
1,467
Last Year
9,294
GitHub Statistics
38 Stars
69 Commits
2 Forks
4 Watching
3 Branches
3 Contributors
Bundle Size
4.81 kB
Minified
1.82 kB
Minified + Gzipped
Package Meta Information
Latest Version
3.1.2
Package Id
csgo-sharecode@3.1.2
Unpacked Size
61.26 kB
Size
15.41 kB
File Count
10
NPM Version
9.6.7
Node Version
18.17.1
Publised On
13 Dec 2023
Total Downloads
Cumulative downloads
Total Downloads
19,962
Last day
-34%
31
Compared to previous day
Last week
30.2%
280
Compared to previous week
Last month
31.8%
1,467
Compared to previous month
Last year
253.8%
9,294
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
4
csgo-sharecode
JS module to decode / encode CS:GO and CS2 share codes used to share game replays/crosshairs between players.
Installation
npm install csgo-sharecode
This module relies on BigInt, your target platform must support it!
Usage
Match
Decoding
Decodes a match share code into a MatchInformation
object.
1import { decodeMatchShareCode, MatchInformation } from 'csgo-sharecode'; 2 3const shareCode = 'CSGO-GADqf-jjyJ8-cSP2r-smZRo-TO2xK'; 4const matchInformation: MatchInformation = decodeMatchShareCode(shareCode); 5console.log(matchInformation); 6// output: 7// 8// { 9// matchId: 3230642215713767580n, 10// reservationId: 3230647599455273103n, 11// tvPort: 55788 12// }
Encoding
Encodes a MatchInformation
object into a match share code.
The example below use values coming from a real CDataGCCStrike15_v2_MatchInfo (lookup for CDataGCCStrike15_v2_MatchInfo
) message.
You should get them from the Steam Game Coordinator or from a .info file.
1import { encodeMatch, MatchInformation } from 'csgo-sharecode'; 2 3const matchInformation: MatchInformation = { 4 matchId: BigInt('3230642215713767580'), 5 reservationId: BigInt('3230647599455273103'), 6 tvPort: 599906796, 7}; 8 9const shareCode = encodeMatch(matchInformation); 10console.log(shareCode); 11// output: 12// 13// "CSGO-GADqf-jjyJ8-cSP2r-smZRo-TO2xK"
Crosshair
Decoding
Decodes a crosshair share code into a Crosshair
object.
1import { decodeCrosshairShareCode, Crosshair } from 'csgo-sharecode'; 2 3const shareCode = 'CSGO-WsnnD-eHaMw-QNDf9-oxuDh-ydOUD'; 4const crosshair: Crosshair = decodeCrosshairShareCode(shareCode); 5console.log(crosshair); 6// output: 7// 8// { 9// gap: -2.2, 10// outline: 1, 11// red: 50, 12// green: 250, 13// blue: 50, 14// alpha: 200, 15// splitDistance: 3, 16// followRecoil: true, 17// fixedCrosshairGap: 3, 18// color: 1, 19// outlineEnabled: true, 20// innerSplitAlpha: 0, 21// outerSplitAlpha: 1, 22// splitSizeRatio: 1, 23// thickness: 0.6, 24// centerDotEnabled: false, 25// deployedWeaponGapEnabled: true, 26// alphaEnabled: true, 27// tStyleEnabled: false, 28// style: 2, 29// length: 10 30// }
Encoding
Encodes a Crosshair
object into a crosshair share code.
1import { encodeCrosshair, Crosshair } from 'csgo-sharecode'; 2 3const crosshair: Crosshair = { 4 gap: -2.2, 5 outline: 1, 6 red: 50, 7 green: 250, 8 blue: 50, 9 alpha: 200, 10 splitDistance: 3, 11 fixedCrosshairGap: 3, 12 color: 1, 13 innerSplitAlpha: 0, 14 outlineEnabled: true, 15 outerSplitAlpha: 1, 16 splitSizeRatio: 1, 17 thickness: 0.6, 18 centerDotEnabled: false, 19 alphaEnabled: true, 20 tStyleEnabled: false, 21 style: 2, 22 length: 10, 23 deployedWeaponGapEnabled: true, 24 followRecoil: true, 25}; 26 27const shareCode = encodeCrosshair(crosshair); 28console.log(shareCode); 29// output: 30// 31// "CSGO-WsnnD-eHaMw-QNDf9-oxuDh-ydOUD"
Generating CSGO ConVars
Utility function to generate CSGO ConVars for a given crosshair.
1import { crosshairToConVars, Crosshair } from 'csgo-sharecode'; 2 3const crosshair: Crosshair = { 4 gap: -2.2, 5 outline: 1, 6 red: 50, 7 green: 250, 8 blue: 50, 9 alpha: 200, 10 splitDistance: 3, 11 fixedCrosshairGap: 3, 12 color: 1, 13 innerSplitAlpha: 0, 14 outlineEnabled: true, 15 outerSplitAlpha: 1, 16 splitSizeRatio: 1, 17 thickness: 0.6, 18 centerDotEnabled: false, 19 alphaEnabled: true, 20 tStyleEnabled: false, 21 style: 2, 22 length: 10, 23 deployedWeaponGapEnabled: true, 24 followRecoil: true, 25}; 26 27const conVars = crosshairToConVars(crosshair); 28console.log(conVars); 29// Output: 30// 31// cl_crosshair_drawoutline "1" 32// cl_crosshair_dynamic_maxdist_splitratio "1" 33// cl_crosshair_dynamic_splitalpha_innermod "0" 34// cl_crosshair_dynamic_splitalpha_outermod "1" 35// cl_crosshair_dynamic_splitdist "3" 36// cl_crosshair_outlinethickness "1" 37// cl_crosshair_t "0" 38// cl_crosshairalpha "200" 39// cl_crosshaircolor "1" 40// cl_crosshaircolor_b "50" 41// cl_crosshaircolor_g "250" 42// cl_crosshaircolor_r "50" 43// cl_crosshairdot "0" 44// cl_crosshairgap "-2.2" 45// cl_crosshairgap_useweaponvalue "1" 46// cl_crosshairsize "10" 47// cl_crosshairstyle "2" 48// cl_crosshairthickness "0.6" 49// cl_crosshairusealpha "1" 50// cl_fixedcrosshairgap "3" 51// cl_crosshair_recoil "1"
License
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: GNU General Public License v2.0: LICENSE:0
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/checks.yaml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/akiver/csgo-sharecode/checks.yaml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/checks.yaml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/akiver/csgo-sharecode/checks.yaml/main?enable=pin
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 1 out of 1 npmCommand dependencies pinned
Reason
7 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm
- Warn: Project is vulnerable to: GHSA-c24v-8rfc-w8vw
- Warn: Project is vulnerable to: GHSA-8jhw-289h-jh2g
- Warn: Project is vulnerable to: GHSA-64vr-g452-qvp3
- Warn: Project is vulnerable to: GHSA-9cwx-2883-4wfx
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/21 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/checks.yaml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 12 are checked with a SAST tool
Score
3
/10
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More