(signedWebBundle: Uint8Array)
| 27 | |
| 28 | // Use with raw Singed Web Bundle data, for example read from file with fs.readFile('bundle.swbn') |
| 29 | static fromBytes(signedWebBundle: Uint8Array): SignedWebBundle { |
| 30 | if (!isSignedWebBundle(signedWebBundle)) { |
| 31 | throw new Error('Not a signed web bundle.'); |
| 32 | } |
| 33 | |
| 34 | const offset = this.obtainIntegrityOffset(signedWebBundle); |
| 35 | |
| 36 | const integrityBlockBytes = signedWebBundle.slice(0, offset); |
| 37 | const integrityBlock = IntegrityBlock.fromCbor(integrityBlockBytes); |
| 38 | |
| 39 | const bundle = signedWebBundle.slice(offset); |
| 40 | |
| 41 | return new SignedWebBundle(integrityBlock, bundle); |
| 42 | } |
| 43 | |
| 44 | // Web bundle ID is derived from the first key if not provided |
| 45 | static async fromWebBundle( |
no test coverage detected