toilscript 0.1.17 → 0.1.19
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/cli.js +90 -4
- package/dist/cli.js.map +2 -2
- package/dist/importmap.json +2 -2
- package/dist/toilscript.js +181 -153
- package/dist/toilscript.js.map +3 -3
- package/dist/web.js +3 -3
- package/package.json +1 -1
- package/std/assembly/crypto.ts +5 -2
- package/std/assembly/index.d.ts +84 -1
package/dist/web.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var ASSEMBLYSCRIPT_VERSION = "0.1.
|
|
1
|
+
var ASSEMBLYSCRIPT_VERSION = "0.1.19";
|
|
2
2
|
var ASSEMBLYSCRIPT_IMPORTMAP = {
|
|
3
3
|
"imports": {
|
|
4
|
-
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
5
|
-
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
4
|
+
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.19/dist/toilscript.js",
|
|
5
|
+
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.19/dist/cli.js",
|
|
6
6
|
"binaryen": "https://cdn.jsdelivr.net/npm/binaryen@129.0.0-nightly.20260428/index.js",
|
|
7
7
|
"long": "https://cdn.jsdelivr.net/npm/long@5.3.2/index.js"
|
|
8
8
|
}
|
package/package.json
CHANGED
package/std/assembly/crypto.ts
CHANGED
|
@@ -68,8 +68,11 @@ function utf8Bytes(s: string): Uint8Array {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
export namespace crypto {
|
|
71
|
-
/// The synchronous SubtleCrypto singleton.
|
|
72
|
-
|
|
71
|
+
/// The synchronous SubtleCrypto singleton. `@lazy` defers initialization to
|
|
72
|
+
/// first use so accessing `crypto.subtle` from global scope (without an
|
|
73
|
+
/// explicit import of "crypto") doesn't hit a cross-module init-order error.
|
|
74
|
+
// @ts-ignore: decorator
|
|
75
|
+
@lazy export const subtle: SubtleCrypto = new SubtleCrypto();
|
|
73
76
|
|
|
74
77
|
/// Fill `array` with cryptographically strong random bytes.
|
|
75
78
|
export function getRandomValues(array: Uint8Array): void {
|
package/std/assembly/index.d.ts
CHANGED
|
@@ -2807,10 +2807,93 @@ declare namespace console {
|
|
|
2807
2807
|
export function timeEnd(label?: string): void;
|
|
2808
2808
|
}
|
|
2809
2809
|
|
|
2810
|
-
/**
|
|
2810
|
+
/** Opaque key handle for the Web Crypto API (per-request on the edge). */
|
|
2811
|
+
declare class CryptoKey {
|
|
2812
|
+
readonly handle: u32;
|
|
2813
|
+
readonly type: string;
|
|
2814
|
+
readonly extractable: bool;
|
|
2815
|
+
readonly algorithm: i32;
|
|
2816
|
+
readonly usages: i32;
|
|
2817
|
+
algorithmName(): string;
|
|
2818
|
+
hasUsage(u: i32): bool;
|
|
2819
|
+
}
|
|
2820
|
+
declare class CryptoKeyPair {
|
|
2821
|
+
readonly publicKey: CryptoKey;
|
|
2822
|
+
readonly privateKey: CryptoKey;
|
|
2823
|
+
}
|
|
2824
|
+
/** Base class for the algorithm-parameter objects passed to SubtleCrypto. */
|
|
2825
|
+
declare abstract class AlgorithmParams {}
|
|
2826
|
+
declare class AesGcmParams extends AlgorithmParams {
|
|
2827
|
+
constructor(iv: Uint8Array, additionalData?: Uint8Array, tagLength?: i32);
|
|
2828
|
+
}
|
|
2829
|
+
declare class AesCbcParams extends AlgorithmParams {
|
|
2830
|
+
constructor(iv: Uint8Array);
|
|
2831
|
+
}
|
|
2832
|
+
declare class AesCtrParams extends AlgorithmParams {
|
|
2833
|
+
constructor(counter: Uint8Array, length?: i32);
|
|
2834
|
+
}
|
|
2835
|
+
declare class HmacImportParams extends AlgorithmParams {
|
|
2836
|
+
constructor(hash: i32);
|
|
2837
|
+
}
|
|
2838
|
+
declare class HmacParams extends AlgorithmParams {}
|
|
2839
|
+
declare class Pbkdf2Params extends AlgorithmParams {
|
|
2840
|
+
constructor(hash: i32, salt: Uint8Array, iterations: u32);
|
|
2841
|
+
}
|
|
2842
|
+
declare class HkdfParams extends AlgorithmParams {
|
|
2843
|
+
constructor(hash: i32, salt: Uint8Array, info?: Uint8Array);
|
|
2844
|
+
}
|
|
2845
|
+
declare class EcdsaParams extends AlgorithmParams {
|
|
2846
|
+
constructor(hash: i32);
|
|
2847
|
+
}
|
|
2848
|
+
declare class EcKeyImportParams extends AlgorithmParams {
|
|
2849
|
+
constructor(alg: i32, namedCurve: i32);
|
|
2850
|
+
}
|
|
2851
|
+
declare class Ed25519Params extends AlgorithmParams {}
|
|
2852
|
+
declare class X25519ImportParams extends AlgorithmParams {}
|
|
2853
|
+
declare class EcdhParams extends AlgorithmParams {
|
|
2854
|
+
constructor(alg: i32, publicKeyHandle: i32);
|
|
2855
|
+
}
|
|
2856
|
+
/** Synchronous SubtleCrypto (no Promises). Returns values directly. */
|
|
2857
|
+
declare class SubtleCrypto {
|
|
2858
|
+
digest(algorithm: string, data: Uint8Array): Uint8Array;
|
|
2859
|
+
importKey(format: string, keyData: Uint8Array, algorithm: AlgorithmParams, extractable: bool, usages: i32): CryptoKey;
|
|
2860
|
+
exportKey(format: string, key: CryptoKey): Uint8Array;
|
|
2861
|
+
encrypt(algorithm: AlgorithmParams, key: CryptoKey, data: Uint8Array): Uint8Array;
|
|
2862
|
+
decrypt(algorithm: AlgorithmParams, key: CryptoKey, data: Uint8Array): Uint8Array;
|
|
2863
|
+
sign(algorithm: AlgorithmParams, key: CryptoKey, data: Uint8Array): Uint8Array;
|
|
2864
|
+
verify(algorithm: AlgorithmParams, key: CryptoKey, signature: Uint8Array, data: Uint8Array): bool;
|
|
2865
|
+
deriveBits(algorithm: AlgorithmParams, baseKey: CryptoKey, length: i32): Uint8Array;
|
|
2866
|
+
deriveKey(algorithm: AlgorithmParams, baseKey: CryptoKey, lengthBits: i32, derivedKeyAlgorithm: AlgorithmParams, extractable: bool, usages: i32): CryptoKey;
|
|
2867
|
+
}
|
|
2868
|
+
|
|
2869
|
+
// Algorithm / format / curve / usage ids (the Web Crypto ABI contract).
|
|
2870
|
+
declare const ALG_SHA_1: i32, ALG_SHA_256: i32, ALG_SHA_384: i32, ALG_SHA_512: i32;
|
|
2871
|
+
declare const ALG_AES_GCM: i32, ALG_AES_CBC: i32, ALG_AES_CTR: i32, ALG_AES_KW: i32;
|
|
2872
|
+
declare const ALG_HMAC: i32, ALG_ECDSA: i32, ALG_ED25519: i32, ALG_ECDH: i32, ALG_X25519: i32, ALG_HKDF: i32, ALG_PBKDF2: i32;
|
|
2873
|
+
declare const CURVE_P256: i32, CURVE_P384: i32;
|
|
2874
|
+
declare const USAGE_ENCRYPT: i32, USAGE_DECRYPT: i32, USAGE_SIGN: i32, USAGE_VERIFY: i32;
|
|
2875
|
+
declare const USAGE_DERIVE_KEY: i32, USAGE_DERIVE_BITS: i32, USAGE_WRAP_KEY: i32, USAGE_UNWRAP_KEY: i32;
|
|
2876
|
+
|
|
2877
|
+
/** Browser-like Web Crypto (synchronous SubtleCrypto + ergonomic helpers). */
|
|
2811
2878
|
declare namespace crypto {
|
|
2879
|
+
/** The synchronous SubtleCrypto instance. */
|
|
2880
|
+
export const subtle: SubtleCrypto;
|
|
2812
2881
|
/** Fills `array` with cryptographically strong random values. */
|
|
2813
2882
|
export function getRandomValues(array: Uint8Array): void;
|
|
2883
|
+
/** An RFC 4122 version-4 UUID string. */
|
|
2884
|
+
export function randomUUID(): string;
|
|
2885
|
+
export function sha1(data: Uint8Array): Uint8Array;
|
|
2886
|
+
export function sha256(data: Uint8Array): Uint8Array;
|
|
2887
|
+
export function sha384(data: Uint8Array): Uint8Array;
|
|
2888
|
+
export function sha512(data: Uint8Array): Uint8Array;
|
|
2889
|
+
export function sha1Text(s: string): Uint8Array;
|
|
2890
|
+
export function sha256Text(s: string): Uint8Array;
|
|
2891
|
+
export function sha384Text(s: string): Uint8Array;
|
|
2892
|
+
export function sha512Text(s: string): Uint8Array;
|
|
2893
|
+
export function hmacSha256(key: Uint8Array, msg: Uint8Array): Uint8Array;
|
|
2894
|
+
export function hmacSha256Text(key: Uint8Array, msg: string): Uint8Array;
|
|
2895
|
+
/** Lowercase hex string of `bytes`. */
|
|
2896
|
+
export function toHex(bytes: Uint8Array): string;
|
|
2814
2897
|
}
|
|
2815
2898
|
|
|
2816
2899
|
// Decorators
|