@alwatr/crypto 1.0.1 → 1.1.1
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/CHANGELOG.md +25 -1
- package/package.json +5 -5
- package/user.d.ts +2 -2
- package/user.d.ts.map +1 -1
- package/user.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,10 +3,34 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [1.
|
|
6
|
+
## [1.1.1](https://github.com/AliMD/alwatr/compare/@alwatr/crypto@1.1.0...@alwatr/crypto@1.1.1) (2023-09-12)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @alwatr/crypto
|
|
9
9
|
|
|
10
|
+
# 1.1.0 (2023-09-12)
|
|
11
|
+
|
|
12
|
+
# 1.0.0 (2023-06-14)
|
|
13
|
+
|
|
14
|
+
# 0.32.0 (2023-05-27)
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **crypto:** add some pre config ([4b960c5](https://github.com/AliMD/alwatr/commit/4b960c5cb3f7495c0689adcb65c62a1032ae2650))
|
|
19
|
+
|
|
20
|
+
### Performance Improvements
|
|
21
|
+
|
|
22
|
+
* **crypto/hash:** enhance crc generator ([ba8c4bc](https://github.com/AliMD/alwatr/commit/ba8c4bcf8f9ec9767b0bd3b6c3fd5c4f503a84dd))
|
|
23
|
+
|
|
24
|
+
# 0.31.0 (2023-05-08)
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* **crypto:** package ([866c5f4](https://github.com/AliMD/alwatr/commit/866c5f490ea2eaa75bf177f35b3f4711931e13d2))
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
* **crypto:** make prefix for userId ([5baa00a](https://github.com/AliMD/alwatr/commit/5baa00aafb16a4c6ed1d77913edddd090f732dad))
|
|
33
|
+
|
|
10
34
|
# [1.0.0](https://github.com/AliMD/alwatr/compare/v0.32.0...v1.0.0) (2023-06-14)
|
|
11
35
|
|
|
12
36
|
**Note:** Version bump only for package @alwatr/crypto
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alwatr/crypto",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Secure authentication HOTP token generator (the HMAC-based One-Time Password algorithm) and crypto utils written in tiny TypeScript module.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"crypto",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"url": "https://github.com/AliMD/alwatr/issues"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@alwatr/logger": "^1.
|
|
44
|
-
"@alwatr/math": "^1.
|
|
45
|
-
"tslib": "^2.
|
|
43
|
+
"@alwatr/logger": "^1.1.1",
|
|
44
|
+
"@alwatr/math": "^1.1.1",
|
|
45
|
+
"tslib": "^2.6.2"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "ebc98f75330ab77c7a5bfeebe0fd1f4748bf3821"
|
|
48
48
|
}
|
package/user.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export declare class AlwatrUserFactory {
|
|
|
42
42
|
* const userToken = userFactory.generateToken([user.id, user.lpe]);
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
|
-
generateToken(uniquelyList:
|
|
45
|
+
generateToken(uniquelyList: (string | number | boolean)[]): string;
|
|
46
46
|
/**
|
|
47
47
|
* Verify user auth token.
|
|
48
48
|
*
|
|
@@ -54,6 +54,6 @@ export declare class AlwatrUserFactory {
|
|
|
54
54
|
* }
|
|
55
55
|
* ```
|
|
56
56
|
*/
|
|
57
|
-
verifyToken(uniquelyList:
|
|
57
|
+
verifyToken(uniquelyList: (string | number | boolean)[], token: string): TokenStatus;
|
|
58
58
|
}
|
|
59
59
|
//# sourceMappingURL=user.d.ts.map
|
package/user.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["src/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAC,oBAAoB,EAAC,MAAM,YAAY,CAAC;AAEhD,OAAO,KAAK,EAAC,mBAAmB,EAAE,oBAAoB,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AAEtF;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,SAAS,CAAC,eAAe,uBAAC;IAC1B,SAAS,CAAC,cAAc,sBAAC;gBAGrB,UAAU,EAAE,mBAAmB,EAC/B,WAAW,EAAE,oBAAoB;IAMrC;;;;;;;;;;;OAWG;IACH,UAAU,IAAI,MAAM;IAIpB;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAI7B;;;;;;;;OAQG;IACH,aAAa,CAAC,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["src/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAC,oBAAoB,EAAC,MAAM,YAAY,CAAC;AAEhD,OAAO,KAAK,EAAC,mBAAmB,EAAE,oBAAoB,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AAEtF;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,SAAS,CAAC,eAAe,uBAAC;IAC1B,SAAS,CAAC,cAAc,sBAAC;gBAGrB,UAAU,EAAE,mBAAmB,EAC/B,WAAW,EAAE,oBAAoB;IAMrC;;;;;;;;;;;OAWG;IACH,UAAU,IAAI,MAAM;IAIpB;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAI7B;;;;;;;;OAQG;IACH,aAAa,CAAC,YAAY,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,GAAG,MAAM;IAIlE;;;;;;;;;;OAUG;IACH,WAAW,CAAC,YAAY,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW;CAGrF"}
|
package/user.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.js","sourceRoot":"","sources":["src/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAC,oBAAoB,EAAC,MAAM,YAAY,CAAC;AAIhD;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAI5B,YACI,UAA+B,EAC/B,WAAiC;QAEnC,IAAI,CAAC,cAAc,GAAG,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAC1D,IAAI,CAAC,eAAe,GAAG,IAAI,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAC/D,CAAC;IAED;;;;;;;;;;;OAWG;IACH,UAAU;QACR,OAAO,GAAG,GAAG,IAAI,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC;IACxD,CAAC;IAED;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAU;QACjB,OAAO,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;;;OAQG;IACH,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"user.js","sourceRoot":"","sources":["src/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAC,oBAAoB,EAAC,MAAM,YAAY,CAAC;AAIhD;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAI5B,YACI,UAA+B,EAC/B,WAAiC;QAEnC,IAAI,CAAC,cAAc,GAAG,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAC1D,IAAI,CAAC,eAAe,GAAG,IAAI,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAC/D,CAAC;IAED;;;;;;;;;;;OAWG;IACH,UAAU;QACR,OAAO,GAAG,GAAG,IAAI,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC;IACxD,CAAC;IAED;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAU;QACjB,OAAO,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IACjE,CAAC;IAED;;;;;;;;OAQG;IACH,aAAa,CAAC,YAA2C;QACvD,OAAO,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED;;;;;;;;;;OAUG;IACH,WAAW,CAAC,YAA2C,EAAE,KAAa;QACpE,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,CAAC;IACjE,CAAC;CACF","sourcesContent":["import {AlwatrHashGenerator} from './hash.js';\nimport {AlwatrTokenGenerator} from './token.js';\n\nimport type {HashGeneratorConfig, TokenGeneratorConfig, TokenStatus} from './type.js';\n\n/**\n * User factory for generating self-validate user-id and user-token.\n */\nexport class AlwatrUserFactory {\n protected _tokenGenerator;\n protected _hashGenerator;\n\n constructor(\n hashConfig: HashGeneratorConfig,\n tokenConfig: TokenGeneratorConfig,\n ) {\n this._hashGenerator = new AlwatrHashGenerator(hashConfig);\n this._tokenGenerator = new AlwatrTokenGenerator(tokenConfig);\n }\n\n /**\n * Generate new self-verifiable user-id.\n *\n * Example:\n *\n * ```ts\n * const newUser = {\n * id: userFactory.generateId(),\n * ...\n * }\n * ```\n */\n generateId(): string {\n return 'U' + this._hashGenerator.randomSelfValidate();\n }\n\n /**\n * Validate user-id without token.\n *\n * Example:\n *\n * ```ts\n * if (!userFactory.verifyId(user.id)) {\n * new Error('invalid_user');\n * }\n * ```\n */\n verifyId(id: string): boolean {\n return this._hashGenerator.verifySelfValidate(id.substring(1));\n }\n\n /**\n * Generate user auth token.\n *\n * Example:\n *\n * ```ts\n * const userToken = userFactory.generateToken([user.id, user.lpe]);\n * ```\n */\n generateToken(uniquelyList: (string | number | boolean)[]): string {\n return this._tokenGenerator.generate(uniquelyList.join());\n }\n\n /**\n * Verify user auth token.\n *\n * Example:\n *\n * ```ts\n * if (!userFactory.verifyToken([user.id, user.lpe], userToken)) {\n * new error('invalid_token');\n * }\n * ```\n */\n verifyToken(uniquelyList: (string | number | boolean)[], token: string): TokenStatus {\n return this._tokenGenerator.verify(uniquelyList.join(), token);\n }\n}\n"]}
|