@reallyme/jose 0.4.6 → 0.5.1
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 +13 -2
- package/dist/boundary.js +3 -3
- package/dist/contract-verification.d.ts +18 -0
- package/dist/contract-verification.js +4 -0
- package/dist/errors.d.ts +7 -3
- package/dist/errors.js +16 -4
- package/dist/facade-shapes.d.ts +70 -0
- package/dist/facade-shapes.js +44 -0
- package/dist/facade-support.d.ts +5 -3
- package/dist/facade-support.js +83 -42
- package/dist/facade.d.ts +5 -3
- package/dist/facade.js +26 -24
- package/dist/index.d.ts +5 -4
- package/dist/index.js +2 -2
- package/dist/proto/contract-values.d.ts +27 -0
- package/dist/proto/contract-values.js +103 -0
- package/dist/proto/generated/reallyme/jose/v1/jose_pb.d.ts +2351 -304
- package/dist/proto/generated/reallyme/jose/v1/jose_pb.js +1040 -82
- package/dist/proto.d.ts +2 -2
- package/dist/proto.js +2 -1
- package/dist/provider.js +12 -6
- package/dist/validate.d.ts +2 -2
- package/dist/validate.js +25 -9
- package/dist/wasm/reallyme_jose_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/dist/proto.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { file_reallyme_jose_v1_jose, JoseBackendErrorSchema, JoseCompactResultSchema,
|
|
2
|
-
export type {
|
|
1
|
+
export { file_reallyme_jose_v1_jose, JoseErrorSchema, JosePrimitiveErrorSchema, JoseProviderErrorSchema, JoseBackendErrorSchema, JoseOperationResponseSchema, JoseOperationRequestSchema, JoseJwsSignWithProviderRequestSchema, JoseJwsInspectRequestSchema, JoseInspectedCompactJwsSchema, JoseJwsInspectResponseSchema, JoseJwsVerifyWithProviderRequestSchema, JoseJwsSignRequestSchema, JoseCompactResultSchema, JoseJwsVerifyRequestSchema, JoseVerifyResultSchema, JoseJwtEncodeUnsignedRequestSchema, JoseJwtDecodeUnsignedRequestSchema, JoseJwtClaimsResultSchema, JoseJwtSignRequestSchema, JoseJwtHeaderEncodeOptionsSchema, JoseJwtVerifyRequestSchema, JoseJwtVerificationPolicySchema, JoseJwtSignatureOnlyPolicySchema, JoseJwtTemporalOnlyPolicySchema, JoseJwtTemporalOptionsSchema, JoseJwtHeaderValidationPolicySchema, JoseJwtTemporalValidationPolicySchema, JoseJweEncryptRequestSchema, JoseJweDecryptRequestSchema, JoseExpectedStringSchema, JoseExpectedBytesSchema, JoseJweHeaderValidationPolicySchema, JoseJwePlaintextResultSchema, JoseJwsSignResponseSchema, JoseJwsVerifyResponseSchema, JoseJwtEncodeUnsignedResponseSchema, JoseJwtDecodeUnsignedResponseSchema, JoseJwtSignResponseSchema, JoseJwtVerifyResponseSchema, JoseJweEncryptResponseSchema, JoseJweDecryptResponseSchema, JoseSignatureSignRequestSchema, JoseSignatureVerifyRequestSchema, JoseSignatureResultSchema, JoseValidationResultSchema, JoseSignatureSuiteInfoRequestSchema, JoseSignatureSuiteInfoResultSchema, JoseJwtSignWithProviderRequestSchema, JoseJweProtectedHeaderSchema, JoseJweDeriveKeyRequestSchema, JoseSecretBytesSchema, JoseJweEncryptWithProviderRequestSchema, JoseJwePolicySchema, JoseJweDecryptWithProviderRequestSchema, JoseContractInfoRequestSchema, JoseContractInfoResultSchema, JoseSignatureSignResponseSchema, JoseSignatureVerifyResponseSchema, JoseSignatureSuiteInfoResponseSchema, JoseJwtSignWithProviderResponseSchema, JoseJweDeriveKeyResponseSchema, JoseJweEncryptWithProviderResponseSchema, JoseJweDecryptWithProviderResponseSchema, JoseContractInfoResponseSchema, JoseJwtRegisteredClaimsSchema, JoseJwtAudienceSchema, JoseJwtClaimsParseRequestSchema, JoseJwtClaimsParseResultSchema, JoseJwtClaimsParseResponseSchema, JoseSdkErrorCode, JoseSdkErrorCodeSchema, JoseErrorReason, JoseErrorReasonSchema, JoseSignatureAlgorithm, JoseSignatureAlgorithmSchema, JoseJweKeyManagementAlgorithm, JoseJweKeyManagementAlgorithmSchema, JoseJweHeaderAlgorithm, JoseJweHeaderAlgorithmSchema, JoseJweContentEncryptionAlgorithm, JoseJweContentEncryptionAlgorithmSchema, JoseJweCompressionAlgorithm, JoseJweCompressionAlgorithmSchema, JoseOperationContractVersion, JoseOperationContractVersionSchema, JoseExternalJwsAlgorithm, JoseExternalJwsAlgorithmSchema, JoseNamedCurve, JoseNamedCurveSchema, JoseSignatureEncoding, JoseSignatureEncodingSchema, JoseContractLimit, JoseContractLimitSchema, JoseJwtPolicyLimit, JoseJwtPolicyLimitSchema, JoseJwtClaim, JoseJwtClaimSchema, JoseErrorBranch, JoseErrorBranchSchema, JoseOperationKind, JoseOperationKindSchema, JoseTransportStatus, JoseTransportStatusSchema, JoseNativeAbiVersion, JoseNativeAbiVersionSchema, } from "./proto/generated/reallyme/jose/v1/jose_pb.js";
|
|
2
|
+
export type { JoseError, JosePrimitiveError, JoseProviderError, JoseBackendError, JoseOperationResponse, JoseOperationRequest, JoseJwsSignWithProviderRequest, JoseJwsInspectRequest, JoseInspectedCompactJws, JoseJwsInspectResponse, JoseJwsVerifyWithProviderRequest, JoseJwsSignRequest, JoseCompactResult, JoseJwsVerifyRequest, JoseVerifyResult, JoseJwtEncodeUnsignedRequest, JoseJwtDecodeUnsignedRequest, JoseJwtClaimsResult, JoseJwtSignRequest, JoseJwtHeaderEncodeOptions, JoseJwtVerifyRequest, JoseJwtVerificationPolicy, JoseJwtSignatureOnlyPolicy, JoseJwtTemporalOnlyPolicy, JoseJwtTemporalOptions, JoseJwtHeaderValidationPolicy, JoseJwtTemporalValidationPolicy, JoseJweEncryptRequest, JoseJweDecryptRequest, JoseExpectedString, JoseExpectedBytes, JoseJweHeaderValidationPolicy, JoseJwePlaintextResult, JoseJwsSignResponse, JoseJwsVerifyResponse, JoseJwtEncodeUnsignedResponse, JoseJwtDecodeUnsignedResponse, JoseJwtSignResponse, JoseJwtVerifyResponse, JoseJweEncryptResponse, JoseJweDecryptResponse, JoseSignatureSignRequest, JoseSignatureVerifyRequest, JoseSignatureResult, JoseValidationResult, JoseSignatureSuiteInfoRequest, JoseSignatureSuiteInfoResult, JoseJwtSignWithProviderRequest, JoseJweProtectedHeader, JoseJweDeriveKeyRequest, JoseSecretBytes, JoseJweEncryptWithProviderRequest, JoseJwePolicy, JoseJweDecryptWithProviderRequest, JoseContractInfoRequest, JoseContractInfoResult, JoseSignatureSignResponse, JoseSignatureVerifyResponse, JoseSignatureSuiteInfoResponse, JoseJwtSignWithProviderResponse, JoseJweDeriveKeyResponse, JoseJweEncryptWithProviderResponse, JoseJweDecryptWithProviderResponse, JoseContractInfoResponse, JoseJwtRegisteredClaims, JoseJwtAudience, JoseJwtClaimsParseRequest, JoseJwtClaimsParseResult, JoseJwtClaimsParseResponse, } from "./proto/generated/reallyme/jose/v1/jose_pb.js";
|
package/dist/proto.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 ReallyMe Technologies Limited
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: MIT OR Apache-2.0
|
|
4
|
-
|
|
4
|
+
// Derived from the protobuf contract. Change the schema and regenerate.
|
|
5
|
+
export { file_reallyme_jose_v1_jose, JoseErrorSchema, JosePrimitiveErrorSchema, JoseProviderErrorSchema, JoseBackendErrorSchema, JoseOperationResponseSchema, JoseOperationRequestSchema, JoseJwsSignWithProviderRequestSchema, JoseJwsInspectRequestSchema, JoseInspectedCompactJwsSchema, JoseJwsInspectResponseSchema, JoseJwsVerifyWithProviderRequestSchema, JoseJwsSignRequestSchema, JoseCompactResultSchema, JoseJwsVerifyRequestSchema, JoseVerifyResultSchema, JoseJwtEncodeUnsignedRequestSchema, JoseJwtDecodeUnsignedRequestSchema, JoseJwtClaimsResultSchema, JoseJwtSignRequestSchema, JoseJwtHeaderEncodeOptionsSchema, JoseJwtVerifyRequestSchema, JoseJwtVerificationPolicySchema, JoseJwtSignatureOnlyPolicySchema, JoseJwtTemporalOnlyPolicySchema, JoseJwtTemporalOptionsSchema, JoseJwtHeaderValidationPolicySchema, JoseJwtTemporalValidationPolicySchema, JoseJweEncryptRequestSchema, JoseJweDecryptRequestSchema, JoseExpectedStringSchema, JoseExpectedBytesSchema, JoseJweHeaderValidationPolicySchema, JoseJwePlaintextResultSchema, JoseJwsSignResponseSchema, JoseJwsVerifyResponseSchema, JoseJwtEncodeUnsignedResponseSchema, JoseJwtDecodeUnsignedResponseSchema, JoseJwtSignResponseSchema, JoseJwtVerifyResponseSchema, JoseJweEncryptResponseSchema, JoseJweDecryptResponseSchema, JoseSignatureSignRequestSchema, JoseSignatureVerifyRequestSchema, JoseSignatureResultSchema, JoseValidationResultSchema, JoseSignatureSuiteInfoRequestSchema, JoseSignatureSuiteInfoResultSchema, JoseJwtSignWithProviderRequestSchema, JoseJweProtectedHeaderSchema, JoseJweDeriveKeyRequestSchema, JoseSecretBytesSchema, JoseJweEncryptWithProviderRequestSchema, JoseJwePolicySchema, JoseJweDecryptWithProviderRequestSchema, JoseContractInfoRequestSchema, JoseContractInfoResultSchema, JoseSignatureSignResponseSchema, JoseSignatureVerifyResponseSchema, JoseSignatureSuiteInfoResponseSchema, JoseJwtSignWithProviderResponseSchema, JoseJweDeriveKeyResponseSchema, JoseJweEncryptWithProviderResponseSchema, JoseJweDecryptWithProviderResponseSchema, JoseContractInfoResponseSchema, JoseJwtRegisteredClaimsSchema, JoseJwtAudienceSchema, JoseJwtClaimsParseRequestSchema, JoseJwtClaimsParseResultSchema, JoseJwtClaimsParseResponseSchema, JoseSdkErrorCode, JoseSdkErrorCodeSchema, JoseErrorReason, JoseErrorReasonSchema, JoseSignatureAlgorithm, JoseSignatureAlgorithmSchema, JoseJweKeyManagementAlgorithm, JoseJweKeyManagementAlgorithmSchema, JoseJweHeaderAlgorithm, JoseJweHeaderAlgorithmSchema, JoseJweContentEncryptionAlgorithm, JoseJweContentEncryptionAlgorithmSchema, JoseJweCompressionAlgorithm, JoseJweCompressionAlgorithmSchema, JoseOperationContractVersion, JoseOperationContractVersionSchema, JoseExternalJwsAlgorithm, JoseExternalJwsAlgorithmSchema, JoseNamedCurve, JoseNamedCurveSchema, JoseSignatureEncoding, JoseSignatureEncodingSchema, JoseContractLimit, JoseContractLimitSchema, JoseJwtPolicyLimit, JoseJwtPolicyLimitSchema, JoseJwtClaim, JoseJwtClaimSchema, JoseErrorBranch, JoseErrorBranchSchema, JoseOperationKind, JoseOperationKindSchema, JoseTransportStatus, JoseTransportStatusSchema, JoseNativeAbiVersion, JoseNativeAbiVersionSchema, } from "./proto/generated/reallyme/jose/v1/jose_pb.js";
|
package/dist/provider.js
CHANGED
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 ReallyMe Technologies Limited
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: MIT OR Apache-2.0
|
|
4
|
-
import { ReallyMeJoseError } from "./errors.js";
|
|
4
|
+
import { ReallyMeJoseError, ReallyMeJoseSdkErrorCode } from "./errors.js";
|
|
5
5
|
let installedProvider;
|
|
6
6
|
const requireObject = (value) => {
|
|
7
7
|
if (typeof value !== "object" || value === null) {
|
|
8
|
-
throw new ReallyMeJoseError(
|
|
8
|
+
throw new ReallyMeJoseError(ReallyMeJoseSdkErrorCode.PROVIDER_FAILURE);
|
|
9
9
|
}
|
|
10
10
|
return value;
|
|
11
11
|
};
|
|
12
12
|
const requireFunction = (module, name) => {
|
|
13
|
-
|
|
13
|
+
let value;
|
|
14
|
+
try {
|
|
15
|
+
value = Reflect.get(module, name);
|
|
16
|
+
}
|
|
17
|
+
catch (_error) {
|
|
18
|
+
throw new ReallyMeJoseError(ReallyMeJoseSdkErrorCode.PROVIDER_FAILURE);
|
|
19
|
+
}
|
|
14
20
|
if (typeof value !== "function") {
|
|
15
|
-
throw new ReallyMeJoseError(
|
|
21
|
+
throw new ReallyMeJoseError(ReallyMeJoseSdkErrorCode.PROVIDER_FAILURE);
|
|
16
22
|
}
|
|
17
23
|
return (request) => {
|
|
18
24
|
try {
|
|
19
25
|
return Reflect.apply(value, undefined, [request]);
|
|
20
26
|
}
|
|
21
27
|
catch (_error) {
|
|
22
|
-
throw new ReallyMeJoseError(
|
|
28
|
+
throw new ReallyMeJoseError(ReallyMeJoseSdkErrorCode.PROVIDER_FAILURE);
|
|
23
29
|
}
|
|
24
30
|
};
|
|
25
31
|
};
|
|
@@ -35,7 +41,7 @@ export const installReallyMeJoseWasmProvider = (module) => {
|
|
|
35
41
|
};
|
|
36
42
|
export const requireReallyMeJoseWasmProvider = () => {
|
|
37
43
|
if (installedProvider === undefined) {
|
|
38
|
-
throw new ReallyMeJoseError(
|
|
44
|
+
throw new ReallyMeJoseError(ReallyMeJoseSdkErrorCode.PROVIDER_NOT_INSTALLED);
|
|
39
45
|
}
|
|
40
46
|
return installedProvider;
|
|
41
47
|
};
|
package/dist/validate.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export declare const MAX_JOSE_BINARY_REQUEST_BYTES = 1048576;
|
|
2
2
|
export declare const MAX_JOSE_JSON_REQUEST_BYTES = 1572864;
|
|
3
|
-
export declare const MAX_JOSE_RESPONSE_BYTES
|
|
3
|
+
export declare const MAX_JOSE_RESPONSE_BYTES: number;
|
|
4
4
|
export declare const invalidInput: () => never;
|
|
5
5
|
export declare const resourceLimit: () => never;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const ensureObjectFields: (value: unknown, allowed: Readonly<Record<string, true>>) => void;
|
|
7
7
|
export declare const ensureBytes: (value: Uint8Array) => void;
|
|
8
8
|
export declare const ensureString: (value: string) => void;
|
|
9
9
|
export declare const ensureBoolean: (value: boolean) => void;
|
package/dist/validate.js
CHANGED
|
@@ -1,20 +1,36 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 ReallyMe Technologies Limited
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: MIT OR Apache-2.0
|
|
4
|
-
import { ReallyMeJoseError } from "./errors.js";
|
|
4
|
+
import { ReallyMeJoseError, ReallyMeJoseSdkErrorCode } from "./errors.js";
|
|
5
5
|
import { JoseErrorReason } from "./proto/generated/reallyme/jose/v1/jose_pb.js";
|
|
6
|
-
|
|
7
|
-
export const
|
|
8
|
-
export const
|
|
6
|
+
import { COMPACT_BYTES, PROTO_JSON_BYTES, RESPONSE_OVERHEAD_BYTES } from "./proto/contract-values.js";
|
|
7
|
+
export const MAX_JOSE_BINARY_REQUEST_BYTES = COMPACT_BYTES;
|
|
8
|
+
export const MAX_JOSE_JSON_REQUEST_BYTES = PROTO_JSON_BYTES;
|
|
9
|
+
export const MAX_JOSE_RESPONSE_BYTES = COMPACT_BYTES + RESPONSE_OVERHEAD_BYTES;
|
|
9
10
|
export const invalidInput = () => {
|
|
10
|
-
throw new ReallyMeJoseError(
|
|
11
|
+
throw new ReallyMeJoseError(ReallyMeJoseSdkErrorCode.INVALID_INPUT);
|
|
11
12
|
};
|
|
12
13
|
export const resourceLimit = () => {
|
|
13
|
-
throw new ReallyMeJoseError(
|
|
14
|
+
throw new ReallyMeJoseError(ReallyMeJoseSdkErrorCode.JOSE_FAILURE, "primitive", JoseErrorReason.COMMON_RESOURCE_LIMIT_EXCEEDED);
|
|
14
15
|
};
|
|
15
|
-
export const
|
|
16
|
-
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
16
|
+
export const ensureObjectFields = (value, allowed) => {
|
|
17
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
18
|
+
return invalidInput();
|
|
19
|
+
const prototype = Object.getPrototypeOf(value);
|
|
20
|
+
if (prototype !== null && prototype !== Object.prototype)
|
|
17
21
|
invalidInput();
|
|
22
|
+
for (const field of Object.keys(allowed)) {
|
|
23
|
+
// Optional settings must be absent or owned by this record. A polluted
|
|
24
|
+
// Object.prototype must never supply authorization or verification policy.
|
|
25
|
+
if (!Object.hasOwn(value, field) && field in value)
|
|
26
|
+
invalidInput();
|
|
27
|
+
}
|
|
28
|
+
for (const field of Reflect.ownKeys(value)) {
|
|
29
|
+
if (typeof field !== "string" || !Object.hasOwn(allowed, field))
|
|
30
|
+
invalidInput();
|
|
31
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, field);
|
|
32
|
+
if (descriptor === undefined || !Object.hasOwn(descriptor, "value"))
|
|
33
|
+
invalidInput();
|
|
18
34
|
}
|
|
19
35
|
};
|
|
20
36
|
export const ensureBytes = (value) => {
|
|
@@ -84,6 +100,6 @@ export const ensureAggregateLength = (...lengths) => {
|
|
|
84
100
|
};
|
|
85
101
|
export const ensureIndependentBytes = (value, inputs) => {
|
|
86
102
|
if (inputs.some((input) => input.buffer === value.buffer)) {
|
|
87
|
-
throw new ReallyMeJoseError(
|
|
103
|
+
throw new ReallyMeJoseError(ReallyMeJoseSdkErrorCode.PROVIDER_FAILURE);
|
|
88
104
|
}
|
|
89
105
|
};
|
|
Binary file
|
package/package.json
CHANGED