firefly-compiler 0.4.34 → 0.4.36
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/bin/Release.ff +47 -4
- package/compiler/Compiler.ff +1 -0
- package/core/Crypto.ff +95 -0
- package/core/NodeSystem.ff +4 -1
- package/core/Pair.ff +9 -0
- package/crypto/SubtleCrypto.ff +149 -0
- package/experimental/s3/S3.ff +93 -0
- package/experimental/s3/S3TestAuthorizationHeader.ff +39 -0
- package/experimental/s3/S3TestPut.ff +16 -0
- package/output/js/ff/compiler/Builder.mjs +2 -0
- package/output/js/ff/compiler/Compiler.mjs +3 -1
- package/output/js/ff/compiler/Dependencies.mjs +2 -0
- package/output/js/ff/compiler/DependencyLock.mjs +2 -0
- package/output/js/ff/compiler/Deriver.mjs +2 -0
- package/output/js/ff/compiler/Dictionaries.mjs +2 -0
- package/output/js/ff/compiler/Environment.mjs +2 -0
- package/output/js/ff/compiler/Inference.mjs +2 -0
- package/output/js/ff/compiler/JsEmitter.mjs +2 -0
- package/output/js/ff/compiler/JsImporter.mjs +2 -0
- package/output/js/ff/compiler/LspHook.mjs +2 -0
- package/output/js/ff/compiler/Main.mjs +2 -0
- package/output/js/ff/compiler/ModuleCache.mjs +2 -0
- package/output/js/ff/compiler/Parser.mjs +2 -0
- package/output/js/ff/compiler/Patterns.mjs +2 -0
- package/output/js/ff/compiler/Resolver.mjs +2 -0
- package/output/js/ff/compiler/Substitution.mjs +2 -0
- package/output/js/ff/compiler/Syntax.mjs +2 -0
- package/output/js/ff/compiler/Token.mjs +2 -0
- package/output/js/ff/compiler/Tokenizer.mjs +2 -0
- package/output/js/ff/compiler/Unification.mjs +2 -0
- package/output/js/ff/compiler/Wildcards.mjs +2 -0
- package/output/js/ff/compiler/Workspace.mjs +2 -0
- package/output/js/ff/core/Any.mjs +2 -0
- package/output/js/ff/core/Array.mjs +2 -0
- package/output/js/ff/core/AssetSystem.mjs +2 -0
- package/output/js/ff/core/Atomic.mjs +2 -0
- package/output/js/ff/core/Bool.mjs +2 -0
- package/output/js/ff/core/BrowserSystem.mjs +2 -0
- package/output/js/ff/core/Buffer.mjs +2 -0
- package/output/js/ff/core/BuildSystem.mjs +2 -0
- package/output/js/ff/core/Channel.mjs +2 -0
- package/output/js/ff/core/Char.mjs +2 -0
- package/output/js/ff/core/Core.mjs +2 -0
- package/output/js/ff/core/Crypto.mjs +275 -0
- package/output/js/ff/core/Duration.mjs +2 -0
- package/output/js/ff/core/Equal.mjs +2 -0
- package/output/js/ff/core/Error.mjs +2 -0
- package/output/js/ff/core/FileHandle.mjs +2 -0
- package/output/js/ff/core/Float.mjs +2 -0
- package/output/js/ff/core/HttpClient.mjs +2 -0
- package/output/js/ff/core/Instant.mjs +2 -0
- package/output/js/ff/core/Int.mjs +2 -0
- package/output/js/ff/core/IntMap.mjs +2 -0
- package/output/js/ff/core/JsSystem.mjs +2 -0
- package/output/js/ff/core/JsValue.mjs +2 -0
- package/output/js/ff/core/Json.mjs +2 -0
- package/output/js/ff/core/List.mjs +2 -0
- package/output/js/ff/core/Lock.mjs +2 -0
- package/output/js/ff/core/Log.mjs +2 -0
- package/output/js/ff/core/Map.mjs +2 -0
- package/output/js/ff/core/NodeSystem.mjs +11 -1
- package/output/js/ff/core/Nothing.mjs +2 -0
- package/output/js/ff/core/Option.mjs +2 -0
- package/output/js/ff/core/Ordering.mjs +2 -0
- package/output/js/ff/core/Pair.mjs +10 -0
- package/output/js/ff/core/Path.mjs +2 -0
- package/output/js/ff/core/Random.mjs +2 -0
- package/output/js/ff/core/RbMap.mjs +2 -0
- package/output/js/ff/core/Serializable.mjs +2 -0
- package/output/js/ff/core/Set.mjs +2 -0
- package/output/js/ff/core/Show.mjs +2 -0
- package/output/js/ff/core/SourceLocation.mjs +2 -0
- package/output/js/ff/core/Stream.mjs +2 -0
- package/output/js/ff/core/String.mjs +2 -0
- package/output/js/ff/core/StringMap.mjs +2 -0
- package/output/js/ff/core/Task.mjs +2 -0
- package/output/js/ff/core/Try.mjs +2 -0
- package/output/js/ff/core/Unit.mjs +2 -0
- package/package.json +1 -1
- package/vscode/package.json +1 -1
|
@@ -28,6 +28,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
28
28
|
|
|
29
29
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
30
30
|
|
|
31
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
32
|
+
|
|
31
33
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
32
34
|
|
|
33
35
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -26,6 +26,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
26
26
|
|
|
27
27
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
28
28
|
|
|
29
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
30
|
+
|
|
29
31
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
30
32
|
|
|
31
33
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -24,6 +24,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
24
24
|
|
|
25
25
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
26
26
|
|
|
27
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
28
|
+
|
|
27
29
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
28
30
|
|
|
29
31
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -26,6 +26,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
26
26
|
|
|
27
27
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
28
28
|
|
|
29
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
30
|
+
|
|
29
31
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
30
32
|
|
|
31
33
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -30,6 +30,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
30
30
|
|
|
31
31
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
32
32
|
|
|
33
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
34
|
+
|
|
33
35
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
34
36
|
|
|
35
37
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -28,6 +28,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
28
28
|
|
|
29
29
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
30
30
|
|
|
31
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
32
|
+
|
|
31
33
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
32
34
|
|
|
33
35
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -26,6 +26,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
26
26
|
|
|
27
27
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
28
28
|
|
|
29
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
30
|
+
|
|
29
31
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
30
32
|
|
|
31
33
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -26,6 +26,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
26
26
|
|
|
27
27
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
28
28
|
|
|
29
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
30
|
+
|
|
29
31
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
30
32
|
|
|
31
33
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import * as ff_core_Any from "../../ff/core/Any.mjs"
|
|
4
|
+
|
|
5
|
+
import * as ff_core_Array from "../../ff/core/Array.mjs"
|
|
6
|
+
|
|
7
|
+
import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
|
|
8
|
+
|
|
9
|
+
import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
|
|
10
|
+
|
|
11
|
+
import * as ff_core_Bool from "../../ff/core/Bool.mjs"
|
|
12
|
+
|
|
13
|
+
import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
|
|
14
|
+
|
|
15
|
+
import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
|
|
16
|
+
|
|
17
|
+
import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
|
|
18
|
+
|
|
19
|
+
import * as ff_core_Channel from "../../ff/core/Channel.mjs"
|
|
20
|
+
|
|
21
|
+
import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
22
|
+
|
|
23
|
+
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
|
+
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
27
|
+
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
28
|
+
|
|
29
|
+
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
30
|
+
|
|
31
|
+
import * as ff_core_Error from "../../ff/core/Error.mjs"
|
|
32
|
+
|
|
33
|
+
import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
|
|
34
|
+
|
|
35
|
+
import * as ff_core_Float from "../../ff/core/Float.mjs"
|
|
36
|
+
|
|
37
|
+
import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
|
|
38
|
+
|
|
39
|
+
import * as ff_core_Instant from "../../ff/core/Instant.mjs"
|
|
40
|
+
|
|
41
|
+
import * as ff_core_Int from "../../ff/core/Int.mjs"
|
|
42
|
+
|
|
43
|
+
import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
|
|
44
|
+
|
|
45
|
+
import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
|
|
46
|
+
|
|
47
|
+
import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
|
|
48
|
+
|
|
49
|
+
import * as ff_core_Json from "../../ff/core/Json.mjs"
|
|
50
|
+
|
|
51
|
+
import * as ff_core_List from "../../ff/core/List.mjs"
|
|
52
|
+
|
|
53
|
+
import * as ff_core_Lock from "../../ff/core/Lock.mjs"
|
|
54
|
+
|
|
55
|
+
import * as ff_core_Log from "../../ff/core/Log.mjs"
|
|
56
|
+
|
|
57
|
+
import * as ff_core_Map from "../../ff/core/Map.mjs"
|
|
58
|
+
|
|
59
|
+
import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
|
|
60
|
+
|
|
61
|
+
import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
|
|
62
|
+
|
|
63
|
+
import * as ff_core_Option from "../../ff/core/Option.mjs"
|
|
64
|
+
|
|
65
|
+
import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
|
|
66
|
+
|
|
67
|
+
import * as ff_core_Pair from "../../ff/core/Pair.mjs"
|
|
68
|
+
|
|
69
|
+
import * as ff_core_Path from "../../ff/core/Path.mjs"
|
|
70
|
+
|
|
71
|
+
import * as ff_core_Random from "../../ff/core/Random.mjs"
|
|
72
|
+
|
|
73
|
+
import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
|
|
74
|
+
|
|
75
|
+
import * as ff_core_Set from "../../ff/core/Set.mjs"
|
|
76
|
+
|
|
77
|
+
import * as ff_core_Show from "../../ff/core/Show.mjs"
|
|
78
|
+
|
|
79
|
+
import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
|
|
80
|
+
|
|
81
|
+
import * as ff_core_Stream from "../../ff/core/Stream.mjs"
|
|
82
|
+
|
|
83
|
+
import * as ff_core_String from "../../ff/core/String.mjs"
|
|
84
|
+
|
|
85
|
+
import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
|
|
86
|
+
|
|
87
|
+
import * as ff_core_Task from "../../ff/core/Task.mjs"
|
|
88
|
+
|
|
89
|
+
import * as ff_core_Try from "../../ff/core/Try.mjs"
|
|
90
|
+
|
|
91
|
+
import * as ff_core_Unit from "../../ff/core/Unit.mjs"
|
|
92
|
+
|
|
93
|
+
// type Crypto
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
export function internalMakePasswordHash_(salt_, password_, iterations_) {
|
|
99
|
+
throw new Error('Function internalMakePasswordHash is missing on this target in sync context.');
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export async function internalMakePasswordHash_$(salt_, password_, iterations_, $task) {
|
|
103
|
+
|
|
104
|
+
const keyMaterial = await crypto.subtle.importKey(
|
|
105
|
+
'raw',
|
|
106
|
+
password_,
|
|
107
|
+
{name: 'PBKDF2'},
|
|
108
|
+
false,
|
|
109
|
+
['deriveKey']
|
|
110
|
+
);
|
|
111
|
+
const derivedKey = await crypto.subtle.deriveKey(
|
|
112
|
+
{
|
|
113
|
+
name: 'PBKDF2',
|
|
114
|
+
salt: salt_,
|
|
115
|
+
iterations: iterations_,
|
|
116
|
+
hash: 'SHA-256'
|
|
117
|
+
},
|
|
118
|
+
keyMaterial,
|
|
119
|
+
{name: 'AES-GCM', length: 256},
|
|
120
|
+
true,
|
|
121
|
+
['encrypt', 'decrypt']
|
|
122
|
+
);
|
|
123
|
+
const hashBuffer = await crypto.subtle.exportKey('raw', derivedKey);
|
|
124
|
+
return new DataView(hashBuffer);
|
|
125
|
+
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function Crypto_randomUuid(self_) {
|
|
129
|
+
throw new Error('Function Crypto_randomUuid is missing on this target in sync context.');
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export function Crypto_randomBuffer(self_, size_) {
|
|
133
|
+
const buffer_ = ff_core_Buffer.new_(size_, false);
|
|
134
|
+
ff_core_Crypto.Crypto_randomizeBuffer(self_, buffer_);
|
|
135
|
+
return buffer_
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function Crypto_randomizeBuffer(self_, buffer_) {
|
|
139
|
+
throw new Error('Function Crypto_randomizeBuffer is missing on this target in sync context.');
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function Crypto_hmacSha256(self_, key_, buffer_) {
|
|
143
|
+
throw new Error('Function Crypto_hmacSha256 is missing on this target in sync context.');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export function Crypto_sha256(self_, buffer_) {
|
|
147
|
+
throw new Error('Function Crypto_sha256 is missing on this target in sync context.');
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export function Crypto_makePasswordHash(self_, password_, iterations_ = 100000) {
|
|
151
|
+
const salt_ = ff_core_Crypto.Crypto_randomBuffer(self_, 16);
|
|
152
|
+
const hash_ = ff_core_Crypto.internalMakePasswordHash_(salt_, ff_core_String.String_toBuffer(password_), iterations_);
|
|
153
|
+
return ((((("PSG_" + iterations_) + "_") + ff_core_Buffer.Buffer_toHex(salt_)) + "_") + ff_core_Buffer.Buffer_toHex(hash_))
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export function Crypto_checkPasswordHash(self_, password_, passwordHash_) {
|
|
157
|
+
{
|
|
158
|
+
const _1 = ff_core_String.String_split(passwordHash_, 95);
|
|
159
|
+
if(_1.length === 4 && _1[0] === "PSG") {
|
|
160
|
+
const iterationsText_ = _1[1];
|
|
161
|
+
const saltText_ = _1[2];
|
|
162
|
+
const hashText_ = _1[3];
|
|
163
|
+
const _guard1 = ff_core_String.String_getInt(iterationsText_);
|
|
164
|
+
if(_guard1.Some) {
|
|
165
|
+
const iterations_ = _guard1.value_;
|
|
166
|
+
const computedHash_ = ff_core_Crypto.internalMakePasswordHash_(ff_core_Buffer.fromHex_(saltText_), ff_core_String.String_toBuffer(password_), iterations_);
|
|
167
|
+
const hash_ = ff_core_Buffer.fromHex_(hashText_);
|
|
168
|
+
return ff_core_Crypto.Crypto_constantTimeEquals(self_, computedHash_, hash_)
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
{
|
|
172
|
+
return false
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export function Crypto_constantTimeEquals(self_, buffer1_, buffer2_) {
|
|
178
|
+
if((ff_core_Buffer.Buffer_size(buffer1_) !== ff_core_Buffer.Buffer_size(buffer2_))) {
|
|
179
|
+
return false
|
|
180
|
+
} else {
|
|
181
|
+
let v_ = 0;
|
|
182
|
+
let i_ = 0;
|
|
183
|
+
while((i_ < ff_core_Buffer.Buffer_size(buffer1_))) {
|
|
184
|
+
v_ = ff_core_Int.Int_bitOr(v_, ff_core_Int.Int_bitXor(ff_core_Buffer.Buffer_grabUint8(buffer1_, i_), ff_core_Buffer.Buffer_grabUint8(buffer2_, i_)))
|
|
185
|
+
};
|
|
186
|
+
return (v_ === 0)
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export async function Crypto_randomUuid$(self_, $task) {
|
|
191
|
+
|
|
192
|
+
return self_.randomUUID();
|
|
193
|
+
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export async function Crypto_randomBuffer$(self_, size_, $task) {
|
|
197
|
+
const buffer_ = ff_core_Buffer.new_(size_, false);
|
|
198
|
+
(await ff_core_Crypto.Crypto_randomizeBuffer$(self_, buffer_, $task));
|
|
199
|
+
return buffer_
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export async function Crypto_randomizeBuffer$(self_, buffer_, $task) {
|
|
203
|
+
|
|
204
|
+
self_.getRandomValues(new Uint8Array(buffer_.buffer, buffer_.byteOffset, buffer_.byteLength));
|
|
205
|
+
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export async function Crypto_hmacSha256$(self_, key_, buffer_, $task) {
|
|
209
|
+
|
|
210
|
+
const cryptoKey = await self_.subtle.importKey(
|
|
211
|
+
'raw',
|
|
212
|
+
key_,
|
|
213
|
+
{name: 'HMAC', hash: {name: 'SHA-256'}},
|
|
214
|
+
false,
|
|
215
|
+
['sign']
|
|
216
|
+
);
|
|
217
|
+
const signature = await self_.subtle.sign(
|
|
218
|
+
'HMAC',
|
|
219
|
+
cryptoKey,
|
|
220
|
+
buffer_
|
|
221
|
+
);
|
|
222
|
+
return new DataView(signature);
|
|
223
|
+
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export async function Crypto_sha256$(self_, buffer_, $task) {
|
|
227
|
+
|
|
228
|
+
let hash = await self_.subtle.digest('SHA-256', buffer_);
|
|
229
|
+
return new DataView(hash);
|
|
230
|
+
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export async function Crypto_makePasswordHash$(self_, password_, iterations_ = 100000, $task) {
|
|
234
|
+
const salt_ = (await ff_core_Crypto.Crypto_randomBuffer$(self_, 16, $task));
|
|
235
|
+
const hash_ = ff_core_Crypto.internalMakePasswordHash_(salt_, ff_core_String.String_toBuffer(password_), iterations_);
|
|
236
|
+
return ((((("PSG_" + iterations_) + "_") + ff_core_Buffer.Buffer_toHex(salt_)) + "_") + ff_core_Buffer.Buffer_toHex(hash_))
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export async function Crypto_checkPasswordHash$(self_, password_, passwordHash_, $task) {
|
|
240
|
+
{
|
|
241
|
+
const _1 = ff_core_String.String_split(passwordHash_, 95);
|
|
242
|
+
if(_1.length === 4 && _1[0] === "PSG") {
|
|
243
|
+
const iterationsText_ = _1[1];
|
|
244
|
+
const saltText_ = _1[2];
|
|
245
|
+
const hashText_ = _1[3];
|
|
246
|
+
const _guard1 = ff_core_String.String_getInt(iterationsText_);
|
|
247
|
+
if(_guard1.Some) {
|
|
248
|
+
const iterations_ = _guard1.value_;
|
|
249
|
+
const computedHash_ = ff_core_Crypto.internalMakePasswordHash_(ff_core_Buffer.fromHex_(saltText_), ff_core_String.String_toBuffer(password_), iterations_);
|
|
250
|
+
const hash_ = ff_core_Buffer.fromHex_(hashText_);
|
|
251
|
+
return (await ff_core_Crypto.Crypto_constantTimeEquals$(self_, computedHash_, hash_, $task))
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
{
|
|
255
|
+
return false
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export async function Crypto_constantTimeEquals$(self_, buffer1_, buffer2_, $task) {
|
|
261
|
+
if((ff_core_Buffer.Buffer_size(buffer1_) !== ff_core_Buffer.Buffer_size(buffer2_))) {
|
|
262
|
+
return false
|
|
263
|
+
} else {
|
|
264
|
+
let v_ = 0;
|
|
265
|
+
let i_ = 0;
|
|
266
|
+
while((i_ < ff_core_Buffer.Buffer_size(buffer1_))) {
|
|
267
|
+
v_ = ff_core_Int.Int_bitOr(v_, ff_core_Int.Int_bitXor(ff_core_Buffer.Buffer_grabUint8(buffer1_, i_), ff_core_Buffer.Buffer_grabUint8(buffer2_, i_)))
|
|
268
|
+
};
|
|
269
|
+
return (v_ === 0)
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
@@ -22,6 +22,8 @@ import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
|
22
22
|
|
|
23
23
|
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
24
|
|
|
25
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
26
|
+
|
|
25
27
|
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
28
|
|
|
27
29
|
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|