envelope.d.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /** An authenticated message of arbitrary type. */
  2. export interface Envelope {
  3. /**
  4. * Message to be signed. (In JSON, this is encoded as base64.)
  5. * REQUIRED.
  6. */
  7. payload: Buffer;
  8. /**
  9. * String unambiguously identifying how to interpret payload.
  10. * REQUIRED.
  11. */
  12. payloadType: string;
  13. /**
  14. * Signature over:
  15. * PAE(type, payload)
  16. * Where PAE is defined as:
  17. * PAE(type, payload) = "DSSEv1" + SP + LEN(type) + SP + type + SP + LEN(payload) + SP + payload
  18. * + = concatenation
  19. * SP = ASCII space [0x20]
  20. * "DSSEv1" = ASCII [0x44, 0x53, 0x53, 0x45, 0x76, 0x31]
  21. * LEN(s) = ASCII decimal encoding of the byte length of s, with no leading zeros
  22. * REQUIRED (length >= 1).
  23. */
  24. signatures: Signature[];
  25. }
  26. export interface Signature {
  27. /**
  28. * Signature itself. (In JSON, this is encoded as base64.)
  29. * REQUIRED.
  30. */
  31. sig: Buffer;
  32. /**
  33. * Unauthenticated* hint identifying which public key was used.
  34. * OPTIONAL.
  35. */
  36. keyid: string;
  37. }
  38. export declare const Envelope: MessageFns<Envelope>;
  39. export declare const Signature: MessageFns<Signature>;
  40. interface MessageFns<T> {
  41. fromJSON(object: any): T;
  42. toJSON(message: T): unknown;
  43. }
  44. export {};