@reallyme/codec 0.1.20 → 0.1.22
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/README.md +16 -2
- package/dist/boundary.d.ts +11 -0
- package/dist/boundary.js +250 -0
- package/dist/cbor.js +119 -29
- package/dist/index.d.ts +7 -4
- package/dist/index.js +4 -0
- package/dist/jcs.js +3 -60
- package/dist/multiformat.js +57 -14
- package/dist/pem.d.ts +4 -4
- package/dist/pem.js +183 -36
- package/dist/proto/generated/reallyme/codec/v1/codec_pb.d.ts +335 -1
- package/dist/proto/generated/reallyme/codec/v1/codec_pb.js +149 -14
- package/dist/proto.d.ts +2 -2
- package/dist/proto.js +1 -1
- package/dist/protoProcess.d.ts +16 -0
- package/dist/protoProcess.js +282 -0
- package/dist/readOutput.d.ts +1 -1
- package/dist/readOutput.js +84 -21
- package/dist/wasm/reallyme_codec_wasm.d.ts +35 -95
- package/dist/wasm/reallyme_codec_wasm.js +153 -290
- package/dist/wasm/reallyme_codec_wasm_bg.wasm +0 -0
- package/dist/wasmProvider.d.ts +4 -18
- package/dist/wasmProvider.js +18 -25
- package/package.json +1 -1
|
Binary file
|
package/dist/wasmProvider.d.ts
CHANGED
|
@@ -8,14 +8,10 @@ type StringBytesToStringFn = (text: string, bytes: Uint8Array) => unknown;
|
|
|
8
8
|
type StringToBooleanFn = (text: string) => unknown;
|
|
9
9
|
type StringStringToBooleanFn = (left: string, right: string) => unknown;
|
|
10
10
|
type ValidateKeyBindingFn = (bindingType: string, algorithm: string | undefined, multikey: string) => unknown;
|
|
11
|
-
type PemDecodeFn = (input:
|
|
11
|
+
type PemDecodeFn = (input: Uint8Array, optionsJson: string) => unknown;
|
|
12
12
|
type PemEncodeFn = (label: string, der: Uint8Array, optionsJson: string) => unknown;
|
|
13
13
|
type Function0 = () => unknown;
|
|
14
|
-
|
|
15
|
-
type BytesToObjectOutputFn = (bytes: Uint8Array) => unknown;
|
|
16
|
-
type StringBytesToObjectOutputFn = (text: string, bytes: Uint8Array) => unknown;
|
|
17
|
-
type PemDecodeObjectOutputFn = (input: string, optionsJson: string) => unknown;
|
|
18
|
-
export declare const REALLYME_CODEC_WASM_EXPORTS: readonly ["base64Decode", "base64Encode", "base64urlDecode", "base64urlEncode", "bytesToLowerHex", "lowerHexToBytes", "base58btcDecode", "base58btcEncode", "multibaseBase58btcEncode", "multibaseBase64urlEncode", "multibaseDecode", "multicodecLookupPrefix", "multicodecLookupPrefixProto", "multicodecLookupPrefixProtoResult", "multicodecPrefixForName", "multicodecPrefixForNameProto", "multicodecPrefixForNameProtoResult", "multicodecStripPrefix", "multicodecTable", "multicodecTableProto", "multicodecTableProtoResult", "multikeyEncode", "multikeyParse", "multikeyParseProto", "multikeyParseProtoResult", "bindingTypeMatchesCodec", "validateKeyBinding", "requireSupportedMulticodec", "dagCborCodecCode", "dagCborComputeCid", "dagCborDecode", "dagCborEncode", "dagCborMultihash", "dagCborSha256ContentHash", "dagCborVerifyCid", "dagCborVerifyCidProto", "dagCborVerifyCidProtoResult", "isValidCidString", "tryParseCid", "canonicalizeJson", "pemDecode", "pemDecodeProto", "pemDecodeProtoResult", "pemEncode"];
|
|
14
|
+
export declare const REALLYME_CODEC_WASM_EXPORTS: readonly ["base64Decode", "base64Encode", "base64urlDecode", "base64urlEncode", "bytesToLowerHex", "lowerHexToBytes", "base58btcDecode", "base58btcEncode", "multibaseBase58btcEncode", "multibaseBase64urlEncode", "multibaseDecode", "multicodecLookupPrefix", "multicodecPrefixForName", "multicodecStripPrefix", "multicodecTable", "multikeyEncode", "multikeyParse", "bindingTypeMatchesCodec", "validateKeyBinding", "requireSupportedMulticodec", "dagCborCodecCode", "dagCborComputeCid", "dagCborDecode", "dagCborEncode", "dagCborMultihash", "dagCborSha256ContentHash", "dagCborVerifyCid", "isValidCidString", "tryParseCid", "canonicalizeJson", "pemDecode", "pemEncode", "processProto", "processProtoJson"];
|
|
19
15
|
export type ReallyMeCodecWasmProvider = Readonly<{
|
|
20
16
|
base64Decode: StringToBytesFn;
|
|
21
17
|
base64Encode: BytesToStringFn;
|
|
@@ -29,19 +25,11 @@ export type ReallyMeCodecWasmProvider = Readonly<{
|
|
|
29
25
|
multibaseBase64urlEncode: BytesToStringFn;
|
|
30
26
|
multibaseDecode: StringToBytesFn;
|
|
31
27
|
multicodecLookupPrefix: BytesToObjectFn;
|
|
32
|
-
multicodecLookupPrefixProto: BytesToBytesFn;
|
|
33
|
-
multicodecLookupPrefixProtoResult: BytesToObjectOutputFn;
|
|
34
28
|
multicodecPrefixForName: StringToObjectFn;
|
|
35
|
-
multicodecPrefixForNameProto: StringToBytesFn;
|
|
36
|
-
multicodecPrefixForNameProtoResult: StringToObjectOutputFn;
|
|
37
29
|
multicodecStripPrefix: BytesToBytesFn;
|
|
38
30
|
multicodecTable: Function0;
|
|
39
|
-
multicodecTableProto: Function0;
|
|
40
|
-
multicodecTableProtoResult: Function0;
|
|
41
31
|
multikeyEncode: StringBytesToStringFn;
|
|
42
32
|
multikeyParse: StringToObjectFn;
|
|
43
|
-
multikeyParseProto: StringToBytesFn;
|
|
44
|
-
multikeyParseProtoResult: StringToObjectOutputFn;
|
|
45
33
|
bindingTypeMatchesCodec: StringStringToBooleanFn;
|
|
46
34
|
validateKeyBinding: ValidateKeyBindingFn;
|
|
47
35
|
requireSupportedMulticodec: StringToStringFn;
|
|
@@ -52,15 +40,13 @@ export type ReallyMeCodecWasmProvider = Readonly<{
|
|
|
52
40
|
dagCborMultihash: BytesToBytesFn;
|
|
53
41
|
dagCborSha256ContentHash: BytesToBytesFn;
|
|
54
42
|
dagCborVerifyCid: StringBytesToStringFn;
|
|
55
|
-
dagCborVerifyCidProto: StringBytesToStringFn;
|
|
56
|
-
dagCborVerifyCidProtoResult: StringBytesToObjectOutputFn;
|
|
57
43
|
isValidCidString: StringToBooleanFn;
|
|
58
44
|
tryParseCid: StringToObjectFn;
|
|
59
45
|
canonicalizeJson: StringToStringFn;
|
|
60
46
|
pemDecode: PemDecodeFn;
|
|
61
|
-
pemDecodeProto: PemDecodeFn;
|
|
62
|
-
pemDecodeProtoResult: PemDecodeObjectOutputFn;
|
|
63
47
|
pemEncode: PemEncodeFn;
|
|
48
|
+
processProto: BytesToBytesFn;
|
|
49
|
+
processProtoJson: BytesToBytesFn;
|
|
64
50
|
}>;
|
|
65
51
|
export declare const installReallyMeCodecWasmProvider: (module: unknown) => void;
|
|
66
52
|
export declare const requireReallyMeCodecWasmProvider: () => ReallyMeCodecWasmProvider;
|
package/dist/wasmProvider.js
CHANGED
|
@@ -15,19 +15,11 @@ export const REALLYME_CODEC_WASM_EXPORTS = [
|
|
|
15
15
|
"multibaseBase64urlEncode",
|
|
16
16
|
"multibaseDecode",
|
|
17
17
|
"multicodecLookupPrefix",
|
|
18
|
-
"multicodecLookupPrefixProto",
|
|
19
|
-
"multicodecLookupPrefixProtoResult",
|
|
20
18
|
"multicodecPrefixForName",
|
|
21
|
-
"multicodecPrefixForNameProto",
|
|
22
|
-
"multicodecPrefixForNameProtoResult",
|
|
23
19
|
"multicodecStripPrefix",
|
|
24
20
|
"multicodecTable",
|
|
25
|
-
"multicodecTableProto",
|
|
26
|
-
"multicodecTableProtoResult",
|
|
27
21
|
"multikeyEncode",
|
|
28
22
|
"multikeyParse",
|
|
29
|
-
"multikeyParseProto",
|
|
30
|
-
"multikeyParseProtoResult",
|
|
31
23
|
"bindingTypeMatchesCodec",
|
|
32
24
|
"validateKeyBinding",
|
|
33
25
|
"requireSupportedMulticodec",
|
|
@@ -38,15 +30,13 @@ export const REALLYME_CODEC_WASM_EXPORTS = [
|
|
|
38
30
|
"dagCborMultihash",
|
|
39
31
|
"dagCborSha256ContentHash",
|
|
40
32
|
"dagCborVerifyCid",
|
|
41
|
-
"dagCborVerifyCidProto",
|
|
42
|
-
"dagCborVerifyCidProtoResult",
|
|
43
33
|
"isValidCidString",
|
|
44
34
|
"tryParseCid",
|
|
45
35
|
"canonicalizeJson",
|
|
46
36
|
"pemDecode",
|
|
47
|
-
"pemDecodeProto",
|
|
48
|
-
"pemDecodeProtoResult",
|
|
49
37
|
"pemEncode",
|
|
38
|
+
"processProto",
|
|
39
|
+
"processProtoJson",
|
|
50
40
|
];
|
|
51
41
|
let installedProvider;
|
|
52
42
|
const wasmErrorCode = (error) => {
|
|
@@ -69,7 +59,20 @@ const requireObject = (module) => {
|
|
|
69
59
|
return module;
|
|
70
60
|
};
|
|
71
61
|
const requireFunction = (module, name) => {
|
|
72
|
-
|
|
62
|
+
let candidate;
|
|
63
|
+
try {
|
|
64
|
+
const descriptor = Object.getOwnPropertyDescriptor(module, name);
|
|
65
|
+
if (descriptor === undefined || !("value" in descriptor)) {
|
|
66
|
+
throw new ReallyMeCodecError("provider-failure");
|
|
67
|
+
}
|
|
68
|
+
candidate = descriptor.value;
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
if (error instanceof ReallyMeCodecError) {
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
throw new ReallyMeCodecError("provider-failure");
|
|
75
|
+
}
|
|
73
76
|
if (typeof candidate !== "function") {
|
|
74
77
|
throw new ReallyMeCodecError("provider-failure");
|
|
75
78
|
}
|
|
@@ -136,19 +139,11 @@ export const installReallyMeCodecWasmProvider = (module) => {
|
|
|
136
139
|
multibaseBase64urlEncode: bytesFunction1(providerModule, "multibaseBase64urlEncode"),
|
|
137
140
|
multibaseDecode: stringFunction1(providerModule, "multibaseDecode"),
|
|
138
141
|
multicodecLookupPrefix: bytesFunction1(providerModule, "multicodecLookupPrefix"),
|
|
139
|
-
multicodecLookupPrefixProto: bytesFunction1(providerModule, "multicodecLookupPrefixProto"),
|
|
140
|
-
multicodecLookupPrefixProtoResult: bytesFunction1(providerModule, "multicodecLookupPrefixProtoResult"),
|
|
141
142
|
multicodecPrefixForName: stringFunction1(providerModule, "multicodecPrefixForName"),
|
|
142
|
-
multicodecPrefixForNameProto: stringFunction1(providerModule, "multicodecPrefixForNameProto"),
|
|
143
|
-
multicodecPrefixForNameProtoResult: stringFunction1(providerModule, "multicodecPrefixForNameProtoResult"),
|
|
144
143
|
multicodecStripPrefix: bytesFunction1(providerModule, "multicodecStripPrefix"),
|
|
145
144
|
multicodecTable: function0(providerModule, "multicodecTable"),
|
|
146
|
-
multicodecTableProto: function0(providerModule, "multicodecTableProto"),
|
|
147
|
-
multicodecTableProtoResult: function0(providerModule, "multicodecTableProtoResult"),
|
|
148
145
|
multikeyEncode: stringBytesFunction2(providerModule, "multikeyEncode"),
|
|
149
146
|
multikeyParse: stringFunction1(providerModule, "multikeyParse"),
|
|
150
|
-
multikeyParseProto: stringFunction1(providerModule, "multikeyParseProto"),
|
|
151
|
-
multikeyParseProtoResult: stringFunction1(providerModule, "multikeyParseProtoResult"),
|
|
152
147
|
bindingTypeMatchesCodec: stringStringBooleanFunction(providerModule, "bindingTypeMatchesCodec"),
|
|
153
148
|
validateKeyBinding: validateKeyBindingFunction(providerModule, "validateKeyBinding"),
|
|
154
149
|
requireSupportedMulticodec: stringFunction1(providerModule, "requireSupportedMulticodec"),
|
|
@@ -159,15 +154,13 @@ export const installReallyMeCodecWasmProvider = (module) => {
|
|
|
159
154
|
dagCborMultihash: bytesFunction1(providerModule, "dagCborMultihash"),
|
|
160
155
|
dagCborSha256ContentHash: bytesFunction1(providerModule, "dagCborSha256ContentHash"),
|
|
161
156
|
dagCborVerifyCid: stringBytesFunction2(providerModule, "dagCborVerifyCid"),
|
|
162
|
-
dagCborVerifyCidProto: stringBytesFunction2(providerModule, "dagCborVerifyCidProto"),
|
|
163
|
-
dagCborVerifyCidProtoResult: stringBytesFunction2(providerModule, "dagCborVerifyCidProtoResult"),
|
|
164
157
|
isValidCidString: stringBooleanFunction(providerModule, "isValidCidString"),
|
|
165
158
|
tryParseCid: stringFunction1(providerModule, "tryParseCid"),
|
|
166
159
|
canonicalizeJson: stringFunction1(providerModule, "canonicalizeJson"),
|
|
167
160
|
pemDecode: pemDecodeFunction(providerModule, "pemDecode"),
|
|
168
|
-
pemDecodeProto: pemDecodeFunction(providerModule, "pemDecodeProto"),
|
|
169
|
-
pemDecodeProtoResult: pemDecodeFunction(providerModule, "pemDecodeProtoResult"),
|
|
170
161
|
pemEncode: pemEncodeFunction(providerModule, "pemEncode"),
|
|
162
|
+
processProto: bytesFunction1(providerModule, "processProto"),
|
|
163
|
+
processProtoJson: bytesFunction1(providerModule, "processProtoJson"),
|
|
171
164
|
};
|
|
172
165
|
};
|
|
173
166
|
export const requireReallyMeCodecWasmProvider = () => {
|