@reallyme/crypto 0.1.8 → 0.2.0
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/LICENSE +201 -0
- package/README.md +43 -3
- package/dist/aead.d.ts +4 -0
- package/dist/aead.js +32 -15
- package/dist/aesKw.d.ts +3 -0
- package/dist/aesKw.js +10 -0
- package/dist/argon2id.d.ts +2 -0
- package/dist/argon2id.js +6 -0
- package/dist/cryptoFacade.d.ts +36 -0
- package/dist/cryptoFacade.js +71 -23
- package/dist/errors.d.ts +1 -1
- package/dist/hpke.d.ts +4 -0
- package/dist/hpke.js +20 -0
- package/dist/index.d.ts +5 -6
- package/dist/index.js +4 -4
- package/dist/jwaConcatKdf.js +8 -4
- package/dist/jwk.js +67 -72
- package/dist/memory.d.ts +8 -0
- package/dist/memory.js +13 -0
- package/dist/mlDsa.d.ts +5 -0
- package/dist/mlDsa.js +23 -0
- package/dist/mlKem.d.ts +6 -0
- package/dist/mlKem.js +29 -0
- package/dist/p256Ecdh.js +5 -1
- package/dist/p384Ecdh.js +5 -1
- package/dist/p521Ecdh.js +5 -1
- package/dist/proto/generated/reallyme/crypto/v1/crypto_pb.d.ts +1392 -72
- package/dist/proto/generated/reallyme/crypto/v1/crypto_pb.js +490 -17
- package/dist/proto.d.ts +113 -5
- package/dist/proto.js +706 -3
- package/dist/rsa.d.ts +2 -0
- package/dist/rsa.js +18 -15
- package/dist/slhDsa.d.ts +5 -0
- package/dist/slhDsa.js +21 -0
- package/dist/validateBytes.d.ts +1 -0
- package/dist/validateBytes.js +6 -0
- package/dist/wasm/reallyme_crypto_wasm.js +1 -246
- package/dist/wasm/reallyme_crypto_wasm_bg.wasm +0 -0
- package/dist/wasmModuleTypes.d.ts +2 -11
- package/dist/wasmProvider.d.ts +1 -16
- package/dist/wasmProvider.js +10 -25
- package/dist/xWing.d.ts +6 -0
- package/dist/xWing.js +34 -2
- package/package.json +7 -2
- package/dist/codecs.d.ts +0 -35
- package/dist/codecs.js +0 -216
- package/dist/proto/generated/reallyme/codec/v1/codec_pb.d.ts +0 -253
- package/dist/proto/generated/reallyme/codec/v1/codec_pb.js +0 -160
package/dist/proto.d.ts
CHANGED
|
@@ -1,10 +1,68 @@
|
|
|
1
1
|
import type { ReallyMeAeadAlgorithm, ReallyMeHashAlgorithm, ReallyMeHpkeSuite, ReallyMeKdfAlgorithm, ReallyMeKemAlgorithm, ReallyMeKeyAgreementAlgorithm, ReallyMeKeyWrapAlgorithm, ReallyMeMacAlgorithm, ReallyMeSignatureAlgorithm } from "./algorithms.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
2
|
+
import { ReallyMeCryptoError } from "./errors.js";
|
|
3
|
+
import type { ReallyMeHpkeSealedMessage, ReallyMeKemEncapsulation, ReallyMeKemKeyPair, ReallyMeKeyAgreementKeyPair, ReallyMeSignatureKeyPair } from "./cryptoFacade.js";
|
|
4
|
+
import type { ReallyMeJwkKey, ReallyMeJwksKeySet } from "./jwk.js";
|
|
5
|
+
export { AeadAlgorithm, AeadAlgorithmSchema, CryptoAlgorithmFamily, CryptoAlgorithmFamilySchema, CryptoAlgorithmIdentifierSchema, CryptoAeadOpenRequestSchema, CryptoAeadOpenResultSchema, CryptoAeadSealRequestSchema, CryptoAeadSealResultSchema, CryptoBackendErrorSchema, CryptoBip340SchnorrSignRequestSchema, CryptoErrorSchema, CryptoErrorReason, CryptoErrorReasonSchema, CryptoHashRequestSchema, CryptoHashResultSchema, CryptoHkdfDeriveRequestSchema, CryptoHkdfDeriveResultSchema, CryptoHpkeOpenRequestSchema, CryptoHpkeOpenResultSchema, CryptoHpkeSealRequestSchema, CryptoHpkeSealedMessageSchema, CryptoJwaConcatKdfSha256DeriveRequestSchema, CryptoJwaConcatKdfSha256DeriveResultSchema, CryptoKdfDeriveKeyRequestSchema, CryptoKdfDeriveKeyResultSchema, CryptoKemEncapsulationSchema, CryptoKemDecapsulateRequestSchema, CryptoKemDecapsulateResultSchema, CryptoKemEncapsulateRequestSchema, CryptoKemGenerateKeyPairRequestSchema, CryptoKeyAgreementDeriveKeyPairRequestSchema, CryptoKeyAgreementDeriveSharedSecretRequestSchema, CryptoKeyAgreementDeriveSharedSecretResultSchema, CryptoKeyPairSchema, CryptoKeyUnwrapRequestSchema, CryptoKeyUnwrapResultSchema, CryptoKeyWrapRequestSchema, CryptoKeyWrapResultSchema, CryptoMacAuthenticateRequestSchema, CryptoMacAuthenticateResultSchema, CryptoMacVerifyRequestSchema, CryptoPrimitiveErrorSchema, CryptoProviderErrorSchema, CryptoProviderCapabilitySchema, CryptoProviderCapabilitySetSchema, CryptoProviderSupportStatus, CryptoProviderSupportStatusSchema, CryptoRsaVerifyRequestSchema, CryptoSignatureDeriveKeyPairRequestSchema, CryptoSignatureGenerateKeyPairRequestSchema, CryptoSignatureSignRequestSchema, CryptoSignatureSignResultSchema, CryptoSignatureVerifyRequestSchema, CryptoVerificationResultSchema, CryptoVerificationStatus, CryptoVerificationStatusSchema, HashAlgorithm, HashAlgorithmSchema, HpkeSuite, HpkeSuiteSchema, JsonWebKeySchema, JsonWebKeySetSchema, KdfAlgorithm, KdfAlgorithmSchema, KemAlgorithm, KemAlgorithmSchema, KeyAgreementAlgorithm, KeyAgreementAlgorithmSchema, KeyWrapAlgorithm, KeyWrapAlgorithmSchema, MacAlgorithm, MacAlgorithmSchema, MulticodecKeyAlgorithm, MulticodecKeyAlgorithmSchema, SignatureAlgorithm, SignatureAlgorithmSchema, file_reallyme_crypto_v1_crypto, } from "./proto/generated/reallyme/crypto/v1/crypto_pb.js";
|
|
6
|
+
export type { CryptoAlgorithmIdentifier, CryptoAeadOpenRequest, CryptoAeadOpenResult, CryptoAeadSealRequest, CryptoAeadSealResult, CryptoBackendError, CryptoBip340SchnorrSignRequest, CryptoError, CryptoHashRequest, CryptoHashResult, CryptoHkdfDeriveRequest, CryptoHkdfDeriveResult, CryptoHpkeOpenRequest, CryptoHpkeOpenResult, CryptoHpkeSealRequest, CryptoHpkeSealedMessage, CryptoJwaConcatKdfSha256DeriveRequest, CryptoJwaConcatKdfSha256DeriveResult, CryptoKdfDeriveKeyRequest, CryptoKdfDeriveKeyResult, CryptoKemEncapsulation, CryptoKemDecapsulateRequest, CryptoKemDecapsulateResult, CryptoKemEncapsulateRequest, CryptoKemGenerateKeyPairRequest, CryptoKeyAgreementDeriveKeyPairRequest, CryptoKeyAgreementDeriveSharedSecretRequest, CryptoKeyAgreementDeriveSharedSecretResult, CryptoKeyPair, CryptoKeyUnwrapRequest, CryptoKeyUnwrapResult, CryptoKeyWrapRequest, CryptoKeyWrapResult, CryptoMacAuthenticateRequest, CryptoMacAuthenticateResult, CryptoMacVerifyRequest, CryptoPrimitiveError, CryptoProviderCapability, CryptoProviderCapabilitySet, CryptoProviderError, CryptoRsaVerifyRequest, CryptoSignatureDeriveKeyPairRequest, CryptoSignatureGenerateKeyPairRequest, CryptoSignatureSignRequest, CryptoSignatureSignResult, CryptoSignatureVerifyRequest, CryptoVerificationResult, JsonWebKey, JsonWebKeySet, } from "./proto/generated/reallyme/crypto/v1/crypto_pb.js";
|
|
7
|
+
import { AeadAlgorithm, HashAlgorithm, HpkeSuite, KdfAlgorithm, KemAlgorithm, KeyAgreementAlgorithm, KeyWrapAlgorithm, MacAlgorithm, MulticodecKeyAlgorithm, SignatureAlgorithm, CryptoAlgorithmFamily, CryptoErrorReason } from "./proto/generated/reallyme/crypto/v1/crypto_pb.js";
|
|
8
|
+
import type { CryptoAlgorithmIdentifier, CryptoError, CryptoHpkeSealedMessage, CryptoKemEncapsulation, CryptoKeyPair, CryptoProviderCapability, CryptoProviderCapabilitySet, CryptoVerificationResult, JsonWebKey, JsonWebKeySet } from "./proto/generated/reallyme/crypto/v1/crypto_pb.js";
|
|
9
|
+
export type ReallyMeCryptoWireErrorBranch = "primitive" | "provider" | "backend";
|
|
10
|
+
export type ReallyMeCryptoWireError = Readonly<{
|
|
11
|
+
branch: ReallyMeCryptoWireErrorBranch;
|
|
12
|
+
reason: CryptoErrorReason;
|
|
13
|
+
reasonCode?: number;
|
|
14
|
+
}>;
|
|
15
|
+
export type ReallyMeCryptoWireErrorValidationCode = "unspecified-reason" | "branch-reason-mismatch" | "reason-code-out-of-range";
|
|
16
|
+
export type ReallyMeCryptoWireErrorValidationResult = Readonly<{
|
|
17
|
+
ok: true;
|
|
18
|
+
value: ReallyMeCryptoWireError;
|
|
19
|
+
}> | Readonly<{
|
|
20
|
+
ok: false;
|
|
21
|
+
error: ReallyMeCryptoWireErrorValidationCode;
|
|
22
|
+
}>;
|
|
23
|
+
export type ReallyMeCryptoProtoStatus = "result" | "crypto-error";
|
|
24
|
+
export declare class ReallyMeCryptoProtoResult {
|
|
25
|
+
#private;
|
|
26
|
+
readonly status: ReallyMeCryptoProtoStatus;
|
|
27
|
+
constructor(status: ReallyMeCryptoProtoStatus, bytes: Uint8Array);
|
|
28
|
+
get bytes(): Uint8Array;
|
|
29
|
+
get isCryptoError(): boolean;
|
|
30
|
+
bestEffortClear(): void;
|
|
31
|
+
toString(): string;
|
|
32
|
+
toJSON(): Readonly<{
|
|
33
|
+
status: ReallyMeCryptoProtoStatus;
|
|
34
|
+
bytes: "<redacted>";
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
7
37
|
export type ReallyMeMulticodecKeyAlgorithm = "ed25519-pub" | "x25519-pub" | "secp256k1-pub" | "p256-pub" | "p384-pub" | "p521-pub" | "ed448-pub" | "rsa-pub" | "mlkem-512-pub" | "mlkem-768-pub" | "mlkem-1024-pub" | "mldsa-44-pub" | "mldsa-65-pub" | "mldsa-87-pub";
|
|
38
|
+
export type ReallyMeProviderSupportStatus = "partial" | "provider-aware" | "supported" | "unsupported";
|
|
39
|
+
export type ReallyMeProviderCapability = Readonly<{
|
|
40
|
+
algorithm: CryptoAlgorithmIdentifier;
|
|
41
|
+
family: CryptoAlgorithmFamily;
|
|
42
|
+
providerNames: ReadonlyArray<string>;
|
|
43
|
+
status: ReallyMeProviderSupportStatus;
|
|
44
|
+
usesRust: boolean;
|
|
45
|
+
}>;
|
|
46
|
+
export type ReallyMeSignatureKeyPairProtoValue = Readonly<{
|
|
47
|
+
algorithm: ReallyMeSignatureAlgorithm;
|
|
48
|
+
keyPair: ReallyMeSignatureKeyPair;
|
|
49
|
+
}>;
|
|
50
|
+
export type ReallyMeKeyAgreementKeyPairProtoValue = Readonly<{
|
|
51
|
+
algorithm: ReallyMeKeyAgreementAlgorithm;
|
|
52
|
+
keyPair: ReallyMeKeyAgreementKeyPair;
|
|
53
|
+
}>;
|
|
54
|
+
export type ReallyMeKemKeyPairProtoValue = Readonly<{
|
|
55
|
+
algorithm: ReallyMeKemAlgorithm;
|
|
56
|
+
keyPair: ReallyMeKemKeyPair;
|
|
57
|
+
}>;
|
|
58
|
+
export type ReallyMeKemEncapsulationProtoValue = Readonly<{
|
|
59
|
+
algorithm: ReallyMeKemAlgorithm;
|
|
60
|
+
encapsulation: ReallyMeKemEncapsulation;
|
|
61
|
+
}>;
|
|
62
|
+
export type ReallyMeHpkeSealedMessageProtoValue = Readonly<{
|
|
63
|
+
sealedMessage: ReallyMeHpkeSealedMessage;
|
|
64
|
+
suite: ReallyMeHpkeSuite;
|
|
65
|
+
}>;
|
|
8
66
|
export declare const signatureAlgorithmFromProto: (value: SignatureAlgorithm) => ReallyMeSignatureAlgorithm;
|
|
9
67
|
export declare const signatureAlgorithmToProto: (value: ReallyMeSignatureAlgorithm) => SignatureAlgorithm;
|
|
10
68
|
export declare const hashAlgorithmFromProto: (value: HashAlgorithm) => ReallyMeHashAlgorithm;
|
|
@@ -25,3 +83,53 @@ export declare const hpkeSuiteFromProto: (value: HpkeSuite) => ReallyMeHpkeSuite
|
|
|
25
83
|
export declare const hpkeSuiteToProto: (value: ReallyMeHpkeSuite) => HpkeSuite;
|
|
26
84
|
export declare const multicodecKeyAlgorithmFromProto: (value: MulticodecKeyAlgorithm) => ReallyMeMulticodecKeyAlgorithm;
|
|
27
85
|
export declare const multicodecKeyAlgorithmToProto: (value: ReallyMeMulticodecKeyAlgorithm) => MulticodecKeyAlgorithm;
|
|
86
|
+
export declare const cryptoWireErrorToProto: (error: ReallyMeCryptoWireError) => CryptoError;
|
|
87
|
+
export declare const cryptoWireErrorFromProto: (value: CryptoError) => ReallyMeCryptoWireError;
|
|
88
|
+
export declare const cryptoWireErrorToProtoBytes: (error: ReallyMeCryptoWireError) => Uint8Array;
|
|
89
|
+
export declare const cryptoWireErrorFromProtoBytes: (bytes: Uint8Array) => ReallyMeCryptoWireError;
|
|
90
|
+
export declare const cryptoWireErrorTryNew: (branch: ReallyMeCryptoWireErrorBranch, reason: CryptoErrorReason) => ReallyMeCryptoWireErrorValidationResult;
|
|
91
|
+
export declare const cryptoWireErrorToFacadeError: (error: ReallyMeCryptoWireError) => ReallyMeCryptoError;
|
|
92
|
+
export declare const cryptoProtoResult: (bytes: Uint8Array) => ReallyMeCryptoProtoResult;
|
|
93
|
+
export declare const cryptoProtoErrorResult: (error: CryptoError | ReallyMeCryptoWireError | ReallyMeCryptoError) => ReallyMeCryptoProtoResult;
|
|
94
|
+
export declare const cryptoErrorToProto: (error: ReallyMeCryptoError) => CryptoError;
|
|
95
|
+
export declare const cryptoErrorToProtoBytes: (error: ReallyMeCryptoError) => Uint8Array;
|
|
96
|
+
export declare const cryptoErrorFromProto: (value: CryptoError) => ReallyMeCryptoError;
|
|
97
|
+
export declare const cryptoErrorFromProtoBytes: (bytes: Uint8Array) => ReallyMeCryptoError;
|
|
98
|
+
export declare const jsonWebKeyToProto: (key: ReallyMeJwkKey) => JsonWebKey;
|
|
99
|
+
export declare const jsonWebKeyToProtoBytes: (key: ReallyMeJwkKey) => Uint8Array;
|
|
100
|
+
export declare const jsonWebKeyFromProto: (value: JsonWebKey) => ReallyMeJwkKey;
|
|
101
|
+
export declare const jsonWebKeyFromProtoBytes: (bytes: Uint8Array) => ReallyMeJwkKey;
|
|
102
|
+
export declare const jsonWebKeySetToProto: (keySet: ReallyMeJwksKeySet) => JsonWebKeySet;
|
|
103
|
+
export declare const jsonWebKeySetToProtoBytes: (keySet: ReallyMeJwksKeySet) => Uint8Array;
|
|
104
|
+
export declare const jsonWebKeySetFromProto: (value: JsonWebKeySet) => ReallyMeJwksKeySet;
|
|
105
|
+
export declare const jsonWebKeySetFromProtoBytes: (bytes: Uint8Array) => ReallyMeJwksKeySet;
|
|
106
|
+
export declare const signatureKeyPairToProto: (algorithm: ReallyMeSignatureAlgorithm, keyPair: ReallyMeSignatureKeyPair) => CryptoKeyPair;
|
|
107
|
+
export declare const signatureKeyPairToProtoBytes: (algorithm: ReallyMeSignatureAlgorithm, keyPair: ReallyMeSignatureKeyPair) => Uint8Array;
|
|
108
|
+
export declare const signatureKeyPairFromProto: (value: CryptoKeyPair) => ReallyMeSignatureKeyPairProtoValue;
|
|
109
|
+
export declare const signatureKeyPairFromProtoBytes: (bytes: Uint8Array) => ReallyMeSignatureKeyPairProtoValue;
|
|
110
|
+
export declare const keyAgreementKeyPairToProto: (algorithm: ReallyMeKeyAgreementAlgorithm, keyPair: ReallyMeKeyAgreementKeyPair) => CryptoKeyPair;
|
|
111
|
+
export declare const keyAgreementKeyPairToProtoBytes: (algorithm: ReallyMeKeyAgreementAlgorithm, keyPair: ReallyMeKeyAgreementKeyPair) => Uint8Array;
|
|
112
|
+
export declare const keyAgreementKeyPairFromProto: (value: CryptoKeyPair) => ReallyMeKeyAgreementKeyPairProtoValue;
|
|
113
|
+
export declare const keyAgreementKeyPairFromProtoBytes: (bytes: Uint8Array) => ReallyMeKeyAgreementKeyPairProtoValue;
|
|
114
|
+
export declare const kemKeyPairToProto: (algorithm: ReallyMeKemAlgorithm, keyPair: ReallyMeKemKeyPair) => CryptoKeyPair;
|
|
115
|
+
export declare const kemKeyPairToProtoBytes: (algorithm: ReallyMeKemAlgorithm, keyPair: ReallyMeKemKeyPair) => Uint8Array;
|
|
116
|
+
export declare const kemKeyPairFromProto: (value: CryptoKeyPair) => ReallyMeKemKeyPairProtoValue;
|
|
117
|
+
export declare const kemKeyPairFromProtoBytes: (bytes: Uint8Array) => ReallyMeKemKeyPairProtoValue;
|
|
118
|
+
export declare const kemEncapsulationToProto: (algorithm: ReallyMeKemAlgorithm, encapsulation: ReallyMeKemEncapsulation) => CryptoKemEncapsulation;
|
|
119
|
+
export declare const kemEncapsulationToProtoBytes: (algorithm: ReallyMeKemAlgorithm, encapsulation: ReallyMeKemEncapsulation) => Uint8Array;
|
|
120
|
+
export declare const kemEncapsulationFromProto: (value: CryptoKemEncapsulation) => ReallyMeKemEncapsulationProtoValue;
|
|
121
|
+
export declare const kemEncapsulationFromProtoBytes: (bytes: Uint8Array) => ReallyMeKemEncapsulationProtoValue;
|
|
122
|
+
export declare const hpkeSealedMessageToProto: (suite: ReallyMeHpkeSuite, sealedMessage: ReallyMeHpkeSealedMessage) => CryptoHpkeSealedMessage;
|
|
123
|
+
export declare const hpkeSealedMessageToProtoBytes: (suite: ReallyMeHpkeSuite, sealedMessage: ReallyMeHpkeSealedMessage) => Uint8Array;
|
|
124
|
+
export declare const hpkeSealedMessageFromProto: (value: CryptoHpkeSealedMessage) => ReallyMeHpkeSealedMessageProtoValue;
|
|
125
|
+
export declare const hpkeSealedMessageFromProtoBytes: (bytes: Uint8Array) => ReallyMeHpkeSealedMessageProtoValue;
|
|
126
|
+
export declare const verificationResultToProto: (algorithm: CryptoAlgorithmIdentifier, valid: boolean) => CryptoVerificationResult;
|
|
127
|
+
export declare const verificationErrorToProto: (algorithm: CryptoAlgorithmIdentifier, error: ReallyMeCryptoError) => CryptoVerificationResult;
|
|
128
|
+
export declare const verificationResultToProtoBytes: (value: CryptoVerificationResult) => Uint8Array;
|
|
129
|
+
export declare const verificationResultFromProtoBytes: (bytes: Uint8Array) => CryptoVerificationResult;
|
|
130
|
+
export declare const providerCapabilityToProto: (value: ReallyMeProviderCapability) => CryptoProviderCapability;
|
|
131
|
+
export declare const providerCapabilityFromProto: (value: CryptoProviderCapability) => ReallyMeProviderCapability;
|
|
132
|
+
export declare const providerCapabilitySetToProto: (values: ReadonlyArray<ReallyMeProviderCapability>) => CryptoProviderCapabilitySet;
|
|
133
|
+
export declare const providerCapabilitySetToProtoBytes: (values: ReadonlyArray<ReallyMeProviderCapability>) => Uint8Array;
|
|
134
|
+
export declare const providerCapabilitySetFromProto: (value: CryptoProviderCapabilitySet) => readonly ReallyMeProviderCapability[];
|
|
135
|
+
export declare const providerCapabilitySetFromProtoBytes: (bytes: Uint8Array) => readonly ReallyMeProviderCapability[];
|