ts-mls 1.4.0 → 1.4.2
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/authenticatedContent.d.ts +3 -1
- package/dist/authenticatedContent.js +10 -8
- package/dist/authenticatedContent.js.map +1 -1
- package/dist/capabilities.d.ts +2 -1
- package/dist/capabilities.js +13 -12
- package/dist/capabilities.js.map +1 -1
- package/dist/clientState.d.ts +4 -3
- package/dist/clientState.js +87 -59
- package/dist/clientState.js.map +1 -1
- package/dist/codec/number.d.ts +5 -1
- package/dist/codec/number.js +33 -24
- package/dist/codec/number.js.map +1 -1
- package/dist/codec/optional.d.ts +2 -2
- package/dist/codec/optional.js +24 -7
- package/dist/codec/optional.js.map +1 -1
- package/dist/codec/tlsEncoder.d.ts +11 -8
- package/dist/codec/tlsEncoder.js +39 -21
- package/dist/codec/tlsEncoder.js.map +1 -1
- package/dist/codec/variableLength.d.ts +4 -4
- package/dist/codec/variableLength.js +58 -28
- package/dist/codec/variableLength.js.map +1 -1
- package/dist/commit.d.ts +2 -1
- package/dist/commit.js +7 -6
- package/dist/commit.js.map +1 -1
- package/dist/contentType.d.ts +2 -1
- package/dist/contentType.js +4 -3
- package/dist/contentType.js.map +1 -1
- package/dist/createCommit.js +6 -5
- package/dist/createCommit.js.map +1 -1
- package/dist/credential.d.ts +5 -1
- package/dist/credential.js +14 -10
- package/dist/credential.js.map +1 -1
- package/dist/credentialType.d.ts +2 -1
- package/dist/credentialType.js +4 -3
- package/dist/credentialType.js.map +1 -1
- package/dist/crypto/ciphersuite.d.ts +2 -1
- package/dist/crypto/ciphersuite.js +4 -3
- package/dist/crypto/ciphersuite.js.map +1 -1
- package/dist/crypto/hash.js +4 -3
- package/dist/crypto/hash.js.map +1 -1
- package/dist/crypto/hpke.js +10 -4
- package/dist/crypto/hpke.js.map +1 -1
- package/dist/crypto/implementation/default/makeAead.js +9 -9
- package/dist/crypto/implementation/default/makeAead.js.map +1 -1
- package/dist/crypto/implementation/default/makeHashImpl.js +5 -5
- package/dist/crypto/implementation/default/makeHashImpl.js.map +1 -1
- package/dist/crypto/implementation/default/makeKdfImpl.js +3 -3
- package/dist/crypto/implementation/default/makeKdfImpl.js.map +1 -1
- package/dist/crypto/implementation/hpke.js +11 -11
- package/dist/crypto/implementation/hpke.js.map +1 -1
- package/dist/crypto/kdf.js +8 -7
- package/dist/crypto/kdf.js.map +1 -1
- package/dist/crypto/signature.js +10 -4
- package/dist/crypto/signature.js.map +1 -1
- package/dist/defaultExtensionType.d.ts +2 -1
- package/dist/defaultExtensionType.js +4 -3
- package/dist/defaultExtensionType.js.map +1 -1
- package/dist/defaultProposalType.d.ts +2 -1
- package/dist/defaultProposalType.js +4 -3
- package/dist/defaultProposalType.js.map +1 -1
- package/dist/extension.d.ts +3 -1
- package/dist/extension.js +8 -6
- package/dist/extension.js.map +1 -1
- package/dist/externalSender.d.ts +2 -1
- package/dist/externalSender.js +5 -4
- package/dist/externalSender.js.map +1 -1
- package/dist/framedContent.d.ts +9 -1
- package/dist/framedContent.js +35 -27
- package/dist/framedContent.js.map +1 -1
- package/dist/groupContext.d.ts +2 -1
- package/dist/groupContext.js +17 -16
- package/dist/groupContext.js.map +1 -1
- package/dist/groupInfo.d.ts +3 -1
- package/dist/groupInfo.js +11 -9
- package/dist/groupInfo.js.map +1 -1
- package/dist/groupSecrets.d.ts +2 -1
- package/dist/groupSecrets.js +6 -5
- package/dist/groupSecrets.js.map +1 -1
- package/dist/hpkeCiphertext.d.ts +2 -1
- package/dist/hpkeCiphertext.js +4 -3
- package/dist/hpkeCiphertext.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/keyPackage.d.ts +12 -3
- package/dist/keyPackage.js +23 -18
- package/dist/keyPackage.js.map +1 -1
- package/dist/leafNode.d.ts +11 -1
- package/dist/leafNode.js +43 -27
- package/dist/leafNode.js.map +1 -1
- package/dist/leafNodeSource.d.ts +2 -1
- package/dist/leafNodeSource.js +4 -3
- package/dist/leafNodeSource.js.map +1 -1
- package/dist/lifetime.d.ts +2 -1
- package/dist/lifetime.js +4 -3
- package/dist/lifetime.js.map +1 -1
- package/dist/message.d.ts +9 -2
- package/dist/message.js +27 -20
- package/dist/message.js.map +1 -1
- package/dist/messageProtection.js +4 -3
- package/dist/messageProtection.js.map +1 -1
- package/dist/nodeType.d.ts +2 -1
- package/dist/nodeType.js +4 -3
- package/dist/nodeType.js.map +1 -1
- package/dist/parentHash.d.ts +2 -1
- package/dist/parentHash.js +5 -4
- package/dist/parentHash.js.map +1 -1
- package/dist/parentNode.d.ts +2 -1
- package/dist/parentNode.js +5 -4
- package/dist/parentNode.js.map +1 -1
- package/dist/presharedkey.d.ts +6 -1
- package/dist/presharedkey.js +16 -11
- package/dist/presharedkey.js.map +1 -1
- package/dist/privateMessage.d.ts +4 -1
- package/dist/privateMessage.js +29 -20
- package/dist/privateMessage.js.map +1 -1
- package/dist/processMessages.js +3 -2
- package/dist/processMessages.js.map +1 -1
- package/dist/proposal.d.ts +17 -1
- package/dist/proposal.js +50 -34
- package/dist/proposal.js.map +1 -1
- package/dist/proposalOrRefType.d.ts +5 -1
- package/dist/proposalOrRefType.js +14 -10
- package/dist/proposalOrRefType.js.map +1 -1
- package/dist/protocolVersion.d.ts +2 -1
- package/dist/protocolVersion.js +4 -3
- package/dist/protocolVersion.js.map +1 -1
- package/dist/publicMessage.d.ts +3 -1
- package/dist/publicMessage.js +9 -7
- package/dist/publicMessage.js.map +1 -1
- package/dist/ratchetTree.d.ts +3 -1
- package/dist/ratchetTree.js +13 -11
- package/dist/ratchetTree.js.map +1 -1
- package/dist/requiredCapabilities.d.ts +2 -1
- package/dist/requiredCapabilities.js +6 -5
- package/dist/requiredCapabilities.js.map +1 -1
- package/dist/sender.d.ts +6 -1
- package/dist/sender.js +24 -13
- package/dist/sender.js.map +1 -1
- package/dist/transcriptHash.d.ts +2 -1
- package/dist/transcriptHash.js +18 -8
- package/dist/transcriptHash.js.map +1 -1
- package/dist/treeHash.d.ts +4 -1
- package/dist/treeHash.js +17 -14
- package/dist/treeHash.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/updatePath.d.ts +3 -1
- package/dist/updatePath.js +10 -8
- package/dist/updatePath.js.map +1 -1
- package/dist/util/byteArray.d.ts +2 -1
- package/dist/util/byteArray.js +21 -2
- package/dist/util/byteArray.js.map +1 -1
- package/dist/welcome.d.ts +3 -1
- package/dist/welcome.js +12 -10
- package/dist/welcome.js.map +1 -1
- package/dist/wireformat.d.ts +2 -1
- package/dist/wireformat.js +4 -3
- package/dist/wireformat.js.map +1 -1
- package/package.json +3 -3
package/dist/externalSender.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { mapDecoders } from "./codec/tlsDecoder.js";
|
|
2
|
-
import {
|
|
3
|
-
import { decodeVarLenData,
|
|
4
|
-
import { decodeCredential,
|
|
5
|
-
export const
|
|
2
|
+
import { contramapBufferEncoders, encode } from "./codec/tlsEncoder.js";
|
|
3
|
+
import { decodeVarLenData, varLenDataEncoder } from "./codec/variableLength.js";
|
|
4
|
+
import { decodeCredential, credentialEncoder } from "./credential.js";
|
|
5
|
+
export const externalSenderEncoder = contramapBufferEncoders([varLenDataEncoder, credentialEncoder], (e) => [e.signaturePublicKey, e.credential]);
|
|
6
|
+
export const encodeExternalSender = encode(externalSenderEncoder);
|
|
6
7
|
export const decodeExternalSender = mapDecoders([decodeVarLenData, decodeCredential], (signaturePublicKey, credential) => ({ signaturePublicKey, credential }));
|
|
7
8
|
//# sourceMappingURL=externalSender.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"externalSender.js","sourceRoot":"","sources":["../src/externalSender.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"externalSender.js","sourceRoot":"","sources":["../src/externalSender.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,uBAAuB,EAAiB,MAAM,EAAW,MAAM,uBAAuB,CAAA;AAC/F,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC/E,OAAO,EAAc,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAOjF,MAAM,CAAC,MAAM,qBAAqB,GAAkC,uBAAuB,CACzF,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,EACtC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC,UAAU,CAAU,CACrD,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAA4B,MAAM,CAAC,qBAAqB,CAAC,CAAA;AAE1F,MAAM,CAAC,MAAM,oBAAoB,GAA4B,WAAW,CACtE,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,EACpC,CAAC,kBAAkB,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC,EAAE,kBAAkB,EAAE,UAAU,EAAE,CAAC,CACzE,CAAA"}
|
package/dist/framedContent.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Decoder } from "./codec/tlsDecoder.js";
|
|
2
|
-
import { Encoder } from "./codec/tlsEncoder.js";
|
|
2
|
+
import { BufferEncoder, Encoder } from "./codec/tlsEncoder.js";
|
|
3
3
|
import { Commit } from "./commit.js";
|
|
4
4
|
import { ContentTypeName } from "./contentType.js";
|
|
5
5
|
import { CiphersuiteImpl } from "./crypto/ciphersuite.js";
|
|
@@ -23,9 +23,13 @@ export interface FramedContentCommitData {
|
|
|
23
23
|
contentType: "commit";
|
|
24
24
|
commit: Commit;
|
|
25
25
|
}
|
|
26
|
+
export declare const framedContentApplicationDataEncoder: BufferEncoder<FramedContentApplicationData>;
|
|
26
27
|
export declare const encodeFramedContentApplicationData: Encoder<FramedContentApplicationData>;
|
|
28
|
+
export declare const framedContentProposalDataEncoder: BufferEncoder<FramedContentProposalData>;
|
|
27
29
|
export declare const encodeFramedContentProposalData: Encoder<FramedContentProposalData>;
|
|
30
|
+
export declare const framedContentCommitDataEncoder: BufferEncoder<FramedContentCommitData>;
|
|
28
31
|
export declare const encodeFramedContentCommitData: Encoder<FramedContentCommitData>;
|
|
32
|
+
export declare const framedContentInfoEncoder: BufferEncoder<FramedContentInfo>;
|
|
29
33
|
export declare const encodeFramedContentInfo: Encoder<FramedContentInfo>;
|
|
30
34
|
export declare const decodeFramedContentApplicationData: Decoder<FramedContentApplicationData>;
|
|
31
35
|
export declare const decodeFramedContentProposalData: Decoder<FramedContentProposalData>;
|
|
@@ -53,6 +57,7 @@ export type FramedContentNewMemberProposal = FramedContent & {
|
|
|
53
57
|
};
|
|
54
58
|
export type FramedContentCommit = FramedContentData & FramedContentCommitData;
|
|
55
59
|
export type FramedContentApplicationOrProposal = FramedContentData & (FramedContentApplicationData | FramedContentProposalData);
|
|
60
|
+
export declare const framedContentEncoder: BufferEncoder<FramedContent>;
|
|
56
61
|
export declare const encodeFramedContent: Encoder<FramedContent>;
|
|
57
62
|
export declare const decodeFramedContent: Decoder<FramedContent>;
|
|
58
63
|
type SenderInfo = SenderInfoMember | SenderInfoNewMemberCommit | SenderInfoExternal | SenderInfoNewMemberProposal;
|
|
@@ -70,6 +75,7 @@ type SenderInfoExternal = {
|
|
|
70
75
|
type SenderInfoNewMemberProposal = {
|
|
71
76
|
senderType: "new_member_proposal";
|
|
72
77
|
};
|
|
78
|
+
export declare const senderInfoEncoder: BufferEncoder<SenderInfo>;
|
|
73
79
|
export declare const encodeSenderInfo: Encoder<SenderInfo>;
|
|
74
80
|
export type FramedContentTBS = {
|
|
75
81
|
protocolVersion: ProtocolVersionName;
|
|
@@ -83,6 +89,7 @@ export type FramedContentTBSApplicationOrProposal = FramedContentTBS & {
|
|
|
83
89
|
content: FramedContentApplicationOrProposal;
|
|
84
90
|
};
|
|
85
91
|
export type FramedContentTBSExternal = FramedContentTBS & (SenderInfoExternal | SenderInfoNewMemberCommit | SenderInfoNewMemberProposal);
|
|
92
|
+
export declare const framedContentTBSEncoder: BufferEncoder<FramedContentTBS>;
|
|
86
93
|
export declare const encodeFramedContentTBS: Encoder<FramedContentTBS>;
|
|
87
94
|
export type FramedContentAuthData = FramedContentAuthDataCommit | FramedContentAuthDataApplicationOrProposal;
|
|
88
95
|
export type FramedContentAuthDataCommit = {
|
|
@@ -98,6 +105,7 @@ type FramedContentAuthDataContentCommit = {
|
|
|
98
105
|
type FramedContentAuthDataContentApplicationOrProposal = {
|
|
99
106
|
contentType: Exclude<ContentTypeName, "commit">;
|
|
100
107
|
};
|
|
108
|
+
export declare const framedContentAuthDataEncoder: BufferEncoder<FramedContentAuthData>;
|
|
101
109
|
export declare const encodeFramedContentAuthData: Encoder<FramedContentAuthData>;
|
|
102
110
|
export declare const decodeFramedContentAuthDataCommit: Decoder<FramedContentAuthDataContentCommit>;
|
|
103
111
|
export declare function decodeFramedContentAuthData(contentType: ContentTypeName): Decoder<FramedContentAuthData>;
|
package/dist/framedContent.js
CHANGED
|
@@ -1,28 +1,32 @@
|
|
|
1
|
-
import { decodeUint64,
|
|
1
|
+
import { decodeUint64, uint64Encoder } from "./codec/number.js";
|
|
2
2
|
import { flatMapDecoder, mapDecoder, mapDecoders } from "./codec/tlsDecoder.js";
|
|
3
|
-
import {
|
|
4
|
-
import { decodeVarLenData,
|
|
5
|
-
import { decodeCommit,
|
|
6
|
-
import {
|
|
3
|
+
import { contramapBufferEncoder, contramapBufferEncoders, encode, encVoid, } from "./codec/tlsEncoder.js";
|
|
4
|
+
import { decodeVarLenData, varLenDataEncoder } from "./codec/variableLength.js";
|
|
5
|
+
import { decodeCommit, commitEncoder } from "./commit.js";
|
|
6
|
+
import { contentTypeEncoder, decodeContentType } from "./contentType.js";
|
|
7
7
|
import { signWithLabel, verifyWithLabel } from "./crypto/signature.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { decodeProposal,
|
|
11
|
-
import {
|
|
12
|
-
import { decodeSender,
|
|
13
|
-
export const
|
|
14
|
-
export const
|
|
15
|
-
export const
|
|
16
|
-
export const
|
|
8
|
+
import { groupContextEncoder } from "./groupContext.js";
|
|
9
|
+
import { wireformatEncoder } from "./wireformat.js";
|
|
10
|
+
import { decodeProposal, proposalEncoder } from "./proposal.js";
|
|
11
|
+
import { protocolVersionEncoder } from "./protocolVersion.js";
|
|
12
|
+
import { decodeSender, senderEncoder, } from "./sender.js";
|
|
13
|
+
export const framedContentApplicationDataEncoder = contramapBufferEncoders([contentTypeEncoder, varLenDataEncoder], (f) => [f.contentType, f.applicationData]);
|
|
14
|
+
export const encodeFramedContentApplicationData = encode(framedContentApplicationDataEncoder);
|
|
15
|
+
export const framedContentProposalDataEncoder = contramapBufferEncoders([contentTypeEncoder, proposalEncoder], (f) => [f.contentType, f.proposal]);
|
|
16
|
+
export const encodeFramedContentProposalData = encode(framedContentProposalDataEncoder);
|
|
17
|
+
export const framedContentCommitDataEncoder = contramapBufferEncoders([contentTypeEncoder, commitEncoder], (f) => [f.contentType, f.commit]);
|
|
18
|
+
export const encodeFramedContentCommitData = encode(framedContentCommitDataEncoder);
|
|
19
|
+
export const framedContentInfoEncoder = (fc) => {
|
|
17
20
|
switch (fc.contentType) {
|
|
18
21
|
case "application":
|
|
19
|
-
return
|
|
22
|
+
return framedContentApplicationDataEncoder(fc);
|
|
20
23
|
case "proposal":
|
|
21
|
-
return
|
|
24
|
+
return framedContentProposalDataEncoder(fc);
|
|
22
25
|
case "commit":
|
|
23
|
-
return
|
|
26
|
+
return framedContentCommitDataEncoder(fc);
|
|
24
27
|
}
|
|
25
28
|
};
|
|
29
|
+
export const encodeFramedContentInfo = encode(framedContentInfoEncoder);
|
|
26
30
|
export const decodeFramedContentApplicationData = mapDecoder(decodeVarLenData, (applicationData) => ({ contentType: "application", applicationData }));
|
|
27
31
|
export const decodeFramedContentProposalData = mapDecoder(decodeProposal, (proposal) => ({ contentType: "proposal", proposal }));
|
|
28
32
|
export const decodeFramedContentCommitData = mapDecoder(decodeCommit, (commit) => ({
|
|
@@ -42,7 +46,8 @@ export const decodeFramedContentInfo = flatMapDecoder(decodeContentType, (conten
|
|
|
42
46
|
export function toTbs(content, wireformat, context) {
|
|
43
47
|
return { protocolVersion: context.version, wireformat, content, senderType: content.sender.senderType, context };
|
|
44
48
|
}
|
|
45
|
-
export const
|
|
49
|
+
export const framedContentEncoder = contramapBufferEncoders([varLenDataEncoder, uint64Encoder, senderEncoder, varLenDataEncoder, framedContentInfoEncoder], (fc) => [fc.groupId, fc.epoch, fc.sender, fc.authenticatedData, fc]);
|
|
50
|
+
export const encodeFramedContent = encode(framedContentEncoder);
|
|
46
51
|
export const decodeFramedContent = mapDecoders([decodeVarLenData, decodeUint64, decodeSender, decodeVarLenData, decodeFramedContentInfo], (groupId, epoch, sender, authenticatedData, info) => ({
|
|
47
52
|
groupId,
|
|
48
53
|
epoch,
|
|
@@ -50,28 +55,31 @@ export const decodeFramedContent = mapDecoders([decodeVarLenData, decodeUint64,
|
|
|
50
55
|
authenticatedData,
|
|
51
56
|
...info,
|
|
52
57
|
}));
|
|
53
|
-
export const
|
|
58
|
+
export const senderInfoEncoder = (info) => {
|
|
54
59
|
switch (info.senderType) {
|
|
55
60
|
case "member":
|
|
56
61
|
case "new_member_commit":
|
|
57
|
-
return
|
|
62
|
+
return groupContextEncoder(info.context);
|
|
58
63
|
case "external":
|
|
59
64
|
case "new_member_proposal":
|
|
60
|
-
return
|
|
65
|
+
return encVoid;
|
|
61
66
|
}
|
|
62
67
|
};
|
|
63
|
-
export const
|
|
68
|
+
export const encodeSenderInfo = encode(senderInfoEncoder);
|
|
69
|
+
export const framedContentTBSEncoder = contramapBufferEncoders([protocolVersionEncoder, wireformatEncoder, framedContentEncoder, senderInfoEncoder], (f) => [f.protocolVersion, f.wireformat, f.content, f]);
|
|
70
|
+
export const encodeFramedContentTBS = encode(framedContentTBSEncoder);
|
|
64
71
|
const encodeFramedContentAuthDataContent = (authData) => {
|
|
65
72
|
switch (authData.contentType) {
|
|
66
73
|
case "commit":
|
|
67
74
|
return encodeFramedContentAuthDataCommit(authData);
|
|
68
75
|
case "application":
|
|
69
76
|
case "proposal":
|
|
70
|
-
return
|
|
77
|
+
return encVoid;
|
|
71
78
|
}
|
|
72
79
|
};
|
|
73
|
-
const encodeFramedContentAuthDataCommit =
|
|
74
|
-
export const
|
|
80
|
+
const encodeFramedContentAuthDataCommit = contramapBufferEncoder(varLenDataEncoder, (data) => data.confirmationTag);
|
|
81
|
+
export const framedContentAuthDataEncoder = contramapBufferEncoders([varLenDataEncoder, encodeFramedContentAuthDataContent], (d) => [d.signature, d]);
|
|
82
|
+
export const encodeFramedContentAuthData = encode(framedContentAuthDataEncoder);
|
|
75
83
|
export const decodeFramedContentAuthDataCommit = mapDecoder(decodeVarLenData, (confirmationTag) => ({
|
|
76
84
|
contentType: "commit",
|
|
77
85
|
confirmationTag,
|
|
@@ -92,10 +100,10 @@ export function decodeFramedContentAuthData(contentType) {
|
|
|
92
100
|
}
|
|
93
101
|
}
|
|
94
102
|
export async function verifyFramedContentSignature(signKey, wireformat, content, auth, context, s) {
|
|
95
|
-
return verifyWithLabel(signKey, "FramedContentTBS",
|
|
103
|
+
return verifyWithLabel(signKey, "FramedContentTBS", encode(framedContentTBSEncoder)(toTbs(content, wireformat, context)), auth.signature, s);
|
|
96
104
|
}
|
|
97
105
|
export function signFramedContentTBS(signKey, tbs, s) {
|
|
98
|
-
return signWithLabel(signKey, "FramedContentTBS",
|
|
106
|
+
return signWithLabel(signKey, "FramedContentTBS", encode(framedContentTBSEncoder)(tbs), s);
|
|
99
107
|
}
|
|
100
108
|
export async function signFramedContentApplicationOrProposal(signKey, tbs, cs) {
|
|
101
109
|
const signature = await signFramedContentTBS(signKey, tbs, cs.signature);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framedContent.js","sourceRoot":"","sources":["../src/framedContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"framedContent.js","sourceRoot":"","sources":["../src/framedContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EAAW,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxF,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EAEvB,MAAM,EACN,OAAO,GAER,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC/E,OAAO,EAAU,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,EAAmB,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAGzF,OAAO,EAAa,aAAa,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACjF,OAAO,EAAE,mBAAmB,EAAgB,MAAM,mBAAmB,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAkB,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAY,MAAM,eAAe,CAAA;AACzE,OAAO,EAAE,sBAAsB,EAAuB,MAAM,sBAAsB,CAAA;AAClF,OAAO,EACL,YAAY,EACZ,aAAa,GAMd,MAAM,aAAa,CAAA;AAiBpB,MAAM,CAAC,MAAM,mCAAmC,GAAgD,uBAAuB,CACrH,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,EACvC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,eAAe,CAAU,CACnD,CAAA;AAED,MAAM,CAAC,MAAM,kCAAkC,GAA0C,MAAM,CAC7F,mCAAmC,CACpC,CAAA;AAED,MAAM,CAAC,MAAM,gCAAgC,GAA6C,uBAAuB,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AA;AAClD,CAAC"}
|
package/dist/groupContext.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Decoder } from "./codec/tlsDecoder.js";
|
|
2
|
-
import { Encoder } from "./codec/tlsEncoder.js";
|
|
2
|
+
import { BufferEncoder, Encoder } from "./codec/tlsEncoder.js";
|
|
3
3
|
import { CiphersuiteName } from "./crypto/ciphersuite.js";
|
|
4
4
|
import { Kdf } from "./crypto/kdf.js";
|
|
5
5
|
import { Extension } from "./extension.js";
|
|
@@ -13,6 +13,7 @@ export interface GroupContext {
|
|
|
13
13
|
confirmedTranscriptHash: Uint8Array;
|
|
14
14
|
extensions: Extension[];
|
|
15
15
|
}
|
|
16
|
+
export declare const groupContextEncoder: BufferEncoder<GroupContext>;
|
|
16
17
|
export declare const encodeGroupContext: Encoder<GroupContext>;
|
|
17
18
|
export declare const decodeGroupContext: Decoder<GroupContext>;
|
|
18
19
|
export declare function extractEpochSecret(context: GroupContext, joinerSecret: Uint8Array, kdf: Kdf, pskSecret?: Uint8Array): Promise<Uint8Array<ArrayBufferLike>>;
|
package/dist/groupContext.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { decodeUint64,
|
|
1
|
+
import { decodeUint64, uint64Encoder } from "./codec/number.js";
|
|
2
2
|
import { mapDecoders } from "./codec/tlsDecoder.js";
|
|
3
|
-
import {
|
|
4
|
-
import { decodeVarLenData, decodeVarLenType,
|
|
5
|
-
import {
|
|
3
|
+
import { contramapBufferEncoders, encode } from "./codec/tlsEncoder.js";
|
|
4
|
+
import { decodeVarLenData, decodeVarLenType, varLenDataEncoder, varLenTypeEncoder } from "./codec/variableLength.js";
|
|
5
|
+
import { ciphersuiteEncoder, decodeCiphersuite } from "./crypto/ciphersuite.js";
|
|
6
6
|
import { expandWithLabel } from "./crypto/kdf.js";
|
|
7
|
-
import { decodeExtension,
|
|
8
|
-
import { decodeProtocolVersion,
|
|
9
|
-
export const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
import { decodeExtension, extensionEncoder } from "./extension.js";
|
|
8
|
+
import { decodeProtocolVersion, protocolVersionEncoder } from "./protocolVersion.js";
|
|
9
|
+
export const groupContextEncoder = contramapBufferEncoders([
|
|
10
|
+
protocolVersionEncoder,
|
|
11
|
+
ciphersuiteEncoder,
|
|
12
|
+
varLenDataEncoder, // groupId
|
|
13
|
+
uint64Encoder, // epoch
|
|
14
|
+
varLenDataEncoder, // treeHash
|
|
15
|
+
varLenDataEncoder, // confirmedTranscriptHash
|
|
16
|
+
varLenTypeEncoder(extensionEncoder),
|
|
17
17
|
], (gc) => [gc.version, gc.cipherSuite, gc.groupId, gc.epoch, gc.treeHash, gc.confirmedTranscriptHash, gc.extensions]);
|
|
18
|
+
export const encodeGroupContext = encode(groupContextEncoder);
|
|
18
19
|
export const decodeGroupContext = mapDecoders([
|
|
19
20
|
decodeProtocolVersion,
|
|
20
21
|
decodeCiphersuite,
|
|
@@ -35,10 +36,10 @@ export const decodeGroupContext = mapDecoders([
|
|
|
35
36
|
export async function extractEpochSecret(context, joinerSecret, kdf, pskSecret) {
|
|
36
37
|
const psk = pskSecret === undefined ? new Uint8Array(kdf.size) : pskSecret;
|
|
37
38
|
const extracted = await kdf.extract(joinerSecret, psk);
|
|
38
|
-
return expandWithLabel(extracted, "epoch",
|
|
39
|
+
return expandWithLabel(extracted, "epoch", encode(groupContextEncoder)(context), kdf.size, kdf);
|
|
39
40
|
}
|
|
40
41
|
export async function extractJoinerSecret(context, previousInitSecret, commitSecret, kdf) {
|
|
41
42
|
const extracted = await kdf.extract(previousInitSecret, commitSecret);
|
|
42
|
-
return expandWithLabel(extracted, "joiner",
|
|
43
|
+
return expandWithLabel(extracted, "joiner", encode(groupContextEncoder)(context), kdf.size, kdf);
|
|
43
44
|
}
|
|
44
45
|
//# sourceMappingURL=groupContext.js.map
|
package/dist/groupContext.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groupContext.js","sourceRoot":"","sources":["../src/groupContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"groupContext.js","sourceRoot":"","sources":["../src/groupContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EAAW,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,uBAAuB,EAAiB,MAAM,EAAW,MAAM,uBAAuB,CAAA;AAC/F,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AACpH,OAAO,EAAmB,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAEhG,OAAO,EAAE,eAAe,EAAO,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAa,MAAM,gBAAgB,CAAA;AAE7E,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAuB,MAAM,sBAAsB,CAAA;AAYzG,MAAM,CAAC,MAAM,mBAAmB,GAAgC,uBAAuB,CACrF;IACE,sBAAsB;IACtB,kBAAkB;IAClB,iBAAiB,EAAE,UAAU;IAC7B,aAAa,EAAE,QAAQ;IACvB,iBAAiB,EAAE,WAAW;IAC9B,iBAAiB,EAAE,0BAA0B;IAC7C,iBAAiB,CAAC,gBAAgB,CAAC;CACpC,EACD,CAAC,EAAE,EAAE,EAAE,CACL,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,uBAAuB,EAAE,EAAE,CAAC,UAAU,CAAU,CACtH,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAA0B,MAAM,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I,EAAE,GAAG,CAAC,CAAA;AAClG,CAAC"}
|
package/dist/groupInfo.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Decoder } from "./codec/tlsDecoder.js";
|
|
2
|
-
import { Encoder } from "./codec/tlsEncoder.js";
|
|
2
|
+
import { BufferEncoder, Encoder } from "./codec/tlsEncoder.js";
|
|
3
3
|
import { CiphersuiteImpl } from "./crypto/ciphersuite.js";
|
|
4
4
|
import { Kdf } from "./crypto/kdf.js";
|
|
5
5
|
import { Signature } from "./crypto/signature.js";
|
|
@@ -12,11 +12,13 @@ export interface GroupInfoTBS {
|
|
|
12
12
|
confirmationTag: Uint8Array;
|
|
13
13
|
signer: number;
|
|
14
14
|
}
|
|
15
|
+
export declare const groupInfoTBSEncoder: BufferEncoder<GroupInfoTBS>;
|
|
15
16
|
export declare const encodeGroupInfoTBS: Encoder<GroupInfoTBS>;
|
|
16
17
|
export declare const decodeGroupInfoTBS: Decoder<GroupInfoTBS>;
|
|
17
18
|
export type GroupInfo = GroupInfoTBS & {
|
|
18
19
|
signature: Uint8Array;
|
|
19
20
|
};
|
|
21
|
+
export declare const groupInfoEncoder: BufferEncoder<GroupInfo>;
|
|
20
22
|
export declare const encodeGroupInfo: Encoder<GroupInfo>;
|
|
21
23
|
export declare const decodeGroupInfo: Decoder<GroupInfo>;
|
|
22
24
|
export declare function ratchetTreeFromExtension(info: GroupInfo): RatchetTree | undefined;
|
package/dist/groupInfo.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import { decodeUint32,
|
|
1
|
+
import { decodeUint32, uint32Encoder } from "./codec/number.js";
|
|
2
2
|
import { mapDecoders } from "./codec/tlsDecoder.js";
|
|
3
|
-
import {
|
|
4
|
-
import { decodeVarLenData, decodeVarLenType,
|
|
3
|
+
import { contramapBufferEncoders, encode } from "./codec/tlsEncoder.js";
|
|
4
|
+
import { decodeVarLenData, decodeVarLenType, varLenDataEncoder, varLenTypeEncoder } from "./codec/variableLength.js";
|
|
5
5
|
import { deriveSecret } from "./crypto/kdf.js";
|
|
6
6
|
import { signWithLabel, verifyWithLabel } from "./crypto/signature.js";
|
|
7
|
-
import { decodeExtension,
|
|
8
|
-
import { decodeGroupContext,
|
|
7
|
+
import { decodeExtension, extensionEncoder } from "./extension.js";
|
|
8
|
+
import { decodeGroupContext, groupContextEncoder, extractEpochSecret } from "./groupContext.js";
|
|
9
9
|
import { CodecError } from "./mlsError.js";
|
|
10
10
|
import { decodeRatchetTree } from "./ratchetTree.js";
|
|
11
|
-
export const
|
|
11
|
+
export const groupInfoTBSEncoder = contramapBufferEncoders([groupContextEncoder, varLenTypeEncoder(extensionEncoder), varLenDataEncoder, uint32Encoder], (g) => [g.groupContext, g.extensions, g.confirmationTag, g.signer]);
|
|
12
|
+
export const encodeGroupInfoTBS = encode(groupInfoTBSEncoder);
|
|
12
13
|
export const decodeGroupInfoTBS = mapDecoders([decodeGroupContext, decodeVarLenType(decodeExtension), decodeVarLenData, decodeUint32], (groupContext, extensions, confirmationTag, signer) => ({
|
|
13
14
|
groupContext,
|
|
14
15
|
extensions,
|
|
15
16
|
confirmationTag,
|
|
16
17
|
signer,
|
|
17
18
|
}));
|
|
18
|
-
export const
|
|
19
|
+
export const groupInfoEncoder = contramapBufferEncoders([groupInfoTBSEncoder, varLenDataEncoder], (g) => [g, g.signature]);
|
|
20
|
+
export const encodeGroupInfo = encode(groupInfoEncoder);
|
|
19
21
|
export const decodeGroupInfo = mapDecoders([decodeGroupInfoTBS, decodeVarLenData], (tbs, signature) => ({
|
|
20
22
|
...tbs,
|
|
21
23
|
signature,
|
|
@@ -30,11 +32,11 @@ export function ratchetTreeFromExtension(info) {
|
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
export async function signGroupInfo(tbs, privateKey, s) {
|
|
33
|
-
const signature = await signWithLabel(privateKey, "GroupInfoTBS",
|
|
35
|
+
const signature = await signWithLabel(privateKey, "GroupInfoTBS", encode(groupInfoTBSEncoder)(tbs), s);
|
|
34
36
|
return { ...tbs, signature };
|
|
35
37
|
}
|
|
36
38
|
export function verifyGroupInfoSignature(gi, publicKey, s) {
|
|
37
|
-
return verifyWithLabel(publicKey, "GroupInfoTBS",
|
|
39
|
+
return verifyWithLabel(publicKey, "GroupInfoTBS", encode(groupInfoTBSEncoder)(gi), gi.signature, s);
|
|
38
40
|
}
|
|
39
41
|
export async function verifyGroupInfoConfirmationTag(gi, joinerSecret, pskSecret, cs) {
|
|
40
42
|
const epochSecret = await extractEpochSecret(gi.groupContext, joinerSecret, cs.kdf, pskSecret);
|
package/dist/groupInfo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groupInfo.js","sourceRoot":"","sources":["../src/groupInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"groupInfo.js","sourceRoot":"","sources":["../src/groupInfo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC/D,OAAO,EAAW,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,uBAAuB,EAAiB,MAAM,EAAW,MAAM,uBAAuB,CAAA;AAC/F,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAEpH,OAAO,EAAE,YAAY,EAAO,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAa,aAAa,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACjF,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAa,MAAM,gBAAgB,CAAA;AAC7E,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,kBAAkB,EAAgB,MAAM,mBAAmB,CAAA;AAC7G,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,iBAAiB,EAAe,MAAM,kBAAkB,CAAA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AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,YAAwB,EAAE,SAAqB,EAAE,GAAQ;IAClG,OAAO,YAAY,CAAC,MAAM,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,CAAC,CAAA;AACjF,CAAC"}
|
package/dist/groupSecrets.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Decoder } from "./codec/tlsDecoder.js";
|
|
2
|
-
import { Encoder } from "./codec/tlsEncoder.js";
|
|
2
|
+
import { BufferEncoder, Encoder } from "./codec/tlsEncoder.js";
|
|
3
3
|
import { PreSharedKeyID } from "./presharedkey.js";
|
|
4
4
|
export interface GroupSecrets {
|
|
5
5
|
joinerSecret: Uint8Array;
|
|
6
6
|
pathSecret: Uint8Array | undefined;
|
|
7
7
|
psks: PreSharedKeyID[];
|
|
8
8
|
}
|
|
9
|
+
export declare const groupSecretsEncoder: BufferEncoder<GroupSecrets>;
|
|
9
10
|
export declare const encodeGroupSecrets: Encoder<GroupSecrets>;
|
|
10
11
|
export declare const decodeGroupSecrets: Decoder<GroupSecrets>;
|
package/dist/groupSecrets.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { decodeOptional,
|
|
1
|
+
import { decodeOptional, optionalEncoder } from "./codec/optional.js";
|
|
2
2
|
import { mapDecoders } from "./codec/tlsDecoder.js";
|
|
3
|
-
import {
|
|
4
|
-
import { decodeVarLenData, decodeVarLenType,
|
|
5
|
-
import { decodePskId,
|
|
6
|
-
export const
|
|
3
|
+
import { contramapBufferEncoders, encode } from "./codec/tlsEncoder.js";
|
|
4
|
+
import { decodeVarLenData, decodeVarLenType, varLenDataEncoder, varLenTypeEncoder } from "./codec/variableLength.js";
|
|
5
|
+
import { decodePskId, pskIdEncoder } from "./presharedkey.js";
|
|
6
|
+
export const groupSecretsEncoder = contramapBufferEncoders([varLenDataEncoder, optionalEncoder(varLenDataEncoder), varLenTypeEncoder(pskIdEncoder)], (gs) => [gs.joinerSecret, gs.pathSecret, gs.psks]);
|
|
7
|
+
export const encodeGroupSecrets = encode(groupSecretsEncoder);
|
|
7
8
|
export const decodeGroupSecrets = mapDecoders([decodeVarLenData, decodeOptional(decodeVarLenData), decodeVarLenType(decodePskId)], (joinerSecret, pathSecret, psks) => ({ joinerSecret, pathSecret, psks }));
|
|
8
9
|
//# sourceMappingURL=groupSecrets.js.map
|
package/dist/groupSecrets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groupSecrets.js","sourceRoot":"","sources":["../src/groupSecrets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"groupSecrets.js","sourceRoot":"","sources":["../src/groupSecrets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrE,OAAO,EAAW,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,uBAAuB,EAAiB,MAAM,EAAW,MAAM,uBAAuB,CAAA;AAC/F,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AACpH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,mBAAmB,CAAA;AAQ7E,MAAM,CAAC,MAAM,mBAAmB,GAAgC,uBAAuB,CACrF,CAAC,iBAAiB,EAAE,eAAe,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC,EACxF,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAU,CAC3D,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAA0B,MAAM,CAAC,mBAAmB,CAAC,CAAA;AAEpF,MAAM,CAAC,MAAM,kBAAkB,GAA0B,WAAW,CAClE,CAAC,gBAAgB,EAAE,cAAc,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC,EACnF,CAAC,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CACzE,CAAA"}
|
package/dist/hpkeCiphertext.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Decoder } from "./codec/tlsDecoder.js";
|
|
2
|
-
import { Encoder } from "./codec/tlsEncoder.js";
|
|
2
|
+
import { BufferEncoder, Encoder } from "./codec/tlsEncoder.js";
|
|
3
3
|
export interface HPKECiphertext {
|
|
4
4
|
kemOutput: Uint8Array;
|
|
5
5
|
ciphertext: Uint8Array;
|
|
6
6
|
}
|
|
7
|
+
export declare const hpkeCiphertextEncoder: BufferEncoder<HPKECiphertext>;
|
|
7
8
|
export declare const encodeHpkeCiphertext: Encoder<HPKECiphertext>;
|
|
8
9
|
export declare const decodeHpkeCiphertext: Decoder<HPKECiphertext>;
|
package/dist/hpkeCiphertext.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { mapDecoders } from "./codec/tlsDecoder.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export const
|
|
2
|
+
import { contramapBufferEncoders, encode } from "./codec/tlsEncoder.js";
|
|
3
|
+
import { varLenDataEncoder, decodeVarLenData } from "./codec/variableLength.js";
|
|
4
|
+
export const hpkeCiphertextEncoder = contramapBufferEncoders([varLenDataEncoder, varLenDataEncoder], (egs) => [egs.kemOutput, egs.ciphertext]);
|
|
5
|
+
export const encodeHpkeCiphertext = encode(hpkeCiphertextEncoder);
|
|
5
6
|
export const decodeHpkeCiphertext = mapDecoders([decodeVarLenData, decodeVarLenData], (kemOutput, ciphertext) => ({ kemOutput, ciphertext }));
|
|
6
7
|
//# sourceMappingURL=hpkeCiphertext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hpkeCiphertext.js","sourceRoot":"","sources":["../src/hpkeCiphertext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,
|
|
1
|
+
{"version":3,"file":"hpkeCiphertext.js","sourceRoot":"","sources":["../src/hpkeCiphertext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAiB,uBAAuB,EAAE,MAAM,EAAW,MAAM,uBAAuB,CAAA;AAC/F,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAO/E,MAAM,CAAC,MAAM,qBAAqB,GAAkC,uBAAuB,CACzF,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,EACtC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,UAAU,CAAU,CAClD,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAA4B,MAAM,CAAC,qBAAqB,CAAC,CAAA;AAE1F,MAAM,CAAC,MAAM,oBAAoB,GAA4B,WAAW,CACtE,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,EACpC,CAAC,SAAS,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CACvD,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export { type AuthenticationService, defaultAuthenticationService } from "./auth
|
|
|
12
12
|
export { type PaddingConfig, defaultPaddingConfig } from "./paddingConfig.js";
|
|
13
13
|
export { defaultKeyPackageEqualityConfig, type KeyPackageEqualityConfig } from "./keyPackageEqualityConfig.js";
|
|
14
14
|
export { type LifetimeConfig, defaultLifetimeConfig } from "./lifetimeConfig.js";
|
|
15
|
-
export { type PrivateKeyPackage, type KeyPackage, generateKeyPackage } from "./keyPackage.js";
|
|
15
|
+
export { type PrivateKeyPackage, type KeyPackage, generateKeyPackage, generateKeyPackageWithKey } from "./keyPackage.js";
|
|
16
16
|
export { type KeyRetentionConfig, defaultKeyRetentionConfig } from "./keyRetentionConfig.js";
|
|
17
17
|
export { createGroup, makePskIndex, joinGroup, joinGroupWithExtensions, type ClientState, type GroupActiveState, type EpochReceiverData, } from "./clientState.js";
|
|
18
18
|
export { createApplicationMessage, createProposal } from "./createMessage.js";
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ export { defaultAuthenticationService } from "./authenticationService.js";
|
|
|
8
8
|
export { defaultPaddingConfig } from "./paddingConfig.js";
|
|
9
9
|
export { defaultKeyPackageEqualityConfig } from "./keyPackageEqualityConfig.js";
|
|
10
10
|
export { defaultLifetimeConfig } from "./lifetimeConfig.js";
|
|
11
|
-
export { generateKeyPackage } from "./keyPackage.js";
|
|
11
|
+
export { generateKeyPackage, generateKeyPackageWithKey } from "./keyPackage.js";
|
|
12
12
|
export { defaultKeyRetentionConfig } from "./keyRetentionConfig.js";
|
|
13
13
|
export { createGroup, makePskIndex, joinGroup, joinGroupWithExtensions, } from "./clientState.js";
|
|
14
14
|
export { createApplicationMessage, createProposal } from "./createMessage.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAgC,MAAM,0BAA0B,CAAA;AAE7F,OAAO,EAAE,qBAAqB,EAAiC,MAAM,2BAA2B,CAAA;AAMhG,OAAO,EAAE,SAAS,EAA4D,MAAM,4BAA4B,CAAA;AAEhH,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAI3E,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAuB,MAAM,qBAAqB,CAAA;AAErG,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,GAE3B,MAAM,2BAA2B,CAA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AiB,EACjB,YAAY,EACZ,8BAA8B,EAC9B,4CAA4C,GAE7C,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,oBAAoB,GAErB,MAAM,sBAAsB,CAAA;AAI7B,OAAO,EAAiB,aAAa,EAAE,MAAM,eAAe,CAAA;AAE5D,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,mBAAmB,EACnB,WAAW,GACZ,MAAM,iBAAiB,CAAA;AAUxB,OAAO,EAIL,YAAY,EACZ,sBAAsB,GACvB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAGnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAA;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AAEnF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAiD,MAAM,cAAc,CAAA;AAChH,OAAO,EAAiB,eAAe,EAAE,MAAM,eAAe,CAAA;AAE9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA"}
|
package/dist/keyPackage.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Decoder } from "./codec/tlsDecoder.js";
|
|
2
|
-
import { Encoder } from "./codec/tlsEncoder.js";
|
|
2
|
+
import { BufferEncoder, Encoder } from "./codec/tlsEncoder.js";
|
|
3
3
|
import { CiphersuiteImpl, CiphersuiteName } from "./crypto/ciphersuite.js";
|
|
4
4
|
import { Hash } from "./crypto/hash.js";
|
|
5
5
|
import { Signature } from "./crypto/signature.js";
|
|
@@ -16,22 +16,31 @@ type KeyPackageTBS = {
|
|
|
16
16
|
leafNode: LeafNodeKeyPackage;
|
|
17
17
|
extensions: Extension[];
|
|
18
18
|
};
|
|
19
|
+
export declare const keyPackageTBSEncoder: BufferEncoder<KeyPackageTBS>;
|
|
19
20
|
export declare const encodeKeyPackageTBS: Encoder<KeyPackageTBS>;
|
|
20
21
|
export declare const decodeKeyPackageTBS: Decoder<KeyPackageTBS>;
|
|
21
22
|
export type KeyPackage = KeyPackageTBS & {
|
|
22
23
|
signature: Uint8Array;
|
|
23
24
|
};
|
|
25
|
+
export declare const keyPackageEncoder: BufferEncoder<KeyPackage>;
|
|
24
26
|
export declare const encodeKeyPackage: Encoder<KeyPackage>;
|
|
25
27
|
export declare const decodeKeyPackage: Decoder<KeyPackage>;
|
|
26
28
|
export declare function signKeyPackage(tbs: KeyPackageTBS, signKey: Uint8Array, s: Signature): Promise<KeyPackage>;
|
|
27
29
|
export declare function verifyKeyPackage(kp: KeyPackage, s: Signature): Promise<boolean>;
|
|
28
|
-
export declare function makeKeyPackageRef(value: KeyPackage, h: Hash): Promise<Uint8Array
|
|
30
|
+
export declare function makeKeyPackageRef(value: KeyPackage, h: Hash): Promise<Uint8Array>;
|
|
29
31
|
export interface PrivateKeyPackage {
|
|
30
32
|
initPrivateKey: Uint8Array;
|
|
31
33
|
hpkePrivateKey: Uint8Array;
|
|
32
34
|
signaturePrivateKey: Uint8Array;
|
|
33
35
|
}
|
|
34
|
-
export declare function
|
|
36
|
+
export declare function generateKeyPackageWithKey(credential: Credential, capabilities: Capabilities, lifetime: Lifetime, extensions: Extension[], signatrueKeyPair: {
|
|
37
|
+
signKey: Uint8Array;
|
|
38
|
+
publicKey: Uint8Array;
|
|
39
|
+
}, cs: CiphersuiteImpl, leafNodeExtensions?: Extension[]): Promise<{
|
|
40
|
+
publicPackage: KeyPackage;
|
|
41
|
+
privatePackage: PrivateKeyPackage;
|
|
42
|
+
}>;
|
|
43
|
+
export declare function generateKeyPackage(credential: Credential, capabilities: Capabilities, lifetime: Lifetime, extensions: Extension[], cs: CiphersuiteImpl, leafNodeExtensions?: Extension[]): Promise<{
|
|
35
44
|
publicPackage: KeyPackage;
|
|
36
45
|
privatePackage: PrivateKeyPackage;
|
|
37
46
|
}>;
|