import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; import type { IBinaryWriter } from "@protobuf-ts/runtime"; import type { BinaryReadOptions } from "@protobuf-ts/runtime"; import type { IBinaryReader } from "@protobuf-ts/runtime"; import type { PartialMessage } from "@protobuf-ts/runtime"; import { MessageType } from "@protobuf-ts/runtime"; /** * * A signature and details to help verify it. * * #### Generation * * - Compute a CID from the `piece` bytes using details from `signature`: * - [CIDv1](https://github.com/multiformats/cid). * - The hash function should be blake2b-256 and `multiHashType` should be empty. * - Content type codec `0x55` * - Base encoded in Base32 with the prefix `b` * - Example: bafk2bzacea73ycjnxe2qov7cvnhx52lzfp6nf5jcblnfus6gqreh6ygganbws * * - Store the public key of the signer in `publicKey` in binary encoding. * * - Store the current time in `timestamp` * - In JavaScript: `timestamp = +new Date()` * * - Format the current time in ISO 8601 `YYYY-MM-DDTHH:mm:ss.sssZ` * - In JavaScript: `timeText = new Date(timestamp).toISOString()` * - In Go format: `2006-01-02T15:04:05.000Z` * * - The signed message to store a piece is: * - `DDC store ${CID} at ${timeText}` * - Note: the `` part is enforced by the Polkadot.js browser extension. * - Example: `DDC store bafk2bzacea73ycjnxe2qov7cvnhx52lzfp6nf5jcblnfus6gqreh6ygganbws at 2022-06-27T07:33:44.607Z` * * - The signing scheme should be sr25519, and `scheme` should be empty. * - If this not supported by a signer, then `scheme` should be "ed25519". * * - Sign and store the signature in `sig` in binary encoding. * * #### Verification * * - Recompute the signed message using the details in `signature`. * - Verify `sig` given the scheme, the message, and the public key. * * #### Legacy signatures before v0.1.4 * * If `timestamp == 0`, assume an older version: * - Decode `value` and `signer` from hexadecimal with or without `0x`. * - Then the signed message is either `${CID}` or `${CID}`. * * * @generated from protobuf message pb.Signature */ export interface Signature { /** * The cryptographic signature in binary encoding as per the scheme. * * @generated from protobuf field: bytes value = 1; */ value: Uint8Array; /** * The public key of the signer in binary encoding as per the scheme. * * @generated from protobuf field: bytes signer = 2; */ signer: Uint8Array; /** * The name of the signature scheme (sr25519, secp256k1, ed25519). * Default and recommended value: "" or "sr25519". * * @generated from protobuf field: string scheme = 3; */ scheme: string; /** * The ID of the hashing algorithm as per multiformats/multihash. * Default and recommended value: 0 or 0xb220, meaning blake2b-256. * * @generated from protobuf field: uint64 multiHashType = 4; */ multiHashType: bigint; /** * The timestamp in UNIX milliseconds. * * @generated from protobuf field: uint64 timestamp = 5; */ timestamp: bigint; } declare class Signature$Type extends MessageType { constructor(); create(value?: PartialMessage): Signature; internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Signature): Signature; internalBinaryWrite(message: Signature, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter; } /** * @generated MessageType for protobuf message pb.Signature */ export declare const Signature: Signature$Type; export {}; //# sourceMappingURL=signature.d.ts.map