@sddxzxqy/core-js-sdk
Version:
Official SDK of OCP Auth
2 lines (1 loc) • 3.12 kB
JavaScript
import{__awaiter as t,__generator as e}from"tslib";import{HttpClientProxy as o}from"../common/HttpClientProxy.js";import{AuthenticationFlowHandler as n}from"../common/AuthenticationFlowHandler.js";import{OidcAuthenticationClient as r}from"../common/OidcAuthenticationClient.js";var i=function(){function i(t){this.options=t,this._httpClient=new o(this.options),this._oidcClient=new r(this._httpClient,this.options),this._authHandler=new n(this._httpClient)}return Object.defineProperty(i.prototype,"httpClient",{get:function(){return this._httpClient},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"oidcClient",{get:function(){return this._oidcClient},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"user",{get:function(){return{arn:"",id:"",userPoolId:""}},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"accessToken",{get:function(){return""},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"authFlow",{get:function(){return this._authHandler},enumerable:!1,configurable:!0}),i.prototype.resetPasswordByFirstLoginToken=function(o){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return[4,this._httpClient.postJson("",o,{encrypt:!0})];case 1:return[2,t.sent()]}}))}))},i.prototype.resetPasswordByEmailCode=function(o,n,r){return t(this,void 0,void 0,(function(){return e(this,(function(t){return[2,Promise.reject()]}))}))},i.prototype.resetPasswordByPhoneCode=function(o,n,r,i){return t(this,void 0,void 0,(function(){return e(this,(function(t){return[2,Promise.reject()]}))}))},i.prototype.sendSmsCode=function(o,n,r){return t(this,void 0,void 0,(function(){return e(this,(function(t){return[2,Promise.reject()]}))}))},i.prototype.sendEmailCode=function(o,n){return t(this,void 0,void 0,(function(){return e(this,(function(t){return[2,Promise.reject()]}))}))},i.prototype.registerByEmail=function(o,n,r,i){return t(this,void 0,void 0,(function(){return e(this,(function(t){return[2,Promise.reject()]}))}))},i.prototype.registerByEmailCode=function(o,n,r,i,u){return t(this,void 0,void 0,(function(){return e(this,(function(t){return[2,Promise.reject()]}))}))},i.prototype.registerByPhoneCode=function(o,n,r,i,u){return t(this,void 0,void 0,(function(){return e(this,(function(t){return[2,Promise.reject()]}))}))},i.prototype.resetPasswordByForceResetToken=function(o){return t(this,void 0,void 0,(function(){return e(this,(function(t){return[2,Promise.reject()]}))}))},i.prototype.loginByEmail=function(t,e,o){return Promise.resolve()},i.prototype.loginByPhone=function(t,e,o){return Promise.resolve()},i.prototype.loginByPhoneCode=function(t,e,o){return Promise.resolve()},i.prototype.loginByAccount=function(t,e,o){return void 0===o&&(o={autoRegister:!1}),this.httpClient.postJson("/ocp/api/login/account",{username:t,password:e,captcha:o.captcha,autoRegister:o.autoRegister},{encrypt:!0})},i.prototype.getImgageCaptcha=function(t){return void 0===t&&(t={category:"WORD_CLICK_CAPTCHA"}),this.httpClient.get("/ocp/api/captcha/image",{category:t.category})},i}();export{i as AuthenticationClient};