@baqhub/sdk
Version:
The official JavaScript SDK for the BAQ federated app platform.
37 lines (36 loc) • 1.34 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthenticationState = exports.RAuthenticationState = void 0;
const tslib_1 = require("tslib");
const IO = tslib_1.__importStar(require("../../helpers/io.js"));
const appRecord_js_1 = require("../recordTypes/appRecord.js");
const entityRecord_js_1 = require("../recordTypes/entityRecord.js");
const serverCredentialsRecord_js_1 = require("../recordTypes/serverCredentialsRecord.js");
//
// Model.
//
const RAuthenticationStateRaw = IO.object({
entityRecord: entityRecord_js_1.EntityRecord,
appRecord: appRecord_js_1.AppRecord,
credentialsRecord: serverCredentialsRecord_js_1.ServerCredentialsRecord,
serverPublicKey: IO.union([IO.undefined, IO.base64Bytes]),
authorizationId: IO.union([IO.undefined, IO.string]),
});
exports.RAuthenticationState = IO.clean(RAuthenticationStateRaw);
//
// I/O.
//
exports.AuthenticationState = {
decode: (value) => {
return IO.decode(exports.RAuthenticationState, value);
},
decodeJSON: (value) => {
return exports.AuthenticationState.decode(JSON.parse(value));
},
encode: (state) => {
return IO.encode(exports.RAuthenticationState, state);
},
encodeJSON: (state) => {
return JSON.stringify(exports.AuthenticationState.encode(state));
},
};