UNPKG

xiot-core-spec-ts

Version:
25 lines (24 loc) 768 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.JwtSecretsImplCodec = void 0; const JwtSecretsImpl_1 = require("../../../typedef/jwt/impl/JwtSecretsImpl"); const Jwt_1 = require("../../../typedef/jwt/Jwt"); class JwtSecretsImplCodec { static encode(x) { const o = { 'key': x.key, }; if (x.expiresInSeconds > 0) { o.expiresInSeconds = x.expiresInSeconds; } if (x.algorithm !== Jwt_1.DEFAULT_SECRETS_SIGNATURE_ALGORITHM) { o.algorithm = x.algorithm; } return o; } static decode(o) { const key = o['key']; return new JwtSecretsImpl_1.JwtSecretsImpl(key); } } exports.JwtSecretsImplCodec = JwtSecretsImplCodec;