@azure/msal-node 2.2.0 → 2.3.0-alpha.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/cache/ITokenCache.d.ts +15 -15
- package/dist/cache/NodeStorage.cjs +401 -401
- package/dist/cache/NodeStorage.cjs.map +1 -1
- package/dist/cache/NodeStorage.d.ts +182 -182
- package/dist/cache/NodeStorage.d.ts.map +1 -1
- package/dist/cache/NodeStorage.mjs +401 -401
- package/dist/cache/NodeStorage.mjs.map +1 -1
- package/dist/cache/TokenCache.cjs +265 -265
- package/dist/cache/TokenCache.d.ts +90 -90
- package/dist/cache/TokenCache.mjs +265 -265
- package/dist/cache/distributed/DistributedCachePlugin.cjs +26 -26
- package/dist/cache/distributed/DistributedCachePlugin.d.ts +10 -10
- package/dist/cache/distributed/DistributedCachePlugin.mjs +26 -26
- package/dist/cache/distributed/ICacheClient.d.ts +17 -17
- package/dist/cache/distributed/IPartitionManager.d.ts +28 -28
- package/dist/cache/serializer/Deserializer.cjs +173 -173
- package/dist/cache/serializer/Deserializer.d.ts +42 -42
- package/dist/cache/serializer/Deserializer.mjs +173 -173
- package/dist/cache/serializer/Serializer.cjs +134 -134
- package/dist/cache/serializer/Serializer.d.ts +39 -39
- package/dist/cache/serializer/Serializer.mjs +134 -134
- package/dist/cache/serializer/SerializerTypes.d.ts +101 -101
- package/dist/client/ClientApplication.cjs +333 -333
- package/dist/client/ClientApplication.cjs.map +1 -1
- package/dist/client/ClientApplication.d.ts +142 -142
- package/dist/client/ClientApplication.d.ts.map +1 -1
- package/dist/client/ClientApplication.mjs +334 -334
- package/dist/client/ClientApplication.mjs.map +1 -1
- package/dist/client/ClientAssertion.cjs +116 -116
- package/dist/client/ClientAssertion.d.ts +46 -46
- package/dist/client/ClientAssertion.mjs +116 -116
- package/dist/client/ClientCredentialClient.cjs +193 -189
- package/dist/client/ClientCredentialClient.cjs.map +1 -1
- package/dist/client/ClientCredentialClient.d.ts +33 -33
- package/dist/client/ClientCredentialClient.d.ts.map +1 -1
- package/dist/client/ClientCredentialClient.mjs +194 -190
- package/dist/client/ClientCredentialClient.mjs.map +1 -1
- package/dist/client/ConfidentialClientApplication.cjs +163 -163
- package/dist/client/ConfidentialClientApplication.d.ts +58 -58
- package/dist/client/ConfidentialClientApplication.mjs +163 -163
- package/dist/client/DeviceCodeClient.cjs +207 -207
- package/dist/client/DeviceCodeClient.d.ts +53 -53
- package/dist/client/DeviceCodeClient.mjs +207 -207
- package/dist/client/IConfidentialClientApplication.d.ts +39 -39
- package/dist/client/IPublicClientApplication.d.ts +42 -42
- package/dist/client/ManagedIdentityApplication.cjs +96 -0
- package/dist/client/ManagedIdentityApplication.cjs.map +1 -0
- package/dist/client/ManagedIdentityApplication.d.ts +24 -0
- package/dist/client/ManagedIdentityApplication.d.ts.map +1 -0
- package/dist/client/ManagedIdentityApplication.mjs +94 -0
- package/dist/client/ManagedIdentityApplication.mjs.map +1 -0
- package/dist/client/ManagedIdentityClient.cjs +49 -0
- package/dist/client/ManagedIdentityClient.cjs.map +1 -0
- package/dist/client/ManagedIdentityClient.d.ts +25 -0
- package/dist/client/ManagedIdentityClient.d.ts.map +1 -0
- package/dist/client/ManagedIdentityClient.mjs +47 -0
- package/dist/client/ManagedIdentityClient.mjs.map +1 -0
- package/dist/client/ManagedIdentitySources/AppService.cjs +79 -0
- package/dist/client/ManagedIdentitySources/AppService.cjs.map +1 -0
- package/dist/client/ManagedIdentitySources/AppService.d.ts +17 -0
- package/dist/client/ManagedIdentitySources/AppService.d.ts.map +1 -0
- package/dist/client/ManagedIdentitySources/AppService.mjs +77 -0
- package/dist/client/ManagedIdentitySources/AppService.mjs.map +1 -0
- package/dist/client/ManagedIdentitySources/AzureArc.cjs +107 -0
- package/dist/client/ManagedIdentitySources/AzureArc.cjs.map +1 -0
- package/dist/client/ManagedIdentitySources/AzureArc.d.ts +19 -0
- package/dist/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -0
- package/dist/client/ManagedIdentitySources/AzureArc.mjs +104 -0
- package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -0
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.cjs +87 -0
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.cjs.map +1 -0
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts +19 -0
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -0
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +85 -0
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -0
- package/dist/client/ManagedIdentitySources/CloudShell.d.ts +7 -0
- package/dist/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -0
- package/dist/client/ManagedIdentitySources/Imds.cjs +63 -0
- package/dist/client/ManagedIdentitySources/Imds.cjs.map +1 -0
- package/dist/client/ManagedIdentitySources/Imds.d.ts +13 -0
- package/dist/client/ManagedIdentitySources/Imds.d.ts.map +1 -0
- package/dist/client/ManagedIdentitySources/Imds.mjs +61 -0
- package/dist/client/ManagedIdentitySources/Imds.mjs.map +1 -0
- package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts +7 -0
- package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -0
- package/dist/client/OnBehalfOfClient.cjs +202 -202
- package/dist/client/OnBehalfOfClient.d.ts +47 -47
- package/dist/client/OnBehalfOfClient.mjs +202 -202
- package/dist/client/PublicClientApplication.cjs +229 -229
- package/dist/client/PublicClientApplication.d.ts +71 -71
- package/dist/client/PublicClientApplication.mjs +229 -229
- package/dist/client/UsernamePasswordClient.cjs +95 -95
- package/dist/client/UsernamePasswordClient.d.ts +25 -25
- package/dist/client/UsernamePasswordClient.mjs +95 -95
- package/dist/config/Configuration.cjs +88 -72
- package/dist/config/Configuration.cjs.map +1 -1
- package/dist/config/Configuration.d.ts +122 -107
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +88 -73
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/config/ManagedIdentityId.cjs +59 -0
- package/dist/config/ManagedIdentityId.cjs.map +1 -0
- package/dist/config/ManagedIdentityId.d.ts +12 -0
- package/dist/config/ManagedIdentityId.d.ts.map +1 -0
- package/dist/config/ManagedIdentityId.mjs +57 -0
- package/dist/config/ManagedIdentityId.mjs.map +1 -0
- package/dist/config/ManagedIdentityRequestParameters.cjs +38 -0
- package/dist/config/ManagedIdentityRequestParameters.cjs.map +1 -0
- package/dist/config/ManagedIdentityRequestParameters.d.ts +12 -0
- package/dist/config/ManagedIdentityRequestParameters.d.ts.map +1 -0
- package/dist/config/ManagedIdentityRequestParameters.mjs +36 -0
- package/dist/config/ManagedIdentityRequestParameters.mjs.map +1 -0
- package/dist/crypto/CryptoProvider.cjs +75 -75
- package/dist/crypto/CryptoProvider.d.ts +52 -52
- package/dist/crypto/CryptoProvider.mjs +75 -75
- package/dist/crypto/GuidGenerator.cjs +22 -22
- package/dist/crypto/GuidGenerator.d.ts +14 -14
- package/dist/crypto/GuidGenerator.mjs +22 -22
- package/dist/crypto/HashUtils.cjs +13 -13
- package/dist/crypto/HashUtils.d.ts +8 -8
- package/dist/crypto/HashUtils.mjs +13 -13
- package/dist/crypto/PkceGenerator.cjs +49 -49
- package/dist/crypto/PkceGenerator.d.ts +22 -22
- package/dist/crypto/PkceGenerator.mjs +49 -49
- package/dist/error/ManagedIdentityError.cjs +40 -0
- package/dist/error/ManagedIdentityError.cjs.map +1 -0
- package/dist/error/ManagedIdentityError.d.ts +22 -0
- package/dist/error/ManagedIdentityError.d.ts.map +1 -0
- package/dist/error/ManagedIdentityError.mjs +36 -0
- package/dist/error/ManagedIdentityError.mjs.map +1 -0
- package/dist/error/ManagedIdentityErrorCodes.cjs +28 -0
- package/dist/error/ManagedIdentityErrorCodes.cjs.map +1 -0
- package/dist/error/ManagedIdentityErrorCodes.d.ts +10 -0
- package/dist/error/ManagedIdentityErrorCodes.d.ts.map +1 -0
- package/dist/error/ManagedIdentityErrorCodes.mjs +18 -0
- package/dist/error/ManagedIdentityErrorCodes.mjs.map +1 -0
- package/dist/error/NodeAuthError.cjs +85 -85
- package/dist/error/NodeAuthError.d.ts +65 -65
- package/dist/error/NodeAuthError.mjs +85 -85
- package/dist/index.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +44 -42
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/dist/internals.cjs +8 -8
- package/dist/internals.d.ts +6 -6
- package/dist/internals.mjs +8 -8
- package/dist/network/HttpClient.cjs +283 -276
- package/dist/network/HttpClient.cjs.map +1 -1
- package/dist/network/HttpClient.d.ts +26 -25
- package/dist/network/HttpClient.d.ts.map +1 -1
- package/dist/network/HttpClient.mjs +283 -276
- package/dist/network/HttpClient.mjs.map +1 -1
- package/dist/network/ILoopbackClient.d.ts +10 -10
- package/dist/network/LoopbackClient.cjs +76 -76
- package/dist/network/LoopbackClient.d.ts +21 -21
- package/dist/network/LoopbackClient.mjs +76 -76
- package/dist/packageMetadata.cjs +4 -4
- package/dist/packageMetadata.cjs.map +1 -1
- package/dist/packageMetadata.d.ts +2 -2
- package/dist/packageMetadata.d.ts.map +1 -1
- package/dist/packageMetadata.mjs +4 -4
- package/dist/packageMetadata.mjs.map +1 -1
- package/dist/request/AuthorizationCodeRequest.d.ts +21 -21
- package/dist/request/AuthorizationUrlRequest.d.ts +33 -33
- package/dist/request/ClientCredentialRequest.d.ts +14 -14
- package/dist/request/DeviceCodeRequest.d.ts +15 -15
- package/dist/request/InteractiveRequest.d.ts +22 -22
- package/dist/request/ManagedIdentityRequest.d.ts +9 -0
- package/dist/request/ManagedIdentityRequest.d.ts.map +1 -0
- package/dist/request/ManagedIdentityRequestParams.d.ts +10 -0
- package/dist/request/ManagedIdentityRequestParams.d.ts.map +1 -0
- package/dist/request/OnBehalfOfRequest.d.ts +14 -14
- package/dist/request/RefreshTokenRequest.d.ts +17 -17
- package/dist/request/SignOutRequest.d.ts +5 -5
- package/dist/request/SilentFlowRequest.d.ts +16 -16
- package/dist/request/UsernamePasswordRequest.d.ts +19 -19
- package/dist/response/ManagedIdentityTokenResponse.d.ts +25 -0
- package/dist/response/ManagedIdentityTokenResponse.d.ts.map +1 -0
- package/dist/utils/Constants.cjs +109 -80
- package/dist/utils/Constants.cjs.map +1 -1
- package/dist/utils/Constants.d.ts +106 -86
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +100 -81
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/EncodingUtils.cjs +44 -44
- package/dist/utils/EncodingUtils.d.ts +26 -26
- package/dist/utils/EncodingUtils.mjs +44 -44
- package/dist/utils/NetworkUtils.cjs +38 -38
- package/dist/utils/NetworkUtils.d.ts +5 -5
- package/dist/utils/NetworkUtils.mjs +38 -38
- package/package.json +2 -2
- package/src/cache/NodeStorage.ts +8 -2
- package/src/client/ClientApplication.ts +3 -1
- package/src/client/ClientCredentialClient.ts +65 -25
- package/src/client/ManagedIdentityApplication.ts +194 -0
- package/src/client/ManagedIdentityClient.ts +111 -0
- package/src/client/ManagedIdentitySources/AppService.ts +151 -0
- package/src/client/ManagedIdentitySources/AzureArc.ts +208 -0
- package/src/client/ManagedIdentitySources/BaseManagedIdentitySource.ts +169 -0
- package/src/client/ManagedIdentitySources/CloudShell.ts +19 -0
- package/src/client/ManagedIdentitySources/Imds.ts +112 -0
- package/src/client/ManagedIdentitySources/ServiceFabric.ts +19 -0
- package/src/config/Configuration.ts +47 -1
- package/src/config/ManagedIdentityId.ts +73 -0
- package/src/config/ManagedIdentityRequestParameters.ts +53 -0
- package/src/error/ManagedIdentityError.ts +46 -0
- package/src/error/ManagedIdentityErrorCodes.ts +15 -0
- package/src/index.ts +2 -0
- package/src/network/HttpClient.ts +17 -5
- package/src/packageMetadata.ts +1 -1
- package/src/request/ManagedIdentityRequest.ts +15 -0
- package/src/request/ManagedIdentityRequestParams.ts +14 -0
- package/src/response/ManagedIdentityTokenResponse.ts +33 -0
- package/src/utils/Constants.ts +27 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*! @azure/msal-node v2.3.0-alpha.0 2023-12-07 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { RequestParameterBuilder, UrlString } from '@azure/msal-common';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
+
* Licensed under the MIT License.
|
|
8
|
+
*/
|
|
9
|
+
class ManagedIdentityRequestParameters {
|
|
10
|
+
constructor(httpMethod, endpoint) {
|
|
11
|
+
this.httpMethod = httpMethod;
|
|
12
|
+
this._baseEndpoint = endpoint;
|
|
13
|
+
this.headers = {};
|
|
14
|
+
this.bodyParameters = {};
|
|
15
|
+
this.queryParameters = {};
|
|
16
|
+
}
|
|
17
|
+
computeUri() {
|
|
18
|
+
const parameterBuilder = new RequestParameterBuilder();
|
|
19
|
+
if (this.queryParameters) {
|
|
20
|
+
parameterBuilder.addExtraQueryParameters(this.queryParameters);
|
|
21
|
+
}
|
|
22
|
+
const queryParametersString = parameterBuilder.createQueryString();
|
|
23
|
+
return UrlString.appendQueryString(this._baseEndpoint, queryParametersString);
|
|
24
|
+
}
|
|
25
|
+
computeParametersBodyString() {
|
|
26
|
+
const parameterBuilder = new RequestParameterBuilder();
|
|
27
|
+
if (this.bodyParameters) {
|
|
28
|
+
parameterBuilder.addExtraQueryParameters(this.bodyParameters);
|
|
29
|
+
}
|
|
30
|
+
const bodyParametersString = parameterBuilder.createQueryString();
|
|
31
|
+
return UrlString.appendQueryString(this._baseEndpoint, bodyParametersString);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { ManagedIdentityRequestParameters };
|
|
36
|
+
//# sourceMappingURL=ManagedIdentityRequestParameters.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ManagedIdentityRequestParameters.mjs","sources":["../../src/config/ManagedIdentityRequestParameters.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAMA;AAEA;;;AAIW,MAAA,gCAAuC,CAAA;AACvC,IAAA,WAAA,CAAA,UAAuB,EAAC,QAAQ,EAAA;AAE3B,QAAA,IAAA,CAAA,UAAA,GAAU,UAAE,CAAA;AAQjB,QAAA,IAAA,CAAA,aAAoB,GAAA,QAAA,CAAA;AAepB,QAAA,IAAA,CAAA,OAAA,GAAA,EAAA,CAAA;AAcV,QAAA,IAAA,CAAA,cAAA,GAAA,EAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.
|
|
1
|
+
/*! @azure/msal-node v2.3.0-alpha.0 2023-12-07 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -7,80 +7,80 @@ var EncodingUtils = require('../utils/EncodingUtils.cjs');
|
|
|
7
7
|
var PkceGenerator = require('./PkceGenerator.cjs');
|
|
8
8
|
var HashUtils = require('./HashUtils.cjs');
|
|
9
9
|
|
|
10
|
-
/*
|
|
11
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
|
-
* Licensed under the MIT License.
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* This class implements MSAL node's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
16
|
-
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
17
|
-
* @public
|
|
18
|
-
*/
|
|
19
|
-
class CryptoProvider {
|
|
20
|
-
constructor() {
|
|
21
|
-
// Browser crypto needs to be validated first before any other classes can be set.
|
|
22
|
-
this.pkceGenerator = new PkceGenerator.PkceGenerator();
|
|
23
|
-
this.guidGenerator = new GuidGenerator.GuidGenerator();
|
|
24
|
-
this.hashUtils = new HashUtils.HashUtils();
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Creates a new random GUID - used to populate state and nonce.
|
|
28
|
-
* @returns string (GUID)
|
|
29
|
-
*/
|
|
30
|
-
createNewGuid() {
|
|
31
|
-
return this.guidGenerator.generateGuid();
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Encodes input string to base64.
|
|
35
|
-
* @param input - string to be encoded
|
|
36
|
-
*/
|
|
37
|
-
base64Encode(input) {
|
|
38
|
-
return EncodingUtils.EncodingUtils.base64Encode(input);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Decodes input string from base64.
|
|
42
|
-
* @param input - string to be decoded
|
|
43
|
-
*/
|
|
44
|
-
base64Decode(input) {
|
|
45
|
-
return EncodingUtils.EncodingUtils.base64Decode(input);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Generates PKCE codes used in Authorization Code Flow.
|
|
49
|
-
*/
|
|
50
|
-
generatePkceCodes() {
|
|
51
|
-
return this.pkceGenerator.generatePkceCodes();
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
|
|
55
|
-
*/
|
|
56
|
-
getPublicKeyThumbprint() {
|
|
57
|
-
throw new Error("Method not implemented.");
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Removes cryptographic keypair from key store matching the keyId passed in
|
|
61
|
-
* @param kid
|
|
62
|
-
*/
|
|
63
|
-
removeTokenBindingKey() {
|
|
64
|
-
throw new Error("Method not implemented.");
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Removes all cryptographic keys from Keystore
|
|
68
|
-
*/
|
|
69
|
-
clearKeystore() {
|
|
70
|
-
throw new Error("Method not implemented.");
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Signs the given object as a jwt payload with private key retrieved by given kid - currently not implemented for node
|
|
74
|
-
*/
|
|
75
|
-
signJwt() {
|
|
76
|
-
throw new Error("Method not implemented.");
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Returns the SHA-256 hash of an input string
|
|
80
|
-
*/
|
|
81
|
-
async hashString(plainText) {
|
|
82
|
-
return EncodingUtils.EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(plainText).toString("base64"), "base64");
|
|
83
|
-
}
|
|
10
|
+
/*
|
|
11
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
|
+
* Licensed under the MIT License.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* This class implements MSAL node's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
16
|
+
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
class CryptoProvider {
|
|
20
|
+
constructor() {
|
|
21
|
+
// Browser crypto needs to be validated first before any other classes can be set.
|
|
22
|
+
this.pkceGenerator = new PkceGenerator.PkceGenerator();
|
|
23
|
+
this.guidGenerator = new GuidGenerator.GuidGenerator();
|
|
24
|
+
this.hashUtils = new HashUtils.HashUtils();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Creates a new random GUID - used to populate state and nonce.
|
|
28
|
+
* @returns string (GUID)
|
|
29
|
+
*/
|
|
30
|
+
createNewGuid() {
|
|
31
|
+
return this.guidGenerator.generateGuid();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Encodes input string to base64.
|
|
35
|
+
* @param input - string to be encoded
|
|
36
|
+
*/
|
|
37
|
+
base64Encode(input) {
|
|
38
|
+
return EncodingUtils.EncodingUtils.base64Encode(input);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Decodes input string from base64.
|
|
42
|
+
* @param input - string to be decoded
|
|
43
|
+
*/
|
|
44
|
+
base64Decode(input) {
|
|
45
|
+
return EncodingUtils.EncodingUtils.base64Decode(input);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Generates PKCE codes used in Authorization Code Flow.
|
|
49
|
+
*/
|
|
50
|
+
generatePkceCodes() {
|
|
51
|
+
return this.pkceGenerator.generatePkceCodes();
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
|
|
55
|
+
*/
|
|
56
|
+
getPublicKeyThumbprint() {
|
|
57
|
+
throw new Error("Method not implemented.");
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Removes cryptographic keypair from key store matching the keyId passed in
|
|
61
|
+
* @param kid
|
|
62
|
+
*/
|
|
63
|
+
removeTokenBindingKey() {
|
|
64
|
+
throw new Error("Method not implemented.");
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Removes all cryptographic keys from Keystore
|
|
68
|
+
*/
|
|
69
|
+
clearKeystore() {
|
|
70
|
+
throw new Error("Method not implemented.");
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Signs the given object as a jwt payload with private key retrieved by given kid - currently not implemented for node
|
|
74
|
+
*/
|
|
75
|
+
signJwt() {
|
|
76
|
+
throw new Error("Method not implemented.");
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Returns the SHA-256 hash of an input string
|
|
80
|
+
*/
|
|
81
|
+
async hashString(plainText) {
|
|
82
|
+
return EncodingUtils.EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(plainText).toString("base64"), "base64");
|
|
83
|
+
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
exports.CryptoProvider = CryptoProvider;
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { ICrypto, PkceCodes } from "@azure/msal-common";
|
|
2
|
-
/**
|
|
3
|
-
* This class implements MSAL node's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
4
|
-
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export declare class CryptoProvider implements ICrypto {
|
|
8
|
-
private pkceGenerator;
|
|
9
|
-
private guidGenerator;
|
|
10
|
-
private hashUtils;
|
|
11
|
-
constructor();
|
|
12
|
-
/**
|
|
13
|
-
* Creates a new random GUID - used to populate state and nonce.
|
|
14
|
-
* @returns string (GUID)
|
|
15
|
-
*/
|
|
16
|
-
createNewGuid(): string;
|
|
17
|
-
/**
|
|
18
|
-
* Encodes input string to base64.
|
|
19
|
-
* @param input - string to be encoded
|
|
20
|
-
*/
|
|
21
|
-
base64Encode(input: string): string;
|
|
22
|
-
/**
|
|
23
|
-
* Decodes input string from base64.
|
|
24
|
-
* @param input - string to be decoded
|
|
25
|
-
*/
|
|
26
|
-
base64Decode(input: string): string;
|
|
27
|
-
/**
|
|
28
|
-
* Generates PKCE codes used in Authorization Code Flow.
|
|
29
|
-
*/
|
|
30
|
-
generatePkceCodes(): Promise<PkceCodes>;
|
|
31
|
-
/**
|
|
32
|
-
* Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
|
|
33
|
-
*/
|
|
34
|
-
getPublicKeyThumbprint(): Promise<string>;
|
|
35
|
-
/**
|
|
36
|
-
* Removes cryptographic keypair from key store matching the keyId passed in
|
|
37
|
-
* @param kid
|
|
38
|
-
*/
|
|
39
|
-
removeTokenBindingKey(): Promise<boolean>;
|
|
40
|
-
/**
|
|
41
|
-
* Removes all cryptographic keys from Keystore
|
|
42
|
-
*/
|
|
43
|
-
clearKeystore(): Promise<boolean>;
|
|
44
|
-
/**
|
|
45
|
-
* Signs the given object as a jwt payload with private key retrieved by given kid - currently not implemented for node
|
|
46
|
-
*/
|
|
47
|
-
signJwt(): Promise<string>;
|
|
48
|
-
/**
|
|
49
|
-
* Returns the SHA-256 hash of an input string
|
|
50
|
-
*/
|
|
51
|
-
hashString(plainText: string): Promise<string>;
|
|
52
|
-
}
|
|
1
|
+
import { ICrypto, PkceCodes } from "@azure/msal-common";
|
|
2
|
+
/**
|
|
3
|
+
* This class implements MSAL node's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
4
|
+
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export declare class CryptoProvider implements ICrypto {
|
|
8
|
+
private pkceGenerator;
|
|
9
|
+
private guidGenerator;
|
|
10
|
+
private hashUtils;
|
|
11
|
+
constructor();
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new random GUID - used to populate state and nonce.
|
|
14
|
+
* @returns string (GUID)
|
|
15
|
+
*/
|
|
16
|
+
createNewGuid(): string;
|
|
17
|
+
/**
|
|
18
|
+
* Encodes input string to base64.
|
|
19
|
+
* @param input - string to be encoded
|
|
20
|
+
*/
|
|
21
|
+
base64Encode(input: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Decodes input string from base64.
|
|
24
|
+
* @param input - string to be decoded
|
|
25
|
+
*/
|
|
26
|
+
base64Decode(input: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Generates PKCE codes used in Authorization Code Flow.
|
|
29
|
+
*/
|
|
30
|
+
generatePkceCodes(): Promise<PkceCodes>;
|
|
31
|
+
/**
|
|
32
|
+
* Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
|
|
33
|
+
*/
|
|
34
|
+
getPublicKeyThumbprint(): Promise<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Removes cryptographic keypair from key store matching the keyId passed in
|
|
37
|
+
* @param kid
|
|
38
|
+
*/
|
|
39
|
+
removeTokenBindingKey(): Promise<boolean>;
|
|
40
|
+
/**
|
|
41
|
+
* Removes all cryptographic keys from Keystore
|
|
42
|
+
*/
|
|
43
|
+
clearKeystore(): Promise<boolean>;
|
|
44
|
+
/**
|
|
45
|
+
* Signs the given object as a jwt payload with private key retrieved by given kid - currently not implemented for node
|
|
46
|
+
*/
|
|
47
|
+
signJwt(): Promise<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the SHA-256 hash of an input string
|
|
50
|
+
*/
|
|
51
|
+
hashString(plainText: string): Promise<string>;
|
|
52
|
+
}
|
|
53
53
|
//# sourceMappingURL=CryptoProvider.d.ts.map
|
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.
|
|
1
|
+
/*! @azure/msal-node v2.3.0-alpha.0 2023-12-07 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { GuidGenerator } from './GuidGenerator.mjs';
|
|
4
4
|
import { EncodingUtils } from '../utils/EncodingUtils.mjs';
|
|
5
5
|
import { PkceGenerator } from './PkceGenerator.mjs';
|
|
6
6
|
import { HashUtils } from './HashUtils.mjs';
|
|
7
7
|
|
|
8
|
-
/*
|
|
9
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10
|
-
* Licensed under the MIT License.
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* This class implements MSAL node's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
14
|
-
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
class CryptoProvider {
|
|
18
|
-
constructor() {
|
|
19
|
-
// Browser crypto needs to be validated first before any other classes can be set.
|
|
20
|
-
this.pkceGenerator = new PkceGenerator();
|
|
21
|
-
this.guidGenerator = new GuidGenerator();
|
|
22
|
-
this.hashUtils = new HashUtils();
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Creates a new random GUID - used to populate state and nonce.
|
|
26
|
-
* @returns string (GUID)
|
|
27
|
-
*/
|
|
28
|
-
createNewGuid() {
|
|
29
|
-
return this.guidGenerator.generateGuid();
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Encodes input string to base64.
|
|
33
|
-
* @param input - string to be encoded
|
|
34
|
-
*/
|
|
35
|
-
base64Encode(input) {
|
|
36
|
-
return EncodingUtils.base64Encode(input);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Decodes input string from base64.
|
|
40
|
-
* @param input - string to be decoded
|
|
41
|
-
*/
|
|
42
|
-
base64Decode(input) {
|
|
43
|
-
return EncodingUtils.base64Decode(input);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Generates PKCE codes used in Authorization Code Flow.
|
|
47
|
-
*/
|
|
48
|
-
generatePkceCodes() {
|
|
49
|
-
return this.pkceGenerator.generatePkceCodes();
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
|
|
53
|
-
*/
|
|
54
|
-
getPublicKeyThumbprint() {
|
|
55
|
-
throw new Error("Method not implemented.");
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Removes cryptographic keypair from key store matching the keyId passed in
|
|
59
|
-
* @param kid
|
|
60
|
-
*/
|
|
61
|
-
removeTokenBindingKey() {
|
|
62
|
-
throw new Error("Method not implemented.");
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Removes all cryptographic keys from Keystore
|
|
66
|
-
*/
|
|
67
|
-
clearKeystore() {
|
|
68
|
-
throw new Error("Method not implemented.");
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Signs the given object as a jwt payload with private key retrieved by given kid - currently not implemented for node
|
|
72
|
-
*/
|
|
73
|
-
signJwt() {
|
|
74
|
-
throw new Error("Method not implemented.");
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Returns the SHA-256 hash of an input string
|
|
78
|
-
*/
|
|
79
|
-
async hashString(plainText) {
|
|
80
|
-
return EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(plainText).toString("base64"), "base64");
|
|
81
|
-
}
|
|
8
|
+
/*
|
|
9
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10
|
+
* Licensed under the MIT License.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* This class implements MSAL node's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
14
|
+
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
class CryptoProvider {
|
|
18
|
+
constructor() {
|
|
19
|
+
// Browser crypto needs to be validated first before any other classes can be set.
|
|
20
|
+
this.pkceGenerator = new PkceGenerator();
|
|
21
|
+
this.guidGenerator = new GuidGenerator();
|
|
22
|
+
this.hashUtils = new HashUtils();
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new random GUID - used to populate state and nonce.
|
|
26
|
+
* @returns string (GUID)
|
|
27
|
+
*/
|
|
28
|
+
createNewGuid() {
|
|
29
|
+
return this.guidGenerator.generateGuid();
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Encodes input string to base64.
|
|
33
|
+
* @param input - string to be encoded
|
|
34
|
+
*/
|
|
35
|
+
base64Encode(input) {
|
|
36
|
+
return EncodingUtils.base64Encode(input);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Decodes input string from base64.
|
|
40
|
+
* @param input - string to be decoded
|
|
41
|
+
*/
|
|
42
|
+
base64Decode(input) {
|
|
43
|
+
return EncodingUtils.base64Decode(input);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Generates PKCE codes used in Authorization Code Flow.
|
|
47
|
+
*/
|
|
48
|
+
generatePkceCodes() {
|
|
49
|
+
return this.pkceGenerator.generatePkceCodes();
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Generates a keypair, stores it and returns a thumbprint - not yet implemented for node
|
|
53
|
+
*/
|
|
54
|
+
getPublicKeyThumbprint() {
|
|
55
|
+
throw new Error("Method not implemented.");
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Removes cryptographic keypair from key store matching the keyId passed in
|
|
59
|
+
* @param kid
|
|
60
|
+
*/
|
|
61
|
+
removeTokenBindingKey() {
|
|
62
|
+
throw new Error("Method not implemented.");
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Removes all cryptographic keys from Keystore
|
|
66
|
+
*/
|
|
67
|
+
clearKeystore() {
|
|
68
|
+
throw new Error("Method not implemented.");
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Signs the given object as a jwt payload with private key retrieved by given kid - currently not implemented for node
|
|
72
|
+
*/
|
|
73
|
+
signJwt() {
|
|
74
|
+
throw new Error("Method not implemented.");
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Returns the SHA-256 hash of an input string
|
|
78
|
+
*/
|
|
79
|
+
async hashString(plainText) {
|
|
80
|
+
return EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(plainText).toString("base64"), "base64");
|
|
81
|
+
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
export { CryptoProvider };
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.
|
|
1
|
+
/*! @azure/msal-node v2.3.0-alpha.0 2023-12-07 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
var uuid = require('uuid');
|
|
6
6
|
|
|
7
|
-
/*
|
|
8
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9
|
-
* Licensed under the MIT License.
|
|
10
|
-
*/
|
|
11
|
-
class GuidGenerator {
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or pseudo-random numbers.
|
|
15
|
-
* uuidv4 generates guids from cryprtographically-string random
|
|
16
|
-
*/
|
|
17
|
-
generateGuid() {
|
|
18
|
-
return uuid.v4();
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* verifies if a string is GUID
|
|
22
|
-
* @param guid
|
|
23
|
-
*/
|
|
24
|
-
isGuid(guid) {
|
|
25
|
-
const regexGuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
26
|
-
return regexGuid.test(guid);
|
|
27
|
-
}
|
|
7
|
+
/*
|
|
8
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9
|
+
* Licensed under the MIT License.
|
|
10
|
+
*/
|
|
11
|
+
class GuidGenerator {
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or pseudo-random numbers.
|
|
15
|
+
* uuidv4 generates guids from cryprtographically-string random
|
|
16
|
+
*/
|
|
17
|
+
generateGuid() {
|
|
18
|
+
return uuid.v4();
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* verifies if a string is GUID
|
|
22
|
+
* @param guid
|
|
23
|
+
*/
|
|
24
|
+
isGuid(guid) {
|
|
25
|
+
const regexGuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
26
|
+
return regexGuid.test(guid);
|
|
27
|
+
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
exports.GuidGenerator = GuidGenerator;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { IGuidGenerator } from "@azure/msal-common";
|
|
2
|
-
export declare class GuidGenerator implements IGuidGenerator {
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or pseudo-random numbers.
|
|
6
|
-
* uuidv4 generates guids from cryprtographically-string random
|
|
7
|
-
*/
|
|
8
|
-
generateGuid(): string;
|
|
9
|
-
/**
|
|
10
|
-
* verifies if a string is GUID
|
|
11
|
-
* @param guid
|
|
12
|
-
*/
|
|
13
|
-
isGuid(guid: string): boolean;
|
|
14
|
-
}
|
|
1
|
+
import { IGuidGenerator } from "@azure/msal-common";
|
|
2
|
+
export declare class GuidGenerator implements IGuidGenerator {
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or pseudo-random numbers.
|
|
6
|
+
* uuidv4 generates guids from cryprtographically-string random
|
|
7
|
+
*/
|
|
8
|
+
generateGuid(): string;
|
|
9
|
+
/**
|
|
10
|
+
* verifies if a string is GUID
|
|
11
|
+
* @param guid
|
|
12
|
+
*/
|
|
13
|
+
isGuid(guid: string): boolean;
|
|
14
|
+
}
|
|
15
15
|
//# sourceMappingURL=GuidGenerator.d.ts.map
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.
|
|
1
|
+
/*! @azure/msal-node v2.3.0-alpha.0 2023-12-07 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { v4 } from 'uuid';
|
|
4
4
|
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
-
* Licensed under the MIT License.
|
|
8
|
-
*/
|
|
9
|
-
class GuidGenerator {
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
* RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or pseudo-random numbers.
|
|
13
|
-
* uuidv4 generates guids from cryprtographically-string random
|
|
14
|
-
*/
|
|
15
|
-
generateGuid() {
|
|
16
|
-
return v4();
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* verifies if a string is GUID
|
|
20
|
-
* @param guid
|
|
21
|
-
*/
|
|
22
|
-
isGuid(guid) {
|
|
23
|
-
const regexGuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
24
|
-
return regexGuid.test(guid);
|
|
25
|
-
}
|
|
5
|
+
/*
|
|
6
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
+
* Licensed under the MIT License.
|
|
8
|
+
*/
|
|
9
|
+
class GuidGenerator {
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* RFC4122: The version 4 UUID is meant for generating UUIDs from truly-random or pseudo-random numbers.
|
|
13
|
+
* uuidv4 generates guids from cryprtographically-string random
|
|
14
|
+
*/
|
|
15
|
+
generateGuid() {
|
|
16
|
+
return v4();
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* verifies if a string is GUID
|
|
20
|
+
* @param guid
|
|
21
|
+
*/
|
|
22
|
+
isGuid(guid) {
|
|
23
|
+
const regexGuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
24
|
+
return regexGuid.test(guid);
|
|
25
|
+
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export { GuidGenerator };
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.
|
|
1
|
+
/*! @azure/msal-node v2.3.0-alpha.0 2023-12-07 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
var Constants = require('../utils/Constants.cjs');
|
|
6
6
|
var crypto = require('crypto');
|
|
7
7
|
|
|
8
|
-
/*
|
|
9
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10
|
-
* Licensed under the MIT License.
|
|
11
|
-
*/
|
|
12
|
-
class HashUtils {
|
|
13
|
-
/**
|
|
14
|
-
* generate 'SHA256' hash
|
|
15
|
-
* @param buffer
|
|
16
|
-
*/
|
|
17
|
-
sha256(buffer) {
|
|
18
|
-
return crypto.createHash(Constants.Hash.SHA256).update(buffer).digest();
|
|
19
|
-
}
|
|
8
|
+
/*
|
|
9
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10
|
+
* Licensed under the MIT License.
|
|
11
|
+
*/
|
|
12
|
+
class HashUtils {
|
|
13
|
+
/**
|
|
14
|
+
* generate 'SHA256' hash
|
|
15
|
+
* @param buffer
|
|
16
|
+
*/
|
|
17
|
+
sha256(buffer) {
|
|
18
|
+
return crypto.createHash(Constants.Hash.SHA256).update(buffer).digest();
|
|
19
|
+
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
exports.HashUtils = HashUtils;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
export declare class HashUtils {
|
|
3
|
-
/**
|
|
4
|
-
* generate 'SHA256' hash
|
|
5
|
-
* @param buffer
|
|
6
|
-
*/
|
|
7
|
-
sha256(buffer: string): Buffer;
|
|
8
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare class HashUtils {
|
|
3
|
+
/**
|
|
4
|
+
* generate 'SHA256' hash
|
|
5
|
+
* @param buffer
|
|
6
|
+
*/
|
|
7
|
+
sha256(buffer: string): Buffer;
|
|
8
|
+
}
|
|
9
9
|
//# sourceMappingURL=HashUtils.d.ts.map
|