https://github.com/softcreatr/wsc-crypto-ts
PoC of cryptographic utility functions for WoltLab Suite Core, implemented in TypeScript.
https://github.com/softcreatr/wsc-crypto-ts
crypto cryptography typescript woltlab woltlab-suite woltlab-suite-core wsc
Last synced: 5 months ago
JSON representation
PoC of cryptographic utility functions for WoltLab Suite Core, implemented in TypeScript.
- Host: GitHub
- URL: https://github.com/softcreatr/wsc-crypto-ts
- Owner: SoftCreatR
- License: isc
- Created: 2024-09-13T13:58:41.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-13T14:33:36.000Z (almost 2 years ago)
- Last Synced: 2025-12-22T07:44:16.747Z (6 months ago)
- Topics: crypto, cryptography, typescript, woltlab, woltlab-suite, woltlab-suite-core, wsc
- Language: TypeScript
- Homepage: https://1-2.dev
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# wsc-crypto-ts
PoC of cryptographic utility functions for WoltLab Suite Core, implemented in TypeScript.
## Overview
This project provides cryptographic helper functions, including:
- Creating secure signatures based on the Keyed-Hash Message Authentication Code (HMAC) algorithm.
- Hexadecimal encoding and decoding without cache-timing leaks.
## Installation
```bash
npm install wsc-crypto-ts
```
## Usage
### Creating a Signed String
```typescript
import { createSignedStringForSession } from 'wsc-crypto-ts';
// Your session ID and secret
const sessionID = 'your-session-id';
const secret = 'your-secret-key';
// Create a signed string
const signedString = createSignedStringForSession(sessionID, secret);
console.log('Signed String:', signedString);
```
### Verifying a Signed String
```typescript
import { CryptoUtil } from 'wsc-crypto-ts';
// Initialize CryptoUtil with your secret
const cryptoUtil = new CryptoUtil(secret);
// Verify and decode the signed string
const decodedValue = cryptoUtil.verifySignedString(signedString);
if (decodedValue !== null) {
console.log('Decoded Value:', decodedValue.toString('utf8'));
} else {
console.error('Invalid signature!');
}
```
## License
This project is licensed under the ISC License. See the [LICENSE](LICENSE.md) file for details.
## Author
- **Sascha Greuel**
- **Email:** [hello@1-2.dev](mailto:hello@1-2.dev)
- **GitHub:** [SoftCreatR](https://github.com/SoftCreatR)