@cloudbase/oauth 2.5.38-beta.0 → 2.5.40-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/auth/apis.d.ts +2 -1
- package/dist/cjs/auth/apis.js +13 -1
- package/dist/cjs/auth/consts.d.ts +2 -1
- package/dist/cjs/auth/consts.js +2 -1
- package/dist/cjs/auth/models.d.ts +4 -0
- package/dist/cjs/auth/models.js +1 -1
- package/dist/cjs/utils/encrypt.d.ts +1 -1
- package/dist/cjs/utils/encrypt.js +2 -11
- package/dist/cjs/utils/encryptlong/index.d.ts +154 -0
- package/dist/cjs/utils/encryptlong/index.js +4029 -0
- package/dist/esm/auth/apis.d.ts +2 -1
- package/dist/esm/auth/apis.js +13 -1
- package/dist/esm/auth/consts.d.ts +2 -1
- package/dist/esm/auth/consts.js +2 -1
- package/dist/esm/auth/models.d.ts +4 -0
- package/dist/esm/auth/models.js +1 -1
- package/dist/esm/utils/encrypt.d.ts +1 -1
- package/dist/esm/utils/encrypt.js +2 -11
- package/dist/esm/utils/encryptlong/index.d.ts +154 -0
- package/dist/esm/utils/encryptlong/index.js +4027 -0
- package/package.json +2 -2
- package/src/auth/apis.ts +14 -0
- package/src/auth/consts.ts +2 -1
- package/src/auth/models.ts +5 -0
- package/src/utils/encrypt.ts +10 -10
- package/src/utils/encryptlong/index.js +5444 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/oauth",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.40-beta.0",
|
|
4
4
|
"description": "cloudbase javascript sdk auth componets",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"encryptlong": "^3.1.4"
|
|
22
22
|
},
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "fdd47542ba93aa05a9a917b2b3cee8e6d5d04c66"
|
|
25
25
|
}
|
package/src/auth/apis.ts
CHANGED
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
WithSudoRequest,
|
|
44
44
|
PublicKey,
|
|
45
45
|
EncryptParams,
|
|
46
|
+
ProviderSubType,
|
|
46
47
|
} from './models'
|
|
47
48
|
import { SimpleStorage, RequestFunction } from '../oauth2client/interface'
|
|
48
49
|
import { OAuth2Client, defaultStorage } from '../oauth2client/oauth2client'
|
|
@@ -758,4 +759,17 @@ export class Auth {
|
|
|
758
759
|
public_key_thumbprint,
|
|
759
760
|
}
|
|
760
761
|
}
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* get provider sub type
|
|
765
|
+
* @returns
|
|
766
|
+
*/
|
|
767
|
+
public async getProviderSubType(): Promise<ProviderSubType> {
|
|
768
|
+
return this.config.request<ProviderSubType>(ApiUrls.GET_PROVIDER_TYPE, {
|
|
769
|
+
method: 'POST',
|
|
770
|
+
body: {
|
|
771
|
+
provider_id: 'weda',
|
|
772
|
+
},
|
|
773
|
+
})
|
|
774
|
+
}
|
|
761
775
|
}
|
package/src/auth/consts.ts
CHANGED
|
@@ -24,7 +24,8 @@ export enum ApiUrls {
|
|
|
24
24
|
AUTH_RESET_PASSWORD = '/auth/v1/reset',
|
|
25
25
|
AUTH_GET_DEVICE_CODE = '/auth/v1/device/code',
|
|
26
26
|
CHECK_USERNAME = '/auth/v1/checkUsername',
|
|
27
|
-
CHECK_IF_USER_EXIST = '/auth/v1/checkIfUserExist'
|
|
27
|
+
CHECK_IF_USER_EXIST = '/auth/v1/checkIfUserExist',
|
|
28
|
+
GET_PROVIDER_TYPE = '/auth/v1/mgr/provider/providerSubType'
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
export enum ApiUrlsV2 {
|
package/src/auth/models.ts
CHANGED
package/src/utils/encrypt.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import JSEncrypt from 'encryptlong'
|
|
2
|
-
import HmacSHA256 from 'crypto-js/hmac-sha256'
|
|
3
|
-
import WordArray from 'crypto-js/lib-typedarrays'
|
|
1
|
+
import JSEncrypt from './encryptlong'
|
|
2
|
+
// import HmacSHA256 from 'crypto-js/hmac-sha256'
|
|
3
|
+
// import WordArray from 'crypto-js/lib-typedarrays'
|
|
4
4
|
import { deepClone } from '.'
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -19,17 +19,17 @@ export const getEncryptInfo = ({ publicKey = '', payload = {} } = {}) => {
|
|
|
19
19
|
// 设置公钥
|
|
20
20
|
rsaInstance.setPublicKey(publicKey)
|
|
21
21
|
// 生成时间戳
|
|
22
|
-
params.timestamp = +new Date()
|
|
22
|
+
// params.timestamp = +new Date()
|
|
23
23
|
// 确定签名算法
|
|
24
|
-
const signMethod = 'HmacSHA256'
|
|
24
|
+
// const signMethod = 'HmacSHA256'
|
|
25
25
|
// 生成随机数
|
|
26
|
-
const nonce = WordArray.random(16).toString()
|
|
26
|
+
// const nonce = WordArray.random(16).toString()
|
|
27
27
|
// 生成签名:基本参数、时间戳 + 随机数
|
|
28
|
-
const signature = HmacSHA256(JSON.stringify(params), nonce).toString()
|
|
28
|
+
// const signature = HmacSHA256(JSON.stringify(params), nonce).toString()
|
|
29
29
|
// 将签名放入参数中
|
|
30
|
-
params.signature = signature
|
|
31
|
-
params.nonce = nonce
|
|
32
|
-
params.signMethod = signMethod
|
|
30
|
+
// params.signature = signature
|
|
31
|
+
// params.nonce = nonce
|
|
32
|
+
// params.signMethod = signMethod
|
|
33
33
|
// rsa公钥加密
|
|
34
34
|
const encrypted = rsaInstance.encryptLong(JSON.stringify(params))
|
|
35
35
|
|