@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/dist/index.js +9292 -9743
- package/dist/index.js.map +4 -4
- package/dist/src/aes.d.ts +8 -0
- package/dist/src/const.d.ts +5 -0
- package/dist/src/did.d.ts +7 -0
- package/dist/src/multibase.d.ts +1 -0
- package/dist/src/p256/ecdh.d.ts +11 -0
- package/dist/src/p256/ecdsa.d.ts +19 -0
- package/dist/src/p256/encoding.d.ts +2 -0
- package/dist/src/p256/keypair.d.ts +19 -0
- package/dist/src/p256/operations.d.ts +4 -0
- package/dist/src/p256/plugin.d.ts +3 -0
- package/dist/src/plugins.d.ts +2 -0
- package/dist/src/random.d.ts +2 -0
- package/dist/src/run.d.ts +1 -0
- package/dist/src/secp256k1/encoding.d.ts +2 -0
- package/dist/src/secp256k1/keypair.d.ts +19 -0
- package/dist/src/secp256k1/operations.d.ts +1 -0
- package/dist/src/secp256k1/plugin.d.ts +3 -0
- package/dist/src/sha.d.ts +1 -0
- package/dist/src/verify.d.ts +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +6 -4
- package/src/kms.ts +4 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/aws",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"main": "
|
|
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/
|
|
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
|
|
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 =
|
|
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 =
|
|
61
|
+
const sig = noble.Signature.fromDER(res.Signature)
|
|
61
62
|
const normalized = sig.normalizeS()
|
|
62
63
|
return normalized.toCompactRawBytes()
|
|
63
64
|
}
|