Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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 wsc
Last synced: 2 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 (3 months ago)
- Default Branch: main
- Last Pushed: 2024-09-13T14:33:36.000Z (3 months ago)
- Last Synced: 2024-10-08T03:02:15.247Z (3 months ago)
- Topics: crypto, cryptography, typescript, woltlab, 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:** [[email protected]](mailto:[email protected])
- **GitHub:** [SoftCreatR](https://github.com/SoftCreatR)