@xmtp/proto
Advanced tools
Comparing version 3.4.0 to 3.5.0
{ | ||
"name": "@xmtp/proto", | ||
"version": "3.4.0", | ||
"version": "3.5.0", | ||
"description": "Protobuf client and generated classes for GRPC API", | ||
@@ -5,0 +5,0 @@ "main": "./ts/dist/cjs/node.js", |
@@ -1,5 +0,11 @@ | ||
# proto | ||
This is the authoritative source of information about the XTMP protocol itself. It contains | ||
Shared Protocol Buffers and their associated generated code | ||
* an overview of the protocol [PROTOCOL.md](https://github.com/xmtp/proto/blob/main/PROTOCOL.md) | ||
* the protobuf definitions of all the elements of the protocol [/proto](https://github.com/xmtp/proto/blob/main/proto) | ||
* code generated from the protobuf definitions [go/](https://github.com/xmtp/proto/blob/main/go) | ||
Note that the generated typescript code is not committed here, instead it is generated dynamically when publishing the [proto package to npm](https://www.npmjs.com/package/@xmtp/proto) | ||
The overview and the protobuf files together form the definition of the protocol. The overview leans heavily on the protobuf files and also serves as a guide for finding the relevant details in them. | ||
## Working on this repo | ||
@@ -6,0 +12,0 @@ |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EncryptedPrivateKeyBundle = exports.EncryptedPrivateKeyBundleV1 = exports.PrivateKeyBundle = exports.PrivateKeyBundleV2 = exports.SignedPrivateKey_Secp256k1 = exports.SignedPrivateKey = exports.PrivateKeyBundleV1 = exports.PrivateKey_Secp256k1 = exports.PrivateKey = exports.protobufPackage = void 0; | ||
exports.EncryptedPrivateKeyBundle = exports.EncryptedPrivateKeyBundleV1 = exports.PrivateKeyBundle = exports.PrivateKeyBundleV1 = exports.PrivateKey_Secp256k1 = exports.PrivateKey = exports.PrivateKeyBundleV2 = exports.SignedPrivateKey_Secp256k1 = exports.SignedPrivateKey = exports.protobufPackage = void 0; | ||
/* eslint-disable */ | ||
@@ -14,15 +14,15 @@ const long_1 = __importDefault(require("long")); | ||
exports.protobufPackage = "xmtp.message_contents"; | ||
function createBasePrivateKey() { | ||
return { timestamp: long_1.default.UZERO, secp256k1: undefined, publicKey: undefined }; | ||
function createBaseSignedPrivateKey() { | ||
return { createdNs: long_1.default.UZERO, secp256k1: undefined, publicKey: undefined }; | ||
} | ||
exports.PrivateKey = { | ||
exports.SignedPrivateKey = { | ||
encode(message, writer = minimal_1.default.Writer.create()) { | ||
if (!message.timestamp.isZero()) { | ||
writer.uint32(8).uint64(message.timestamp); | ||
if (!message.createdNs.isZero()) { | ||
writer.uint32(8).uint64(message.createdNs); | ||
} | ||
if (message.secp256k1 !== undefined) { | ||
exports.PrivateKey_Secp256k1.encode(message.secp256k1, writer.uint32(18).fork()).ldelim(); | ||
exports.SignedPrivateKey_Secp256k1.encode(message.secp256k1, writer.uint32(18).fork()).ldelim(); | ||
} | ||
if (message.publicKey !== undefined) { | ||
public_key_pb_1.PublicKey.encode(message.publicKey, writer.uint32(26).fork()).ldelim(); | ||
public_key_pb_1.SignedPublicKey.encode(message.publicKey, writer.uint32(26).fork()).ldelim(); | ||
} | ||
@@ -34,3 +34,3 @@ return writer; | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBasePrivateKey(); | ||
const message = createBaseSignedPrivateKey(); | ||
while (reader.pos < end) { | ||
@@ -40,9 +40,9 @@ const tag = reader.uint32(); | ||
case 1: | ||
message.timestamp = reader.uint64(); | ||
message.createdNs = reader.uint64(); | ||
break; | ||
case 2: | ||
message.secp256k1 = exports.PrivateKey_Secp256k1.decode(reader, reader.uint32()); | ||
message.secp256k1 = exports.SignedPrivateKey_Secp256k1.decode(reader, reader.uint32()); | ||
break; | ||
case 3: | ||
message.publicKey = public_key_pb_1.PublicKey.decode(reader, reader.uint32()); | ||
message.publicKey = public_key_pb_1.SignedPublicKey.decode(reader, reader.uint32()); | ||
break; | ||
@@ -58,10 +58,10 @@ default: | ||
return { | ||
timestamp: isSet(object.timestamp) | ||
? long_1.default.fromValue(object.timestamp) | ||
createdNs: isSet(object.createdNs) | ||
? long_1.default.fromValue(object.createdNs) | ||
: long_1.default.UZERO, | ||
secp256k1: isSet(object.secp256k1) | ||
? exports.PrivateKey_Secp256k1.fromJSON(object.secp256k1) | ||
? exports.SignedPrivateKey_Secp256k1.fromJSON(object.secp256k1) | ||
: undefined, | ||
publicKey: isSet(object.publicKey) | ||
? public_key_pb_1.PublicKey.fromJSON(object.publicKey) | ||
? public_key_pb_1.SignedPublicKey.fromJSON(object.publicKey) | ||
: undefined, | ||
@@ -72,11 +72,11 @@ }; | ||
const obj = {}; | ||
message.timestamp !== undefined && | ||
(obj.timestamp = (message.timestamp || long_1.default.UZERO).toString()); | ||
message.createdNs !== undefined && | ||
(obj.createdNs = (message.createdNs || long_1.default.UZERO).toString()); | ||
message.secp256k1 !== undefined && | ||
(obj.secp256k1 = message.secp256k1 | ||
? exports.PrivateKey_Secp256k1.toJSON(message.secp256k1) | ||
? exports.SignedPrivateKey_Secp256k1.toJSON(message.secp256k1) | ||
: undefined); | ||
message.publicKey !== undefined && | ||
(obj.publicKey = message.publicKey | ||
? public_key_pb_1.PublicKey.toJSON(message.publicKey) | ||
? public_key_pb_1.SignedPublicKey.toJSON(message.publicKey) | ||
: undefined); | ||
@@ -86,14 +86,14 @@ return obj; | ||
fromPartial(object) { | ||
const message = createBasePrivateKey(); | ||
message.timestamp = | ||
object.timestamp !== undefined && object.timestamp !== null | ||
? long_1.default.fromValue(object.timestamp) | ||
const message = createBaseSignedPrivateKey(); | ||
message.createdNs = | ||
object.createdNs !== undefined && object.createdNs !== null | ||
? long_1.default.fromValue(object.createdNs) | ||
: long_1.default.UZERO; | ||
message.secp256k1 = | ||
object.secp256k1 !== undefined && object.secp256k1 !== null | ||
? exports.PrivateKey_Secp256k1.fromPartial(object.secp256k1) | ||
? exports.SignedPrivateKey_Secp256k1.fromPartial(object.secp256k1) | ||
: undefined; | ||
message.publicKey = | ||
object.publicKey !== undefined && object.publicKey !== null | ||
? public_key_pb_1.PublicKey.fromPartial(object.publicKey) | ||
? public_key_pb_1.SignedPublicKey.fromPartial(object.publicKey) | ||
: undefined; | ||
@@ -103,6 +103,6 @@ return message; | ||
}; | ||
function createBasePrivateKey_Secp256k1() { | ||
function createBaseSignedPrivateKey_Secp256k1() { | ||
return { bytes: new Uint8Array() }; | ||
} | ||
exports.PrivateKey_Secp256k1 = { | ||
exports.SignedPrivateKey_Secp256k1 = { | ||
encode(message, writer = minimal_1.default.Writer.create()) { | ||
@@ -117,3 +117,3 @@ if (message.bytes.length !== 0) { | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBasePrivateKey_Secp256k1(); | ||
const message = createBaseSignedPrivateKey_Secp256k1(); | ||
while (reader.pos < end) { | ||
@@ -147,3 +147,3 @@ const tag = reader.uint32(); | ||
var _a; | ||
const message = createBasePrivateKey_Secp256k1(); | ||
const message = createBaseSignedPrivateKey_Secp256k1(); | ||
message.bytes = (_a = object.bytes) !== null && _a !== void 0 ? _a : new Uint8Array(); | ||
@@ -153,12 +153,12 @@ return message; | ||
}; | ||
function createBasePrivateKeyBundleV1() { | ||
function createBasePrivateKeyBundleV2() { | ||
return { identityKey: undefined, preKeys: [] }; | ||
} | ||
exports.PrivateKeyBundleV1 = { | ||
exports.PrivateKeyBundleV2 = { | ||
encode(message, writer = minimal_1.default.Writer.create()) { | ||
if (message.identityKey !== undefined) { | ||
exports.PrivateKey.encode(message.identityKey, writer.uint32(10).fork()).ldelim(); | ||
exports.SignedPrivateKey.encode(message.identityKey, writer.uint32(10).fork()).ldelim(); | ||
} | ||
for (const v of message.preKeys) { | ||
exports.PrivateKey.encode(v, writer.uint32(18).fork()).ldelim(); | ||
exports.SignedPrivateKey.encode(v, writer.uint32(18).fork()).ldelim(); | ||
} | ||
@@ -170,3 +170,3 @@ return writer; | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBasePrivateKeyBundleV1(); | ||
const message = createBasePrivateKeyBundleV2(); | ||
while (reader.pos < end) { | ||
@@ -176,6 +176,6 @@ const tag = reader.uint32(); | ||
case 1: | ||
message.identityKey = exports.PrivateKey.decode(reader, reader.uint32()); | ||
message.identityKey = exports.SignedPrivateKey.decode(reader, reader.uint32()); | ||
break; | ||
case 2: | ||
message.preKeys.push(exports.PrivateKey.decode(reader, reader.uint32())); | ||
message.preKeys.push(exports.SignedPrivateKey.decode(reader, reader.uint32())); | ||
break; | ||
@@ -192,6 +192,6 @@ default: | ||
identityKey: isSet(object.identityKey) | ||
? exports.PrivateKey.fromJSON(object.identityKey) | ||
? exports.SignedPrivateKey.fromJSON(object.identityKey) | ||
: undefined, | ||
preKeys: Array.isArray(object === null || object === void 0 ? void 0 : object.preKeys) | ||
? object.preKeys.map((e) => exports.PrivateKey.fromJSON(e)) | ||
? object.preKeys.map((e) => exports.SignedPrivateKey.fromJSON(e)) | ||
: [], | ||
@@ -204,6 +204,6 @@ }; | ||
(obj.identityKey = message.identityKey | ||
? exports.PrivateKey.toJSON(message.identityKey) | ||
? exports.SignedPrivateKey.toJSON(message.identityKey) | ||
: undefined); | ||
if (message.preKeys) { | ||
obj.preKeys = message.preKeys.map((e) => e ? exports.PrivateKey.toJSON(e) : undefined); | ||
obj.preKeys = message.preKeys.map((e) => e ? exports.SignedPrivateKey.toJSON(e) : undefined); | ||
} | ||
@@ -217,25 +217,25 @@ else { | ||
var _a; | ||
const message = createBasePrivateKeyBundleV1(); | ||
const message = createBasePrivateKeyBundleV2(); | ||
message.identityKey = | ||
object.identityKey !== undefined && object.identityKey !== null | ||
? exports.PrivateKey.fromPartial(object.identityKey) | ||
? exports.SignedPrivateKey.fromPartial(object.identityKey) | ||
: undefined; | ||
message.preKeys = | ||
((_a = object.preKeys) === null || _a === void 0 ? void 0 : _a.map((e) => exports.PrivateKey.fromPartial(e))) || []; | ||
((_a = object.preKeys) === null || _a === void 0 ? void 0 : _a.map((e) => exports.SignedPrivateKey.fromPartial(e))) || []; | ||
return message; | ||
}, | ||
}; | ||
function createBaseSignedPrivateKey() { | ||
return { createdNs: long_1.default.UZERO, secp256k1: undefined, publicKey: undefined }; | ||
function createBasePrivateKey() { | ||
return { timestamp: long_1.default.UZERO, secp256k1: undefined, publicKey: undefined }; | ||
} | ||
exports.SignedPrivateKey = { | ||
exports.PrivateKey = { | ||
encode(message, writer = minimal_1.default.Writer.create()) { | ||
if (!message.createdNs.isZero()) { | ||
writer.uint32(8).uint64(message.createdNs); | ||
if (!message.timestamp.isZero()) { | ||
writer.uint32(8).uint64(message.timestamp); | ||
} | ||
if (message.secp256k1 !== undefined) { | ||
exports.SignedPrivateKey_Secp256k1.encode(message.secp256k1, writer.uint32(18).fork()).ldelim(); | ||
exports.PrivateKey_Secp256k1.encode(message.secp256k1, writer.uint32(18).fork()).ldelim(); | ||
} | ||
if (message.publicKey !== undefined) { | ||
public_key_pb_1.SignedPublicKey.encode(message.publicKey, writer.uint32(26).fork()).ldelim(); | ||
public_key_pb_1.PublicKey.encode(message.publicKey, writer.uint32(26).fork()).ldelim(); | ||
} | ||
@@ -247,3 +247,3 @@ return writer; | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseSignedPrivateKey(); | ||
const message = createBasePrivateKey(); | ||
while (reader.pos < end) { | ||
@@ -253,9 +253,9 @@ const tag = reader.uint32(); | ||
case 1: | ||
message.createdNs = reader.uint64(); | ||
message.timestamp = reader.uint64(); | ||
break; | ||
case 2: | ||
message.secp256k1 = exports.SignedPrivateKey_Secp256k1.decode(reader, reader.uint32()); | ||
message.secp256k1 = exports.PrivateKey_Secp256k1.decode(reader, reader.uint32()); | ||
break; | ||
case 3: | ||
message.publicKey = public_key_pb_1.SignedPublicKey.decode(reader, reader.uint32()); | ||
message.publicKey = public_key_pb_1.PublicKey.decode(reader, reader.uint32()); | ||
break; | ||
@@ -271,10 +271,10 @@ default: | ||
return { | ||
createdNs: isSet(object.createdNs) | ||
? long_1.default.fromValue(object.createdNs) | ||
timestamp: isSet(object.timestamp) | ||
? long_1.default.fromValue(object.timestamp) | ||
: long_1.default.UZERO, | ||
secp256k1: isSet(object.secp256k1) | ||
? exports.SignedPrivateKey_Secp256k1.fromJSON(object.secp256k1) | ||
? exports.PrivateKey_Secp256k1.fromJSON(object.secp256k1) | ||
: undefined, | ||
publicKey: isSet(object.publicKey) | ||
? public_key_pb_1.SignedPublicKey.fromJSON(object.publicKey) | ||
? public_key_pb_1.PublicKey.fromJSON(object.publicKey) | ||
: undefined, | ||
@@ -285,11 +285,11 @@ }; | ||
const obj = {}; | ||
message.createdNs !== undefined && | ||
(obj.createdNs = (message.createdNs || long_1.default.UZERO).toString()); | ||
message.timestamp !== undefined && | ||
(obj.timestamp = (message.timestamp || long_1.default.UZERO).toString()); | ||
message.secp256k1 !== undefined && | ||
(obj.secp256k1 = message.secp256k1 | ||
? exports.SignedPrivateKey_Secp256k1.toJSON(message.secp256k1) | ||
? exports.PrivateKey_Secp256k1.toJSON(message.secp256k1) | ||
: undefined); | ||
message.publicKey !== undefined && | ||
(obj.publicKey = message.publicKey | ||
? public_key_pb_1.SignedPublicKey.toJSON(message.publicKey) | ||
? public_key_pb_1.PublicKey.toJSON(message.publicKey) | ||
: undefined); | ||
@@ -299,14 +299,14 @@ return obj; | ||
fromPartial(object) { | ||
const message = createBaseSignedPrivateKey(); | ||
message.createdNs = | ||
object.createdNs !== undefined && object.createdNs !== null | ||
? long_1.default.fromValue(object.createdNs) | ||
const message = createBasePrivateKey(); | ||
message.timestamp = | ||
object.timestamp !== undefined && object.timestamp !== null | ||
? long_1.default.fromValue(object.timestamp) | ||
: long_1.default.UZERO; | ||
message.secp256k1 = | ||
object.secp256k1 !== undefined && object.secp256k1 !== null | ||
? exports.SignedPrivateKey_Secp256k1.fromPartial(object.secp256k1) | ||
? exports.PrivateKey_Secp256k1.fromPartial(object.secp256k1) | ||
: undefined; | ||
message.publicKey = | ||
object.publicKey !== undefined && object.publicKey !== null | ||
? public_key_pb_1.SignedPublicKey.fromPartial(object.publicKey) | ||
? public_key_pb_1.PublicKey.fromPartial(object.publicKey) | ||
: undefined; | ||
@@ -316,6 +316,6 @@ return message; | ||
}; | ||
function createBaseSignedPrivateKey_Secp256k1() { | ||
function createBasePrivateKey_Secp256k1() { | ||
return { bytes: new Uint8Array() }; | ||
} | ||
exports.SignedPrivateKey_Secp256k1 = { | ||
exports.PrivateKey_Secp256k1 = { | ||
encode(message, writer = minimal_1.default.Writer.create()) { | ||
@@ -330,3 +330,3 @@ if (message.bytes.length !== 0) { | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseSignedPrivateKey_Secp256k1(); | ||
const message = createBasePrivateKey_Secp256k1(); | ||
while (reader.pos < end) { | ||
@@ -360,3 +360,3 @@ const tag = reader.uint32(); | ||
var _a; | ||
const message = createBaseSignedPrivateKey_Secp256k1(); | ||
const message = createBasePrivateKey_Secp256k1(); | ||
message.bytes = (_a = object.bytes) !== null && _a !== void 0 ? _a : new Uint8Array(); | ||
@@ -366,12 +366,12 @@ return message; | ||
}; | ||
function createBasePrivateKeyBundleV2() { | ||
function createBasePrivateKeyBundleV1() { | ||
return { identityKey: undefined, preKeys: [] }; | ||
} | ||
exports.PrivateKeyBundleV2 = { | ||
exports.PrivateKeyBundleV1 = { | ||
encode(message, writer = minimal_1.default.Writer.create()) { | ||
if (message.identityKey !== undefined) { | ||
exports.SignedPrivateKey.encode(message.identityKey, writer.uint32(10).fork()).ldelim(); | ||
exports.PrivateKey.encode(message.identityKey, writer.uint32(10).fork()).ldelim(); | ||
} | ||
for (const v of message.preKeys) { | ||
exports.SignedPrivateKey.encode(v, writer.uint32(18).fork()).ldelim(); | ||
exports.PrivateKey.encode(v, writer.uint32(18).fork()).ldelim(); | ||
} | ||
@@ -383,3 +383,3 @@ return writer; | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBasePrivateKeyBundleV2(); | ||
const message = createBasePrivateKeyBundleV1(); | ||
while (reader.pos < end) { | ||
@@ -389,6 +389,6 @@ const tag = reader.uint32(); | ||
case 1: | ||
message.identityKey = exports.SignedPrivateKey.decode(reader, reader.uint32()); | ||
message.identityKey = exports.PrivateKey.decode(reader, reader.uint32()); | ||
break; | ||
case 2: | ||
message.preKeys.push(exports.SignedPrivateKey.decode(reader, reader.uint32())); | ||
message.preKeys.push(exports.PrivateKey.decode(reader, reader.uint32())); | ||
break; | ||
@@ -405,6 +405,6 @@ default: | ||
identityKey: isSet(object.identityKey) | ||
? exports.SignedPrivateKey.fromJSON(object.identityKey) | ||
? exports.PrivateKey.fromJSON(object.identityKey) | ||
: undefined, | ||
preKeys: Array.isArray(object === null || object === void 0 ? void 0 : object.preKeys) | ||
? object.preKeys.map((e) => exports.SignedPrivateKey.fromJSON(e)) | ||
? object.preKeys.map((e) => exports.PrivateKey.fromJSON(e)) | ||
: [], | ||
@@ -417,6 +417,6 @@ }; | ||
(obj.identityKey = message.identityKey | ||
? exports.SignedPrivateKey.toJSON(message.identityKey) | ||
? exports.PrivateKey.toJSON(message.identityKey) | ||
: undefined); | ||
if (message.preKeys) { | ||
obj.preKeys = message.preKeys.map((e) => e ? exports.SignedPrivateKey.toJSON(e) : undefined); | ||
obj.preKeys = message.preKeys.map((e) => e ? exports.PrivateKey.toJSON(e) : undefined); | ||
} | ||
@@ -430,9 +430,9 @@ else { | ||
var _a; | ||
const message = createBasePrivateKeyBundleV2(); | ||
const message = createBasePrivateKeyBundleV1(); | ||
message.identityKey = | ||
object.identityKey !== undefined && object.identityKey !== null | ||
? exports.SignedPrivateKey.fromPartial(object.identityKey) | ||
? exports.PrivateKey.fromPartial(object.identityKey) | ||
: undefined; | ||
message.preKeys = | ||
((_a = object.preKeys) === null || _a === void 0 ? void 0 : _a.map((e) => exports.SignedPrivateKey.fromPartial(e))) || []; | ||
((_a = object.preKeys) === null || _a === void 0 ? void 0 : _a.map((e) => exports.PrivateKey.fromPartial(e))) || []; | ||
return message; | ||
@@ -439,0 +439,0 @@ }, |
/* eslint-disable */ | ||
import Long from "long"; | ||
import { PublicKey, SignedPublicKey } from "./public_key.pb"; | ||
import { SignedPublicKey, PublicKey } from "./public_key.pb"; | ||
import { Ciphertext } from "./ciphertext.pb"; | ||
import _m0 from "protobufjs/minimal"; | ||
export const protobufPackage = "xmtp.message_contents"; | ||
function createBasePrivateKey() { | ||
return { timestamp: Long.UZERO, secp256k1: undefined, publicKey: undefined }; | ||
function createBaseSignedPrivateKey() { | ||
return { createdNs: Long.UZERO, secp256k1: undefined, publicKey: undefined }; | ||
} | ||
export const PrivateKey = { | ||
export const SignedPrivateKey = { | ||
encode(message, writer = _m0.Writer.create()) { | ||
if (!message.timestamp.isZero()) { | ||
writer.uint32(8).uint64(message.timestamp); | ||
if (!message.createdNs.isZero()) { | ||
writer.uint32(8).uint64(message.createdNs); | ||
} | ||
if (message.secp256k1 !== undefined) { | ||
PrivateKey_Secp256k1.encode(message.secp256k1, writer.uint32(18).fork()).ldelim(); | ||
SignedPrivateKey_Secp256k1.encode(message.secp256k1, writer.uint32(18).fork()).ldelim(); | ||
} | ||
if (message.publicKey !== undefined) { | ||
PublicKey.encode(message.publicKey, writer.uint32(26).fork()).ldelim(); | ||
SignedPublicKey.encode(message.publicKey, writer.uint32(26).fork()).ldelim(); | ||
} | ||
@@ -26,3 +26,3 @@ return writer; | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBasePrivateKey(); | ||
const message = createBaseSignedPrivateKey(); | ||
while (reader.pos < end) { | ||
@@ -32,9 +32,9 @@ const tag = reader.uint32(); | ||
case 1: | ||
message.timestamp = reader.uint64(); | ||
message.createdNs = reader.uint64(); | ||
break; | ||
case 2: | ||
message.secp256k1 = PrivateKey_Secp256k1.decode(reader, reader.uint32()); | ||
message.secp256k1 = SignedPrivateKey_Secp256k1.decode(reader, reader.uint32()); | ||
break; | ||
case 3: | ||
message.publicKey = PublicKey.decode(reader, reader.uint32()); | ||
message.publicKey = SignedPublicKey.decode(reader, reader.uint32()); | ||
break; | ||
@@ -50,10 +50,10 @@ default: | ||
return { | ||
timestamp: isSet(object.timestamp) | ||
? Long.fromValue(object.timestamp) | ||
createdNs: isSet(object.createdNs) | ||
? Long.fromValue(object.createdNs) | ||
: Long.UZERO, | ||
secp256k1: isSet(object.secp256k1) | ||
? PrivateKey_Secp256k1.fromJSON(object.secp256k1) | ||
? SignedPrivateKey_Secp256k1.fromJSON(object.secp256k1) | ||
: undefined, | ||
publicKey: isSet(object.publicKey) | ||
? PublicKey.fromJSON(object.publicKey) | ||
? SignedPublicKey.fromJSON(object.publicKey) | ||
: undefined, | ||
@@ -64,11 +64,11 @@ }; | ||
const obj = {}; | ||
message.timestamp !== undefined && | ||
(obj.timestamp = (message.timestamp || Long.UZERO).toString()); | ||
message.createdNs !== undefined && | ||
(obj.createdNs = (message.createdNs || Long.UZERO).toString()); | ||
message.secp256k1 !== undefined && | ||
(obj.secp256k1 = message.secp256k1 | ||
? PrivateKey_Secp256k1.toJSON(message.secp256k1) | ||
? SignedPrivateKey_Secp256k1.toJSON(message.secp256k1) | ||
: undefined); | ||
message.publicKey !== undefined && | ||
(obj.publicKey = message.publicKey | ||
? PublicKey.toJSON(message.publicKey) | ||
? SignedPublicKey.toJSON(message.publicKey) | ||
: undefined); | ||
@@ -78,14 +78,14 @@ return obj; | ||
fromPartial(object) { | ||
const message = createBasePrivateKey(); | ||
message.timestamp = | ||
object.timestamp !== undefined && object.timestamp !== null | ||
? Long.fromValue(object.timestamp) | ||
const message = createBaseSignedPrivateKey(); | ||
message.createdNs = | ||
object.createdNs !== undefined && object.createdNs !== null | ||
? Long.fromValue(object.createdNs) | ||
: Long.UZERO; | ||
message.secp256k1 = | ||
object.secp256k1 !== undefined && object.secp256k1 !== null | ||
? PrivateKey_Secp256k1.fromPartial(object.secp256k1) | ||
? SignedPrivateKey_Secp256k1.fromPartial(object.secp256k1) | ||
: undefined; | ||
message.publicKey = | ||
object.publicKey !== undefined && object.publicKey !== null | ||
? PublicKey.fromPartial(object.publicKey) | ||
? SignedPublicKey.fromPartial(object.publicKey) | ||
: undefined; | ||
@@ -95,6 +95,6 @@ return message; | ||
}; | ||
function createBasePrivateKey_Secp256k1() { | ||
function createBaseSignedPrivateKey_Secp256k1() { | ||
return { bytes: new Uint8Array() }; | ||
} | ||
export const PrivateKey_Secp256k1 = { | ||
export const SignedPrivateKey_Secp256k1 = { | ||
encode(message, writer = _m0.Writer.create()) { | ||
@@ -109,3 +109,3 @@ if (message.bytes.length !== 0) { | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBasePrivateKey_Secp256k1(); | ||
const message = createBaseSignedPrivateKey_Secp256k1(); | ||
while (reader.pos < end) { | ||
@@ -139,3 +139,3 @@ const tag = reader.uint32(); | ||
var _a; | ||
const message = createBasePrivateKey_Secp256k1(); | ||
const message = createBaseSignedPrivateKey_Secp256k1(); | ||
message.bytes = (_a = object.bytes) !== null && _a !== void 0 ? _a : new Uint8Array(); | ||
@@ -145,12 +145,12 @@ return message; | ||
}; | ||
function createBasePrivateKeyBundleV1() { | ||
function createBasePrivateKeyBundleV2() { | ||
return { identityKey: undefined, preKeys: [] }; | ||
} | ||
export const PrivateKeyBundleV1 = { | ||
export const PrivateKeyBundleV2 = { | ||
encode(message, writer = _m0.Writer.create()) { | ||
if (message.identityKey !== undefined) { | ||
PrivateKey.encode(message.identityKey, writer.uint32(10).fork()).ldelim(); | ||
SignedPrivateKey.encode(message.identityKey, writer.uint32(10).fork()).ldelim(); | ||
} | ||
for (const v of message.preKeys) { | ||
PrivateKey.encode(v, writer.uint32(18).fork()).ldelim(); | ||
SignedPrivateKey.encode(v, writer.uint32(18).fork()).ldelim(); | ||
} | ||
@@ -162,3 +162,3 @@ return writer; | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBasePrivateKeyBundleV1(); | ||
const message = createBasePrivateKeyBundleV2(); | ||
while (reader.pos < end) { | ||
@@ -168,6 +168,6 @@ const tag = reader.uint32(); | ||
case 1: | ||
message.identityKey = PrivateKey.decode(reader, reader.uint32()); | ||
message.identityKey = SignedPrivateKey.decode(reader, reader.uint32()); | ||
break; | ||
case 2: | ||
message.preKeys.push(PrivateKey.decode(reader, reader.uint32())); | ||
message.preKeys.push(SignedPrivateKey.decode(reader, reader.uint32())); | ||
break; | ||
@@ -184,6 +184,6 @@ default: | ||
identityKey: isSet(object.identityKey) | ||
? PrivateKey.fromJSON(object.identityKey) | ||
? SignedPrivateKey.fromJSON(object.identityKey) | ||
: undefined, | ||
preKeys: Array.isArray(object === null || object === void 0 ? void 0 : object.preKeys) | ||
? object.preKeys.map((e) => PrivateKey.fromJSON(e)) | ||
? object.preKeys.map((e) => SignedPrivateKey.fromJSON(e)) | ||
: [], | ||
@@ -196,6 +196,6 @@ }; | ||
(obj.identityKey = message.identityKey | ||
? PrivateKey.toJSON(message.identityKey) | ||
? SignedPrivateKey.toJSON(message.identityKey) | ||
: undefined); | ||
if (message.preKeys) { | ||
obj.preKeys = message.preKeys.map((e) => e ? PrivateKey.toJSON(e) : undefined); | ||
obj.preKeys = message.preKeys.map((e) => e ? SignedPrivateKey.toJSON(e) : undefined); | ||
} | ||
@@ -209,25 +209,25 @@ else { | ||
var _a; | ||
const message = createBasePrivateKeyBundleV1(); | ||
const message = createBasePrivateKeyBundleV2(); | ||
message.identityKey = | ||
object.identityKey !== undefined && object.identityKey !== null | ||
? PrivateKey.fromPartial(object.identityKey) | ||
? SignedPrivateKey.fromPartial(object.identityKey) | ||
: undefined; | ||
message.preKeys = | ||
((_a = object.preKeys) === null || _a === void 0 ? void 0 : _a.map((e) => PrivateKey.fromPartial(e))) || []; | ||
((_a = object.preKeys) === null || _a === void 0 ? void 0 : _a.map((e) => SignedPrivateKey.fromPartial(e))) || []; | ||
return message; | ||
}, | ||
}; | ||
function createBaseSignedPrivateKey() { | ||
return { createdNs: Long.UZERO, secp256k1: undefined, publicKey: undefined }; | ||
function createBasePrivateKey() { | ||
return { timestamp: Long.UZERO, secp256k1: undefined, publicKey: undefined }; | ||
} | ||
export const SignedPrivateKey = { | ||
export const PrivateKey = { | ||
encode(message, writer = _m0.Writer.create()) { | ||
if (!message.createdNs.isZero()) { | ||
writer.uint32(8).uint64(message.createdNs); | ||
if (!message.timestamp.isZero()) { | ||
writer.uint32(8).uint64(message.timestamp); | ||
} | ||
if (message.secp256k1 !== undefined) { | ||
SignedPrivateKey_Secp256k1.encode(message.secp256k1, writer.uint32(18).fork()).ldelim(); | ||
PrivateKey_Secp256k1.encode(message.secp256k1, writer.uint32(18).fork()).ldelim(); | ||
} | ||
if (message.publicKey !== undefined) { | ||
SignedPublicKey.encode(message.publicKey, writer.uint32(26).fork()).ldelim(); | ||
PublicKey.encode(message.publicKey, writer.uint32(26).fork()).ldelim(); | ||
} | ||
@@ -239,3 +239,3 @@ return writer; | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseSignedPrivateKey(); | ||
const message = createBasePrivateKey(); | ||
while (reader.pos < end) { | ||
@@ -245,9 +245,9 @@ const tag = reader.uint32(); | ||
case 1: | ||
message.createdNs = reader.uint64(); | ||
message.timestamp = reader.uint64(); | ||
break; | ||
case 2: | ||
message.secp256k1 = SignedPrivateKey_Secp256k1.decode(reader, reader.uint32()); | ||
message.secp256k1 = PrivateKey_Secp256k1.decode(reader, reader.uint32()); | ||
break; | ||
case 3: | ||
message.publicKey = SignedPublicKey.decode(reader, reader.uint32()); | ||
message.publicKey = PublicKey.decode(reader, reader.uint32()); | ||
break; | ||
@@ -263,10 +263,10 @@ default: | ||
return { | ||
createdNs: isSet(object.createdNs) | ||
? Long.fromValue(object.createdNs) | ||
timestamp: isSet(object.timestamp) | ||
? Long.fromValue(object.timestamp) | ||
: Long.UZERO, | ||
secp256k1: isSet(object.secp256k1) | ||
? SignedPrivateKey_Secp256k1.fromJSON(object.secp256k1) | ||
? PrivateKey_Secp256k1.fromJSON(object.secp256k1) | ||
: undefined, | ||
publicKey: isSet(object.publicKey) | ||
? SignedPublicKey.fromJSON(object.publicKey) | ||
? PublicKey.fromJSON(object.publicKey) | ||
: undefined, | ||
@@ -277,11 +277,11 @@ }; | ||
const obj = {}; | ||
message.createdNs !== undefined && | ||
(obj.createdNs = (message.createdNs || Long.UZERO).toString()); | ||
message.timestamp !== undefined && | ||
(obj.timestamp = (message.timestamp || Long.UZERO).toString()); | ||
message.secp256k1 !== undefined && | ||
(obj.secp256k1 = message.secp256k1 | ||
? SignedPrivateKey_Secp256k1.toJSON(message.secp256k1) | ||
? PrivateKey_Secp256k1.toJSON(message.secp256k1) | ||
: undefined); | ||
message.publicKey !== undefined && | ||
(obj.publicKey = message.publicKey | ||
? SignedPublicKey.toJSON(message.publicKey) | ||
? PublicKey.toJSON(message.publicKey) | ||
: undefined); | ||
@@ -291,14 +291,14 @@ return obj; | ||
fromPartial(object) { | ||
const message = createBaseSignedPrivateKey(); | ||
message.createdNs = | ||
object.createdNs !== undefined && object.createdNs !== null | ||
? Long.fromValue(object.createdNs) | ||
const message = createBasePrivateKey(); | ||
message.timestamp = | ||
object.timestamp !== undefined && object.timestamp !== null | ||
? Long.fromValue(object.timestamp) | ||
: Long.UZERO; | ||
message.secp256k1 = | ||
object.secp256k1 !== undefined && object.secp256k1 !== null | ||
? SignedPrivateKey_Secp256k1.fromPartial(object.secp256k1) | ||
? PrivateKey_Secp256k1.fromPartial(object.secp256k1) | ||
: undefined; | ||
message.publicKey = | ||
object.publicKey !== undefined && object.publicKey !== null | ||
? SignedPublicKey.fromPartial(object.publicKey) | ||
? PublicKey.fromPartial(object.publicKey) | ||
: undefined; | ||
@@ -308,6 +308,6 @@ return message; | ||
}; | ||
function createBaseSignedPrivateKey_Secp256k1() { | ||
function createBasePrivateKey_Secp256k1() { | ||
return { bytes: new Uint8Array() }; | ||
} | ||
export const SignedPrivateKey_Secp256k1 = { | ||
export const PrivateKey_Secp256k1 = { | ||
encode(message, writer = _m0.Writer.create()) { | ||
@@ -322,3 +322,3 @@ if (message.bytes.length !== 0) { | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBaseSignedPrivateKey_Secp256k1(); | ||
const message = createBasePrivateKey_Secp256k1(); | ||
while (reader.pos < end) { | ||
@@ -352,3 +352,3 @@ const tag = reader.uint32(); | ||
var _a; | ||
const message = createBaseSignedPrivateKey_Secp256k1(); | ||
const message = createBasePrivateKey_Secp256k1(); | ||
message.bytes = (_a = object.bytes) !== null && _a !== void 0 ? _a : new Uint8Array(); | ||
@@ -358,12 +358,12 @@ return message; | ||
}; | ||
function createBasePrivateKeyBundleV2() { | ||
function createBasePrivateKeyBundleV1() { | ||
return { identityKey: undefined, preKeys: [] }; | ||
} | ||
export const PrivateKeyBundleV2 = { | ||
export const PrivateKeyBundleV1 = { | ||
encode(message, writer = _m0.Writer.create()) { | ||
if (message.identityKey !== undefined) { | ||
SignedPrivateKey.encode(message.identityKey, writer.uint32(10).fork()).ldelim(); | ||
PrivateKey.encode(message.identityKey, writer.uint32(10).fork()).ldelim(); | ||
} | ||
for (const v of message.preKeys) { | ||
SignedPrivateKey.encode(v, writer.uint32(18).fork()).ldelim(); | ||
PrivateKey.encode(v, writer.uint32(18).fork()).ldelim(); | ||
} | ||
@@ -375,3 +375,3 @@ return writer; | ||
let end = length === undefined ? reader.len : reader.pos + length; | ||
const message = createBasePrivateKeyBundleV2(); | ||
const message = createBasePrivateKeyBundleV1(); | ||
while (reader.pos < end) { | ||
@@ -381,6 +381,6 @@ const tag = reader.uint32(); | ||
case 1: | ||
message.identityKey = SignedPrivateKey.decode(reader, reader.uint32()); | ||
message.identityKey = PrivateKey.decode(reader, reader.uint32()); | ||
break; | ||
case 2: | ||
message.preKeys.push(SignedPrivateKey.decode(reader, reader.uint32())); | ||
message.preKeys.push(PrivateKey.decode(reader, reader.uint32())); | ||
break; | ||
@@ -397,6 +397,6 @@ default: | ||
identityKey: isSet(object.identityKey) | ||
? SignedPrivateKey.fromJSON(object.identityKey) | ||
? PrivateKey.fromJSON(object.identityKey) | ||
: undefined, | ||
preKeys: Array.isArray(object === null || object === void 0 ? void 0 : object.preKeys) | ||
? object.preKeys.map((e) => SignedPrivateKey.fromJSON(e)) | ||
? object.preKeys.map((e) => PrivateKey.fromJSON(e)) | ||
: [], | ||
@@ -409,6 +409,6 @@ }; | ||
(obj.identityKey = message.identityKey | ||
? SignedPrivateKey.toJSON(message.identityKey) | ||
? PrivateKey.toJSON(message.identityKey) | ||
: undefined); | ||
if (message.preKeys) { | ||
obj.preKeys = message.preKeys.map((e) => e ? SignedPrivateKey.toJSON(e) : undefined); | ||
obj.preKeys = message.preKeys.map((e) => e ? PrivateKey.toJSON(e) : undefined); | ||
} | ||
@@ -422,9 +422,9 @@ else { | ||
var _a; | ||
const message = createBasePrivateKeyBundleV2(); | ||
const message = createBasePrivateKeyBundleV1(); | ||
message.identityKey = | ||
object.identityKey !== undefined && object.identityKey !== null | ||
? SignedPrivateKey.fromPartial(object.identityKey) | ||
? PrivateKey.fromPartial(object.identityKey) | ||
: undefined; | ||
message.preKeys = | ||
((_a = object.preKeys) === null || _a === void 0 ? void 0 : _a.map((e) => SignedPrivateKey.fromPartial(e))) || []; | ||
((_a = object.preKeys) === null || _a === void 0 ? void 0 : _a.map((e) => PrivateKey.fromPartial(e))) || []; | ||
return message; | ||
@@ -431,0 +431,0 @@ }, |
@@ -6,3 +6,3 @@ import Long from "long"; | ||
export declare const protobufPackage = "xmtp.message_api.v1"; | ||
/** Authn protocol */ | ||
/** Client authentication protocol */ | ||
/** | ||
@@ -9,0 +9,0 @@ * Token is used by clients to prove to the nodes |
@@ -13,3 +13,3 @@ import Long from "long"; | ||
/** | ||
* User key bundle V1 using PublicKeys. | ||
* LEGACY: User key bundle V1 using PublicKeys. | ||
* The PublicKeys MUST be signed. | ||
@@ -16,0 +16,0 @@ */ |
@@ -14,3 +14,3 @@ import Long from "long"; | ||
/** | ||
* topic name chosen for this conversion. | ||
* topic name chosen for this conversation. | ||
* It MUST be randomly generated bytes (length >= 32), | ||
@@ -33,3 +33,3 @@ * then base64 encoded without padding | ||
} | ||
/** The Tag type */ | ||
/** The context type */ | ||
export interface InvitationV1_Context { | ||
@@ -36,0 +36,0 @@ /** Expected to be a URI (ie xmtp.org/convo1) */ |
@@ -29,6 +29,3 @@ import Long from "long"; | ||
} | ||
/** | ||
* PublicKeyBundle packages the cryptographic keys associated with a wallet, | ||
* both senders and recipients are identified by their key bundles. | ||
*/ | ||
/** PublicKeyBundle packages the cryptographic keys associated with a wallet. */ | ||
export interface SignedPublicKeyBundle { | ||
@@ -35,0 +32,0 @@ /** Identity key MUST be signed by the wallet. */ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
960316
18
15325