summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2023-03-14 00:18:07 +0900
committerGitHub <noreply@github.com>2023-03-14 00:18:07 +0900
commitcd8a8993f1513b2ac34057bf47d3e6fee3610411 (patch)
tree77487970312c8c93eba68604738d5be8e07e2813
parent58d8b2e98dbcf44e2282fccd1e50cc9b717edfd8 (diff)
chore(ext/node): copy internal/crypto/types.ts from std (#18156)
-rw-r--r--ext/node/polyfills/internal/crypto/types.ts46
1 files changed, 46 insertions, 0 deletions
diff --git a/ext/node/polyfills/internal/crypto/types.ts b/ext/node/polyfills/internal/crypto/types.ts
new file mode 100644
index 000000000..0560864f9
--- /dev/null
+++ b/ext/node/polyfills/internal/crypto/types.ts
@@ -0,0 +1,46 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+// Copyright Joyent, Inc. and Node.js contributors. All rights reserved. MIT license.
+
+import { Buffer } from "../../buffer.ts";
+
+export type HASH_DATA = string | ArrayBufferView | Buffer;
+
+export type BinaryToTextEncoding = "base64" | "base64url" | "hex" | "binary";
+
+export type CharacterEncoding = "utf8" | "utf-8" | "utf16le" | "latin1";
+
+export type LegacyCharacterEncoding = "ascii" | "binary" | "ucs2" | "ucs-2";
+
+export type Encoding =
+ | BinaryToTextEncoding
+ | CharacterEncoding
+ | LegacyCharacterEncoding;
+
+export type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid";
+
+export type BinaryLike = string | ArrayBufferView;
+
+export type KeyFormat = "pem" | "der";
+
+export type KeyType =
+ | "rsa"
+ | "rsa-pss"
+ | "dsa"
+ | "ec"
+ | "ed25519"
+ | "ed448"
+ | "x25519"
+ | "x448";
+
+export interface PrivateKeyInput {
+ key: string | Buffer;
+ format?: KeyFormat | undefined;
+ type?: "pkcs1" | "pkcs8" | "sec1" | undefined;
+ passphrase?: string | Buffer | undefined;
+}
+
+export interface PublicKeyInput {
+ key: string | Buffer;
+ format?: KeyFormat | undefined;
+ type?: "pkcs1" | "spki" | undefined;
+}