@atproto/aws 0.3.0-next.0 → 0.3.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 +9 -11
- package/dist/kms.d.ts.map +1 -1
- package/dist/kms.js +3 -4
- package/dist/kms.js.map +1 -1
- package/package.json +5 -5
- package/src/kms.ts +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
# @atproto/aws
|
|
2
2
|
|
|
3
|
-
## 0.3.0
|
|
3
|
+
## 0.3.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
-
- [#4929](https://github.com/bluesky-social/atproto/pull/4929) [`
|
|
7
|
+
- [#4929](https://github.com/bluesky-social/atproto/pull/4929) [`f01c59f`](https://github.com/bluesky-social/atproto/commit/f01c59f5bd3f75fb8b47a9eecd4858b84033fb7c) Thanks [@devinivy](https://github.com/devinivy)! - **BREAKING:** Drop support for Node.js 18 and 20. Node.js 22 is now the minimum supported version. Docker images now use Node.js 24.
|
|
8
8
|
|
|
9
|
-
- [#4943](https://github.com/bluesky-social/atproto/pull/4943) [`
|
|
9
|
+
- [#4943](https://github.com/bluesky-social/atproto/pull/4943) [`c459153`](https://github.com/bluesky-social/atproto/commit/c459153395a30ce89e050892c8fab7dc98e019b9) Thanks [@devinivy](https://github.com/devinivy)! - **BREAKING:** Convert to pure ESM. All packages now ship `"type": "module"` with ES module output and Node16 module resolution.
|
|
10
10
|
|
|
11
11
|
Node.js 22's `require()` compatibility layer can still load these packages in CommonJS code.
|
|
12
12
|
|
|
13
|
-
- [#4930](https://github.com/bluesky-social/atproto/pull/4930) [`
|
|
14
|
-
|
|
15
|
-
Internal: tsconfig `moduleResolution: "node"` is silenced via `ignoreDeprecations: "6.0"` for now; the proper migration to `node16`/`bundler` resolution is deferred.
|
|
13
|
+
- [#4930](https://github.com/bluesky-social/atproto/pull/4930) [`908bece`](https://github.com/bluesky-social/atproto/commit/908bece169258bff5ad121e5eec157d6ded6f705) Thanks [@devinivy](https://github.com/devinivy)! - Build with TypeScript 6.0.
|
|
16
14
|
|
|
17
15
|
### Patch Changes
|
|
18
16
|
|
|
19
|
-
- Updated dependencies [[`
|
|
20
|
-
- @atproto/common@0.6.0
|
|
21
|
-
- @atproto/common-web@0.5.0
|
|
22
|
-
- @atproto/crypto@0.5.0
|
|
23
|
-
- @atproto/repo@0.10.0
|
|
17
|
+
- Updated dependencies [[`affb50c`](https://github.com/bluesky-social/atproto/commit/affb50c040b497a12631df99a6310f8e78cab557), [`f01c59f`](https://github.com/bluesky-social/atproto/commit/f01c59f5bd3f75fb8b47a9eecd4858b84033fb7c), [`c459153`](https://github.com/bluesky-social/atproto/commit/c459153395a30ce89e050892c8fab7dc98e019b9), [`908bece`](https://github.com/bluesky-social/atproto/commit/908bece169258bff5ad121e5eec157d6ded6f705)]:
|
|
18
|
+
- @atproto/common@0.6.0
|
|
19
|
+
- @atproto/common-web@0.5.0
|
|
20
|
+
- @atproto/crypto@0.5.0
|
|
21
|
+
- @atproto/repo@0.10.0
|
|
24
22
|
|
|
25
23
|
## 0.2.32
|
|
26
24
|
|
package/dist/kms.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kms.d.ts","sourceRoot":"","sources":["../src/kms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"kms.d.ts","sourceRoot":"","sources":["../src/kms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAA;AAI1C,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AAOzC,MAAM,MAAM,SAAS,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAC9C,GAAG,CAAC,eAAe,EACnB,YAAY,CACb,CAAA;AAED,qBAAa,UAAW,YAAW,MAAM,CAAC,OAAO;IAI7C,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,SAAS;IALnB,MAAM,SAA2B;gBAGvB,MAAM,EAAE,GAAG,CAAC,GAAG,EACf,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,UAAU;WAGlB,IAAI,CAAC,GAAG,EAAE,SAAS;IAoBhC,GAAG,IAAI,MAAM;IAIP,IAAI,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CAkBjD;AAED,eAAe,UAAU,CAAA"}
|
package/dist/kms.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as aws from '@aws-sdk/client-kms';
|
|
2
2
|
import { secp256k1 as noble } from '@noble/curves/secp256k1';
|
|
3
|
-
|
|
4
|
-
import _KeyEncoder from 'key-encoder';
|
|
5
|
-
// key-encoder is CJS with exports.default; Node ESM interop wraps it as { default: Class }
|
|
6
|
-
const KeyEncoder = _KeyEncoder.default ?? _KeyEncoder;
|
|
3
|
+
import KeyEncoderModule from 'key-encoder';
|
|
7
4
|
import * as ui8 from 'uint8arrays';
|
|
8
5
|
import * as crypto from '@atproto/crypto';
|
|
6
|
+
// key-encoder is CJS with exports.default; Node ESM interop wraps it as { default: Class }
|
|
7
|
+
const KeyEncoder = ((m) => m.default ?? m)(KeyEncoderModule);
|
|
9
8
|
const keyEncoder = new KeyEncoder('secp256k1');
|
|
10
9
|
export class KmsKeypair {
|
|
11
10
|
constructor(client, keyId, publicKey) {
|
package/dist/kms.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kms.js","sourceRoot":"","sources":["../src/kms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAE,SAAS,IAAI,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAC5D,
|
|
1
|
+
{"version":3,"file":"kms.js","sourceRoot":"","sources":["../src/kms.ts"],"names":[],"mappings":"AA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;QACD,MAAM,SAAS,GAAG,GAAG,CAAC,UAAU,CAAC,eAAe,EAAE,KAAK,CAAC,CAAA;QACxD,OAAO,IAAI,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,CAAA;IACjD,CAAC;IAED,GAAG;QACD,OAAO,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;IACzD,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,GAAe;QACxB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;YACjC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,GAAG;YACZ,gBAAgB,EAAE,eAAe;SAClC,CAAC,CAAA;QACF,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;QAC5C,CAAC;QACD,oDAAoD;QACpD,uCAAuC;QACvC,kFAAkF;QAClF,qCAAqC;QACrC,8HAA8H;QAC9H,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;QAClD,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,EAAE,CAAA;QACnC,OAAO,UAAU,CAAC,iBAAiB,EAAE,CAAA;IACvC,CAAC;CACF;AAED,eAAe,UAAU,CAAA","sourcesContent":["import * as aws from '@aws-sdk/client-kms'\nimport { secp256k1 as noble } from '@noble/curves/secp256k1'\nimport KeyEncoderModule from 'key-encoder'\nimport * as ui8 from 'uint8arrays'\nimport * as crypto from '@atproto/crypto'\n\n// key-encoder is CJS with exports.default; Node ESM interop wraps it as { default: Class }\nconst KeyEncoder = ((m) => m.default ?? m)(KeyEncoderModule)\n\nconst keyEncoder = new KeyEncoder('secp256k1')\n\nexport type KmsConfig = { keyId: string } & Omit<\n aws.KMSClientConfig,\n 'apiVersion'\n>\n\nexport class KmsKeypair implements crypto.Keypair {\n jwtAlg = crypto.SECP256K1_JWT_ALG\n\n constructor(\n private client: aws.KMS,\n private keyId: string,\n private publicKey: Uint8Array,\n ) {}\n\n static async load(cfg: KmsConfig) {\n const { keyId, ...rest } = cfg\n const client = new aws.KMS({\n ...rest,\n apiVersion: '2014-11-01',\n })\n const res = await client.getPublicKey({ KeyId: keyId })\n if (!res.PublicKey) {\n throw new Error('Could not find public key')\n }\n // public key comes back DER-encoded, so we translate it to raw 65 byte encoding\n const rawPublicKeyHex = keyEncoder.encodePublic(\n Buffer.from(res.PublicKey),\n 'der',\n 'raw',\n )\n const publicKey = ui8.fromString(rawPublicKeyHex, 'hex')\n return new KmsKeypair(client, keyId, publicKey)\n }\n\n did(): string {\n return crypto.formatDidKey(this.jwtAlg, this.publicKey)\n }\n\n async sign(msg: Uint8Array): Promise<Uint8Array> {\n const res = await this.client.sign({\n KeyId: this.keyId,\n Message: msg,\n SigningAlgorithm: 'ECDSA_SHA_256',\n })\n if (!res.Signature) {\n throw new Error('Could not get signature')\n }\n // signature comes back DER encoded & not-normalized\n // we translate to raw 64 byte encoding\n // we also normalize s as no more than 1/2 prime order to pass strict verification\n // (prevents duplicating a signature)\n // more: https://github.com/bitcoin-core/secp256k1/blob/a1102b12196ea27f44d6201de4d25926a2ae9640/include/secp256k1.h#L530-L534\n const sig = noble.Signature.fromDER(res.Signature)\n const normalized = sig.normalizeS()\n return normalized.toCompactRawBytes()\n }\n}\n\nexport default KmsKeypair\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/aws",
|
|
3
|
-
"version": "0.3.0
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Shared AWS cloud API helpers for atproto services",
|
|
6
6
|
"keywords": [
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"key-encoder": "^2.0.3",
|
|
26
26
|
"multiformats": "^13.0.0",
|
|
27
27
|
"uint8arrays": "^5.0.0",
|
|
28
|
-
"@atproto/common
|
|
29
|
-
"@atproto/common": "^0.
|
|
30
|
-
"@atproto/crypto": "^0.5.0
|
|
31
|
-
"@atproto/repo": "^0.10.0
|
|
28
|
+
"@atproto/common": "^0.6.0",
|
|
29
|
+
"@atproto/common-web": "^0.5.0",
|
|
30
|
+
"@atproto/crypto": "^0.5.0",
|
|
31
|
+
"@atproto/repo": "^0.10.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"typescript": "^6.0.3"
|
package/src/kms.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as aws from '@aws-sdk/client-kms'
|
|
2
2
|
import { secp256k1 as noble } from '@noble/curves/secp256k1'
|
|
3
|
-
|
|
4
|
-
import _KeyEncoder from 'key-encoder'
|
|
5
|
-
// key-encoder is CJS with exports.default; Node ESM interop wraps it as { default: Class }
|
|
6
|
-
const KeyEncoder = (_KeyEncoder as any).default ?? _KeyEncoder
|
|
3
|
+
import KeyEncoderModule from 'key-encoder'
|
|
7
4
|
import * as ui8 from 'uint8arrays'
|
|
8
5
|
import * as crypto from '@atproto/crypto'
|
|
9
6
|
|
|
7
|
+
// key-encoder is CJS with exports.default; Node ESM interop wraps it as { default: Class }
|
|
8
|
+
const KeyEncoder = ((m) => m.default ?? m)(KeyEncoderModule)
|
|
9
|
+
|
|
10
10
|
const keyEncoder = new KeyEncoder('secp256k1')
|
|
11
11
|
|
|
12
12
|
export type KmsConfig = { keyId: string } & Omit<
|