- Add full Telegram bot functionality with Z.AI API integration
- Implement 4 tools: Bash, FileEdit, WebSearch, Git
- Add 3 agents: Code Reviewer, Architect, DevOps Engineer
- Add 6 skills for common coding tasks
- Add systemd service file for 24/7 operation
- Add nginx configuration for HTTPS webhook
- Add comprehensive documentation
- Implement WebSocket server for real-time updates
- Add logging system with Winston
- Add environment validation
🤖 zCode CLI X - Agentic coder with Z.AI + Telegram integration
22 lines
898 B
JavaScript
22 lines
898 B
JavaScript
import { flattenedVerify } from '../flattened/verify.js';
|
|
import { JWSInvalid } from '../../util/errors.js';
|
|
import { decoder } from '../../lib/buffer_utils.js';
|
|
export async function compactVerify(jws, key, options) {
|
|
if (jws instanceof Uint8Array) {
|
|
jws = decoder.decode(jws);
|
|
}
|
|
if (typeof jws !== 'string') {
|
|
throw new JWSInvalid('Compact JWS must be a string or Uint8Array');
|
|
}
|
|
const { 0: protectedHeader, 1: payload, 2: signature, length } = jws.split('.');
|
|
if (length !== 3) {
|
|
throw new JWSInvalid('Invalid Compact JWS');
|
|
}
|
|
const verified = await flattenedVerify({ payload, protected: protectedHeader, signature }, key, options);
|
|
const result = { payload: verified.payload, protectedHeader: verified.protectedHeader };
|
|
if (typeof key === 'function') {
|
|
return { ...result, key: verified.key };
|
|
}
|
|
return result;
|
|
}
|