https://github.com/affix/vala-jwt
A native Vala JWT Client with HS256 Support
https://github.com/affix/vala-jwt
hmac hmac-sha256 json jwt jwt-token vala
Last synced: 12 months ago
JSON representation
A native Vala JWT Client with HS256 Support
- Host: GitHub
- URL: https://github.com/affix/vala-jwt
- Owner: affix
- License: mit
- Created: 2019-01-28T19:28:07.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-28T19:29:14.000Z (over 7 years ago)
- Last Synced: 2025-01-14T14:59:37.629Z (over 1 year ago)
- Topics: hmac, hmac-sha256, json, jwt, jwt-token, vala
- Language: Vala
- Size: 2.93 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JWT Vala Library
A Native Vala Minimal JWT Library
## Build Requirements
- Vala
## Usage
```
using JWT;
class demo {
public static int main(string[] args) {
string key = "secret";
string payload = "{\"sub\":\"1234567890\",\"name\":\"John Doe\",\"admin\":true}";
string header = "{\"alg\":\"HS256\",\"typ\":\"JWT\"}";
var jwt = new Jwt();
stdout.printf(jwt.encode(header, payload, key));
return 0;
}
}
```
## Build Instructions
valac JWT/jwt.vala demo.vala -o demo
## Demo
The demo application is pre-configures with a plaintext secret `secret`
```
✗ valac JWT/jwt.vala demo.vala -o demo
✗ ./demo
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ
```
Validate with [JWT.io](https://jwt.io)