@lindorm/oct 0.1.8 → 0.2.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 +16 -0
- package/dist/classes/OctKit.d.ts +7 -5
- package/dist/classes/OctKit.d.ts.map +1 -1
- package/dist/classes/OctKit.js +8 -6
- package/dist/classes/OctKit.js.map +1 -1
- package/dist/types/oct-kit.d.ts +6 -7
- package/dist/types/oct-kit.d.ts.map +1 -1
- package/dist/utils/private/assert-key-size.d.ts.map +1 -1
- package/dist/utils/private/get-key.d.ts.map +1 -1
- package/dist/utils/private/map-algorithm.d.ts.map +1 -1
- package/dist/utils/private/oct-signature.d.ts +2 -2
- package/dist/utils/private/oct-signature.d.ts.map +1 -1
- package/dist/utils/private/oct-signature.js +4 -3
- package/dist/utils/private/oct-signature.js.map +1 -1
- package/package.json +9 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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
|
+
## [0.2.1](https://github.com/lindorm-io/monorepo/compare/@lindorm/oct@0.2.0...@lindorm/oct@0.2.1) (2025-07-02)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @lindorm/oct
|
|
9
|
+
|
|
10
|
+
# [0.2.0](https://github.com/lindorm-io/monorepo/compare/@lindorm/oct@0.1.8...@lindorm/oct@0.2.0) (2025-06-17)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- add and implement keykit interface ([70762aa](https://github.com/lindorm-io/monorepo/commit/70762aaca51c9fe904121b69b4bc072cdd89c8a2))
|
|
15
|
+
- align with changes to kryptos ([74bbfff](https://github.com/lindorm-io/monorepo/commit/74bbfff6fb50504dc70327f7de3fd6d4b45cb65a))
|
|
16
|
+
- align with kryptos changes ([206eb38](https://github.com/lindorm-io/monorepo/commit/206eb38ae2a03b14973e706035c87a953cc753af))
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
- upgrade key kits ([198956c](https://github.com/lindorm-io/monorepo/commit/198956c5fa276ae192af22cb204b3c2158c74339))
|
|
21
|
+
|
|
6
22
|
## [0.1.8](https://github.com/lindorm-io/monorepo/compare/@lindorm/oct@0.1.7...@lindorm/oct@0.1.8) (2025-01-28)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @lindorm/oct
|
package/dist/classes/OctKit.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { IKeyKit, KeyData } from "@lindorm/types";
|
|
1
2
|
import { OctKitOptions } from "../types";
|
|
2
|
-
export declare class OctKit {
|
|
3
|
-
private readonly
|
|
3
|
+
export declare class OctKit implements IKeyKit {
|
|
4
|
+
private readonly encoding;
|
|
4
5
|
private readonly kryptos;
|
|
5
6
|
constructor(options: OctKitOptions);
|
|
6
|
-
sign(data:
|
|
7
|
-
verify(data:
|
|
8
|
-
assert(data:
|
|
7
|
+
sign(data: KeyData): Buffer;
|
|
8
|
+
verify(data: KeyData, signature: KeyData): boolean;
|
|
9
|
+
assert(data: KeyData, signature: KeyData): void;
|
|
10
|
+
format(data: Buffer): string;
|
|
9
11
|
}
|
|
10
12
|
//# sourceMappingURL=OctKit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OctKit.d.ts","sourceRoot":"","sources":["../../src/classes/OctKit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OctKit.d.ts","sourceRoot":"","sources":["../../src/classes/OctKit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAOzC,qBAAa,MAAO,YAAW,OAAO;IACpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;IAC1C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;gBAEnB,OAAO,EAAE,aAAa;IAUlC,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM;IAO3B,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO;IASlD,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI;IAS/C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAGpC"}
|
package/dist/classes/OctKit.js
CHANGED
|
@@ -5,11 +5,11 @@ const kryptos_1 = require("@lindorm/kryptos");
|
|
|
5
5
|
const errors_1 = require("../errors");
|
|
6
6
|
const private_1 = require("../utils/private");
|
|
7
7
|
class OctKit {
|
|
8
|
-
|
|
8
|
+
encoding;
|
|
9
9
|
kryptos;
|
|
10
10
|
constructor(options) {
|
|
11
|
-
this.
|
|
12
|
-
if (!kryptos_1.
|
|
11
|
+
this.encoding = options.encoding ?? "base64";
|
|
12
|
+
if (!kryptos_1.KryptosKit.isOct(options.kryptos)) {
|
|
13
13
|
throw new errors_1.OctError("Invalid Kryptos instance");
|
|
14
14
|
}
|
|
15
15
|
this.kryptos = options.kryptos;
|
|
@@ -17,14 +17,13 @@ class OctKit {
|
|
|
17
17
|
sign(data) {
|
|
18
18
|
return (0, private_1.createOctSignature)({
|
|
19
19
|
data,
|
|
20
|
-
format: this.format,
|
|
21
20
|
kryptos: this.kryptos,
|
|
22
21
|
});
|
|
23
22
|
}
|
|
24
23
|
verify(data, signature) {
|
|
25
24
|
return (0, private_1.verifyOctSignature)({
|
|
26
25
|
data,
|
|
27
|
-
|
|
26
|
+
encoding: this.encoding,
|
|
28
27
|
kryptos: this.kryptos,
|
|
29
28
|
signature,
|
|
30
29
|
});
|
|
@@ -32,11 +31,14 @@ class OctKit {
|
|
|
32
31
|
assert(data, signature) {
|
|
33
32
|
return (0, private_1.assertOctSignature)({
|
|
34
33
|
data,
|
|
35
|
-
|
|
34
|
+
encoding: this.encoding,
|
|
36
35
|
kryptos: this.kryptos,
|
|
37
36
|
signature,
|
|
38
37
|
});
|
|
39
38
|
}
|
|
39
|
+
format(data) {
|
|
40
|
+
return data.toString(this.encoding);
|
|
41
|
+
}
|
|
40
42
|
}
|
|
41
43
|
exports.OctKit = OctKit;
|
|
42
44
|
//# sourceMappingURL=OctKit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OctKit.js","sourceRoot":"","sources":["../../src/classes/OctKit.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"OctKit.js","sourceRoot":"","sources":["../../src/classes/OctKit.ts"],"names":[],"mappings":";;;AAAA,8CAA2D;AAE3D,sCAAqC;AAErC,8CAI0B;AAE1B,MAAa,MAAM;IACA,QAAQ,CAAiB;IACzB,OAAO,CAAc;IAEtC,YAAmB,OAAsB;QACvC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,QAAQ,CAAC;QAE7C,IAAI,CAAC,oBAAU,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACvC,MAAM,IAAI,iBAAQ,CAAC,0BAA0B,CAAC,CAAC;QACjD,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACjC,CAAC;IAEM,IAAI,CAAC,IAAa;QACvB,OAAO,IAAA,4BAAkB,EAAC;YACxB,IAAI;YACJ,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAC;IACL,CAAC;IAEM,MAAM,CAAC,IAAa,EAAE,SAAkB;QAC7C,OAAO,IAAA,4BAAkB,EAAC;YACxB,IAAI;YACJ,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS;SACV,CAAC,CAAC;IACL,CAAC;IAEM,MAAM,CAAC,IAAa,EAAE,SAAkB;QAC7C,OAAO,IAAA,4BAAkB,EAAC;YACxB,IAAI;YACJ,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,SAAS;SACV,CAAC,CAAC;IACL,CAAC;IAEM,MAAM,CAAC,IAAY;QACxB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;CACF;AA1CD,wBA0CC"}
|
package/dist/types/oct-kit.d.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { IKryptos, IKryptosOct } from "@lindorm/kryptos";
|
|
2
|
-
import {
|
|
2
|
+
import { KeyData } from "@lindorm/types";
|
|
3
3
|
export type CreateOctSignatureOptions = {
|
|
4
|
-
data:
|
|
5
|
-
format: BufferFormat;
|
|
4
|
+
data: KeyData;
|
|
6
5
|
kryptos: IKryptosOct;
|
|
7
6
|
};
|
|
8
7
|
export type VerifyOctSignatureOptions = {
|
|
9
|
-
data:
|
|
10
|
-
|
|
8
|
+
data: KeyData;
|
|
9
|
+
encoding: BufferEncoding;
|
|
11
10
|
kryptos: IKryptosOct;
|
|
12
|
-
signature:
|
|
11
|
+
signature: KeyData;
|
|
13
12
|
};
|
|
14
13
|
export type OctKitOptions = {
|
|
15
|
-
|
|
14
|
+
encoding?: BufferEncoding;
|
|
16
15
|
kryptos: IKryptos;
|
|
17
16
|
};
|
|
18
17
|
//# sourceMappingURL=oct-kit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oct-kit.d.ts","sourceRoot":"","sources":["../../src/types/oct-kit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"oct-kit.d.ts","sourceRoot":"","sources":["../../src/types/oct-kit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,OAAO,EAAE,QAAQ,CAAC;CACnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert-key-size.d.ts","sourceRoot":"","sources":["../../../src/utils/private/assert-key-size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"assert-key-size.d.ts","sourceRoot":"","sources":["../../../src/utils/private/assert-key-size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,aAAa,GAAI,WAAW,YAAY,EAAE,YAAY,MAAM,KAAG,IAiB3E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-key.d.ts","sourceRoot":"","sources":["../../../src/utils/private/get-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"get-key.d.ts","sourceRoot":"","sources":["../../../src/utils/private/get-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG/C,eAAO,MAAM,aAAa,GAAI,SAAS,WAAW,KAAG,MAQpD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-algorithm.d.ts","sourceRoot":"","sources":["../../../src/utils/private/map-algorithm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"map-algorithm.d.ts","sourceRoot":"","sources":["../../../src/utils/private/map-algorithm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,eAAe,GAAI,SAAS,WAAW,KAAG,YAMtD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CreateOctSignatureOptions, VerifyOctSignatureOptions } from "../../types";
|
|
2
|
-
export declare const createOctSignature: ({ data,
|
|
3
|
-
export declare const verifyOctSignature: ({ data,
|
|
2
|
+
export declare const createOctSignature: ({ data, kryptos, }: CreateOctSignatureOptions) => Buffer;
|
|
3
|
+
export declare const verifyOctSignature: ({ data, encoding, kryptos, signature, }: VerifyOctSignatureOptions) => boolean;
|
|
4
4
|
export declare const assertOctSignature: (options: VerifyOctSignatureOptions) => void;
|
|
5
5
|
//# sourceMappingURL=oct-signature.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oct-signature.d.ts","sourceRoot":"","sources":["../../../src/utils/private/oct-signature.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oct-signature.d.ts","sourceRoot":"","sources":["../../../src/utils/private/oct-signature.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAKnF,eAAO,MAAM,kBAAkB,GAAI,oBAGhC,yBAAyB,KAAG,MAO9B,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,yCAKhC,yBAAyB,KAAG,OAG5B,CAAC;AAEJ,eAAO,MAAM,kBAAkB,GAAI,SAAS,yBAAyB,KAAG,IAGvE,CAAC"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.assertOctSignature = exports.verifyOctSignature = exports.createOctSignature = void 0;
|
|
4
|
+
const is_1 = require("@lindorm/is");
|
|
4
5
|
const crypto_1 = require("crypto");
|
|
5
6
|
const errors_1 = require("../../errors");
|
|
6
7
|
const assert_key_size_1 = require("./assert-key-size");
|
|
7
8
|
const get_key_1 = require("./get-key");
|
|
8
9
|
const map_algorithm_1 = require("./map-algorithm");
|
|
9
|
-
const createOctSignature = ({ data,
|
|
10
|
+
const createOctSignature = ({ data, kryptos, }) => {
|
|
10
11
|
const algorithm = (0, map_algorithm_1.mapOctAlgorithm)(kryptos);
|
|
11
12
|
const privateKey = (0, get_key_1.getPrivateKey)(kryptos);
|
|
12
13
|
(0, assert_key_size_1.assertKeySize)(algorithm, privateKey);
|
|
13
|
-
return (0, crypto_1.createHmac)(algorithm, privateKey).update(data).digest(
|
|
14
|
+
return (0, crypto_1.createHmac)(algorithm, privateKey).update(data).digest();
|
|
14
15
|
};
|
|
15
16
|
exports.createOctSignature = createOctSignature;
|
|
16
|
-
const verifyOctSignature = ({ data,
|
|
17
|
+
const verifyOctSignature = ({ data, encoding, kryptos, signature, }) => (0, exports.createOctSignature)({ data, kryptos }).equals((0, is_1.isString)(signature) ? Buffer.from(signature, encoding) : signature);
|
|
17
18
|
exports.verifyOctSignature = verifyOctSignature;
|
|
18
19
|
const assertOctSignature = (options) => {
|
|
19
20
|
if ((0, exports.verifyOctSignature)(options))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oct-signature.js","sourceRoot":"","sources":["../../../src/utils/private/oct-signature.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;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QAAA,kBAAkB,sBAG7B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lindorm/oct",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"license": "AGPL-3.0-or-later",
|
|
5
5
|
"author": "Jonn Nilsson",
|
|
6
6
|
"repository": {
|
|
@@ -18,20 +18,23 @@
|
|
|
18
18
|
"example": "ts-node example",
|
|
19
19
|
"integration": "compd --file docker-compose.yml jest --config jest.config.integration.js --watch",
|
|
20
20
|
"integration:focus": "compd --file docker-compose.yml jest --config jest.config.integration.js --watch $1",
|
|
21
|
+
"prettier": "prettier --write ./src/*",
|
|
21
22
|
"test": "jest --watch --",
|
|
22
23
|
"test:ci": "npm run test:unit",
|
|
23
24
|
"test:integration": "jest --config jest.config.integration.js --",
|
|
24
25
|
"test:unit": "jest --config jest.config.js --",
|
|
25
26
|
"typecheck": "tsc --watch",
|
|
26
27
|
"typecheck:ci": "tsc",
|
|
27
|
-
"update": "ncu -
|
|
28
|
+
"update": "ncu -i",
|
|
29
|
+
"update:auto": "ncu -u"
|
|
28
30
|
},
|
|
29
31
|
"dependencies": {
|
|
30
|
-
"@lindorm/errors": "^0.1.
|
|
31
|
-
"@lindorm/
|
|
32
|
+
"@lindorm/errors": "^0.1.9",
|
|
33
|
+
"@lindorm/is": "^0.1.8",
|
|
34
|
+
"@lindorm/kryptos": "^0.4.1"
|
|
32
35
|
},
|
|
33
36
|
"devDependencies": {
|
|
34
|
-
"@lindorm/types": "^0.
|
|
37
|
+
"@lindorm/types": "^0.3.0"
|
|
35
38
|
},
|
|
36
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "e66150efb6d7a4688bcece59481ab98d54865af3"
|
|
37
40
|
}
|