@atproto/aws 0.0.1 → 0.1.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atproto/aws",
3
- "version": "0.0.1",
4
- "main": "dist/index.js",
3
+ "version": "0.1.0",
4
+ "main": "src/index.ts",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -24,7 +24,9 @@
24
24
  "@aws-sdk/client-kms": "^3.196.0",
25
25
  "@aws-sdk/client-s3": "^3.224.0",
26
26
  "@aws-sdk/lib-storage": "^3.226.0",
27
- "@noble/secp256k1": "^1.7.0",
28
- "key-encoder": "^2.0.3"
27
+ "@noble/curves": "^1.1.0",
28
+ "key-encoder": "^2.0.3",
29
+ "multiformats": "^9.6.4",
30
+ "uint8arrays": "3.0.0"
29
31
  }
30
32
  }
package/src/kms.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as aws from '@aws-sdk/client-kms'
2
- import * as secp from '@noble/secp256k1'
2
+ import { secp256k1 as noble } from '@noble/curves/secp256k1'
3
+ import * as ui8 from 'uint8arrays'
3
4
  import * as crypto from '@atproto/crypto'
4
5
  import KeyEncoder from 'key-encoder'
5
6
 
@@ -35,7 +36,7 @@ export class KmsKeypair implements crypto.Keypair {
35
36
  'der',
36
37
  'raw',
37
38
  )
38
- const publicKey = secp.utils.hexToBytes(rawPublicKeyHex)
39
+ const publicKey = ui8.fromString(rawPublicKeyHex, 'hex')
39
40
  return new KmsKeypair(client, keyId, publicKey)
40
41
  }
41
42
 
@@ -57,7 +58,7 @@ export class KmsKeypair implements crypto.Keypair {
57
58
  // we also normalize s as no more than 1/2 prime order to pass strict verification
58
59
  // (prevents duplicating a signature)
59
60
  // more: https://github.com/bitcoin-core/secp256k1/blob/a1102b12196ea27f44d6201de4d25926a2ae9640/include/secp256k1.h#L530-L534
60
- const sig = secp.Signature.fromDER(res.Signature)
61
+ const sig = noble.Signature.fromDER(res.Signature)
61
62
  const normalized = sig.normalizeS()
62
63
  return normalized.toCompactRawBytes()
63
64
  }