Skip to content

Commit 13f63f5

Browse files
committed
chore: Better typing from Typescript
Now that TS is building both the tests and source.
1 parent 64cc85b commit 13f63f5

File tree

5 files changed

+47
-7
lines changed

5 files changed

+47
-7
lines changed

modules/decrypt-node/test/fixtures.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export function fourEdksMessage() {
7474
return 'AYAAFO/VP38MeBJoKQshvIaF8TgAAAAEAAR0ZW1wABhrZXkzAAAAgAAAAAzIotUMc7SaFTbzk0EAIKgxmVzmYedtQj5od6KglliFAx7G3OBYHMgyvbGQVJSyAAR0ZW1wABhrZXkwAAAAgAAAAAwBe+86+eb8+uYOeoIAIFmT8yZvThnsJigzsRen9OJc0kuGE+rJyalk+yF5VdNBAAR0ZW1wABhrZXkyAAAAgAAAAAy939QOrzUF3XKc0m8AICSGMg1tdgULYD15Jr7RWkFgqCXjtwyUK86xqrU+OzV9AAR0ZW1wABhrZXkxAAAAgAAAAAxE6lJVWjxWLtvnkBYAIJUl4vhbLEjNS/3g3of4T/QvAR7TGPJZgv7cLqOP0T7uAgAAAAAMAAAQAAAAAAAAAAAAAAAAAOMcqPpQVjBzbYAHIPjMM1T/////AAAAAQAAAAAAAAAAAAAAAQAAAAQPcr1WkUGY1IDMmCgdibk0zwg4Yg=='
7575
}
7676

77-
export function decryptKeyring() {
77+
export function decryptKeyring(): KeyringNode {
7878
class TestKeyring extends KeyringNode {
7979
async _onEncrypt(): Promise<NodeEncryptionMaterial> {
8080
throw new Error('I should never see this error')

modules/example-browser/src/fallback.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const { encrypt, decrypt } = buildClient(
3636
*/
3737
// @ts-ignore
3838
import { subtle } from './msrcrypto'
39-
configureFallback(subtle).catch((e) => {
39+
configureFallback(subtle as SubtleCrypto).catch((e) => {
4040
throw e
4141
})
4242

modules/integration-browser/src/cli.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ if (!existsSync(fixtures)) {
9292
slice,
9393
karma,
9494
concurrency,
95-
} = argv
95+
} = await argv
9696

9797
writeFileSync(`${fixtures}/decrypt_tests.json`, JSON.stringify([]))
9898
writeFileSync(`${fixtures}/encrypt_tests.json`, JSON.stringify([]))

modules/material-management/src/types.ts

+43
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,16 @@ export interface AwsEsdkKeyObject {
100100
* bytes. This property is `undefined` for symmetric keys.
101101
*/
102102
asymmetricKeySize?: number
103+
/**
104+
* This property exists only on asymmetric keys. Depending on the type of the key,
105+
* this object contains information about the key. None of the information obtained
106+
* through this property can be used to uniquely identify a key or to compromise the
107+
* security of the key.
108+
*/
109+
asymmetricKeyDetails?: AwsEsdkAsymmetricKeyDetails
103110
export(options: AwsEsdkKeyExportOptions<'pem'>): string | Buffer
104111
export(options?: AwsEsdkKeyExportOptions<'der'>): Buffer
112+
export(options?: { format: 'jwk' }): AwsEsdkJsonWebKey
105113
symmetricSize?: number
106114
type: AwsEsdkKeyObjectType
107115
}
@@ -113,3 +121,38 @@ export interface ClientOptions {
113121
}
114122

115123
export type Newable<T> = { new (...args: any[]): T }
124+
125+
export interface AwsEsdkJsonWebKey {
126+
crv?: string
127+
d?: string
128+
dp?: string
129+
dq?: string
130+
e?: string
131+
k?: string
132+
kty?: string
133+
n?: string
134+
p?: string
135+
q?: string
136+
qi?: string
137+
x?: string
138+
y?: string
139+
[key: string]: unknown
140+
}
141+
export interface AwsEsdkAsymmetricKeyDetails {
142+
/**
143+
* Key size in bits (RSA, DSA).
144+
*/
145+
modulusLength?: number
146+
/**
147+
* Public exponent (RSA).
148+
*/
149+
publicExponent?: bigint
150+
/**
151+
* Size of q in bits (DSA).
152+
*/
153+
divisorLength?: number
154+
/**
155+
* Name of the curve (EC).
156+
*/
157+
namedCurve?: string
158+
}

modules/raw-rsa-keyring-browser/test/raw_rsa_keyring_web_crypto.test.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55

66
import * as chai from 'chai'
77
import chaiAsPromised from 'chai-as-promised'
8-
import {
9-
RsaImportableKey,
10-
RawRsaKeyringWebCrypto,
11-
} from '@aws-crypto/raw-rsa-keyring-browser'
8+
import { RsaImportableKey, RawRsaKeyringWebCrypto } from '../src/index'
129
import {
1310
KeyringWebCrypto,
1411
WebCryptoEncryptionMaterial,

0 commit comments

Comments
 (0)