53 lines
2.0 KiB
Ziran
53 lines
2.0 KiB
Ziran
// C test exports only; apps import entity directly.
|
|
#import "mesh_client/entity"
|
|
|
|
#program_export
|
|
EntityTestRecordKey :: (private_key: []u8, kind: string, output: []u8) -> bool {
|
|
return EntityRecordKey(private_key, kind, output)
|
|
}
|
|
|
|
#program_export
|
|
EntityTestBlobKey :: (private_key: []u8, kind: string, hash: string, output: []u8) -> bool {
|
|
return EntityBlobKey(private_key, kind, hash, output)
|
|
}
|
|
|
|
#program_export
|
|
EntityTestChunkKey :: (private_key: []u8, kind: string, hash: string, index: s64, output: []u8) -> bool {
|
|
return EntityChunkKey(private_key, kind, hash, index, output)
|
|
}
|
|
|
|
#program_export
|
|
EntityTestSeal :: (private_key: []u8, kind: string, hash: string, index: s64, plain: []u8, output: []u8) -> s64 {
|
|
return SealEntityChunk(private_key, kind, hash, index, plain, output)
|
|
}
|
|
|
|
#program_export
|
|
EntityTestOpen :: (private_key: []u8, kind: string, hash: string, index: s64, sealed: []u8, output: []u8) -> s64 {
|
|
return OpenEntityChunk(private_key, kind, hash, index, sealed, output)
|
|
}
|
|
|
|
#import "mesh_client/crypto"
|
|
|
|
#program_export
|
|
EntityTestSha256Hex :: (data: []u8, output: []u8) {
|
|
if data.count > 0 && output.count >= 65 { Sha256Hex(*data[0], data.count, *output[0]) }
|
|
}
|
|
|
|
#program_export
|
|
EntityTestSealRecord :: (private_key: []u8, account: string, kind: string, id: string, schema: string,
|
|
plain: []u8, nonce: []u8, sealed: []u8, output: []u8) -> s64 {
|
|
return SealEntityRecord(private_key, EntityRecordMetadata.{account, kind, id, schema}, plain, nonce, sealed, output)
|
|
}
|
|
|
|
#program_export
|
|
EntityTestEnvelope :: (text: string, output: []u8) -> s64 { return EntityRecordEnvelope(text, output) }
|
|
|
|
#program_export
|
|
EntityTestOpenRecord :: (private_key: []u8, account: string, kind: string, id: string, envelope: string,
|
|
schema: []u8, output: []u8) -> s64 {
|
|
return OpenEntityRecord(private_key, EntityRecordMetadata.{account, kind, id, ""}, envelope, schema, output)
|
|
}
|
|
|
|
#program_export
|
|
EntityTestNonceText :: (nonce: []u8, output: []u8) -> s64 { return EntityRecordNonceText(nonce, output).count }
|