@ac-kit/crypto-mac 0.1.4 → 0.2.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/CHANGELOG.md +53 -0
- package/README.md +11 -4
- package/dist/hmac-core.d.ts +38 -15
- package/dist/hmac-core.d.ts.map +1 -1
- package/dist/hmac-core.js +11 -16
- package/dist/hmac-core.js.map +1 -1
- package/dist/hmac-md5.js +1 -1
- package/dist/hmac-md5.js.map +1 -1
- package/dist/hmac-sha1.js +1 -1
- package/dist/hmac-sha1.js.map +1 -1
- package/dist/hmac-sha224.js +1 -1
- package/dist/hmac-sha224.js.map +1 -1
- package/dist/hmac-sha256.d.ts.map +1 -1
- package/dist/hmac-sha256.js +6 -1
- package/dist/hmac-sha256.js.map +1 -1
- package/dist/hmac-sha384.d.ts.map +1 -1
- package/dist/hmac-sha384.js +6 -1
- package/dist/hmac-sha384.js.map +1 -1
- package/dist/hmac-sha512.d.ts.map +1 -1
- package/dist/hmac-sha512.js +6 -1
- package/dist/hmac-sha512.js.map +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,58 @@
|
|
|
1
1
|
# @ac-kit/crypto-mac
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7f9f15d: Argument shapes follow one rule: required arguments are positional, `options`
|
|
8
|
+
is optional with every field optional, and five or more parameters become one
|
|
9
|
+
`input` object.
|
|
10
|
+
|
|
11
|
+
- `core`: `truncateCore(input: TruncateCoreInput)` takes `atoms`, `measure`
|
|
12
|
+
and `maxMeasure`; `input.options` (`TruncateCoreOptions`) takes the
|
|
13
|
+
`TruncateOptions` fields with their defaults, plus `ellipsisMeasure`
|
|
14
|
+
(default `measure(ellipsisString)`).
|
|
15
|
+
- `node`: `new ProcessExitWithOutputError(input)` takes
|
|
16
|
+
`{ code, signal, killed, stdout, stderr, options? }`.
|
|
17
|
+
- `async`: `staggeredRace(candidates, attempt, options?)`; `delayMs` defaults
|
|
18
|
+
to 250, RFC 8305's Connection Attempt Delay.
|
|
19
|
+
- `crypto-mac`: `hmac({ hash, blockSizeBytes, key, message, options? })` with
|
|
20
|
+
`options.tagLengthBytes`, and
|
|
21
|
+
`hmacVerify({ hash, blockSizeBytes, key, message, tag })`.
|
|
22
|
+
- `math-grid`: `dfsPackGrid2(items, columnCount, classify, options?)`, with the
|
|
23
|
+
new `GridPackClassifier` type; `findFrontierTilings(input)` takes
|
|
24
|
+
`{ grid, items, getSize, getDedupeKey, getMoveScore, options? }`.
|
|
25
|
+
- `net-address`: `printEui(address, options?)` and
|
|
26
|
+
`printEuiOui(address, options?)` default to the IEEE Std 802 canonical
|
|
27
|
+
spelling: `notation` `"hyphen"`, `letterCase` `"upper"`.
|
|
28
|
+
- `format-monospace`: `renderTableRow(input)` takes
|
|
29
|
+
`{ row, rowIndex, columns, layout, options? }`.
|
|
30
|
+
- `format-asn1`: `module(name, types, options?)`; `ModuleOptions` no longer
|
|
31
|
+
holds `name`.
|
|
32
|
+
- `app-config`: `resolveExtendableConfig(input)` takes
|
|
33
|
+
`{ configData, configPath, configParser, configId, options? }`.
|
|
34
|
+
- `@ac-bench/core`: `new Sampler(policy, bounds, options?)`;
|
|
35
|
+
`runForkUnit(input)` takes `{ unit, signal, sink, file, parentScopeId,
|
|
36
|
+
options? }`; `runCaseOnce(input)` takes
|
|
37
|
+
`{ unit, caseTitle, signal, file, options? }`, with `options.measureOptions`
|
|
38
|
+
defaulting to `{}`.
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Updated dependencies [7f9f15d]
|
|
43
|
+
- @ac-kit/core@0.7.0
|
|
44
|
+
- @ac-kit/crypto-hash@0.1.6
|
|
45
|
+
- @ac-kit/crypto-safe@0.1.6
|
|
46
|
+
|
|
47
|
+
## 0.1.5
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- Updated dependencies [47e39a2]
|
|
52
|
+
- @ac-kit/core@0.6.0
|
|
53
|
+
- @ac-kit/crypto-hash@0.1.5
|
|
54
|
+
- @ac-kit/crypto-safe@0.1.5
|
|
55
|
+
|
|
3
56
|
## 0.1.4
|
|
4
57
|
|
|
5
58
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -16,7 +16,13 @@ const key = new TextEncoder().encode("shared secret");
|
|
|
16
16
|
const message = new TextEncoder().encode("transfer 100 to alice");
|
|
17
17
|
|
|
18
18
|
const tag = hmacSha256Ts(key, message);
|
|
19
|
-
const authentic = hmacVerify(
|
|
19
|
+
const authentic = hmacVerify({
|
|
20
|
+
hash: sha256Ts,
|
|
21
|
+
blockSizeBytes: 64,
|
|
22
|
+
key,
|
|
23
|
+
message,
|
|
24
|
+
tag,
|
|
25
|
+
});
|
|
20
26
|
```
|
|
21
27
|
|
|
22
28
|
`hmacVerify` compares in constant time, so a wrong tag takes as long to reject
|
|
@@ -24,9 +30,10 @@ as a right one — never compare tags with `===`.
|
|
|
24
30
|
|
|
25
31
|
## What it exposes
|
|
26
32
|
|
|
27
|
-
- `hmac(hash, blockSizeBytes, key, message,
|
|
28
|
-
RFC 2104 construction over any hash function.
|
|
29
|
-
|
|
33
|
+
- `hmac({ hash, blockSizeBytes, key, message, options? })` — the generic
|
|
34
|
+
RFC 2104 construction over any hash function; `options.tagLengthBytes`
|
|
35
|
+
truncates the tag.
|
|
36
|
+
- `hmacVerify({ hash, blockSizeBytes, key, message, tag })` — constant-time
|
|
30
37
|
comparison against a freshly computed tag.
|
|
31
38
|
- Named wrappers binding one hash each: `hmacMd5`, `hmacSha1`, `hmacSha224`,
|
|
32
39
|
`hmacSha256`, `hmacSha384`, `hmacSha512`.
|
package/dist/hmac-core.d.ts
CHANGED
|
@@ -1,21 +1,44 @@
|
|
|
1
|
+
/** Optional part of {@link HmacInput}. */
|
|
2
|
+
export type HmacOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Truncates the returned tag to this many bytes (RFC 2104 §5). Default: the
|
|
5
|
+
* full untruncated output.
|
|
6
|
+
*/
|
|
7
|
+
readonly tagLengthBytes?: number;
|
|
8
|
+
};
|
|
9
|
+
/** Input of {@link hmac}. */
|
|
10
|
+
export type HmacInput<THashReturnArrayBuffer extends ArrayBufferLike> = {
|
|
11
|
+
/**
|
|
12
|
+
* A one-shot, synchronous hash function — the TS kernel of whichever
|
|
13
|
+
* algorithm the caller has chosen (e.g. `sha256Ts`), never the
|
|
14
|
+
* Web-Crypto-preferring dual kernel, since that one's `Promise`-returning
|
|
15
|
+
* shape doesn't fit HMAC's handful of nested synchronous calls.
|
|
16
|
+
*/
|
|
17
|
+
readonly hash: (data: Uint8Array) => Uint8Array<THashReturnArrayBuffer>;
|
|
18
|
+
/**
|
|
19
|
+
* `hash`'s compression function's block size — 64 for
|
|
20
|
+
* MD5/SHA-1/SHA-224/SHA-256, 128 for SHA-384/SHA-512.
|
|
21
|
+
*/
|
|
22
|
+
readonly blockSizeBytes: number;
|
|
23
|
+
readonly key: Uint8Array;
|
|
24
|
+
readonly message: Uint8Array;
|
|
25
|
+
readonly options?: HmacOptions;
|
|
26
|
+
};
|
|
27
|
+
/** Input of {@link hmacVerify}. */
|
|
28
|
+
export type HmacVerifyInput = Omit<HmacInput<ArrayBufferLike>, "options"> & {
|
|
29
|
+
/** The tag to check, possibly truncated (RFC 2104 §5). */
|
|
30
|
+
readonly tag: Uint8Array;
|
|
31
|
+
};
|
|
1
32
|
/**
|
|
2
33
|
* HMAC (RFC 2104 / FIPS 198-1): a keyed-hash message authentication code built
|
|
3
34
|
* from any hash function and its compression function's block size — both
|
|
4
|
-
* supplied explicitly by the caller (e.g. `hmac(
|
|
5
|
-
*
|
|
6
|
-
* (`merkleDamgardPad`)
|
|
7
|
-
* algorithm
|
|
8
|
-
*
|
|
9
|
-
* @param hash A one-shot, synchronous hash function — the TS kernel of
|
|
10
|
-
* whichever algorithm the caller has chosen (e.g. `sha256Ts`), never the
|
|
11
|
-
* Web-Crypto-preferring dual kernel, since that one's `Promise`-returning
|
|
12
|
-
* shape doesn't fit HMAC's handful of nested synchronous calls.
|
|
13
|
-
* @param blockSizeBytes `hash`'s compression function's block size — 64 for
|
|
14
|
-
* MD5/SHA-1/SHA-224/SHA-256, 128 for SHA-384/SHA-512.
|
|
15
|
-
* @param tagLengthBytes Truncates the returned tag to this many bytes (RFC 2104
|
|
16
|
-
* §5). Defaults to the full untruncated output.
|
|
35
|
+
* supplied explicitly by the caller (e.g. `hmac({ hash: sha256Ts,
|
|
36
|
+
* blockSizeBytes: 64, key, message })`), matching every other
|
|
37
|
+
* block-size-parametrized primitive in `crypto/hash` (`merkleDamgardPad`)
|
|
38
|
+
* rather than a hash-algorithm registry; the caller owns algorithm
|
|
39
|
+
* specificities.
|
|
17
40
|
*/
|
|
18
|
-
export declare function hmac<THashReturnArrayBuffer extends ArrayBufferLike>(
|
|
41
|
+
export declare function hmac<THashReturnArrayBuffer extends ArrayBufferLike>(input: HmacInput<THashReturnArrayBuffer>): Uint8Array<THashReturnArrayBuffer>;
|
|
19
42
|
/**
|
|
20
43
|
* Verifies `tag` against a freshly computed HMAC, comparing in constant time
|
|
21
44
|
* via `@ac-kit/crypto-safe`'s `constantTimeBytesIsEqual`. Unlike
|
|
@@ -25,5 +48,5 @@ export declare function hmac<THashReturnArrayBuffer extends ArrayBufferLike>(has
|
|
|
25
48
|
* this boundary, e.g. a modified or truncated tag from a Wycheproof `"invalid"`
|
|
26
49
|
* test vector) and simply fails verification rather than throwing.
|
|
27
50
|
*/
|
|
28
|
-
export declare function hmacVerify(
|
|
51
|
+
export declare function hmacVerify(input: HmacVerifyInput): boolean;
|
|
29
52
|
//# sourceMappingURL=hmac-core.d.ts.map
|
package/dist/hmac-core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmac-core.d.ts","sourceRoot":"","sources":["../src/hmac-core.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"hmac-core.d.ts","sourceRoot":"","sources":["../src/hmac-core.ts"],"names":[],"mappings":"AAGA,0CAA0C;AAC1C,MAAM,MAAM,WAAW,GAAG;IACzB;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF,6BAA6B;AAC7B,MAAM,MAAM,SAAS,CAAC,sBAAsB,SAAS,eAAe,IAAI;IACvE;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,UAAU,CAAC,sBAAsB,CAAC,CAAC;IAExE;;;OAGG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAEhC,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC;CAC/B,CAAC;AAEF,mCAAmC;AACnC,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE,SAAS,CAAC,GAAG;IAC3E,0DAA0D;IAC1D,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAAC,sBAAsB,SAAS,eAAe,EAClE,KAAK,EAAE,SAAS,CAAC,sBAAsB,CAAC,GACtC,UAAU,CAAC,sBAAsB,CAAC,CAkBpC;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAO1D"}
|
package/dist/hmac-core.js
CHANGED
|
@@ -3,21 +3,15 @@ import { constantTimeBytesIsEqual } from "@ac-kit/crypto-safe";
|
|
|
3
3
|
/**
|
|
4
4
|
* HMAC (RFC 2104 / FIPS 198-1): a keyed-hash message authentication code built
|
|
5
5
|
* from any hash function and its compression function's block size — both
|
|
6
|
-
* supplied explicitly by the caller (e.g. `hmac(
|
|
7
|
-
*
|
|
8
|
-
* (`merkleDamgardPad`)
|
|
9
|
-
* algorithm
|
|
10
|
-
*
|
|
11
|
-
* @param hash A one-shot, synchronous hash function — the TS kernel of
|
|
12
|
-
* whichever algorithm the caller has chosen (e.g. `sha256Ts`), never the
|
|
13
|
-
* Web-Crypto-preferring dual kernel, since that one's `Promise`-returning
|
|
14
|
-
* shape doesn't fit HMAC's handful of nested synchronous calls.
|
|
15
|
-
* @param blockSizeBytes `hash`'s compression function's block size — 64 for
|
|
16
|
-
* MD5/SHA-1/SHA-224/SHA-256, 128 for SHA-384/SHA-512.
|
|
17
|
-
* @param tagLengthBytes Truncates the returned tag to this many bytes (RFC 2104
|
|
18
|
-
* §5). Defaults to the full untruncated output.
|
|
6
|
+
* supplied explicitly by the caller (e.g. `hmac({ hash: sha256Ts,
|
|
7
|
+
* blockSizeBytes: 64, key, message })`), matching every other
|
|
8
|
+
* block-size-parametrized primitive in `crypto/hash` (`merkleDamgardPad`)
|
|
9
|
+
* rather than a hash-algorithm registry; the caller owns algorithm
|
|
10
|
+
* specificities.
|
|
19
11
|
*/
|
|
20
|
-
export function hmac(
|
|
12
|
+
export function hmac(input) {
|
|
13
|
+
const { hash, blockSizeBytes, key, message, options } = input;
|
|
14
|
+
const tagLengthBytes = options?.tagLengthBytes;
|
|
21
15
|
const blockSizedKey = deriveBlockSizedKey_(hash, blockSizeBytes, key);
|
|
22
16
|
const ipad = new Uint8Array(blockSizeBytes);
|
|
23
17
|
const opad = new Uint8Array(blockSizeBytes);
|
|
@@ -39,8 +33,9 @@ export function hmac(hash, blockSizeBytes, key, message, tagLengthBytes) {
|
|
|
39
33
|
* this boundary, e.g. a modified or truncated tag from a Wycheproof `"invalid"`
|
|
40
34
|
* test vector) and simply fails verification rather than throwing.
|
|
41
35
|
*/
|
|
42
|
-
export function hmacVerify(
|
|
43
|
-
const
|
|
36
|
+
export function hmacVerify(input) {
|
|
37
|
+
const { tag, ...rest } = input;
|
|
38
|
+
const expected = hmac({ ...rest, options: { tagLengthBytes: tag.length } });
|
|
44
39
|
return (expected.length === tag.length && constantTimeBytesIsEqual(expected, tag));
|
|
45
40
|
}
|
|
46
41
|
/**
|
package/dist/hmac-core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmac-core.js","sourceRoot":"","sources":["../src/hmac-core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"hmac-core.js","sourceRoot":"","sources":["../src/hmac-core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAsC/D;;;;;;;;GAQG;AACH,MAAM,UAAU,IAAI,CACnB,KAAwC;IAExC,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAC9D,MAAM,cAAc,GAAG,OAAO,EAAE,cAAc,CAAC;IAC/C,MAAM,aAAa,GAAG,oBAAoB,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,CAAC,CAAC;IAEtE,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,cAAc,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,cAAc,CAAC,CAAC;IAE5C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,cAAc,EAAE,KAAK,EAAE,EAAE,CAAC;QACrD,MAAM,OAAO,GAAG,aAAa,CAAC,KAAK,CAAE,CAAC;QACtC,IAAI,CAAC,KAAK,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,KAAK,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC;IAC9B,CAAC;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IACrD,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;IAEjD,OAAO,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;AAC7E,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CAAC,KAAsB;IAChD,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAE5E,OAAO,CACN,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,IAAI,wBAAwB,CAAC,QAAQ,EAAE,GAAG,CAAC,CACzE,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAS,oBAAoB,CAC5B,IAAsC,EACtC,cAAsB,EACtB,GAAe;IAEf,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAE9D,IAAI,OAAO,CAAC,MAAM,KAAK,cAAc,EAAE,CAAC;QACvC,OAAO,OAAO,CAAC;IAChB,CAAC;IAED,MAAM,aAAa,GAAG,IAAI,UAAU,CAAC,cAAc,CAAC,CAAC;IACrD,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAE3B,OAAO,aAAa,CAAC;AACtB,CAAC"}
|
package/dist/hmac-md5.js
CHANGED
|
@@ -7,6 +7,6 @@ const BLOCK_SIZE_BYTES = 64;
|
|
|
7
7
|
* down. No Web Crypto kernel, matching `md5` itself.
|
|
8
8
|
*/
|
|
9
9
|
export function hmacMd5(key, message) {
|
|
10
|
-
return hmac(md5, BLOCK_SIZE_BYTES, key, message);
|
|
10
|
+
return hmac({ hash: md5, blockSizeBytes: BLOCK_SIZE_BYTES, key, message });
|
|
11
11
|
}
|
|
12
12
|
//# sourceMappingURL=hmac-md5.js.map
|
package/dist/hmac-md5.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmac-md5.js","sourceRoot":"","sources":["../src/hmac-md5.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,GAAe,EAAE,OAAmB;IAC3D,OAAO,IAAI,CAAC,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"hmac-md5.js","sourceRoot":"","sources":["../src/hmac-md5.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,GAAe,EAAE,OAAmB;IAC3D,OAAO,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,cAAc,EAAE,gBAAgB,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;AAC5E,CAAC"}
|
package/dist/hmac-sha1.js
CHANGED
|
@@ -3,7 +3,7 @@ import { hmac } from "./hmac-core.js";
|
|
|
3
3
|
const BLOCK_SIZE_BYTES = 64;
|
|
4
4
|
/** The TS kernel, always available — see the module doc in `index.ts`. */
|
|
5
5
|
export function hmacSha1Ts(key, message) {
|
|
6
|
-
return hmac(sha1Js, BLOCK_SIZE_BYTES, key, message);
|
|
6
|
+
return hmac({ hash: sha1Js, blockSizeBytes: BLOCK_SIZE_BYTES, key, message });
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* HMAC-SHA-1 (RFC 2104), legacy interop only. Prefers the Web Crypto kernel
|
package/dist/hmac-sha1.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmac-sha1.js","sourceRoot":"","sources":["../src/hmac-sha1.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B,0EAA0E;AAC1E,MAAM,UAAU,UAAU,CACzB,GAAe,EACf,OAAmB;IAEnB,OAAO,IAAI,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"hmac-sha1.js","sourceRoot":"","sources":["../src/hmac-sha1.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B,0EAA0E;AAC1E,MAAM,UAAU,UAAU,CACzB,GAAe,EACf,OAAmB;IAEnB,OAAO,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;AAC/E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CACvB,GAA4B,EAC5B,OAAgC;IAEhC,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACrD,OAAO,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;IAED,OAAO,MAAM,CAAC,MAAM;SAClB,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC;SACvE,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;SACnE,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;AAClD,CAAC"}
|
package/dist/hmac-sha224.js
CHANGED
|
@@ -6,6 +6,6 @@ const BLOCK_SIZE_BYTES = 64;
|
|
|
6
6
|
* engine recognises the algorithm name.
|
|
7
7
|
*/
|
|
8
8
|
export function hmacSha224(key, message) {
|
|
9
|
-
return hmac(sha224, BLOCK_SIZE_BYTES, key, message);
|
|
9
|
+
return hmac({ hash: sha224, blockSizeBytes: BLOCK_SIZE_BYTES, key, message });
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=hmac-sha224.js.map
|
package/dist/hmac-sha224.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmac-sha224.js","sourceRoot":"","sources":["../src/hmac-sha224.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,GAAe,EAAE,OAAmB;IAC9D,OAAO,IAAI,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"hmac-sha224.js","sourceRoot":"","sources":["../src/hmac-sha224.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,GAAe,EAAE,OAAmB;IAC9D,OAAO,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmac-sha256.d.ts","sourceRoot":"","sources":["../src/hmac-sha256.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAOhD,0EAA0E;AAC1E,wBAAgB,YAAY,CAC3B,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,UAAU,GACjB,UAAU,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"hmac-sha256.d.ts","sourceRoot":"","sources":["../src/hmac-sha256.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAOhD,0EAA0E;AAC1E,wBAAgB,YAAY,CAC3B,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,UAAU,GACjB,UAAU,CAAC,WAAW,CAAC,CAOzB;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CACzB,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,EAC5B,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,GAC9B,gBAAgB,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAS3C"}
|
package/dist/hmac-sha256.js
CHANGED
|
@@ -3,7 +3,12 @@ import { hmac } from "./hmac-core.js";
|
|
|
3
3
|
const BLOCK_SIZE_BYTES = 64;
|
|
4
4
|
/** The TS kernel, always available — see the module doc in `index.ts`. */
|
|
5
5
|
export function hmacSha256Ts(key, message) {
|
|
6
|
-
return hmac(
|
|
6
|
+
return hmac({
|
|
7
|
+
hash: sha256Ts,
|
|
8
|
+
blockSizeBytes: BLOCK_SIZE_BYTES,
|
|
9
|
+
key,
|
|
10
|
+
message,
|
|
11
|
+
});
|
|
7
12
|
}
|
|
8
13
|
/**
|
|
9
14
|
* HMAC-SHA-256 (RFC 2104). Prefers the Web Crypto kernel
|
package/dist/hmac-sha256.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmac-sha256.js","sourceRoot":"","sources":["../src/hmac-sha256.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B,0EAA0E;AAC1E,MAAM,UAAU,YAAY,CAC3B,GAAe,EACf,OAAmB;IAEnB,OAAO,IAAI,CAAC,QAAQ,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"hmac-sha256.js","sourceRoot":"","sources":["../src/hmac-sha256.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B,0EAA0E;AAC1E,MAAM,UAAU,YAAY,CAC3B,GAAe,EACf,OAAmB;IAEnB,OAAO,IAAI,CAAC;QACX,IAAI,EAAE,QAAQ;QACd,cAAc,EAAE,gBAAgB;QAChC,GAAG;QACH,OAAO;KACP,CAAC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CACzB,GAA4B,EAC5B,OAAgC;IAEhC,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACrD,OAAO,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,MAAM,CAAC,MAAM;SAClB,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC;SACzE,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;SACnE,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmac-sha384.d.ts","sourceRoot":"","sources":["../src/hmac-sha384.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAOhD,0EAA0E;AAC1E,wBAAgB,YAAY,CAC3B,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,UAAU,GACjB,UAAU,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"hmac-sha384.d.ts","sourceRoot":"","sources":["../src/hmac-sha384.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAOhD,0EAA0E;AAC1E,wBAAgB,YAAY,CAC3B,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,UAAU,GACjB,UAAU,CAAC,WAAW,CAAC,CAOzB;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CACzB,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,EAC5B,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,GAC9B,gBAAgB,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAS3C"}
|
package/dist/hmac-sha384.js
CHANGED
|
@@ -3,7 +3,12 @@ import { hmac } from "./hmac-core.js";
|
|
|
3
3
|
const BLOCK_SIZE_BYTES = 128;
|
|
4
4
|
/** The TS kernel, always available — see the module doc in `index.ts`. */
|
|
5
5
|
export function hmacSha384Ts(key, message) {
|
|
6
|
-
return hmac(
|
|
6
|
+
return hmac({
|
|
7
|
+
hash: sha384Ts,
|
|
8
|
+
blockSizeBytes: BLOCK_SIZE_BYTES,
|
|
9
|
+
key,
|
|
10
|
+
message,
|
|
11
|
+
});
|
|
7
12
|
}
|
|
8
13
|
/**
|
|
9
14
|
* HMAC-SHA-384 (RFC 2104). Prefers the Web Crypto kernel
|
package/dist/hmac-sha384.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmac-sha384.js","sourceRoot":"","sources":["../src/hmac-sha384.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,0EAA0E;AAC1E,MAAM,UAAU,YAAY,CAC3B,GAAe,EACf,OAAmB;IAEnB,OAAO,IAAI,CAAC,QAAQ,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"hmac-sha384.js","sourceRoot":"","sources":["../src/hmac-sha384.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,0EAA0E;AAC1E,MAAM,UAAU,YAAY,CAC3B,GAAe,EACf,OAAmB;IAEnB,OAAO,IAAI,CAAC;QACX,IAAI,EAAE,QAAQ;QACd,cAAc,EAAE,gBAAgB;QAChC,GAAG;QACH,OAAO;KACP,CAAC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CACzB,GAA4B,EAC5B,OAAgC;IAEhC,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACrD,OAAO,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,MAAM,CAAC,MAAM;SAClB,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC;SACzE,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;SACnE,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmac-sha512.d.ts","sourceRoot":"","sources":["../src/hmac-sha512.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAOhD,0EAA0E;AAC1E,wBAAgB,YAAY,CAC3B,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,UAAU,GACjB,UAAU,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"hmac-sha512.d.ts","sourceRoot":"","sources":["../src/hmac-sha512.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAOhD,0EAA0E;AAC1E,wBAAgB,YAAY,CAC3B,GAAG,EAAE,UAAU,EACf,OAAO,EAAE,UAAU,GACjB,UAAU,CAAC,WAAW,CAAC,CAOzB;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CACzB,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC,EAC5B,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,GAC9B,gBAAgB,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAS3C"}
|
package/dist/hmac-sha512.js
CHANGED
|
@@ -3,7 +3,12 @@ import { hmac } from "./hmac-core.js";
|
|
|
3
3
|
const BLOCK_SIZE_BYTES = 128;
|
|
4
4
|
/** The TS kernel, always available — see the module doc in `index.ts`. */
|
|
5
5
|
export function hmacSha512Ts(key, message) {
|
|
6
|
-
return hmac(
|
|
6
|
+
return hmac({
|
|
7
|
+
hash: sha512Ts,
|
|
8
|
+
blockSizeBytes: BLOCK_SIZE_BYTES,
|
|
9
|
+
key,
|
|
10
|
+
message,
|
|
11
|
+
});
|
|
7
12
|
}
|
|
8
13
|
/**
|
|
9
14
|
* HMAC-SHA-512 (RFC 2104). Prefers the Web Crypto kernel
|
package/dist/hmac-sha512.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmac-sha512.js","sourceRoot":"","sources":["../src/hmac-sha512.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,0EAA0E;AAC1E,MAAM,UAAU,YAAY,CAC3B,GAAe,EACf,OAAmB;IAEnB,OAAO,IAAI,CAAC,QAAQ,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"hmac-sha512.js","sourceRoot":"","sources":["../src/hmac-sha512.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,0EAA0E;AAC1E,MAAM,UAAU,YAAY,CAC3B,GAAe,EACf,OAAmB;IAEnB,OAAO,IAAI,CAAC;QACX,IAAI,EAAE,QAAQ;QACd,cAAc,EAAE,gBAAgB;QAChC,GAAG;QACH,OAAO;KACP,CAAC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CACzB,GAA4B,EAC5B,OAAgC;IAEhC,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACrD,OAAO,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,MAAM,CAAC,MAAM;SAClB,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC;SACzE,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;SACnE,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;AAClD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ac-kit/crypto-mac",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Message authentication codes: generic hmac() and hmacVerify() plus named MD5, SHA-1 and SHA-2 HMAC wrappers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"authentication",
|
|
@@ -44,23 +44,23 @@
|
|
|
44
44
|
"prepack": "yarn build"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@ac-kit/core": "^0.
|
|
48
|
-
"@ac-kit/crypto-hash": "^0.1.
|
|
49
|
-
"@ac-kit/crypto-safe": "^0.1.
|
|
50
|
-
"@types/web": "^0.0.
|
|
47
|
+
"@ac-kit/core": "^0.7.0",
|
|
48
|
+
"@ac-kit/crypto-hash": "^0.1.6",
|
|
49
|
+
"@ac-kit/crypto-safe": "^0.1.6",
|
|
50
|
+
"@types/web": "^0.0.362"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@ac-kit/fixture-crypto": "0.1.0",
|
|
54
54
|
"@ac-kit/tsconfig": "0.1.0",
|
|
55
55
|
"@ac-kit/typedoc-config": "0.1.0",
|
|
56
56
|
"@ac-kit/vitest-config": "0.1.1",
|
|
57
|
-
"@types/node": "26.6.
|
|
57
|
+
"@types/node": "26.6.6",
|
|
58
58
|
"@typescript/native": "typescript@7.0.2",
|
|
59
|
-
"rimraf": "6.1.
|
|
59
|
+
"rimraf": "6.1.4",
|
|
60
60
|
"typedoc": "0.28.20",
|
|
61
61
|
"typescript": "@typescript/typescript6@6.0.2",
|
|
62
|
-
"vite": "8.3.
|
|
63
|
-
"vitest": "5.0
|
|
62
|
+
"vite": "8.3.7",
|
|
63
|
+
"vitest": "5.1.0"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"vitest": ">=4.0.0"
|