@3sixty/vault-models 0.20.0-next.0 → 0.20.0-next.2
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/factories/vaultConnectorFactory.js.map +1 -1
- package/dist/es/index.js.map +1 -1
- package/dist/es/models/IVaultConnector.js.map +1 -1
- package/dist/es/models/vaultEncryptionType.js.map +1 -1
- package/dist/es/models/vaultKeyType.js.map +1 -1
- package/dist/es/utils/vaultConnectorHelper.js.map +1 -1
- package/docs/changelog.md +16 -0
- package/docs/reference/classes/VaultConnectorHelper.md +2 -2
- package/docs/reference/interfaces/IVaultConnector.md +2 -2
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vaultConnectorFactory.js","
|
|
1
|
+
{"version":3,"file":"vaultConnectorFactory.js","sources":["../../../src/factories/vaultConnectorFactory.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,qBAAqB,GAAG,OAAO,CAAC,aAAa,CAAkB,OAAO,CAAC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Factory } from \"@3sixty/core\";\nimport type { IVaultConnector } from \"../models/IVaultConnector.js\";\n\n/**\n * Factory for creating vault connectors.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const VaultConnectorFactory = Factory.createFactory<IVaultConnector>(\"vault\");\n"]}
|
package/dist/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,sCAAsC,CAAC;AACrD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./factories/vaultConnectorFactory.js\";\nexport * from \"./models/IVaultConnector.js\";\nexport * from \"./models/vaultEncryptionType.js\";\nexport * from \"./models/vaultKeyType.js\";\nexport * from \"./utils/vaultConnectorHelper.js\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IVaultConnector.js","
|
|
1
|
+
{"version":3,"file":"IVaultConnector.js","sources":["../../../src/models/IVaultConnector.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@3sixty/core\";\nimport type { VaultEncryptionType } from \"./vaultEncryptionType.js\";\nimport type { VaultKeyType } from \"./vaultKeyType.js\";\n\n/**\n * Interface describing a vault securely storing data.\n */\nexport interface IVaultConnector extends IComponent {\n\t/**\n\t * Generate a new key and store it in the vault.\n\t * @param name The name of the key to generate and store in the vault.\n\t * @param type The type of key to create.\n\t * @returns The public key for the key pair.\n\t */\n\tcreateKey(name: string, type: VaultKeyType): Promise<Uint8Array>;\n\n\t/**\n\t * Add an existing key to the vault.\n\t * @param name The name of the key to add to the vault.\n\t * @param type The type of key to add.\n\t * @param privateKey The private key.\n\t * @param publicKey The public key, can be undefined if the key type is symmetric.\n\t * @returns A promise that resolves when the key has been stored.\n\t */\n\taddKey(\n\t\tname: string,\n\t\ttype: VaultKeyType,\n\t\tprivateKey: Uint8Array,\n\t\tpublicKey?: Uint8Array\n\t): Promise<void>;\n\n\t/**\n\t * Get a key from the vault.\n\t * @param name The name of the key to get from the vault.\n\t * @param components Which key components to return, defaults to \"both\".\n\t * @returns The key, publicKey can be undefined if key is symmetric, privateKey can be undefined if only public was requested.\n\t * @throws GeneralError if \"private\" is requested for a symmetric key.\n\t */\n\tgetKey(\n\t\tname: string,\n\t\tcomponents?: \"public\" | \"private\" | \"both\"\n\t): Promise<{\n\t\t/**\n\t\t * The type of the key e.g. Ed25519.\n\t\t */\n\t\ttype: VaultKeyType;\n\n\t\t/**\n\t\t * The private key, undefined if only public component was requested.\n\t\t */\n\t\tprivateKey?: Uint8Array;\n\n\t\t/**\n\t\t * The public key, which can be undefined if key type is symmetric or only private was requested.\n\t\t */\n\t\tpublicKey?: Uint8Array;\n\t}>;\n\n\t/**\n\t * Check if a key exists in the vault.\n\t * @param name The name of the key to check.\n\t * @returns True if the key exists, false otherwise.\n\t */\n\tkeyExists(name: string): Promise<boolean>;\n\n\t/**\n\t * Get the type of a key from the vault without retrieving the key material.\n\t * @param name The name of the key.\n\t * @returns The key type.\n\t * @throws NotFoundError if the key does not exist.\n\t */\n\tgetKeyType(name: string): Promise<VaultKeyType>;\n\n\t/**\n\t * Rename a key in the vault.\n\t * @param name The name of the key to rename.\n\t * @param newName The new name of the key.\n\t * @returns A promise that resolves when the key has been renamed.\n\t */\n\trenameKey(name: string, newName: string): Promise<void>;\n\n\t/**\n\t * Remove a key from the vault.\n\t * @param name The name of the key to remove from the vault.\n\t * @returns A promise that resolves when the key has been removed.\n\t */\n\tremoveKey(name: string): Promise<void>;\n\n\t/**\n\t * Sign the data using a key in the vault.\n\t * @param name The name of the key to use for signing.\n\t * @param data The data to sign.\n\t * @returns The signature for the data.\n\t */\n\tsign(name: string, data: Uint8Array): Promise<Uint8Array>;\n\n\t/**\n\t * Verify the signature of the data using a key in the vault.\n\t * @param name The name of the key to use for verification.\n\t * @param data The data that was signed.\n\t * @param signature The signature to verify.\n\t * @returns True if the verification is successful.\n\t */\n\tverify(name: string, data: Uint8Array, signature: Uint8Array): Promise<boolean>;\n\n\t/**\n\t * Encrypt the data using a key in the vault.\n\t * @param name The name of the key to use for encryption.\n\t * @param encryptionType The type of encryption to use.\n\t * @param data The data to encrypt.\n\t * @returns The encrypted data.\n\t */\n\tencrypt(name: string, encryptionType: VaultEncryptionType, data: Uint8Array): Promise<Uint8Array>;\n\n\t/**\n\t * Decrypt the data using a key in the vault.\n\t * @param name The name of the key to use for decryption.\n\t * @param encryptionType The type of encryption to use.\n\t * @param encryptedData The data to decrypt.\n\t * @returns The decrypted data.\n\t */\n\tdecrypt(\n\t\tname: string,\n\t\tencryptionType: VaultEncryptionType,\n\t\tencryptedData: Uint8Array\n\t): Promise<Uint8Array>;\n\n\t/**\n\t * Store a secret in the vault.\n\t * @param name The name of the secret in the vault to set.\n\t * @param data The secret to add to the vault.\n\t * @returns A promise that resolves when the secret has been stored.\n\t */\n\tsetSecret<T>(name: string, data: T): Promise<void>;\n\n\t/**\n\t * Check if a secret exists in the vault.\n\t * @param name The name of the secret to check.\n\t * @returns True if the secret exists, false otherwise.\n\t */\n\tsecretExists(name: string): Promise<boolean>;\n\n\t/**\n\t * Get a secret from the vault.\n\t * @param name The name of the secret in the vault to get.\n\t * @returns The secret from the vault.\n\t * @throws Error if the secret is not found.\n\t */\n\tgetSecret<T>(name: string): Promise<T>;\n\n\t/**\n\t * Remove a secret from the vault.\n\t * @param name The name of the secret in the vault to remove.\n\t * @returns A promise that resolves when the secret has been removed.\n\t * @throws Error if the secret is not found.\n\t */\n\tremoveSecret(name: string): Promise<void>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vaultEncryptionType.js","
|
|
1
|
+
{"version":3,"file":"vaultEncryptionType.js","sources":["../../../src/models/vaultEncryptionType.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAClC;;OAEG;IACH,gBAAgB,EAAE,CAAC;CACV,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The names of the vault encryption types.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const VaultEncryptionType = {\n\t/**\n\t * The ChaCha20Poly1305. (symmetric)\n\t */\n\tChaCha20Poly1305: 0\n} as const;\n\n/**\n * Vault encryption types.\n */\nexport type VaultEncryptionType = (typeof VaultEncryptionType)[keyof typeof VaultEncryptionType];\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vaultKeyType.js","
|
|
1
|
+
{"version":3,"file":"vaultKeyType.js","sources":["../../../src/models/vaultKeyType.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,YAAY,GAAG;IAC3B;;OAEG;IACH,OAAO,EAAE,CAAC;IAEV;;OAEG;IACH,gBAAgB,EAAE,CAAC;CACV,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The names of the vault key types.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const VaultKeyType = {\n\t/**\n\t * Ed25519. (asymmetric)\n\t */\n\tEd25519: 0,\n\n\t/**\n\t * The ChaCha20Poly1305. (symmetric)\n\t */\n\tChaCha20Poly1305: 2\n} as const;\n\n/**\n * Vault key types.\n */\nexport type VaultKeyType = (typeof VaultKeyType)[keyof typeof VaultKeyType];\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vaultConnectorHelper.js","
|
|
1
|
+
{"version":3,"file":"vaultConnectorHelper.js","sources":["../../../src/utils/vaultConnectorHelper.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,EAAE,GAAG,EAAqC,MAAM,aAAa,CAAC;AAGrE;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAChC;;OAEG;IACI,MAAM,CAAU,UAAU,GAAW,sBAAsB,CAAC;IAEnE;;;;;;;OAOG;IACI,MAAM,CAAC,KAAK,CAAC,SAAS,CAC5B,cAA+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AAiB,CAAC,oBAAoB,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;QAClF,CAAC;QAED,OAAO,GAAG,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC3C,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,YAAY,CAAC,GAAG,QAAkB;QAC/C,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Guards, UnauthorizedError } from \"@3sixty/core\";\n\nimport { Jwt, type IJwtHeader, type IJwtPayload } from \"@3sixty/web\";\nimport type { IVaultConnector } from \"../models/IVaultConnector.js\";\n\n/**\n * Helpers for vault connectors.\n */\nexport class VaultConnectorHelper {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = \"VaultConnectorHelper\";\n\n\t/**\n\t * Sign a JWT using vault connector.\n\t * @param vaultConnector The vault connector to use.\n\t * @param keyName The name of the key to sign with.\n\t * @param header The header to sign.\n\t * @param payload The payload to sign.\n\t * @returns The token.\n\t */\n\tpublic static async jwtSigner(\n\t\tvaultConnector: IVaultConnector,\n\t\tkeyName: string,\n\t\theader: IJwtHeader,\n\t\tpayload: IJwtPayload\n\t): Promise<string> {\n\t\tGuards.object<IVaultConnector>(\n\t\t\tVaultConnectorHelper.CLASS_NAME,\n\t\t\t\"vaultConnector\",\n\t\t\tvaultConnector\n\t\t);\n\t\tGuards.stringValue(VaultConnectorHelper.CLASS_NAME, \"keyName\", keyName);\n\t\tGuards.object(VaultConnectorHelper.CLASS_NAME, \"header\", header);\n\t\tGuards.object(VaultConnectorHelper.CLASS_NAME, \"payload\", payload);\n\n\t\tconst signingBytes = Jwt.toSigningBytes(header, payload);\n\t\tconst signatureBytes = await vaultConnector.sign(keyName, signingBytes);\n\t\treturn Jwt.tokenFromBytes(signingBytes, signatureBytes);\n\t}\n\n\t/**\n\t * Verify a JWT using a vault connector.\n\t * @param vaultConnector The vault connector to use.\n\t * @param keyName The name of the key to verify with.\n\t * @param token The token to verify.\n\t * @returns The header and payload if verification successful.\n\t */\n\tpublic static async jwtVerifier<T extends IJwtHeader, U extends IJwtPayload>(\n\t\tvaultConnector: IVaultConnector,\n\t\tkeyName: string,\n\t\ttoken: string\n\t): Promise<{\n\t\theader: T;\n\t\tpayload: U;\n\t}> {\n\t\tGuards.object<IVaultConnector>(\n\t\t\tVaultConnectorHelper.CLASS_NAME,\n\t\t\t\"vaultConnector\",\n\t\t\tvaultConnector\n\t\t);\n\t\tGuards.stringValue(VaultConnectorHelper.CLASS_NAME, \"keyName\", keyName);\n\t\tGuards.stringValue(VaultConnectorHelper.CLASS_NAME, \"token\", token);\n\n\t\tconst { signingBytes, signature } = Jwt.tokenToBytes(token);\n\n\t\tconst verified = await vaultConnector.verify(keyName, signingBytes, signature);\n\t\tif (!verified) {\n\t\t\tthrow new UnauthorizedError(VaultConnectorHelper.CLASS_NAME, \"invalidSignature\");\n\t\t}\n\n\t\treturn Jwt.fromSigningBytes(signingBytes);\n\t}\n\n\t/**\n\t * Build a key name from parts.\n\t * @param keyParts The parts of the key.\n\t * @returns The constructed key name.\n\t */\n\tpublic static buildKeyName(...keyParts: string[]): string {\n\t\treturn keyParts.join(\"/\");\n\t}\n}\n"]}
|
package/docs/changelog.md
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.20.0-next.2](https://github.com/3sixtyglobal/vault/compare/vault-models-v0.20.0-next.1...vault-models-v0.20.0-next.2) (2026-10-26)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* release to next [skip ci] ([#11](https://github.com/3sixtyglobal/vault/issues/11)) ([ac3d481](https://github.com/3sixtyglobal/vault/commit/ac3d4819869724df40e2e9a8d68e28a20353525b))
|
|
9
|
+
|
|
10
|
+
## [0.20.0-next.1](https://github.com/3sixtyglobal/vault/compare/vault-models-v0.20.0-next.0...vault-models-v0.20.0-next.1) (2026-10-23)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* publish packages under the [@3sixty](https://github.com/3sixty) namespace ([a32b1e0](https://github.com/3sixtyglobal/vault/commit/a32b1e0dfc861076908bb8c9532f37f24cbc6baf))
|
|
16
|
+
* updated ts compile ([77b7687](https://github.com/3sixtyglobal/vault/commit/77b76879092f9be9408b43e3136a29e69f14972c))
|
|
@@ -344,7 +344,7 @@ Store a secret in the vault.
|
|
|
344
344
|
|
|
345
345
|
#### Type Parameters
|
|
346
346
|
|
|
347
|
-
##### T
|
|
347
|
+
##### T {#t}
|
|
348
348
|
|
|
349
349
|
`T`
|
|
350
350
|
|
|
@@ -400,7 +400,7 @@ Get a secret from the vault.
|
|
|
400
400
|
|
|
401
401
|
#### Type Parameters
|
|
402
402
|
|
|
403
|
-
##### T
|
|
403
|
+
##### T {#t-1}
|
|
404
404
|
|
|
405
405
|
`T`
|
|
406
406
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@3sixty/vault-models",
|
|
3
|
-
"version": "0.20.0-next.
|
|
3
|
+
"version": "0.20.0-next.2",
|
|
4
4
|
"description": "Shared models and factory utilities for consistent vault connector integration",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"license": "Apache-2.0",
|
|
12
12
|
"type": "module",
|
|
13
13
|
"engines": {
|
|
14
|
-
"node": ">=24.0.0"
|
|
14
|
+
"node": ">=24.0.0",
|
|
15
|
+
"bun": ">=1.4.4"
|
|
15
16
|
},
|
|
16
17
|
"dependencies": {
|
|
17
18
|
"@3sixty/core": "next",
|