@twin.org/api-auth-entity-storage-service 0.0.3-next.17 → 0.0.3-next.19
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/es/entities/authenticationUser.js +9 -1
- package/dist/es/entities/authenticationUser.js.map +1 -1
- package/dist/es/index.js +1 -1
- package/dist/es/index.js.map +1 -1
- package/dist/es/processors/authHeaderProcessor.js +1 -1
- package/dist/es/processors/authHeaderProcessor.js.map +1 -1
- package/dist/es/restEntryPoints.js +7 -0
- package/dist/es/restEntryPoints.js.map +1 -1
- package/dist/es/routes/entityStorageAuthenticationAdminRoutes.js +362 -0
- package/dist/es/routes/entityStorageAuthenticationAdminRoutes.js.map +1 -0
- package/dist/es/routes/entityStorageAuthenticationRoutes.js +4 -8
- package/dist/es/routes/entityStorageAuthenticationRoutes.js.map +1 -1
- package/dist/es/services/entityStorageAuthenticationAdminService.js +110 -41
- package/dist/es/services/entityStorageAuthenticationAdminService.js.map +1 -1
- package/dist/es/services/entityStorageAuthenticationService.js +16 -10
- package/dist/es/services/entityStorageAuthenticationService.js.map +1 -1
- package/dist/es/utils/tokenHelper.js +16 -3
- package/dist/es/utils/tokenHelper.js.map +1 -1
- package/dist/types/entities/authenticationUser.d.ts +4 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/routes/entityStorageAuthenticationAdminRoutes.d.ts +61 -0
- package/dist/types/services/entityStorageAuthenticationAdminService.d.ts +21 -6
- package/dist/types/services/entityStorageAuthenticationService.d.ts +1 -2
- package/dist/types/utils/tokenHelper.d.ts +4 -2
- package/docs/changelog.md +32 -0
- package/docs/reference/classes/AuthenticationUser.md +8 -0
- package/docs/reference/classes/EntityStorageAuthenticationAdminService.md +73 -13
- package/docs/reference/classes/EntityStorageAuthenticationService.md +1 -7
- package/docs/reference/classes/TokenHelper.md +14 -2
- package/docs/reference/functions/authenticationAdminCreateUser.md +31 -0
- package/docs/reference/functions/authenticationAdminGetUser.md +31 -0
- package/docs/reference/functions/authenticationAdminGetUserByIdentity.md +31 -0
- package/docs/reference/functions/authenticationAdminRemoveUser.md +31 -0
- package/docs/reference/functions/authenticationAdminUpdateUser.md +31 -0
- package/docs/reference/functions/authenticationAdminUpdateUserPassword.md +31 -0
- package/docs/reference/functions/generateRestRoutesAuthenticationAdmin.md +25 -0
- package/docs/reference/index.md +8 -1
- package/docs/reference/variables/tagsAuthenticationAdmin.md +5 -0
- package/locales/en.json +4 -2
- package/package.json +4 -4
- package/dist/es/utils/passwordHelper.js +0 -29
- package/dist/es/utils/passwordHelper.js.map +0 -1
- package/dist/types/utils/passwordHelper.d.ts +0 -16
- package/docs/reference/classes/PasswordHelper.md +0 -49
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 IOTA Stiftung.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
-
import { Converter, Guards } from "@twin.org/core";
|
|
4
|
-
import { Blake2b } from "@twin.org/crypto";
|
|
5
|
-
/**
|
|
6
|
-
* Helper class for password operations.
|
|
7
|
-
*/
|
|
8
|
-
export class PasswordHelper {
|
|
9
|
-
/**
|
|
10
|
-
* Runtime name for the class.
|
|
11
|
-
*/
|
|
12
|
-
static CLASS_NAME = "PasswordHelper";
|
|
13
|
-
/**
|
|
14
|
-
* Hash the password for the user.
|
|
15
|
-
* @param passwordBytes The password bytes.
|
|
16
|
-
* @param saltBytes The salt bytes.
|
|
17
|
-
* @returns The hashed password.
|
|
18
|
-
*/
|
|
19
|
-
static async hashPassword(passwordBytes, saltBytes) {
|
|
20
|
-
Guards.uint8Array(PasswordHelper.CLASS_NAME, "passwordBytes", passwordBytes);
|
|
21
|
-
Guards.uint8Array(PasswordHelper.CLASS_NAME, "saltBytes", saltBytes);
|
|
22
|
-
const combined = new Uint8Array(saltBytes.length + passwordBytes.length);
|
|
23
|
-
combined.set(saltBytes);
|
|
24
|
-
combined.set(passwordBytes, saltBytes.length);
|
|
25
|
-
const hashedPassword = Blake2b.sum256(combined);
|
|
26
|
-
return Converter.bytesToBase64(hashedPassword);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=passwordHelper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"passwordHelper.js","sourceRoot":"","sources":["../../../src/utils/passwordHelper.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C;;GAEG;AACH,MAAM,OAAO,cAAc;IAC1B;;OAEG;IACI,MAAM,CAAU,UAAU,oBAAoC;IAErE;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,YAAY,CAC/B,aAAyB,EACzB,SAAqB;QAErB,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,UAAU,mBAAyB,aAAa,CAAC,CAAC;QACnF,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,UAAU,eAAqB,SAAS,CAAC,CAAC;QAE3E,MAAM,QAAQ,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;QACzE,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACxB,QAAQ,CAAC,GAAG,CAAC,aAAa,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;QAE9C,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEhD,OAAO,SAAS,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;IAChD,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Converter, Guards } from \"@twin.org/core\";\nimport { Blake2b } from \"@twin.org/crypto\";\nimport { nameof } from \"@twin.org/nameof\";\n\n/**\n * Helper class for password operations.\n */\nexport class PasswordHelper {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<PasswordHelper>();\n\n\t/**\n\t * Hash the password for the user.\n\t * @param passwordBytes The password bytes.\n\t * @param saltBytes The salt bytes.\n\t * @returns The hashed password.\n\t */\n\tpublic static async hashPassword(\n\t\tpasswordBytes: Uint8Array,\n\t\tsaltBytes: Uint8Array\n\t): Promise<string> {\n\t\tGuards.uint8Array(PasswordHelper.CLASS_NAME, nameof(passwordBytes), passwordBytes);\n\t\tGuards.uint8Array(PasswordHelper.CLASS_NAME, nameof(saltBytes), saltBytes);\n\n\t\tconst combined = new Uint8Array(saltBytes.length + passwordBytes.length);\n\t\tcombined.set(saltBytes);\n\t\tcombined.set(passwordBytes, saltBytes.length);\n\n\t\tconst hashedPassword = Blake2b.sum256(combined);\n\n\t\treturn Converter.bytesToBase64(hashedPassword);\n\t}\n}\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Helper class for password operations.
|
|
3
|
-
*/
|
|
4
|
-
export declare class PasswordHelper {
|
|
5
|
-
/**
|
|
6
|
-
* Runtime name for the class.
|
|
7
|
-
*/
|
|
8
|
-
static readonly CLASS_NAME: string;
|
|
9
|
-
/**
|
|
10
|
-
* Hash the password for the user.
|
|
11
|
-
* @param passwordBytes The password bytes.
|
|
12
|
-
* @param saltBytes The salt bytes.
|
|
13
|
-
* @returns The hashed password.
|
|
14
|
-
*/
|
|
15
|
-
static hashPassword(passwordBytes: Uint8Array, saltBytes: Uint8Array): Promise<string>;
|
|
16
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# Class: PasswordHelper
|
|
2
|
-
|
|
3
|
-
Helper class for password operations.
|
|
4
|
-
|
|
5
|
-
## Constructors
|
|
6
|
-
|
|
7
|
-
### Constructor
|
|
8
|
-
|
|
9
|
-
> **new PasswordHelper**(): `PasswordHelper`
|
|
10
|
-
|
|
11
|
-
#### Returns
|
|
12
|
-
|
|
13
|
-
`PasswordHelper`
|
|
14
|
-
|
|
15
|
-
## Properties
|
|
16
|
-
|
|
17
|
-
### CLASS\_NAME
|
|
18
|
-
|
|
19
|
-
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
20
|
-
|
|
21
|
-
Runtime name for the class.
|
|
22
|
-
|
|
23
|
-
## Methods
|
|
24
|
-
|
|
25
|
-
### hashPassword()
|
|
26
|
-
|
|
27
|
-
> `static` **hashPassword**(`passwordBytes`, `saltBytes`): `Promise`\<`string`\>
|
|
28
|
-
|
|
29
|
-
Hash the password for the user.
|
|
30
|
-
|
|
31
|
-
#### Parameters
|
|
32
|
-
|
|
33
|
-
##### passwordBytes
|
|
34
|
-
|
|
35
|
-
`Uint8Array`
|
|
36
|
-
|
|
37
|
-
The password bytes.
|
|
38
|
-
|
|
39
|
-
##### saltBytes
|
|
40
|
-
|
|
41
|
-
`Uint8Array`
|
|
42
|
-
|
|
43
|
-
The salt bytes.
|
|
44
|
-
|
|
45
|
-
#### Returns
|
|
46
|
-
|
|
47
|
-
`Promise`\<`string`\>
|
|
48
|
-
|
|
49
|
-
The hashed password.
|