|
21 | 21 | import org.eclipse.biscuit.crypto.KeyPair; |
22 | 22 | import org.eclipse.biscuit.crypto.PublicKey; |
23 | 23 | import org.eclipse.biscuit.datalog.Check; |
24 | | -import org.eclipse.biscuit.datalog.Pair; |
25 | 24 | import org.eclipse.biscuit.datalog.SymbolTable; |
26 | 25 | import org.eclipse.biscuit.error.Error; |
27 | 26 | import org.eclipse.biscuit.token.format.ExternalSignature; |
@@ -92,11 +91,8 @@ public static UnverifiedBiscuit fromBytesWithSymbols(byte[] data, SymbolTable sy |
92 | 91 | */ |
93 | 92 | private static UnverifiedBiscuit fromSerializedBiscuit( |
94 | 93 | SerializedBiscuit ser, SymbolTable symbolTable) throws Error { |
95 | | - Pair<Block, ArrayList<Block>> t = ser.extractBlocks(symbolTable); |
96 | | - Block authority = t._1; |
97 | | - ArrayList<Block> blocks = t._2; |
98 | | - |
99 | | - return new UnverifiedBiscuit(authority, blocks, symbolTable, ser); |
| 94 | + var t = ser.extractBlocks(symbolTable); |
| 95 | + return new UnverifiedBiscuit(t._1, t._2, symbolTable, ser); |
100 | 96 | } |
101 | 97 |
|
102 | 98 | /** |
@@ -201,15 +197,12 @@ public List<Optional<PublicKey>> externalPublicKeys() { |
201 | 197 | .collect(Collectors.toList()); |
202 | 198 | } |
203 | 199 |
|
204 | | - public List<List<Check>> getChecks() { |
205 | | - ArrayList<List<Check>> l = new ArrayList<>(); |
206 | | - l.add(new ArrayList<>(this.authority.getChecks())); |
207 | | - |
208 | | - for (Block b : this.blocks) { |
209 | | - l.add(new ArrayList<>(b.getChecks())); |
210 | | - } |
| 200 | + public List<Block> getBlocks() { |
| 201 | + return Stream.concat(Stream.of(authority), blocks.stream()).collect(Collectors.toList()); |
| 202 | + } |
211 | 203 |
|
212 | | - return l; |
| 204 | + public List<List<Check>> getChecks() { |
| 205 | + return getBlocks().stream().map(Block::getChecks).collect(Collectors.toList()); |
213 | 206 | } |
214 | 207 |
|
215 | 208 | public List<Optional<String>> getContext() { |
|
0 commit comments