{"version":3,"file":"index.cjs","sources":["../../../../../../src/mods/secp256k1/signature/index.ts"],"sourcesContent":["import { Base16 } from \"@hazae41/base16\"\nimport { Box } from \"@hazae41/box\"\nimport { Bytes, Uint8Array } from \"@hazae41/bytes\"\nimport { Cursor } from \"@hazae41/cursor\"\nimport { RawHexString, ZeroHexString } from \"@hazae41/hexane\"\nimport { Secp256k1 } from \"@hazae41/secp256k1\"\nimport { Copiable } from \"libs/copiable/index.js\"\nimport { BytesAsInteger, CopiableBytesAsInteger, NumberAsInteger, RawHexAsInteger, ZeroHexAsInteger } from \"../../convert/index.js\"\n\nexport type Signature =\n  | RsvZeroHexSignature\n  | RsvBytesSignature\n  | ZeroHexSignature\n  | BytesSignature\n  | ExtSignature\n\nexport namespace Signature {\n\n  export type From =\n    | RsvZeroHexSignature.From\n    | RsvBytesSignature.From\n    | ZeroHexSignature.From\n    | BytesSignature.From\n    | ExtSignature.From\n\n  export function fromOrThrow(from: Signature.From): Signature {\n    if (from instanceof Secp256k1.SignatureAndRecovery)\n      return from\n    if (from instanceof Uint8Array)\n      return BytesSignature.fromBytesOrThrow(from)\n    if (typeof from === \"object\")\n      return RsvZeroHexSignature.fromRsvOrThrow(from)\n    return ZeroHexSignature.fromOtherOrThrow(from)\n  }\n\n}\n\nexport type RsvSignature =\n  | RsvZeroHexSignature\n  | RsvBytesSignature\n\nexport namespace RsvSignature {\n\n  export type From =\n    | RsvZeroHexSignature.From\n    | RsvBytesSignature.From\n\n}\n\nexport interface RsvZeroHexSignatureInit {\n  readonly r: ZeroHexString<32>\n  readonly s: ZeroHexString<32>\n  readonly v: number\n}\n\nexport class RsvZeroHexSignature {\n\n  constructor(\n    readonly r: ZeroHexString<32>,\n    readonly s: ZeroHexString<32>,\n    readonly v: number\n  ) { }\n\n}\n\nexport namespace RsvZeroHexSignature {\n\n  export interface From {\n    readonly r: ZeroHexAsInteger.From\n    readonly s: ZeroHexAsInteger.From\n    readonly v: NumberAsInteger.From\n  }\n\n  export function fromOrThrow(from: Signature.From): RsvZeroHexSignature {\n    if (from instanceof Secp256k1.SignatureAndRecovery)\n      return fromExtOrThrow(from)\n    if (from instanceof Uint8Array)\n      return fromBytesOrThrow(from)\n    if (typeof from === \"object\")\n      return fromRsvOrThrow(from)\n    return fromOtherOrThrow(from)\n  }\n\n  export function fromExtOrThrow(from: ExtSignature): RsvZeroHexSignature {\n    using slice = from.exportOrThrow()\n\n    const cursor = new Cursor(slice.bytes)\n\n    const hr = Base16.get().getOrThrow().encodeOrThrow(cursor.readOrThrow(32)) as ZeroHexString<32>\n    const hs = Base16.get().getOrThrow().encodeOrThrow(cursor.readOrThrow(32)) as ZeroHexString<32>\n\n    const v = cursor.readUint8OrThrow()\n\n    return new RsvZeroHexSignature(hr, hs, v)\n  }\n\n  export function fromBytesOrThrow(from: Uint8Array): RsvZeroHexSignature {\n    const cursor = new Cursor(from)\n\n    const hr = Base16.get().getOrThrow().encodeOrThrow(cursor.readOrThrow(32)) as ZeroHexString<32>\n    const hs = Base16.get().getOrThrow().encodeOrThrow(cursor.readOrThrow(32)) as ZeroHexString<32>\n\n    const v = cursor.readUint8OrThrow()\n\n    return new RsvZeroHexSignature(hr, hs, v)\n  }\n\n  export function fromRsvOrThrow(from: RsvSignature.From): RsvZeroHexSignature {\n    const { r, s, v } = from\n\n    const hr = ZeroHexAsInteger.Length.fromOrThrow(r, 32)\n    const hs = ZeroHexAsInteger.Length.fromOrThrow(s, 32)\n    const nv = NumberAsInteger.fromOrThrow(v)\n\n    return new RsvZeroHexSignature(hr, hs, nv)\n  }\n\n  export function fromOtherOrThrow(from: ZeroHexAsInteger.From): RsvZeroHexSignature {\n    const bytes = BytesAsInteger.Length.fromOrThrow(from, 65)\n\n    const cursor = new Cursor(bytes)\n\n    const hr = Base16.get().getOrThrow().encodeOrThrow(cursor.readOrThrow(32)) as ZeroHexString<32>\n    const hs = Base16.get().getOrThrow().encodeOrThrow(cursor.readOrThrow(32)) as ZeroHexString<32>\n\n    const v = cursor.readUint8OrThrow()\n\n    return new RsvZeroHexSignature(hr, hs, v)\n  }\n\n}\n\nexport interface RsvBytesSignature {\n  readonly r: Uint8Array<32>\n  readonly s: Uint8Array<32>\n  readonly v: number\n}\n\nexport class RsvBytesSignature {\n\n  constructor(\n    readonly r: Uint8Array<32>,\n    readonly s: Uint8Array<32>,\n    readonly v: number\n  ) { }\n\n}\n\nexport namespace RsvBytesSignature {\n\n  export interface From {\n    readonly r: BytesAsInteger.From\n    readonly s: BytesAsInteger.From\n    readonly v: NumberAsInteger.From\n  }\n\n  export function fromOrThrow(from: Signature.From): RsvBytesSignature {\n    if (from instanceof Secp256k1.SignatureAndRecovery)\n      return fromExtOrThrow(from)\n    if (from instanceof Uint8Array)\n      return fromBytesOrThrow(from)\n    if (typeof from === \"object\")\n      return fromRsvOrThrow(from)\n    return fromOtherOrThrow(from)\n  }\n\n  export function fromExtOrThrow(from: ExtSignature): RsvBytesSignature {\n    using slice = from.exportOrThrow()\n\n    const cursor = new Cursor(slice.bytes)\n\n    const r = cursor.readAndCopyOrThrow(32)\n    const s = cursor.readAndCopyOrThrow(32)\n    const v = cursor.readUint8OrThrow()\n\n    return new RsvBytesSignature(r, s, v)\n  }\n\n  export function fromBytesOrThrow(from: Uint8Array): RsvBytesSignature {\n    const cursor = new Cursor(from)\n\n    const r = cursor.readAndCopyOrThrow(32)\n    const s = cursor.readAndCopyOrThrow(32)\n    const v = cursor.readUint8OrThrow()\n\n    return new RsvBytesSignature(r, s, v)\n  }\n\n  export function fromRsvOrThrow(from: RsvSignature.From): RsvBytesSignature {\n    const { r, s, v } = from\n\n    const br = BytesAsInteger.Length.fromOrThrow(r, 32)\n    const bs = BytesAsInteger.Length.fromOrThrow(s, 32)\n    const nv = NumberAsInteger.fromOrThrow(v)\n\n    return new RsvBytesSignature(br, bs, nv)\n  }\n\n  export function fromOtherOrThrow(from: BytesAsInteger.From): RsvBytesSignature {\n    const bytes = BytesAsInteger.Length.fromOrThrow(from, 65)\n\n    const cursor = new Cursor(bytes)\n\n    const r = cursor.readAndCopyOrThrow(32)\n    const s = cursor.readAndCopyOrThrow(32)\n    const v = cursor.readUint8OrThrow()\n\n    return new RsvBytesSignature(r, s, v)\n  }\n\n}\n\nexport type ZeroHexSignature = ZeroHexString<65>\n\nexport namespace ZeroHexSignature {\n\n  export type From = ZeroHexAsInteger.From\n\n  export function fromOrThrow(from: Signature.From): ZeroHexSignature {\n    if (from instanceof Secp256k1.SignatureAndRecovery)\n      return fromExtOrThrow(from)\n    if (from instanceof Uint8Array)\n      return fromBytesOrThrow(from)\n    if (typeof from === \"object\")\n      return fromRsvOrThrow(from)\n    return fromOtherOrThrow(from)\n  }\n\n  export function fromExtOrThrow(from: ExtSignature): ZeroHexSignature {\n    using slice = from.exportOrThrow()\n\n    const base16 = Base16.get().getOrThrow().encodeOrThrow(slice.bytes)\n\n    return `0x${base16}` as ZeroHexString<65>\n  }\n\n  export function fromBytesOrThrow(from: Uint8Array): ZeroHexSignature {\n    const bytes = Bytes.castOrThrow(from, 65)\n    const base16 = Base16.get().getOrThrow().encodeOrThrow(bytes)\n\n    return `0x${base16}` as ZeroHexString<65>\n  }\n\n  export function fromRsvOrThrow(from: RsvSignature.From): ZeroHexSignature {\n    const { r, s, v } = from\n\n    const hr = RawHexAsInteger.Length.fromOrThrow(r, 32)\n    const hs = RawHexAsInteger.Length.fromOrThrow(s, 32)\n\n    const hvx = RawHexAsInteger.fromOrThrow(v)\n    const hvp = RawHexString.padStart(hvx)\n\n    return `0x${hr}${hs}${hvp}` as ZeroHexString<65>\n  }\n\n  export function fromOtherOrThrow(from: ZeroHexAsInteger.From): ZeroHexSignature {\n    return ZeroHexAsInteger.Length.fromOrThrow(from, 65)\n  }\n\n}\n\nexport type BytesSignature = Uint8Array<65>\n\nexport namespace BytesSignature {\n\n  export type From = BytesAsInteger.From\n\n  export function fromOrThrow(from: Signature.From): BytesSignature {\n    if (from instanceof Secp256k1.SignatureAndRecovery)\n      return fromExtOrThrow(from)\n    if (from instanceof Uint8Array)\n      return fromBytesOrThrow(from)\n    if (typeof from === \"object\")\n      return fromRsvOrThrow(from)\n    return fromOtherOrThrow(from)\n  }\n\n  export function fromExtOrThrow(from: ExtSignature): BytesSignature {\n    return Copiable.copyAndDispose(from.exportOrThrow()) as Uint8Array<65>\n  }\n\n  export function fromBytesOrThrow(from: Uint8Array): BytesSignature {\n    return Bytes.castOrThrow(from, 65) as Uint8Array<65>\n  }\n\n  export function fromRsvOrThrow(from: RsvSignature.From): BytesSignature {\n    const { r, s, v } = from\n\n    using br = CopiableBytesAsInteger.Length.fromOrThrow(r, 32)\n    using bs = CopiableBytesAsInteger.Length.fromOrThrow(s, 32)\n\n    const cursor = new Cursor(new Uint8Array(65))\n\n    cursor.writeOrThrow(br.bytes)\n    cursor.writeOrThrow(bs.bytes)\n\n    cursor.writeUint8OrThrow(NumberAsInteger.fromOrThrow(v))\n\n    return cursor.bytes as Uint8Array<65>\n  }\n\n  export function fromOtherOrThrow(from: BytesAsInteger.From): BytesSignature {\n    return BytesAsInteger.Length.fromOrThrow(from, 65)\n  }\n\n}\n\nexport type ExtSignature = Secp256k1.SignatureAndRecovery\n\nexport namespace ExtSignature {\n\n  export type From = Secp256k1.SignatureAndRecovery\n\n  export function fromOrThrow(from: Signature.From): Box<ExtSignature> {\n    if (from instanceof Secp256k1.SignatureAndRecovery)\n      return fromExtOrThrow(from)\n    if (from instanceof Uint8Array)\n      return fromBytesOrThrow(from)\n    if (typeof from === \"object\")\n      return fromRsvOrThrow(from)\n    return fromOtherOrThrow(from)\n  }\n\n  export function fromRsvOrThrow(from: RsvSignature.From): Box<ExtSignature> {\n    const { r, s, v } = from\n\n    using br = CopiableBytesAsInteger.Length.fromOrThrow(r, 32)\n    using bs = CopiableBytesAsInteger.Length.fromOrThrow(s, 32)\n\n    const cursor = new Cursor(new Uint8Array(65))\n\n    cursor.writeOrThrow(br.bytes)\n    cursor.writeOrThrow(bs.bytes)\n\n    cursor.writeUint8OrThrow(NumberAsInteger.fromOrThrow(v))\n\n    return new Box(Secp256k1.get().getOrThrow().SignatureAndRecovery.importOrThrow(cursor.bytes))\n  }\n\n  export function fromBytesOrThrow(from: Uint8Array): Box<ExtSignature> {\n    return new Box(Secp256k1.get().getOrThrow().SignatureAndRecovery.importOrThrow(Bytes.castOrThrow(from, 65)))\n  }\n\n  export function fromOtherOrThrow(from: BytesAsInteger.From): Box<ExtSignature> {\n    return new Box(Secp256k1.get().getOrThrow().SignatureAndRecovery.importOrThrow(BytesAsInteger.Length.fromOrThrow(from, 65)))\n  }\n\n  export function fromExtOrThrow(from: ExtSignature): Box<ExtSignature> {\n    return Box.createAsDropped(from)\n  }\n\n}"],"names":["Signature","Secp256k1","BytesSignature","ZeroHexSignature","__addDisposableResource","cursor","Cursor","Base16","ZeroHexAsInteger","NumberAsInteger","BytesAsInteger","base16","bytes","Bytes","RawHexAsInteger","RawHexString","Copiable","CopiableBytesAsInteger","ExtSignature","Box"],"mappings":";;;;;;;;;;;;AAgBiBA;AAAjB,CAAA,UAAiB,SAAS,EAAA;IASxB,SAAgB,WAAW,CAAC,IAAoB,EAAA;AAC9C,QAAA,IAAI,IAAI,YAAYC,mBAAS,CAAC,oBAAoB;AAChD,YAAA,OAAO,IAAI;QACb,IAAI,IAAI,YAAY,UAAU;AAC5B,YAAA,OAAOC,sBAAc,CAAC,gBAAgB,CAAC,IAAI,CAAC;QAC9C,IAAI,OAAO,IAAI,KAAK,QAAQ;AAC1B,YAAA,OAAO,mBAAmB,CAAC,cAAc,CAAC,IAAI,CAAC;AACjD,QAAA,OAAOC,wBAAgB,CAAC,gBAAgB,CAAC,IAAI,CAAC;;AAPhC,IAAA,SAAA,CAAA,WAAW,cAQ1B;AAEH,CAAC,EAnBgBH,iBAAS,KAATA,iBAAS,GAmBzB,EAAA,CAAA,CAAA;MAoBY,mBAAmB,CAAA;AAGnB,IAAA,CAAA;AACA,IAAA,CAAA;AACA,IAAA,CAAA;AAHX,IAAA,WAAA,CACW,CAAoB,EACpB,CAAoB,EACpB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